Fake the leaveplayer and joinplayer events
Sends leaveplayer and joinplayer when players cloak/uncloak.
This commit is contained in:
parent
8adde253fa
commit
72463866b3
22
core.lua
22
core.lua
|
@ -113,12 +113,19 @@ cloaking.cloak = function(player)
|
||||||
|
|
||||||
cloaked_players[victim] = true
|
cloaked_players[victim] = true
|
||||||
|
|
||||||
minetest.chat_send_all("*** " .. victim .. " left the game.")
|
local t = nil
|
||||||
if irc then
|
if areas and areas.hud and areas.hud[victim] then
|
||||||
irc.say("*** " .. victim .. " left the game")
|
t = areas.hud[victim]
|
||||||
end
|
end
|
||||||
|
|
||||||
if areas and areas.hud and areas.hud[victim] then
|
for _, f in ipairs(minetest.registered_on_leaveplayers) do
|
||||||
|
if f ~= cloaking.auto_uncloak then
|
||||||
|
f(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if t then
|
||||||
|
areas.hud[victim] = t
|
||||||
p:hud_change(areas.hud[victim].areasId, "text", "Cloaked")
|
p:hud_change(areas.hud[victim].areasId, "text", "Cloaked")
|
||||||
areas.hud[victim].oldAreas = ""
|
areas.hud[victim].oldAreas = ""
|
||||||
end
|
end
|
||||||
|
@ -136,8 +143,11 @@ cloaking.uncloak = function(player)
|
||||||
cloaked_players[victim] = false
|
cloaked_players[victim] = false
|
||||||
|
|
||||||
minetest.chat_send_all("*** " .. victim .. " joined the game.")
|
minetest.chat_send_all("*** " .. victim .. " joined the game.")
|
||||||
if irc then
|
|
||||||
irc.say("*** " .. victim .. " joined the game")
|
for _, f in ipairs(minetest.registered_on_joinplayers) do
|
||||||
|
if f ~= cloaking.auto_uncloak then
|
||||||
|
f(p)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue