Loading .luacheckrc +4 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,8 @@ read_globals = { "stairs", "doors", "xpanes", "xdecor", "xbg", table = {fields = {"copy"}}, string = {fields = {"split"}}, "unpack", "stairsplus", "mesecon" } depends.txt +2 −1 Original line number Diff line number Diff line Loading @@ -9,3 +9,4 @@ xpanes fire? oresplus? moreblocks? mesecons_doors? handlers/animations.lua +15 −9 Original line number Diff line number Diff line Loading @@ -19,24 +19,29 @@ function xdecor.sit(pos, node, clicker, pointed_thing) if default.player_attached[player_name] then pos.y = pos.y - 0.5 clicker:setpos(pos) clicker:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) clicker:set_physics_override(1, 1, 1) clicker:set_eye_offset(vector.new(), vector.new()) clicker:set_physics_override({speed = 1, jump = 1, gravity = 1}) default.player_attached[player_name] = false default.player_set_animation(clicker, "stand", 30) elseif not default.player_attached[player_name] and node.param2 <= 3 and not ctrl.sneak and vector.equals(vel, {x=0,y=0,z=0}) then not ctrl.sneak and vector.equals(vel, vector.new()) then clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0}) clicker:set_physics_override(0, 0, 0) clicker:set_eye_offset({x = 0, y = -7, z = 2}, vector.new()) clicker:set_physics_override({speed = 0, jump = 0, gravity = 1}) clicker:setpos(pos) default.player_attached[player_name] = true default.player_set_animation(clicker, "sit", 30) if node.param2 == 0 then clicker:set_look_yaw(3.15) elseif node.param2 == 1 then clicker:set_look_yaw(7.9) elseif node.param2 == 2 then clicker:set_look_yaw(6.28) elseif node.param2 == 3 then clicker:set_look_yaw(4.75) end if node.param2 == 0 then clicker:set_look_yaw(3.15) elseif node.param2 == 1 then clicker:set_look_yaw(7.9) elseif node.param2 == 2 then clicker:set_look_yaw(6.28) elseif node.param2 == 3 then clicker:set_look_yaw(4.75) end end end Loading @@ -47,6 +52,7 @@ function xdecor.sit_dig(pos, digger) return false end end return true end handlers/helpers.lua +14 −3 Original line number Diff line number Diff line Loading @@ -2,21 +2,31 @@ function xdecor.maxn(T) local n = 0 for k in pairs(T) do if k > n then n = k end if k > n then n = k end end return n end -- Returns the length of an hash table. function xdecor.tablelen(T) local n = 0 for _ in pairs(T) do n = n + 1 end for _ in pairs(T) do n = n + 1 end return n end -- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons). function xdecor.tablecopy(T) if type(T) ~= "table" then return T end -- No need to copy. if type(T) ~= "table" then return T -- No need to copy. end local new = {} for k, v in pairs(T) do Loading @@ -26,6 +36,7 @@ function xdecor.tablecopy(T) new[k] = v end end return new end Loading handlers/nodeboxes.lua +21 −12 Original line number Diff line number Diff line xdecor.box = { slab_y = function(height, shift) return {-0.5, -0.5 + (shift or 0), -0.5, 0.5, -0.5 + height + (shift or 0), 0.5} return { -0.5, -0.5 + (shift or 0), -0.5, 0.5, -0.5 + height + (shift or 0), 0.5 } end, slab_z = function(depth) return {-0.5, -0.5, -0.5 + depth, 0.5, 0.5, 0.5} Loading @@ -16,12 +22,14 @@ xdecor.box = { xdecor.nodebox = { regular = {type = "regular"}, null = {type="fixed", fixed={0,0,0,0,0,0}} null = { type = "fixed", fixed = {0,0,0,0,0,0} } } xdecor.pixelbox = function(size, boxes) local fixed = {} for _, box in pairs(boxes) do for _, box in ipairs(boxes) do -- `unpack` has been changed to `table.unpack` in newest Lua versions. local x, y, z, w, h, l = unpack(box) fixed[#fixed + 1] = { Loading @@ -33,10 +41,12 @@ xdecor.pixelbox = function(size, boxes) ((z + l) / size) - 0.5 } end return {type = "fixed", fixed = fixed} end local mt = {} mt.__index = function(table, key) local ref = xdecor.box[key] local ref_type = type(ref) Loading @@ -55,4 +65,3 @@ mt.__index = function(table, key) end setmetatable(xdecor.nodebox, mt) Loading
.luacheckrc +4 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,8 @@ read_globals = { "stairs", "doors", "xpanes", "xdecor", "xbg", table = {fields = {"copy"}}, string = {fields = {"split"}}, "unpack", "stairsplus", "mesecon" }
depends.txt +2 −1 Original line number Diff line number Diff line Loading @@ -9,3 +9,4 @@ xpanes fire? oresplus? moreblocks? mesecons_doors?
handlers/animations.lua +15 −9 Original line number Diff line number Diff line Loading @@ -19,24 +19,29 @@ function xdecor.sit(pos, node, clicker, pointed_thing) if default.player_attached[player_name] then pos.y = pos.y - 0.5 clicker:setpos(pos) clicker:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) clicker:set_physics_override(1, 1, 1) clicker:set_eye_offset(vector.new(), vector.new()) clicker:set_physics_override({speed = 1, jump = 1, gravity = 1}) default.player_attached[player_name] = false default.player_set_animation(clicker, "stand", 30) elseif not default.player_attached[player_name] and node.param2 <= 3 and not ctrl.sneak and vector.equals(vel, {x=0,y=0,z=0}) then not ctrl.sneak and vector.equals(vel, vector.new()) then clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0}) clicker:set_physics_override(0, 0, 0) clicker:set_eye_offset({x = 0, y = -7, z = 2}, vector.new()) clicker:set_physics_override({speed = 0, jump = 0, gravity = 1}) clicker:setpos(pos) default.player_attached[player_name] = true default.player_set_animation(clicker, "sit", 30) if node.param2 == 0 then clicker:set_look_yaw(3.15) elseif node.param2 == 1 then clicker:set_look_yaw(7.9) elseif node.param2 == 2 then clicker:set_look_yaw(6.28) elseif node.param2 == 3 then clicker:set_look_yaw(4.75) end if node.param2 == 0 then clicker:set_look_yaw(3.15) elseif node.param2 == 1 then clicker:set_look_yaw(7.9) elseif node.param2 == 2 then clicker:set_look_yaw(6.28) elseif node.param2 == 3 then clicker:set_look_yaw(4.75) end end end Loading @@ -47,6 +52,7 @@ function xdecor.sit_dig(pos, digger) return false end end return true end
handlers/helpers.lua +14 −3 Original line number Diff line number Diff line Loading @@ -2,21 +2,31 @@ function xdecor.maxn(T) local n = 0 for k in pairs(T) do if k > n then n = k end if k > n then n = k end end return n end -- Returns the length of an hash table. function xdecor.tablelen(T) local n = 0 for _ in pairs(T) do n = n + 1 end for _ in pairs(T) do n = n + 1 end return n end -- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons). function xdecor.tablecopy(T) if type(T) ~= "table" then return T end -- No need to copy. if type(T) ~= "table" then return T -- No need to copy. end local new = {} for k, v in pairs(T) do Loading @@ -26,6 +36,7 @@ function xdecor.tablecopy(T) new[k] = v end end return new end Loading
handlers/nodeboxes.lua +21 −12 Original line number Diff line number Diff line xdecor.box = { slab_y = function(height, shift) return {-0.5, -0.5 + (shift or 0), -0.5, 0.5, -0.5 + height + (shift or 0), 0.5} return { -0.5, -0.5 + (shift or 0), -0.5, 0.5, -0.5 + height + (shift or 0), 0.5 } end, slab_z = function(depth) return {-0.5, -0.5, -0.5 + depth, 0.5, 0.5, 0.5} Loading @@ -16,12 +22,14 @@ xdecor.box = { xdecor.nodebox = { regular = {type = "regular"}, null = {type="fixed", fixed={0,0,0,0,0,0}} null = { type = "fixed", fixed = {0,0,0,0,0,0} } } xdecor.pixelbox = function(size, boxes) local fixed = {} for _, box in pairs(boxes) do for _, box in ipairs(boxes) do -- `unpack` has been changed to `table.unpack` in newest Lua versions. local x, y, z, w, h, l = unpack(box) fixed[#fixed + 1] = { Loading @@ -33,10 +41,12 @@ xdecor.pixelbox = function(size, boxes) ((z + l) / size) - 0.5 } end return {type = "fixed", fixed = fixed} end local mt = {} mt.__index = function(table, key) local ref = xdecor.box[key] local ref_type = type(ref) Loading @@ -55,4 +65,3 @@ mt.__index = function(table, key) end setmetatable(xdecor.nodebox, mt)