hook merge + hook wrappers

This commit is contained in:
Oiltanker
2022-04-13 01:34:38 +03:00
parent 1e6ac68e86
commit 5d06df437e
40 changed files with 539 additions and 284 deletions
@@ -387,7 +387,7 @@ namespace Barotrauma.Items.Components
Limb targetLimb = target.UserData as Limb;
Character targetCharacter = targetLimb?.character ?? target.UserData as Character;
GameMain.LuaCs.hook.Call("meleeWeapon.handleImpact", this, target);
GameMain.LuaCs.HookBase.Call("meleeWeapon.handleImpact", this, target);
if (Attack != null)
{
Attack.SetUser(User);
@@ -325,8 +325,8 @@ namespace Barotrauma.Items.Components
Connection connection = recipient;
object[] obj = new object[] { signal, connection };
GameMain.LuaCs.hook.Call("signalReceived", obj);
GameMain.LuaCs.hook.Call("signalReceived." + recipient.item.Prefab.Identifier, obj);
GameMain.LuaCs.HookBase.Call("signalReceived", obj);
GameMain.LuaCs.HookBase.Call("signalReceived." + recipient.item.Prefab.Identifier, obj);
foreach (ItemComponent ic in recipient.item.Components)
{
@@ -205,7 +205,7 @@ namespace Barotrauma.Items.Components
public void TransmitSignal(Signal signal, bool sentFromChat)
{
var should = new LuaResult(GameMain.LuaCs.hook.Call("wifiSignalTransmitted", new object[] { this, signal, sentFromChat }));
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("wifiSignalTransmitted", new object[] { this, signal, sentFromChat }));
if (should.Bool())
return;
@@ -540,7 +540,7 @@ namespace Barotrauma
return;
}
var should = new LuaResult(GameMain.LuaCs.hook.Call("inventoryPutItem", new object[] { this, item, user, i, removeItem }));
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("inventoryPutItem", new object[] { this, item, user, i, removeItem }));
if (should.Bool())
return;
@@ -648,7 +648,7 @@ namespace Barotrauma
if (slots[index].Items.Any(it => !it.IsInteractable(user))) { return false; }
if (!AllowSwappingContainedItems) { return false; }
var should = new LuaResult(GameMain.LuaCs.hook.Call("inventoryItemSwap", new object[] { this, item, user, index, swapWholeStack }));
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("inventoryItemSwap", new object[] { this, item, user, index, swapWholeStack }));
if (!should.IsNull())
return should.Bool();
@@ -999,7 +999,7 @@ namespace Barotrauma
if (Components.Any(ic => ic is Wire) && Components.All(ic => ic is Wire || ic is Holdable)) { isWire = true; }
if (HasTag("logic")) { isLogic = true; }
GameMain.LuaCs.hook.Call("item.created", this);
GameMain.LuaCs.HookBase.Call("item.created", this);
ApplyStatusEffects(ActionType.OnSpawn, 1.0f);
Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f));
@@ -2469,7 +2469,7 @@ namespace Barotrauma
if (condition == 0.0f) { return; }
var should = new LuaResult(GameMain.LuaCs.hook.Call("item.use", new object[] { this, character, targetLimb }));
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("item.use", new object[] { this, character, targetLimb }));
if (should.Bool())
return;
@@ -2507,7 +2507,7 @@ namespace Barotrauma
{
if (condition == 0.0f) { return; }
var should = new LuaResult(GameMain.LuaCs.hook.Call("item.secondaryUse", new object[] { this, character}));
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("item.secondaryUse", new object[] { this, character}));
if (should.Bool())
return;
@@ -2851,7 +2851,7 @@ namespace Barotrauma
}
}
var result = new LuaResult(GameMain.LuaCs.hook.Call("item.readPropertyChange", this, property, parentObject, allowEditing));
var result = new LuaResult(GameMain.LuaCs.HookBase.Call("item.readPropertyChange", this, property, parentObject, allowEditing));
if (result.Bool())
return;
@@ -3343,7 +3343,7 @@ namespace Barotrauma
body = null;
}
GameMain.LuaCs.hook.Call("item.removed", this);
GameMain.LuaCs.HookBase.Call("item.removed", this);
}
public override void Remove()
@@ -3427,7 +3427,7 @@ namespace Barotrauma
RemoveProjSpecific();
GameMain.LuaCs.hook.Call("item.removed", this);
GameMain.LuaCs.HookBase.Call("item.removed", this);
}
partial void RemoveProjSpecific();