diff options
Diffstat (limited to 'builtin/game/falling.lua')
-rw-r--r-- | builtin/game/falling.lua | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 714506a5f..057d0d0ed 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -52,6 +52,7 @@ core.register_entity(":__builtin:falling_node", { floats = false, set_node = function(self, node, meta) + node.param2 = node.param2 or 0 self.node = node meta = meta or {} if type(meta.to_table) == "function" then @@ -83,6 +84,9 @@ core.register_entity(":__builtin:falling_node", { local textures if def.tiles and def.tiles[1] then local tile = def.tiles[1] + if def.drawtype == "torchlike" and def.paramtype2 ~= "wallmounted" then + tile = def.tiles[2] or def.tiles[1] + end if type(tile) == "table" then tile = tile.name end @@ -126,7 +130,7 @@ core.register_entity(":__builtin:falling_node", { -- Set collision box (certain nodeboxes only for now) local nb_types = {fixed=true, leveled=true, connected=true} if def.drawtype == "nodebox" and def.node_box and - nb_types[def.node_box.type] then + nb_types[def.node_box.type] and def.node_box.fixed then local box = table.copy(def.node_box.fixed) if type(box[1]) == "table" then box = #box == 1 and box[1] or nil -- We can only use a single box @@ -143,9 +147,13 @@ core.register_entity(":__builtin:falling_node", { -- Rotate entity if def.drawtype == "torchlike" then - self.object:set_yaw(math.pi*0.25) - elseif (node.param2 ~= 0 and (def.wield_image == "" - or def.wield_image == nil)) + if def.paramtype2 == "wallmounted" then + self.object:set_yaw(math.pi*0.25) + else + self.object:set_yaw(-math.pi*0.25) + end + elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh") + and (def.wield_image == "" or def.wield_image == nil)) or def.drawtype == "signlike" or def.drawtype == "mesh" or def.drawtype == "normal" @@ -160,16 +168,30 @@ core.register_entity(":__builtin:falling_node", { elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then local rot = node.param2 % 8 local pitch, yaw, roll = 0, 0, 0 - if rot == 1 then - pitch, yaw = math.pi, math.pi - elseif rot == 2 then - pitch, yaw = math.pi/2, math.pi/2 - elseif rot == 3 then - pitch, yaw = math.pi/2, -math.pi/2 - elseif rot == 4 then - pitch, yaw = math.pi/2, math.pi - elseif rot == 5 then - pitch, yaw = math.pi/2, 0 + if def.drawtype == "nodebox" or def.drawtype == "mesh" then + if rot == 0 then + pitch, yaw = math.pi/2, 0 + elseif rot == 1 then + pitch, yaw = -math.pi/2, math.pi + elseif rot == 2 then + pitch, yaw = 0, math.pi/2 + elseif rot == 3 then + pitch, yaw = 0, -math.pi/2 + elseif rot == 4 then + pitch, yaw = 0, math.pi + end + else + if rot == 1 then + pitch, yaw = math.pi, math.pi + elseif rot == 2 then + pitch, yaw = math.pi/2, math.pi/2 + elseif rot == 3 then + pitch, yaw = math.pi/2, -math.pi/2 + elseif rot == 4 then + pitch, yaw = math.pi/2, math.pi + elseif rot == 5 then + pitch, yaw = math.pi/2, 0 + end end if def.drawtype == "signlike" then pitch = pitch - math.pi/2 @@ -178,7 +200,7 @@ core.register_entity(":__builtin:falling_node", { elseif rot == 1 then yaw = yaw - math.pi/2 end - elseif def.drawtype == "mesh" or def.drawtype == "normal" then + elseif def.drawtype == "mesh" or def.drawtype == "normal" or def.drawtype == "nodebox" then if rot >= 0 and rot <= 1 then roll = roll + math.pi else |