Merge branch 'general-devel' into otapi3
This commit is contained in:
commit
acde508c53
6 changed files with 121 additions and 232 deletions
|
|
@ -11,7 +11,16 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
|||
* Do not insert tabs into this file, under any circumstances, ever.
|
||||
* Do not forget to sign every line you change with your name. (@hakusaro)
|
||||
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change.
|
||||
|
||||
## Upcoming changes
|
||||
* World peace
|
||||
|
||||
## TShock 4.5.14
|
||||
* Improved the `/grow` command to reduce code duplication, use `TileID` constants for less ambiguous types. (@drunderscore)
|
||||
* Fixed item dupe via /logout & NPC. (@Terrarxxn)
|
||||
* Added preliminary support for Terraria 1.4.3.4. Note that this has the side-effect of adding `IEntitySource` as the first parameter to `Item.NewItem` and `NPC.NewNPC`, and in `TSAPI`, `NpcLootDropEventArgs` passes `IEntitySource` as `Source`. If you're updating a plugin, you can either make something that implements with `IEntitySource` or just use `new EntitySource_DebugCommand()` [like TShock does](https://github.com/Pryaxis/TShock/commit/1b96ed8992110c5bbcc2ef952cc98459ea194dee). (@SignatureBeef, @Patrikkk, @hakusaro)
|
||||
|
||||
## TShock 4.5.13
|
||||
* Added hook `GetDataHandlers.OnReleaseNpc` to handling ReleaseNPC packet and a bouncer to stops unregistered and logged out players on SSC servers from releasing critters NPC. The bouncer has additional filter to stops players who tried to release different critter using crafted packet, e.g. using bunny item to release golden bunny. (@tru321)
|
||||
* Added filter in `GetDataHandlers.HandleCatchNpc` that stops unregistered and logged out players on SSC servers to catch critters. (@tru321)
|
||||
* Fixed rejection check inside of `HandlePaintTile` to account for the Paint Sprayer (or Architect Gizmo Pack) being inside your inventory, rather than on an accessory slot. (@drunderscore)
|
||||
|
|
|
|||
|
|
@ -910,6 +910,12 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Player.TPlayer.talkNPC != -1)
|
||||
{
|
||||
args.Player.SendErrorMessage("Please close NPC windows before logging out.");
|
||||
return;
|
||||
}
|
||||
|
||||
args.Player.Logout();
|
||||
args.Player.SendSuccessMessage("You have been successfully logged out of your account.");
|
||||
if (Main.ServerSideCharacter)
|
||||
|
|
@ -6325,7 +6331,7 @@ namespace TShockAPI
|
|||
|
||||
public static void Grow(CommandArgs args)
|
||||
{
|
||||
bool growevilAmb = args.Player.HasPermission(Permissions.growevil);
|
||||
bool canGrowEvil = args.Player.HasPermission(Permissions.growevil);
|
||||
string subcmd = args.Parameters.Count == 0 ? "help" : args.Parameters[0].ToLower();
|
||||
|
||||
var name = "Fail";
|
||||
|
|
@ -6367,284 +6373,163 @@ namespace TShockAPI
|
|||
}
|
||||
break;
|
||||
|
||||
case "basic":
|
||||
bool rejectCannotGrowEvil()
|
||||
{
|
||||
if(!canGrowEvil)
|
||||
{
|
||||
args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prepareAreaForGrow(ushort groundType = TileID.Grass, bool evil = false)
|
||||
{
|
||||
if(evil && !rejectCannotGrowEvil())
|
||||
return false;
|
||||
|
||||
for (var i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = groundType;
|
||||
Main.tile[i, y].wall = WallID.None;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = WallID.None;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool growTree(ushort groundType, string fancyName, bool evil = false)
|
||||
{
|
||||
if(!prepareAreaForGrow(groundType, evil))
|
||||
return false;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = fancyName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool growTreeByType(ushort groundType, string fancyName, ushort typeToPrepare = 2, bool evil = false)
|
||||
{
|
||||
if(!prepareAreaForGrow(typeToPrepare, evil))
|
||||
return false;
|
||||
WorldGen.TryGrowingTreeByType(groundType, x, y);
|
||||
name = fancyName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool growPalmTree(ushort sandType, ushort supportingType, string properName, bool evil = false)
|
||||
{
|
||||
if(evil && !rejectCannotGrowEvil())
|
||||
return false;
|
||||
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 2;
|
||||
Main.tile[i, y].wall = 0;
|
||||
Main.tile[i, y].type = sandType;
|
||||
Main.tile[i, y].wall = WallID.None;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Basic Tree";
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y + 1].active(true);
|
||||
Main.tile[i, y + 1].type = supportingType;
|
||||
Main.tile[i, y + 1].wall = WallID.None;
|
||||
}
|
||||
|
||||
Main.tile[x, y - 1].wall = WallID.None;
|
||||
WorldGen.GrowPalmTree(x, y);
|
||||
|
||||
name = properName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case "basic":
|
||||
growTree(TileID.Grass, "Basic Tree");
|
||||
break;
|
||||
|
||||
case "boreal":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 147;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Boreal Tree";
|
||||
growTree(TileID.SnowBlock, "Boreal Tree");
|
||||
break;
|
||||
|
||||
case "mahogany":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 60;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Rich Mahogany";
|
||||
growTree(TileID.JungleGrass, "Rich Mahogany");
|
||||
break;
|
||||
|
||||
case "sakura":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 2;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(596, x, y);
|
||||
name = "Sakura Tree";
|
||||
growTreeByType(TileID.VanityTreeSakura, "Sakura Tree");
|
||||
break;
|
||||
|
||||
case "willow":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 2;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(616, x, y);
|
||||
name = "Willow Tree";
|
||||
growTreeByType(TileID.VanityTreeYellowWillow, "Willow Tree");
|
||||
break;
|
||||
|
||||
case "shadewood":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 199;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Shadewood tree";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growTree(TileID.CrimsonGrass, "Shadewood Tree", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "ebonwood":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 23;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Ebonwood Tree";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growTree(TileID.CorruptGrass, "Ebonwood Tree", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "pearlwood":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 109;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowTree(x, y);
|
||||
name = "Pearlwood Tree";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growTree(TileID.HallowedGrass, "Pearlwood Tree", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "palm":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 53;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y + 1].active(true);
|
||||
Main.tile[i, y + 1].type = 397;
|
||||
Main.tile[i, y + 1].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowPalmTree(x, y);
|
||||
name = "Desert Palm";
|
||||
growPalmTree(TileID.Sand, TileID.HardenedSand, "Desert Palm");
|
||||
break;
|
||||
|
||||
case "hallowpalm":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 116;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y + 1].active(true);
|
||||
Main.tile[i, y + 1].type = 402;
|
||||
Main.tile[i, y + 1].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowPalmTree(x, y);
|
||||
name = "Hallow Palm";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growPalmTree(TileID.Pearlsand, TileID.HallowHardenedSand, "Hallow Palm", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "crimsonpalm":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 234;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y + 1].active(true);
|
||||
Main.tile[i, y + 1].type = 399;
|
||||
Main.tile[i, y + 1].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowPalmTree(x, y);
|
||||
name = "Crimson Palm";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growPalmTree(TileID.Crimsand, TileID.CrimsonHardenedSand, "Crimson Palm", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "corruptpalm":
|
||||
if (growevilAmb)
|
||||
{
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 112;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y + 1].active(true);
|
||||
Main.tile[i, y + 1].type = 398;
|
||||
Main.tile[i, y + 1].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.GrowPalmTree(x, y);
|
||||
name = "Corruption Palm";
|
||||
}
|
||||
else args.Player.SendErrorMessage("You do not have permission to grow this tree type");
|
||||
if(!growPalmTree(TileID.Ebonsand, TileID.CorruptHardenedSand, "Corruption Palm", true))
|
||||
return;
|
||||
break;
|
||||
|
||||
case "topaz":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(583, x, y);
|
||||
name = "Topaz Gemtree";
|
||||
growTreeByType(TileID.TreeTopaz, "Topaz Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "amethyst":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(584, x, y);
|
||||
name = "Amethyst Gemtree";
|
||||
growTreeByType(TileID.TreeAmethyst, "Amethyst Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "sapphire":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(585, x, y);
|
||||
name = "Sapphire Gemtree";
|
||||
growTreeByType(TileID.TreeSapphire, "Sapphire Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "emerald":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(586, x, y);
|
||||
name = "Emerald Gemtree";
|
||||
growTreeByType(TileID.TreeEmerald, "Emerald Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "ruby":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(587, x, y);
|
||||
name = "Ruby Gemtree";
|
||||
growTreeByType(TileID.TreeRuby, "Ruby Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "diamond":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(588, x, y);
|
||||
name = "Diamond Gemtree";
|
||||
growTreeByType(TileID.TreeDiamond, "Diamond Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "amber":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 1;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
WorldGen.TryGrowingTreeByType(589, x, y);
|
||||
name = "Amber Gemtree";
|
||||
growTreeByType(TileID.TreeAmber, "Amber Gemtree", 1);
|
||||
break;
|
||||
|
||||
case "cactus":
|
||||
Main.tile[x, y].type = 53;
|
||||
Main.tile[x, y].type = TileID.Sand;
|
||||
WorldGen.GrowCactus(x, y);
|
||||
name = "Cactus";
|
||||
break;
|
||||
|
|
@ -6652,19 +6537,13 @@ namespace TShockAPI
|
|||
case "herb":
|
||||
Main.tile[x, y].active(true);
|
||||
Main.tile[x, y].frameX = 36;
|
||||
Main.tile[x, y].type = 83;
|
||||
Main.tile[x, y].type = TileID.MatureHerbs;
|
||||
WorldGen.GrowAlch(x, y);
|
||||
name = "Herb";
|
||||
break;
|
||||
|
||||
case "mushroom":
|
||||
for (int i = x - 2; i < x + 3; i++)
|
||||
{
|
||||
Main.tile[i, y].active(true);
|
||||
Main.tile[i, y].type = 70;
|
||||
Main.tile[i, y].wall = 0;
|
||||
}
|
||||
Main.tile[x, y - 1].wall = 0;
|
||||
prepareAreaForGrow(TileID.MushroomGrass);
|
||||
WorldGen.GrowShroom(x, y);
|
||||
name = "Glowing Mushroom Tree";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1378,7 +1378,7 @@ namespace TShockAPI
|
|||
/// <param name="prefix">The item prefix.</param>
|
||||
public virtual void GiveItem(int type, int stack, int prefix = 0)
|
||||
{
|
||||
int itemIndex = Item.NewItem((int)X, (int)Y, TPlayer.width, TPlayer.height, type, stack, true, prefix, true);
|
||||
int itemIndex = Item.NewItem(new EntitySource_DebugCommand(), (int)X, (int)Y, TPlayer.width, TPlayer.height, type, stack, true, prefix, true);
|
||||
SendData(PacketTypes.ItemDrop, "", itemIndex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ using TShockAPI;
|
|||
using TShockAPI.DB;
|
||||
using Terraria.Localization;
|
||||
using System.Linq;
|
||||
using Terraria.DataStructures;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -165,7 +166,7 @@ namespace TShockAPI
|
|||
int spawnTileY;
|
||||
TShock.Utils.GetRandomClearTileWithInRange(startTileX, startTileY, tileXRange, tileYRange, out spawnTileX,
|
||||
out spawnTileY);
|
||||
NPC.NewNPC(spawnTileX * 16, spawnTileY * 16, type);
|
||||
NPC.NewNPC(new EntitySource_DebugCommand(), spawnTileX * 16, spawnTileY * 16, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace TShockAPI
|
|||
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
|
||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
|
||||
public static readonly string VersionCodename = "Herrscher of Logic";
|
||||
public static readonly string VersionCodename = "Minutes to Midnight";
|
||||
|
||||
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
|
||||
public static string SavePath = "tshock";
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a7949a2cee98e43e321ed9981c92d08334156f79
|
||||
Subproject commit 0f4b53aaa5a2cf04a89e7b1effee60d91f28aca3
|
||||
Loading…
Add table
Add a link
Reference in a new issue