mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 23:10:17 +01:00
Bed bugfix: Remove "reverse" toggle in favor of swap_node/set_node combo (#2976)
This commit is contained in:
parent
ff755eed9c
commit
43185f19e3
@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
local reverse = true
|
|
||||||
|
|
||||||
local function destruct_bed(pos, n)
|
local function destruct_bed(pos, n)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local other
|
local other
|
||||||
@ -12,15 +10,14 @@ local function destruct_bed(pos, n)
|
|||||||
local dir = minetest.facedir_to_dir(node.param2)
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
other = vector.add(pos, dir)
|
other = vector.add(pos, dir)
|
||||||
end
|
end
|
||||||
|
local oname = minetest.get_node(other).name
|
||||||
if reverse then
|
if minetest.get_item_group(oname, "bed") ~= 0 then
|
||||||
reverse = not reverse
|
-- Swap node leaves meta, but doesn't call destruct_bed again
|
||||||
minetest.remove_node(other)
|
minetest.swap_node(other, {name = "air"})
|
||||||
|
minetest.remove_node(other) -- Now clear the meta
|
||||||
minetest.check_for_falling(other)
|
minetest.check_for_falling(other)
|
||||||
beds.remove_spawns_at(pos)
|
beds.remove_spawns_at(pos)
|
||||||
beds.remove_spawns_at(other)
|
beds.remove_spawns_at(other)
|
||||||
else
|
|
||||||
reverse = not reverse
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user