mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-02-02 21:30:20 +01:00
[chatplus] Don't use globalsteps
This commit is contained in:
parent
2d16e24d2d
commit
67ed362f27
@ -326,52 +326,50 @@ minetest.register_chatcommand("mail", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
local function tick()
|
||||||
chatplus.count = chatplus.count + dtime
|
-- loop through player list
|
||||||
if chatplus.count > 5 then
|
for key,value in pairs(chatplus.players) do
|
||||||
chatplus.count = 0
|
if (
|
||||||
-- loop through player list
|
chatplus.loggedin and
|
||||||
for key,value in pairs(chatplus.players) do
|
chatplus.loggedin[key] and
|
||||||
if (
|
chatplus.loggedin[key].player and
|
||||||
chatplus.loggedin and
|
value and
|
||||||
chatplus.loggedin[key] and
|
value.inbox and
|
||||||
chatplus.loggedin[key].player and
|
chatplus.loggedin[key].player.hud_add and
|
||||||
value and
|
chatplus.loggedin[key].lastcount ~= #value.inbox
|
||||||
value.inbox and
|
) then
|
||||||
chatplus.loggedin[key].player.hud_add and
|
if chatplus.loggedin[key].msgicon then
|
||||||
chatplus.loggedin[key].lastcount ~= #value.inbox
|
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon)
|
||||||
) then
|
|
||||||
if chatplus.loggedin[key].msgicon then
|
|
||||||
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon)
|
|
||||||
end
|
|
||||||
|
|
||||||
if chatplus.loggedin[key].msgicon2 then
|
|
||||||
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon2)
|
|
||||||
end
|
|
||||||
|
|
||||||
if #value.inbox>0 then
|
|
||||||
chatplus.loggedin[key].msgicon = chatplus.loggedin[key].player:hud_add({
|
|
||||||
hud_elem_type = "image",
|
|
||||||
name = "MailIcon",
|
|
||||||
position = {x=0.52, y=0.52},
|
|
||||||
text="chatplus_mail.png",
|
|
||||||
scale = {x=1,y=1},
|
|
||||||
alignment = {x=0.5, y=0.5},
|
|
||||||
})
|
|
||||||
chatplus.loggedin[key].msgicon2 = chatplus.loggedin[key].player:hud_add({
|
|
||||||
hud_elem_type = "text",
|
|
||||||
name = "MailText",
|
|
||||||
position = {x=0.55, y=0.52},
|
|
||||||
text=#value.inbox,
|
|
||||||
scale = {x=1,y=1},
|
|
||||||
alignment = {x=0.5, y=0.5},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
chatplus.loggedin[key].lastcount = #value.inbox
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if chatplus.loggedin[key].msgicon2 then
|
||||||
|
chatplus.loggedin[key].player:hud_remove(chatplus.loggedin[key].msgicon2)
|
||||||
|
end
|
||||||
|
|
||||||
|
if #value.inbox>0 then
|
||||||
|
chatplus.loggedin[key].msgicon = chatplus.loggedin[key].player:hud_add({
|
||||||
|
hud_elem_type = "image",
|
||||||
|
name = "MailIcon",
|
||||||
|
position = {x=0.52, y=0.52},
|
||||||
|
text="chatplus_mail.png",
|
||||||
|
scale = {x=1,y=1},
|
||||||
|
alignment = {x=0.5, y=0.5},
|
||||||
|
})
|
||||||
|
chatplus.loggedin[key].msgicon2 = chatplus.loggedin[key].player:hud_add({
|
||||||
|
hud_elem_type = "text",
|
||||||
|
name = "MailText",
|
||||||
|
position = {x=0.55, y=0.52},
|
||||||
|
text=#value.inbox,
|
||||||
|
scale = {x=1,y=1},
|
||||||
|
alignment = {x=0.5, y=0.5},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
chatplus.loggedin[key].lastcount = #value.inbox
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
minetest.after(5, tick)
|
||||||
|
end
|
||||||
|
tick()
|
||||||
|
|
||||||
chatplus.register_handler(function(from,to,msg)
|
chatplus.register_handler(function(from,to,msg)
|
||||||
if chatplus.setting("distance") <= 0 then
|
if chatplus.setting("distance") <= 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user