From 93637586e25fc141e23a1d4022a9a6647291ad88 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Thu, 8 Oct 2020 20:58:12 +0200 Subject: [PATCH] add lattice slope node --- init.lua | 51 +++++++++++++++++++++++++++ models/techpack_stairway_slope.obj | 56 ++++++++++++++++++++++++++++++ readme.md | 1 + 3 files changed, 108 insertions(+) create mode 100644 models/techpack_stairway_slope.obj diff --git a/init.lua b/init.lua index 79cce5c..405779c 100644 --- a/init.lua +++ b/init.lua @@ -503,6 +503,53 @@ minetest.register_node("techpack_stairway:lattice", { sounds = default.node_sound_metal_defaults(), }) +minetest.register_node("techpack_stairway:lattice_slop", { + description = "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}, + }, + }, + + 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, + + 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", @@ -558,6 +605,10 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "techpack_stairway:lattice_slop 2", + recipe = {{"techpack_stairway:lattice"}}, +}) minetest.register_craft({ output = "techpack_stairway:handrail2", diff --git a/models/techpack_stairway_slope.obj b/models/techpack_stairway_slope.obj new file mode 100644 index 0000000..f96e575 --- /dev/null +++ b/models/techpack_stairway_slope.obj @@ -0,0 +1,56 @@ +g top +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 +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.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 +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.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 +vn -1.0000 0.0000 0.0000 +s off +f 9/9/3 11/10/3 10/11/3 +g left +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 +vn 1.0000 0.0000 0.0000 +s off +f 12/12/4 13/13/4 14/14/4 +g back +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 +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 diff --git a/readme.md b/readme.md index 7000048..e56f817 100644 --- a/readme.md +++ b/readme.md @@ -17,3 +17,4 @@ none ### History - 2018-12-29 v0.01 * first draft - 2020-04-26 v1.00 * extracted from TechPack and released +- 2020-10-08 v1.01 * Lattice Slope node added