Eluna
Eluna copied to clipboard
Changed how data pushed to lua is validated to use weak_ptr
Makes use of https://github.com/TrinityCore/TrinityCore/commit/a79b42bf681e211997923dbc6c191aae187aded6
Also removed additional indirection when pushing 64 bit integers and ObjectGuids
This allows storing direct object references in scripts
local test_stashed_player = nil
local function OnTextEmote(event, player, textEmote, emoteNum, guid)
if test_stashed_player ~= nil then
xpcall(
function() test_stashed_player:SendBroadcastMessage("reuse stored player") end,
function(err) player:SendBroadcastMessage(err) end
)
else
test_stashed_player = player
test_stashed_player:SendBroadcastMessage("store player ".. tostring(player:GetGUID()))
end
end
RegisterPlayerEvent(24, OnTextEmote)
Player handles are intentionally invalidated on cross map teleports
- login
- /lol
- /lol
- .tele dalaran
- .rec
- /lol
Result:
~~PR is marked as draft because map create/destroy hooks currently don't work (fix needed in main TC repo that changes where they are called)~~
Other emus won't currently compile - I plan to submit a PR to CMangos with the same commit that was pushed to TC (in the worst case that nobody is interested in adopting that code it would have to be instead done by forks that maintain Eluna integration)