diff options
Diffstat (limited to 'clear_penalty.lua')
-rw-r--r-- | clear_penalty.lua | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/clear_penalty.lua b/clear_penalty.lua deleted file mode 100644 index 0fe84fe..0000000 --- a/clear_penalty.lua +++ /dev/null @@ -1,29 +0,0 @@ - --- playername => time-of-last-cooldown -local cooldown = {} - -minetest.register_chatcommand("mesecons_clear_penalty", { - description = "clears the penalty in the current mapblock " .. - "(cooldown: " .. mesecons_debug.penalty_clear_cooldown .. ")", - func = function(name) - local player = minetest.get_player_by_name(name) - if not player then - return - end - - local last_cooldown_time = cooldown[name] or 0 - local remaining_time = mesecons_debug.penalty_clear_cooldown - (os.time() - last_cooldown_time) - if remaining_time > 0 then - -- cooldown still in progress - return true, "cooldown still in progress, remaining time: " .. remaining_time .. " seconds" - end - - -- set timer - cooldown[name] = os.time() - - local ctx = mesecons_debug.get_context(player:get_pos()) - ctx.penalty = 0 - - return true, "penalty reset" - end -}) |