Skip to content

Commit 9bf64b6

Browse files
authoredFeb 8, 2020
Fix simple bed height, make player lay down just above it, not inside it
1 parent f255e36 commit 9bf64b6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

Diff for: ‎mods/beds/beds.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ beds.register_bed("beds:bed", {
7979
}
8080
},
8181
nodebox = {
82-
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
83-
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
82+
bottom = {-0.5, -0.5, -0.5, 0.5, 0.0625, 0.5},
83+
top = {-0.5, -0.5, -0.5, 0.5, 0.0625, 0.5},
8484
},
85-
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
85+
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.0625, 1.5},
8686
recipe = {
8787
{"wool:white", "wool:white", "wool:white"},
8888
{"group:wood", "group:wood", "group:wood"}

Diff for: ‎mods/beds/functions.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ local function lay_down(player, pos, bed_pos, state, skip)
9090
local yaw, param2 = get_look_yaw(bed_pos)
9191
player:set_look_horizontal(yaw)
9292
local dir = minetest.facedir_to_dir(param2)
93-
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
93+
-- p.y is just above the nodebox height of the 'Simple Bed' (the highest bed),
94+
-- to avoid sinking down through the bed.
95+
local p = {
96+
x = bed_pos.x + dir.x / 2,
97+
y = bed_pos.y + 0.07,
98+
z = bed_pos.z + dir.z / 2
99+
}
94100
player:set_physics_override(0, 0, 0)
95101
player:set_pos(p)
96102
default.player_attached[name] = true

0 commit comments

Comments
 (0)
Please sign in to comment.