From 013a000fa4da105e814133939b0862b901bc745b Mon Sep 17 00:00:00 2001 From: ezhh Date: Tue, 5 Jul 2016 17:15:36 +0100 Subject: [PATCH] Reduced to single register_on_joinplayer --- init.lua | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/init.lua b/init.lua index 88ce638..8ef87bb 100644 --- a/init.lua +++ b/init.lua @@ -33,13 +33,6 @@ minetest.register_chatcommand("hobble", { end }) -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - if minetest.get_player_privs(name).hobbled then - hobble(name,name) - end -end) - --reduces player movement speed local function slowmo(name, param) local player = minetest.get_player_by_name(param) @@ -65,13 +58,6 @@ minetest.register_chatcommand("slowmo", { end }) -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - if minetest.get_player_privs(name).slowed then - slowmo(name,name) - end -end) - --disable sneak glitch for the player. local function noglitch(name, param) local player = minetest.get_player_by_name(param) @@ -97,13 +83,6 @@ minetest.register_chatcommand("noglitch", { end }) -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - if minetest.get_player_privs(name).unglitched then - noglitch(name,name) - end -end) - --prevents player from changing speed/direction and jumping. local function freeze(name, param) local player = minetest.get_player_by_name(param) @@ -129,13 +108,25 @@ minetest.register_chatcommand("freeze", { end }) +--trigger curse effects when player joins minetest.register_on_joinplayer(function(player) local name = player:get_player_name() + if minetest.get_player_privs(name).hobbled then + hobble(name,name) + end + if minetest.get_player_privs(name).slowed then + slowmo(name,name) + end + if minetest.get_player_privs(name).unglitched then + noglitch(name,name) + end if minetest.get_player_privs(name).frozen then freeze(name,name) - end + end end) + + --reset player physics. minetest.register_chatcommand("setfree",{ params = "",