new hook call method + function to delegate conversion
This commit is contained in:
+2
-2
@@ -80,9 +80,9 @@ namespace Barotrauma
|
||||
|
||||
public void AddObjective<T>(T objective) where T : AIObjective
|
||||
{
|
||||
var result = new LuaResult(GameMain.LuaCs.HookBase.Call("AI.AddObjective", this, objective));
|
||||
var result = GameMain.LuaCs.Hook.Call<bool?>("AI.AddObjective", this, objective);
|
||||
|
||||
if (result.Bool()) return;
|
||||
if (result != null && result.Value) return;
|
||||
|
||||
if (objective == null)
|
||||
{
|
||||
|
||||
+2
-2
@@ -1440,11 +1440,11 @@ namespace Barotrauma
|
||||
// -> the character should be revived if there are no major afflictions in addition to lack of oxygen
|
||||
target.Oxygen = Math.Max(target.Oxygen + 10.0f, 10.0f);
|
||||
|
||||
GameMain.LuaCs.HookBase.Call("human.CPRSuccess", this);
|
||||
GameMain.LuaCs.Hook.Call("human.CPRSuccess", this);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.LuaCs.HookBase.Call("human.CPRFailed", this);
|
||||
GameMain.LuaCs.Hook.Call("human.CPRFailed", this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,11 +745,11 @@ namespace Barotrauma
|
||||
|
||||
float impactDamage = Math.Min((impact - ImpactTolerance) * ImpactDamageMultiplayer, character.MaxVitality * MaxImpactDamage);
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("changeFallDamage", new object[] { impactDamage, character, impactPos, velocity }));
|
||||
var should = GameMain.LuaCs.Hook.Call<float?>("changeFallDamage", impactDamage, character, impactPos, velocity);
|
||||
|
||||
if (!should.IsNull())
|
||||
if (should != null)
|
||||
{
|
||||
impactDamage = should.Float();
|
||||
impactDamage = should.Value;
|
||||
}
|
||||
|
||||
character.LastDamageSource = null;
|
||||
|
||||
@@ -1043,7 +1043,7 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
GameMain.LuaCs.HookBase.Call("characterCreated", new object[] { newCharacter });
|
||||
GameMain.LuaCs.Hook.Call("characterCreated", new object[] { newCharacter });
|
||||
|
||||
return newCharacter;
|
||||
}
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ namespace Barotrauma
|
||||
AdditionStrength -= amount;
|
||||
}
|
||||
#if SERVER
|
||||
GameMain.LuaCs.HookBase.Call("afflictionUpdate", new object[] { this, characterHealth, targetLimb, deltaTime });
|
||||
GameMain.LuaCs.Hook.Call("afflictionUpdate", new object[] { this, characterHealth, targetLimb, deltaTime });
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -308,7 +308,7 @@ namespace Barotrauma
|
||||
if (client != null)
|
||||
{
|
||||
GameMain.Server.SetClientCharacter(client, husk);
|
||||
GameMain.LuaCs.HookBase.Call("husk.clientControlHusk", new object[] { client, husk });
|
||||
GameMain.LuaCs.Hook.Call("husk.clientControlHusk", new object[] { client, husk });
|
||||
}
|
||||
#else
|
||||
if (!character.IsRemotelyControlled && character == Character.Controlled)
|
||||
|
||||
@@ -541,9 +541,9 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("character.applyDamage", new object[] { this, attackResult, hitLimb, allowStacking }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("character.applyDamage", this, attackResult, hitLimb, allowStacking);
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
foreach (Affliction newAffliction in attackResult.Afflictions)
|
||||
@@ -674,9 +674,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var should = new LuaResult(GameMain.LuaCs.HookBase.Call("character.applyAffliction", new object[] { this, limbHealth, newAffliction, allowStacking }));
|
||||
var should = GameMain.LuaCs.Hook.Call<bool?>("character.applyAffliction", this, limbHealth, newAffliction, allowStacking);
|
||||
|
||||
if (should.Bool())
|
||||
if (should != null && should.Value)
|
||||
return;
|
||||
|
||||
Affliction existingAffliction = null;
|
||||
|
||||
Reference in New Issue
Block a user