forked from mtcontrib/random_messages
Merge branch 'master' into nalc-1.2
This commit is contained in:
commit
9ef432bd8b
5
init.lua
5
init.lua
|
@ -34,7 +34,7 @@ end
|
|||
|
||||
function random_messages.initialize() --Set the interval in minetest.conf.
|
||||
minetest.settings:set("random_messages_interval",120)
|
||||
minetest.settings:save()
|
||||
minetest.settings:write();
|
||||
return 120
|
||||
end
|
||||
|
||||
|
@ -64,6 +64,7 @@ function random_messages.read_messages()
|
|||
-- blame the admin if not found
|
||||
output:write(S("Blame the server admin! He/She has probably not edited the random messages yet.\n"))
|
||||
output:write(S("Tell your dumb admin that this line is in (worldpath)/random_messages\n"))
|
||||
return
|
||||
else
|
||||
-- or write default_input content in worldpath message file
|
||||
local content = default_input:read("*all")
|
||||
|
@ -123,6 +124,7 @@ random_messages.set_interval()
|
|||
random_messages.read_messages()
|
||||
|
||||
local TIMER = 0
|
||||
if random_messages.messages[1] then
|
||||
minetest.register_globalstep(function(dtime)
|
||||
TIMER = TIMER + dtime;
|
||||
if TIMER > MESSAGE_INTERVAL then
|
||||
|
@ -130,6 +132,7 @@ minetest.register_globalstep(function(dtime)
|
|||
TIMER = 0
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local register_chatcommand_table = {
|
||||
params = "viewmessages | removemessage <number> | addmessage <number>",
|
||||
|
|
Loading…
Reference in New Issue
Block a user