Merge pull request #6 from zeuner/bugfix2

Bugfixes related to messages file
This commit is contained in:
Zheyu Shen 2019-01-09 09:26:05 -05:00 committed by GitHub
commit 48c2553798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,7 @@ function random_messages.read_messages()
-- blame the admin if not found -- 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("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")) output:write(S("Tell your dumb admin that this line is in (worldpath)/random_messages\n"))
return
else else
-- or write default_input content in worldpath message file -- or write default_input content in worldpath message file
local content = default_input:read("*all") local content = default_input:read("*all")
@ -123,13 +124,15 @@ random_messages.set_interval()
random_messages.read_messages() random_messages.read_messages()
local TIMER = 0 local TIMER = 0
minetest.register_globalstep(function(dtime) if random_messages.messages[1] then
TIMER = TIMER + dtime; minetest.register_globalstep(function(dtime)
if TIMER > MESSAGE_INTERVAL then TIMER = TIMER + dtime;
random_messages.show_message() if TIMER > MESSAGE_INTERVAL then
TIMER = 0 random_messages.show_message()
end TIMER = 0
end) end
end)
end
local register_chatcommand_table = { local register_chatcommand_table = {
params = "viewmessages | removemessage <number> | addmessage <number>", params = "viewmessages | removemessage <number> | addmessage <number>",