forked from mtcontrib/homedecor_modpack
free player when seat is dug (#84)
This commit is contained in:
@ -193,7 +193,7 @@ function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
|
||||
|
||||
xcompat.player.player_attached[name] = true
|
||||
xcompat.player.set_animation(clicker, "sit", 0)
|
||||
seated_cache[name] = true
|
||||
seated_cache[name] = minetest.hash_node_position(pos)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
@ -210,6 +210,17 @@ function lrfurn.stand(clicker)
|
||||
end
|
||||
end
|
||||
|
||||
function lrfurn.on_seat_destruct(pos) --called when a seat is destroyed
|
||||
for name, seatpos in pairs(seated_cache) do
|
||||
if seatpos == minetest.hash_node_position(pos) then
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
lrfurn.stand(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--if the player gets killed in the seat, handle it
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if seated_cache[player:get_player_name()] then
|
||||
|
Reference in New Issue
Block a user