summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2014-07-14 18:10:31 +0200
committerWuzzy <almikes@aol.com>2014-07-14 18:10:31 +0200
commit1dd5c5527a65e739aba8af89ab982fbe6c44ab00 (patch)
tree66b6455acdbaf336930809190d2fd653f3076740
parent15daa210c496232caa110e32bfb61bfb54e13183 (diff)
Check for correct player in apply_effect_type
-rw-r--r--init.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 0b6b0eb..173a460 100644
--- a/init.lua
+++ b/init.lua
@@ -69,13 +69,26 @@ end
function playereffects.apply_effect_type(effect_type_id, duration, player)
local start_time = os.time()
+ local is_player = false
+ if(type(player)=="userdata") then
+ if(player.is_player ~= nil) then
+ if(player:is_player() == true) then
+ is_player = true
+ end
+ end
+ end
+ if(is_player == false) then
+ minetest.log("error", "[playereffects] Attempted to apply effect type "..effect_type_id.." to a non-player!")
+ return false
+ end
+
local status = playereffects.effect_types[effect_type_id].apply(player)
local playername = player:get_player_name()
local metadata
if(status == false) then
minetest.log("action", "[playereffects] Attempt to apply effect type "..effect_type_id.." to player "..playername.." failed!")
- return
+ return false
else
metadata = status
end