From cadc5f2f07f9447277718fdd247e96674d987d31 Mon Sep 17 00:00:00 2001 From: Andrey Kozlovskiy Date: Sat, 16 Jan 2021 01:32:05 +0300 Subject: [PATCH 1/3] Fixes and improvements for 'TechPack Stairway' Lattice - Fix `Mesh not found: techpack_stairway_slope.obj` error on start by adding missing obj file taken from `moreblocks` mod - When available, use `moreblocks` for creating different stairs and slopes --- .gitignore | 1 - techpack_stairway/depends.txt | 1 + techpack_stairway/init.lua | 102 ++++++++++-------- techpack_stairway/mod.conf | 1 + .../models/techpack_stairway_slope.obj | 56 ++++++++++ 5 files changed, 117 insertions(+), 44 deletions(-) create mode 100644 techpack_stairway/models/techpack_stairway_slope.obj diff --git a/.gitignore b/.gitignore index eb83c85..54b33ce 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ luac.out *.o *.os *.ko -*.obj *.elf # Precompiled Headers diff --git a/techpack_stairway/depends.txt b/techpack_stairway/depends.txt index 3a7daa1..2daa131 100644 --- a/techpack_stairway/depends.txt +++ b/techpack_stairway/depends.txt @@ -1,2 +1,3 @@ default +moreblocks? diff --git a/techpack_stairway/init.lua b/techpack_stairway/init.lua index b0bac50..197752f 100644 --- a/techpack_stairway/init.lua +++ b/techpack_stairway/init.lua @@ -504,53 +504,69 @@ minetest.register_node("techpack_stairway:lattice", { sounds = default.node_sound_metal_defaults(), }) -minetest.register_node("techpack_stairway:lattice_slop", { - description = S("TechPack Lattice Slope"), - tiles = { - 'techpack_stairway_lattice.png', - }, - drawtype = "mesh", - mesh="techpack_stairway_slope.obj", +if minetest.get_modpath("moreblocks") then + stairsplus:register_all("techpack_stairway", "lattice", "techpack_stairway:lattice", { + description = S("TechPack Lattice"), + tiles = { + 'techpack_stairway_lattice.png', + }, - selection_box = { - type = "fixed", - fixed = { - {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, - {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, - {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, - {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), + }) + + minetest.register_alias("techpack_stairway:lattice_slop", "techpack_stairway:slope_lattice") +else + minetest.register_node("techpack_stairway:lattice_slop", { + description = S("TechPack Lattice Slope"), + tiles = { + 'techpack_stairway_lattice.png', }, - }, - - collision_box = { - type = "fixed", - fixed = { - {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, - {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, - {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, - {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, + drawtype = "mesh", + mesh="techpack_stairway_slope.obj", + + selection_box = { + type = "fixed", + fixed = { + {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, + {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, + {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, + {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, + }, }, - }, - - after_place_node = function(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local dir = minetest.facedir_to_dir(node.param2) - if pointed_thing.under.y >= pointed_thing.above.y then - local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2] - if newparam2 then - node.param2 = newparam2 - minetest.swap_node(pos, node) + + collision_box = { + type = "fixed", + fixed = { + {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, + {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, + {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, + {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, + }, + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local dir = minetest.facedir_to_dir(node.param2) + if pointed_thing.under.y >= pointed_thing.above.y then + local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2] + if newparam2 then + node.param2 = newparam2 + minetest.swap_node(pos, node) + end end - end - end, - - paramtype2 = "facedir", - paramtype = "light", - sunlight_propagates = true, - is_ground_content = false, - groups = {cracky = 2}, - sounds = default.node_sound_metal_defaults(), -}) + end, + + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), + }) +end minetest.register_craft({ output = "techpack_stairway:grating 4", diff --git a/techpack_stairway/mod.conf b/techpack_stairway/mod.conf index 9ab7517..c0913bd 100644 --- a/techpack_stairway/mod.conf +++ b/techpack_stairway/mod.conf @@ -1,3 +1,4 @@ name=techpack_stairway description=Simple stairways and bridges for your machines. depends=default +optional_depends=moreblocks diff --git a/techpack_stairway/models/techpack_stairway_slope.obj b/techpack_stairway/models/techpack_stairway_slope.obj new file mode 100644 index 0000000..57298d7 --- /dev/null +++ b/techpack_stairway/models/techpack_stairway_slope.obj @@ -0,0 +1,56 @@ +g top +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn 0.0000 0.7071 -0.7071 +s off +f 2/1/1 1/2/1 4/3/1 3/4/1 +g bottom +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 -1.0000 -0.0000 +s off +f 6/5/2 5/6/2 7/7/2 8/8/2 +g right +v -0.500000 0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +vt 1.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn -1.0000 0.0000 0.0000 +s off +f 9/9/3 11/10/3 10/11/3 +g left +v 0.500000 0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +s off +f 12/12/4 13/13/4 14/14/4 +g back +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn 0.0000 -0.0000 1.0000 +s off +f 15/15/5 16/16/5 17/17/5 18/18/5 From 258734e9da55ac687159b9c694bb3fe416207e66 Mon Sep 17 00:00:00 2001 From: Andrey Kozlovskiy Date: Mon, 18 Jan 2021 03:59:38 +0300 Subject: [PATCH 2/3] Use techpack_stairway_slope.obj from joe7575/techpack_stairway --- .../models/techpack_stairway_slope.obj | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/techpack_stairway/models/techpack_stairway_slope.obj b/techpack_stairway/models/techpack_stairway_slope.obj index 57298d7..f96e575 100644 --- a/techpack_stairway/models/techpack_stairway_slope.obj +++ b/techpack_stairway/models/techpack_stairway_slope.obj @@ -1,8 +1,8 @@ g top -v 0.500000 0.500000 0.500000 -v -0.500000 0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 +v 0.498000 0.498000 0.498000 +v -0.498000 0.498000 0.498000 +v -0.498000 -0.498000 -0.498000 +v 0.498000 -0.498000 -0.498000 vt 1.0000 1.0000 vt 0.0000 1.0000 vt 0.0000 0.0000 @@ -11,10 +11,10 @@ vn 0.0000 0.7071 -0.7071 s off f 2/1/1 1/2/1 4/3/1 3/4/1 g bottom -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 +v -0.498000 -0.498000 0.498000 +v 0.498000 -0.498000 0.498000 +v -0.498000 -0.498000 -0.498000 +v 0.498000 -0.498000 -0.498000 vt 0.0000 0.0000 vt 1.0000 0.0000 vt 1.0000 1.0000 @@ -23,9 +23,9 @@ vn 0.0000 -1.0000 -0.0000 s off f 6/5/2 5/6/2 7/7/2 8/8/2 g right -v -0.500000 0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 +v -0.498000 0.498000 0.498000 +v -0.498000 -0.498000 0.498000 +v -0.498000 -0.498000 -0.498000 vt 1.0000 1.0000 vt 0.0000 0.0000 vt 1.0000 0.0000 @@ -33,9 +33,9 @@ vn -1.0000 0.0000 0.0000 s off f 9/9/3 11/10/3 10/11/3 g left -v 0.500000 0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 -0.500000 +v 0.498000 0.498000 0.498000 +v 0.498000 -0.498000 0.498000 +v 0.498000 -0.498000 -0.498000 vt 0.0000 1.0000 vt 0.0000 0.0000 vt 1.0000 0.0000 @@ -43,10 +43,10 @@ vn 1.0000 0.0000 0.0000 s off f 12/12/4 13/13/4 14/14/4 g back -v 0.500000 0.500000 0.500000 -v -0.500000 0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 +v 0.498000 0.498000 0.498000 +v -0.498000 0.498000 0.498000 +v -0.498000 -0.498000 0.498000 +v 0.498000 -0.498000 0.498000 vt 1.0000 1.0000 vt 0.0000 1.0000 vt 0.0000 0.0000 From 3a8148ba2b8338605e66fd178aa8161fccdda202 Mon Sep 17 00:00:00 2001 From: Andrey Kozlovskiy Date: Mon, 18 Jan 2021 04:26:55 +0300 Subject: [PATCH 3/3] Do not use moreblocks for stairway lattice slope --- techpack_stairway/depends.txt | 1 - techpack_stairway/init.lua | 104 ++++++++++++++-------------------- techpack_stairway/mod.conf | 1 - 3 files changed, 44 insertions(+), 62 deletions(-) diff --git a/techpack_stairway/depends.txt b/techpack_stairway/depends.txt index 2daa131..3a7daa1 100644 --- a/techpack_stairway/depends.txt +++ b/techpack_stairway/depends.txt @@ -1,3 +1,2 @@ default -moreblocks? diff --git a/techpack_stairway/init.lua b/techpack_stairway/init.lua index 197752f..b0bac50 100644 --- a/techpack_stairway/init.lua +++ b/techpack_stairway/init.lua @@ -504,69 +504,53 @@ minetest.register_node("techpack_stairway:lattice", { sounds = default.node_sound_metal_defaults(), }) -if minetest.get_modpath("moreblocks") then - stairsplus:register_all("techpack_stairway", "lattice", "techpack_stairway:lattice", { - description = S("TechPack Lattice"), - tiles = { - 'techpack_stairway_lattice.png', +minetest.register_node("techpack_stairway:lattice_slop", { + description = S("TechPack Lattice Slope"), + tiles = { + 'techpack_stairway_lattice.png', + }, + drawtype = "mesh", + mesh="techpack_stairway_slope.obj", + + selection_box = { + type = "fixed", + fixed = { + {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, + {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, + {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, + {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, }, - - sunlight_propagates = true, - is_ground_content = false, - groups = {cracky = 2}, - sounds = default.node_sound_metal_defaults(), - }) - - minetest.register_alias("techpack_stairway:lattice_slop", "techpack_stairway:slope_lattice") -else - minetest.register_node("techpack_stairway:lattice_slop", { - description = S("TechPack Lattice Slope"), - tiles = { - 'techpack_stairway_lattice.png', + }, + + collision_box = { + type = "fixed", + fixed = { + {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, + {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, + {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, + {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, }, - drawtype = "mesh", - mesh="techpack_stairway_slope.obj", - - selection_box = { - type = "fixed", - fixed = { - {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, - {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, - {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, - {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, - }, - }, - - collision_box = { - type = "fixed", - fixed = { - {-8/16, 4/16, 4/16, 8/16, 8/16, 8/16}, - {-8/16, 0/16, 0/16, 8/16, 4/16, 8/16}, - {-8/16, -4/16, -4/16, 8/16, 0/16, 8/16}, - {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}, - }, - }, - - after_place_node = function(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - local dir = minetest.facedir_to_dir(node.param2) - if pointed_thing.under.y >= pointed_thing.above.y then - local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2] - if newparam2 then - node.param2 = newparam2 - minetest.swap_node(pos, node) - end + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local dir = minetest.facedir_to_dir(node.param2) + if pointed_thing.under.y >= pointed_thing.above.y then + local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2] + if newparam2 then + node.param2 = newparam2 + minetest.swap_node(pos, node) end - end, - - paramtype2 = "facedir", - paramtype = "light", - sunlight_propagates = true, - is_ground_content = false, - groups = {cracky = 2}, - sounds = default.node_sound_metal_defaults(), - }) -end + end + end, + + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), +}) minetest.register_craft({ output = "techpack_stairway:grating 4", diff --git a/techpack_stairway/mod.conf b/techpack_stairway/mod.conf index c0913bd..9ab7517 100644 --- a/techpack_stairway/mod.conf +++ b/techpack_stairway/mod.conf @@ -1,4 +1,3 @@ name=techpack_stairway description=Simple stairways and bridges for your machines. depends=default -optional_depends=moreblocks