Fix kicking players from bed when it's destroyed

This commit is contained in:
Marcin Serwin 2021-04-29 08:18:33 +02:00
parent cf46f0d8b8
commit 6fac49550e

View file

@ -88,7 +88,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
end end
for _, other_pos in pairs(mcl_beds.bed_pos) do for _, other_pos in pairs(mcl_beds.bed_pos) do
if vector.distance(bed_pos, other_pos) < 0.1 then if vector.distance(bed_pos2, other_pos) < 0.1 then
return false, S("This bed is already occupied!") return false, S("This bed is already occupied!")
end end
end end
@ -170,7 +170,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
mcl_beds.player[name] = 1 mcl_beds.player[name] = 1
mcl_beds.pos[name] = pos mcl_beds.pos[name] = pos
mcl_beds.bed_pos[name] = bed_pos mcl_beds.bed_pos[name] = bed_pos2
player_in_bed = player_in_bed + 1 player_in_bed = player_in_bed + 1
-- physics, eye_offset, etc -- physics, eye_offset, etc
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0}) player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})