1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

Beds: Strip colour bits from param2 in 'get look yaw'

Based on code by github user 'hdak1945git'.
Fixes a crash when 'colorfacedir' param2 is used for beds.
This commit is contained in:
paramat 2017-09-28 18:23:08 +01:00 committed by paramat
parent 2d8207a924
commit 809e5933c4

View File

@ -9,15 +9,18 @@ end
-- Helper functions -- Helper functions
local function get_look_yaw(pos) local function get_look_yaw(pos)
local n = minetest.get_node(pos) local rotation = minetest.get_node(pos).param2
if n.param2 == 1 then if rotation > 3 then
return pi / 2, n.param2 rotation = rotation % 4 -- Mask colorfacedir values
elseif n.param2 == 3 then end
return -pi / 2, n.param2 if rotation == 1 then
elseif n.param2 == 0 then return pi / 2, rotation
return pi, n.param2 elseif rotation == 3 then
return -pi / 2, rotation
elseif rotation == 0 then
return pi, rotation
else else
return 0, n.param2 return 0, rotation
end end
end end