From 1b96ed8992110c5bbcc2ef952cc98459ea194dee Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 25 Feb 2022 04:42:16 +0100 Subject: [PATCH] Adding EntitySource parameter to the used at NewNPC and NewItem methods. I've decided to use the DebugCommand entity source for anything server related, as it makes the most sense as source. Feel free to discuss. --- TShockAPI/TSPlayer.cs | 2 +- TShockAPI/TSServerPlayer.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 6a04bf0c..7b452fe4 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1379,7 +1379,7 @@ namespace TShockAPI /// The item prefix. 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); } diff --git a/TShockAPI/TSServerPlayer.cs b/TShockAPI/TSServerPlayer.cs index d414d424..14ea674b 100644 --- a/TShockAPI/TSServerPlayer.cs +++ b/TShockAPI/TSServerPlayer.cs @@ -26,6 +26,7 @@ using TShockAPI; using TShockAPI.DB; using Terraria.Localization; using System.Linq; +using Terraria.DataStructures; namespace TShockAPI { @@ -166,7 +167,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); } }