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

@ -174,6 +174,15 @@ local function find_free_pos(pos)
end
-- 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
function mobs.attach(entity, player)
entity.player_rotation = entity.player_rotation or {x = 0, y = 0, z = 0}
@ -212,7 +221,7 @@ function mobs.attach(entity, player)
minetest.after(0.2, function()
if player and player:is_player() then
if is_player(player) then
if is_50 then
player_api.set_animation(player, "sit", 30)