mirror of
https://github.com/minetest/minetest_game.git
synced 2025-06-29 21:30:26 +02:00
Beds: priv/griefing fixes.
- disallow placing beds in protected areas
- fix rotation of beds(broken after 41c2b2ae
)
- allow using others' beds, but don't change spawn location
Fixes #953. #943 isn't something I think was ever implemented, and
this does a fair job of addressing the main concern (spawning in
others' houses)
This commit is contained in:
@ -18,8 +18,8 @@ function beds.read_spawns()
|
||||
repeat
|
||||
local x = input:read("*n")
|
||||
if x == nil then
|
||||
break
|
||||
end
|
||||
break
|
||||
end
|
||||
local y = input:read("*n")
|
||||
local z = input:read("*n")
|
||||
local name = input:read("*l")
|
||||
@ -52,7 +52,10 @@ function beds.set_spawns()
|
||||
for name,_ in pairs(beds.player) do
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local p = player:getpos()
|
||||
beds.spawn[name] = p
|
||||
-- but don't change spawn location if borrowing a bed
|
||||
if not minetest.is_protected(p, name) then
|
||||
beds.spawn[name] = p
|
||||
end
|
||||
end
|
||||
beds.save_spawns()
|
||||
end
|
||||
|
Reference in New Issue
Block a user