mirror of
https://repo.or.cz/minetest_playereffects.git
synced 2025-01-09 10:30:17 +01:00
Check for correct player in apply_effect_type
This commit is contained in:
parent
15daa210c4
commit
1dd5c5527a
15
init.lua
15
init.lua
@ -69,13 +69,26 @@ end
|
|||||||
|
|
||||||
function playereffects.apply_effect_type(effect_type_id, duration, player)
|
function playereffects.apply_effect_type(effect_type_id, duration, player)
|
||||||
local start_time = os.time()
|
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 status = playereffects.effect_types[effect_type_id].apply(player)
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
local metadata
|
local metadata
|
||||||
|
|
||||||
if(status == false) then
|
if(status == false) then
|
||||||
minetest.log("action", "[playereffects] Attempt to apply effect type "..effect_type_id.." to player "..playername.." failed!")
|
minetest.log("action", "[playereffects] Attempt to apply effect type "..effect_type_id.." to player "..playername.." failed!")
|
||||||
return
|
return false
|
||||||
else
|
else
|
||||||
metadata = status
|
metadata = status
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user