add many item and inventory related hooks

This commit is contained in:
Evil Factory
2021-10-16 17:58:24 -03:00
parent fad7d2d001
commit 3a7355ed21
3 changed files with 21 additions and 2 deletions
@@ -523,6 +523,11 @@ namespace Barotrauma
return;
}
var should = new LuaResult(GameMain.Lua.hook.Call("inventoryPutItem", new object[] { this, item, user, i, removeItem }));
if (should.Bool())
return;
if (Owner == null) { return; }
Inventory prevInventory = item.ParentInventory;
@@ -624,6 +629,11 @@ namespace Barotrauma
{
if (item?.ParentInventory == null || !slots[index].Any()) { return false; }
var should = new LuaResult(GameMain.Lua.hook.Call("inventoryItemSwap", new object[] { this, item, user, index, swapWholeStack }));
if (!should.IsNull())
return should.Bool();
//swap to InvSlotType.Any if possible
Inventory otherInventory = item.ParentInventory;
bool otherIsEquipped = false;