Skip to content

Commit 176ddba

Browse files
DesourSmallJoker
authored andcommittedJan 26, 2020
Reset spawn position on bed destruction
1 parent eac4795 commit 176ddba

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

Diff for: ‎mods/beds/api.lua

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ local function destruct_bed(pos, n)
1717
reverse = not reverse
1818
minetest.remove_node(other)
1919
minetest.check_for_falling(other)
20+
beds.remove_spawns_at(pos)
21+
beds.remove_spawns_at(other)
2022
else
2123
reverse = not reverse
2224
end

Diff for: ‎mods/beds/spawns.lua

+9
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,12 @@ function beds.set_spawns()
6161
end
6262
beds.save_spawns()
6363
end
64+
65+
function beds.remove_spawns_at(pos)
66+
for name, p in pairs(beds.spawn) do
67+
if vector.equals(vector.round(p), pos) then
68+
beds.spawn[name] = nil
69+
end
70+
end
71+
beds.save_spawns()
72+
end

1 commit comments

Comments
 (1)

Fixer-007 commented on Jan 29, 2020

@Fixer-007
Contributor

Finally this is actual gameplay fix I wanted all those years!

Please sign in to comment.