player bugfix

This commit is contained in:
Joachim Stolberg 2017-09-09 21:55:17 +02:00
parent 4a9ea3272c
commit 01e08cbb30

@ -3,7 +3,7 @@
Tower Crane Mod Tower Crane Mod
=============== ===============
v0.10 by JoSt v0.11 by JoSt
Copyright (C) 2017 Joachim Stolberg Copyright (C) 2017 Joachim Stolberg
LGPLv2.1+ LGPLv2.1+
@ -20,6 +20,7 @@
2017-07-16 v0.08 player times out bugfix 2017-07-16 v0.08 player times out bugfix
2017-08-19 v0.09 crane protection area to prevent crane clusters 2017-08-19 v0.09 crane protection area to prevent crane clusters
2017-08-27 v0.10 hook instance and sound switch off bug fixes 2017-08-27 v0.10 hook instance and sound switch off bug fixes
2017-09-09 v0.11 further player bugfixes
]]-- ]]--
@ -346,12 +347,14 @@ local function remove_hook(player, pos, y_offs)
pos = table.copy(pos) pos = table.copy(pos)
pos.y = pos.y + y_offs pos.y = pos.y + y_offs
local key = minetest.hash_node_position(pos) local key = minetest.hash_node_position(pos)
default.player_set_animation(player, "stand" , 10) if player ~= nil then
default.player_set_animation(player, "stand" , 10)
end
local hook = towercrane.hook[key] local hook = towercrane.hook[key]
if hook then if hook then
-- remove hook -- remove hook
hook:remove() hook:remove()
if hook:get_luaentity().sound ~= nil then if hook and hook:get_luaentity() and hook:get_luaentity().sound ~= nil then
-- stop sound -- stop sound
minetest.sound_stop(hook:get_luaentity().sound) minetest.sound_stop(hook:get_luaentity().sound)
end end