refactor: no more dynvalues or userdatas
This commit is contained in:
@@ -714,11 +714,14 @@ namespace Barotrauma
|
||||
|
||||
#if SERVER
|
||||
|
||||
var should = GameMain.Lua.hook.Call("changeFallDamage", new DynValue[] { DynValue.NewNumber(impactDamage), LuaSetup.CreateUserDataSafe(character), LuaSetup.CreateUserDataSafe(impactPos), LuaSetup.CreateUserDataSafe(velocity) });
|
||||
var should = GameMain.Lua.hook.Call("changeFallDamage", new object[] { impactDamage, character, impactPos, velocity });
|
||||
|
||||
if (should != null)
|
||||
{
|
||||
impactDamage = (float)should.CastToNumber();
|
||||
if (should is DynValue dyn)
|
||||
{
|
||||
impactDamage = (float)dyn.CastToNumber();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3810,7 +3810,7 @@ namespace Barotrauma
|
||||
|
||||
|
||||
#if SERVER
|
||||
GameMain.Lua.hook.Call("characterDeath", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(this) });
|
||||
GameMain.Lua.hook.Call("characterDeath", new object[] { this });
|
||||
#endif
|
||||
}
|
||||
partial void KillProjSpecific(CauseOfDeathType causeOfDeath, Affliction causeOfDeathAffliction, bool log);
|
||||
|
||||
@@ -410,11 +410,17 @@ namespace Barotrauma
|
||||
if (targetLimb == null)
|
||||
{
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new DynValue[] { LuaSetup.CreateUserDataSafe(this), LuaSetup.CreateUserDataSafe(affliction) });
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
if (should != null)
|
||||
{
|
||||
return;
|
||||
if (should is DynValue dyn)
|
||||
{
|
||||
if (dyn.CastToBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -428,11 +434,17 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new DynValue[] { UserData.Create(this), UserData.Create(affliction), UserData.Create(targetLimb) });
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction, targetLimb });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
if (should != null)
|
||||
{
|
||||
return;
|
||||
if (should is DynValue dyn)
|
||||
{
|
||||
if (dyn.CastToBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -442,11 +454,17 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new DynValue[] { UserData.Create(this), UserData.Create(affliction)});
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
if (should != null)
|
||||
{
|
||||
return;
|
||||
if (should is DynValue dyn)
|
||||
{
|
||||
if (dyn.CastToBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -527,11 +545,17 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new DynValue[] { LuaSetup.CreateUserDataSafe(this), LuaSetup.CreateUserDataSafe(attackResult), LuaSetup.CreateUserDataSafe(hitLimb) });
|
||||
var should = GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, attackResult, hitLimb });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
if (should != null)
|
||||
{
|
||||
return;
|
||||
if (should is DynValue dyn)
|
||||
{
|
||||
if (dyn.CastToBool())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user