refactor: no more dynvalues or userdatas

This commit is contained in:
Evil Factory
2021-08-29 00:16:33 -03:00
parent fdb9ca1d30
commit e24797dd05
16 changed files with 161 additions and 149 deletions
@@ -94,10 +94,15 @@ namespace Barotrauma.Networking
ChatMessage.CanUseRadio(sender.Character, out WifiComponent senderRadio) &&
ChatMessage.CanUseRadio(recipient.Character, out WifiComponent recipientRadio))
{
var should = GameMain.Lua.hook.Call("canUseVoiceRadio", new DynValue[] { UserData.Create(sender), LuaSetup.CreateUserDataSafe(recipient) });
var should = GameMain.Lua.hook.Call("canUseVoiceRadio", new object[] { sender, recipient });
if (should != null)
return should.CastToBool();
{
if (should is DynValue dyn)
{
return dyn.CastToBool();
}
}
if (recipientRadio.CanReceive(senderRadio)) { return true; }
}