1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-06-28 06:30:18 +02:00

harden is_player checks

This commit is contained in:
tenplus1
2023-07-26 17:43:40 +01:00
parent e2ee5c62c7
commit 07dce8208b
3 changed files with 46 additions and 19 deletions

View File

@ -1,8 +1,17 @@
local S = mobs.intllib
-- mob spawner
-- are we a real player ?
local function is_player(player)
if player and type(player) == "userdata" and minetest.is_player(player) then
return true
end
end
-- mob spawner
local spawner_default = "mobs_animal:pumba 10 15 0 0 0"
minetest.register_node("mobs:spawner", {
@ -148,7 +157,7 @@ minetest.register_abm({
for _, oir in pairs(objsp) do
if oir:is_player() then
if is_player(oir) then
in_range = 1