~hristoast/tes3mp-uniqueitems

5a45ef9a144304dae96511df414888de3701f52b — Hristos N. Triantafillou 1 year, 3 months ago e3fefbe
Use a validator to beat a rare race condition

When used as a handler, our `OnObjectSpawn` method would sometimes
crash on indexing cell data.  I assume it's due to some race condition
as I could only make it happen with Stirk and even then only under
some specific conditions.

See the below link for details on that:

https://git.modding-openmw.com/TES3MP/tes3mp-server/issues/2
1 files changed, 2 insertions(+), 1 deletions(-)

M main.lua
M main.lua => main.lua +2 -1
@@ 422,9 422,10 @@ function UniqueItems.OnServerPostInit()
   updateDatabase()
end

customEventHooks.registerHandler("OnObjectSpawn", UniqueItems.OnObjectSpawn)

customEventHooks.registerHandler("OnPlayerAuthentified", UniqueItems.OnPlayerAuthentified)
customEventHooks.registerHandler("OnPlayerInventory", UniqueItems.OnPlayerInventory)
customEventHooks.registerHandler("OnServerPostInit", UniqueItems.OnServerPostInit)

customEventHooks.registerValidator("OnObjectSpawn", UniqueItems.OnObjectSpawn)
customEventHooks.registerValidator("OnPlayerDisconnect", UniqueItems.OnPlayerDisconnect)