Skip to content

Commit

Permalink
Better ReplaceWith
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Jan 14, 2025
1 parent a8039e3 commit d9ec0ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
34 changes: 0 additions & 34 deletions Scripts/Nelderim/helpers/ItemExtension.cs

This file was deleted.

20 changes: 20 additions & 0 deletions Server/Nelderim/ItemExt.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Server.Items;

namespace Server
{
public partial class Item
Expand All @@ -10,5 +12,23 @@ public bool Stealable
get { return GetSavedFlag(StealableFlag); }
set { SetSavedFlag(StealableFlag, value); }
}

public void ReplaceWith(Item newItem)
{
if (Parent is Container container)
{
container.AddItem(newItem);
newItem.Location = m_Location;
}
else
{
newItem.MoveToWorld(GetWorldLocation(), m_Map);
}

newItem.IsLockedDown = IsLockedDown;
newItem.IsSecure = IsSecure;

Delete();
}
}
}

0 comments on commit d9ec0ee

Please sign in to comment.