diff --git a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua index e266752b0..6ca382f63 100644 --- a/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua +++ b/Barotrauma/BarotraumaShared/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua @@ -78,20 +78,4 @@ end compatibilityLib["Player"] = luaPlayer -Hook.Add("character.created", "compatibility.character.created", function (character) - Hook.Call("characterCreated", character) -end) - -Hook.Add("character.death", "compatibility.character.death", function (character, causeOfDeathAffliction) - Hook.Call("characterDeath", character, causeOfDeathAffliction) -end) - -Hook.Add("client.connected", "compatibility.client.connected", function (client) - Hook.Call("clientConnected", client) -end) - -Hook.Add("client.disconnected", "compatibility.client.disconnected", function (client) - Hook.Call("clientDisconnected", client) -end) - return compatibilityLib \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/LuaScriptManagementService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/LuaScriptManagementService.cs index b2d3c5db2..5a8b76be9 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/LuaScriptManagementService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/LuaScriptManagementService.cs @@ -239,12 +239,20 @@ class LuaScriptManagementService : ILuaScriptManagementService, ILuaDataService _eventService.RegisterLuaEventAlias("inventoryPutItem", nameof(IEventInventoryPutItem.OnInventoryPutItem)); _eventService.RegisterLuaEventAlias("inventoryItemSwap", nameof(IEventInventoryItemSwap.OnInventoryItemSwap)); + // Compatibility + _eventService.RegisterLuaEventAlias("characterCreated", nameof(IEventCharacterCreated.OnCharacterCreated)); + _eventService.RegisterLuaEventAlias("characterDeath", nameof(IEventCharacterDeath.OnCharacterDeath)); + #if SERVER _eventService.RegisterLuaEventAlias("client.connected", nameof(IEventClientConnected.OnClientConnected)); _eventService.RegisterLuaEventAlias("client.disconnected", nameof(IEventClientDisconnected.OnClientDisconnected)); _eventService.RegisterLuaEventAlias("jobsAssigned", nameof(IEventJobsAssigned.OnJobsAssigned)); _eventService.RegisterLuaEventAlias("netMessageReceived", nameof(IEventClientRawNetMessageReceived.OnReceivedClientNetMessage)); + + // Compatibility + _eventService.RegisterLuaEventAlias("clientConnected", nameof(IEventClientConnected.OnClientConnected)); + _eventService.RegisterLuaEventAlias("clientDisconnected", nameof(IEventClientDisconnected.OnClientDisconnected)); #elif CLIENT _eventService.RegisterLuaEventAlias("netMessageReceived", nameof(IEventServerRawNetMessageReceived.OnReceivedServerNetMessage)); #endif