added item.created and item.removed hooks

This commit is contained in:
Evil Factory
2022-03-29 14:01:31 -03:00
parent bd0a5980fb
commit 0164a776c7
@@ -1027,6 +1027,8 @@ namespace Barotrauma
if (Components.Any(ic => ic is Wire) && Components.All(ic => ic is Wire || ic is Holdable)) { isWire = true; } if (Components.Any(ic => ic is Wire) && Components.All(ic => ic is Wire || ic is Holdable)) { isWire = true; }
if (HasTag("logic")) { isLogic = true; } if (HasTag("logic")) { isLogic = true; }
GameMain.Lua.hook.Call("item.created", this);
ApplyStatusEffects(ActionType.OnSpawn, 1.0f); ApplyStatusEffects(ActionType.OnSpawn, 1.0f);
Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f)); Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f));
} }
@@ -3256,6 +3258,8 @@ namespace Barotrauma
body.Remove(); body.Remove();
body = null; body = null;
} }
GameMain.Lua.hook.Call("item.removed", this);
} }
public override void Remove() public override void Remove()
@@ -3338,6 +3342,8 @@ namespace Barotrauma
} }
RemoveProjSpecific(); RemoveProjSpecific();
GameMain.Lua.hook.Call("item.removed", this);
} }
partial void RemoveProjSpecific(); partial void RemoveProjSpecific();