From f0e5e07da112ad4ec18c6ba450c090070b6b3a5b Mon Sep 17 00:00:00 2001 From: ezhh Date: Sun, 3 Jul 2016 18:14:34 +0100 Subject: [PATCH] Prevented slowmo breaking freeze on join if both present --- init.lua | 64 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/init.lua b/init.lua index 5e1d97c..9d4f059 100644 --- a/init.lua +++ b/init.lua @@ -5,38 +5,6 @@ minetest.register_privilege("slowed", {description = "Slow moving.", give_to_sin minetest.register_privilege("unglitched", {description = "Not very glitchy...", give_to_singleplayer=false}) ---prevents player from changing speed/direction and jumping. -local function freeze(name, param) - local player = minetest.get_player_by_name(param) - local privs=minetest.get_player_privs(param) - privs.frozen=true - minetest.set_player_privs(param,privs) - player:set_physics_override({jump = 0, speed = 0}) -end - -minetest.register_chatcommand("freeze", { - params = "", - privs = {secret=true}, - description = "Prevent player movement.", - func = function(name, param) - local player = minetest.get_player_by_name(param) - if player == nil then - minetest.chat_send_player(name,"Player does not exist") - return - end - freeze(name, param) - minetest.chat_send_player(param, "Cursed by an admin! You are now frozen!") - minetest.chat_send_player(name, "Curse successful!") - end -}) - -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - if minetest.get_player_privs(name).frozen then - freeze(name,name) - end -end) - --prevents player from jumping. local function hobble(name, param) local player = minetest.get_player_by_name(param) @@ -133,6 +101,38 @@ minetest.register_on_joinplayer(function(player) end end) +--prevents player from changing speed/direction and jumping. +local function freeze(name, param) + local player = minetest.get_player_by_name(param) + local privs=minetest.get_player_privs(param) + privs.frozen=true + minetest.set_player_privs(param,privs) + player:set_physics_override({jump = 0, speed = 0}) +end + +minetest.register_chatcommand("freeze", { + params = "", + privs = {secret=true}, + description = "Prevent player movement.", + func = function(name, param) + local player = minetest.get_player_by_name(param) + if player == nil then + minetest.chat_send_player(name,"Player does not exist") + return + end + freeze(name, param) + minetest.chat_send_player(param, "Cursed by an admin! You are now frozen!") + minetest.chat_send_player(name, "Curse successful!") + end +}) + +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + if minetest.get_player_privs(name).frozen then + freeze(name,name) + end +end) + --reset player physics. minetest.register_chatcommand("setfree",{ params = "",