From 7bf6c9e16e4c44a28a572efa7114c7f228c40a67 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Wed, 3 Aug 2016 18:31:00 +0200 Subject: [PATCH] [random_messages & pipeworks] Change globalsteps, remove variables - For #179 --- mods/pipeworks/luaentity.lua | 1 - mods/random_messages/init.lua | 13 +++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mods/pipeworks/luaentity.lua b/mods/pipeworks/luaentity.lua index 8430e7a3..68d16601 100755 --- a/mods/pipeworks/luaentity.lua +++ b/mods/pipeworks/luaentity.lua @@ -53,7 +53,6 @@ end local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones) local handle_active_blocks_step = 2 -local handle_active_blocks_timer = 0 local function active_blocks_step() local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2 local new_active_blocks = {} diff --git a/mods/random_messages/init.lua b/mods/random_messages/init.lua index a7c76566..72ed2855 100755 --- a/mods/random_messages/init.lua +++ b/mods/random_messages/init.lua @@ -103,14 +103,11 @@ end random_messages.set_interval() random_messages.read_messages() -local TIMER = 0 -minetest.register_globalstep(function(dtime) - TIMER = TIMER + dtime; - if TIMER > MESSAGE_INTERVAL then - random_messages.show_message() - TIMER = 0 - end -end) +local function step() + random_messages.show_message() + minetest.after(MESSAGE_INTERVAL, step) +end +minetest.after(0, step) local register_chatcommand_table = { params = "viewmessages | removemessage | addmessage ",