new hook call method + function to delegate conversion
This commit is contained in:
@@ -387,7 +387,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
Limb targetLimb = target.UserData as Limb;
|
||||
Character targetCharacter = targetLimb?.character ?? target.UserData as Character;
|
||||
GameMain.LuaCs.HookBase.Call("meleeWeapon.handleImpact", this, target);
|
||||
GameMain.LuaCs.Hook.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.HookBase.Call("signalReceived", obj);
|
||||
GameMain.LuaCs.HookBase.Call("signalReceived." + recipient.item.Prefab.Identifier, obj);
|
||||
GameMain.LuaCs.Hook.Call("signalReceived", obj);
|
||||
GameMain.LuaCs.Hook.Call("signalReceived." + recipient.item.Prefab.Identifier, obj);
|
||||
|
||||
foreach (ItemComponent ic in recipient.item.Components)
|
||||
{
|
||||
|
||||
@@ -205,9 +205,9 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void TransmitSignal(Signal signal, bool sentFromChat)
|
||||
{
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("wifiSignalTransmitted", new object[] { this, signal, sentFromChat }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("wifiSignalTransmitted", this, signal, sentFromChat);
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
if (sentFromChat)
|
||||
|
||||
@@ -540,9 +540,9 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("inventoryPutItem", new object[] { this, item, user, i, removeItem }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("inventoryPutItem", this, item, user, i, removeItem);
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
if (Owner == null) { return; }
|
||||
@@ -648,10 +648,10 @@ namespace Barotrauma
|
||||
if (slots[index].Items.Any(it => !it.IsInteractable(user))) { return false; }
|
||||
if (!AllowSwappingContainedItems) { return false; }
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("inventoryItemSwap", new object[] { this, item, user, index, swapWholeStack }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("inventoryItemSwap", this, item, user, index, swapWholeStack);
|
||||
|
||||
if (!should.IsNull())
|
||||
return should.Bool();
|
||||
if (should != null)
|
||||
return should.Value;
|
||||
|
||||
//swap to InvSlotType.Any if possible
|
||||
Inventory otherInventory = item.ParentInventory;
|
||||
|
||||
@@ -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.HookBase.Call("item.created", this);
|
||||
GameMain.LuaCs.Hook.Call("item.created", this);
|
||||
|
||||
ApplyStatusEffects(ActionType.OnSpawn, 1.0f);
|
||||
Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f));
|
||||
@@ -2469,9 +2469,9 @@ namespace Barotrauma
|
||||
|
||||
if (condition == 0.0f) { return; }
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("item.use", new object[] { this, character, targetLimb }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("item.use", new object[] { this, character, targetLimb });
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
bool remove = false;
|
||||
@@ -2507,9 +2507,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (condition == 0.0f) { return; }
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("item.secondaryUse", new object[] { this, character}));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("item.secondaryUse", this, character);
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
bool remove = false;
|
||||
@@ -2851,8 +2851,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var result = new LuaResult(GameMain.LuaCs.HookBase.Call("item.readPropertyChange", this, property, parentObject, allowEditing));
|
||||
if (result.Bool())
|
||||
var result = GameMain.LuaCs.Hook.Call<bool?>("item.readPropertyChange", this, property, parentObject, allowEditing);
|
||||
if (result != null && result.Value)
|
||||
return;
|
||||
|
||||
Type type = property.PropertyType;
|
||||
@@ -3343,7 +3343,7 @@ namespace Barotrauma
|
||||
body = null;
|
||||
}
|
||||
|
||||
GameMain.LuaCs.HookBase.Call("item.removed", this);
|
||||
GameMain.LuaCs.Hook.Call("item.removed", this);
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
@@ -3427,7 +3427,7 @@ namespace Barotrauma
|
||||
|
||||
RemoveProjSpecific();
|
||||
|
||||
GameMain.LuaCs.HookBase.Call("item.removed", this);
|
||||
GameMain.LuaCs.Hook.Call("item.removed", this);
|
||||
}
|
||||
|
||||
partial void RemoveProjSpecific();
|
||||
|
||||
Reference in New Issue
Block a user