diff options
author | Singularis <singularis@volny.cz> | 2024-11-15 21:29:20 +0100 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2025-05-27 20:22:01 +0200 |
commit | d9d470e8093be4d1a944b6572dc2646899c0b46b (patch) | |
tree | e3f0890a7e631e1b14641b1962ecb653e0ccc979 /advtrains | |
parent | 0d2051adcdd93368cc719e9dee2f7e02f6f2bad5 (diff) | |
download | advtrains-d9d470e8093be4d1a944b6572dc2646899c0b46b.tar.gz advtrains-d9d470e8093be4d1a944b6572dc2646899c0b46b.tar.bz2 advtrains-d9d470e8093be4d1a944b6572dc2646899c0b46b.zip |
[advtrains,ch_core/shapes_db] registrace nástupišť plně podřízena shapes_db
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/misc_nodes.lua | 242 |
1 files changed, 133 insertions, 109 deletions
diff --git a/advtrains/misc_nodes.lua b/advtrains/misc_nodes.lua index 0750d1d..60e304f 100644 --- a/advtrains/misc_nodes.lua +++ b/advtrains/misc_nodes.lua @@ -1,5 +1,30 @@ --all nodes that do not fit in any other category +local diagonalbox = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.5, -0.25, 0.5, -0.8 }, + {-0.25, -0.5, 0.5 , 0, 0.5, -0.55}, + {0, -0.5, 0.5 , 0.25, 0.5, -0.3 }, + {0.25 , -0.5, 0.5, 0.5, 0.5, -0.05} + } +} + +local diagonalbox_low = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.5, -0.25, 0, -0.8 }, + {-0.25, -0.5, 0.5 , 0, 0, -0.55}, + {0, -0.5, 0.5 , 0.25, 0, -0.3 }, + {0.25 , -0.5, 0.5, 0.5, 0, -0.05} + } +} + +local nodename_override = { + ["darkage:marble"] = "darkage_marble", + ["technic:marble"] = "technic_marble", +} + function advtrains.register_platform(modprefix, preset, use_full_nodename) local ndef=minetest.registered_nodes[preset] if not ndef then @@ -17,125 +42,122 @@ function advtrains.register_platform(modprefix, preset, use_full_nodename) end end local desc=ndef.description or "" - local nodename + local nodename = nodename_override[preset] - if use_full_nodename then - local a, b = string.match(":"..preset, ":(.+):(.+)$") - nodename = a.."_"..b - -- minetest.log("warning", "DEBUG: generated name '"..nodename.."'") - else - nodename =string.match(preset, ":(.+)$") + if nodename == nil then + nodename = string.match(preset, ":(.+)$") end -- minetest.log("action", "DEBUG: will register platforms for "..preset.." using nodename = ("..nodename..")") - minetest.register_node(modprefix .. ":platform_low_"..nodename, { - description = attrans("@1 Platform (low)", desc), - tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex}, - groups = {cracky = 1, not_blocking_trains = 1, platform=1}, - sounds = ndef.sounds, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.1, -0.1, 0.5, 0 , 0.5}, - {-0.5, -0.5, 0 , 0.5, -0.1, 0.5} + + if ch_core.is_shape_allowed(preset, "advtrains", "platform_low") then + minetest.register_node(modprefix .. ":platform_low_"..nodename, { + description = attrans("@1 Platform (low)", desc), + tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex}, + groups = {cracky = 1, not_blocking_trains = 1, platform=1}, + sounds = ndef.sounds, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.1, -0.1, 0.5, 0 , 0.5}, + {-0.5, -0.5, 0 , 0.5, -0.1, 0.5} + }, }, - }, - paramtype2="facedir", - paramtype = "light", - sunlight_propagates = true, - }) - minetest.register_node(modprefix .. ":platform_high_"..nodename, { - description = attrans("@1 Platform (high)", desc), - tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex}, - groups = {cracky = 1, not_blocking_trains = 1, platform=2}, - sounds = ndef.sounds, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.5, 0.3, 0, 0.5, 0.5, 0.5}, - {-0.5, -0.5, 0.1 , 0.5, 0.3, 0.5} + paramtype2="facedir", + paramtype = "light", + sunlight_propagates = true, + }) + minetest.register_craft({ + type="shapeless", + output = modprefix .. ":platform_low_"..nodename.." 4", + recipe = { + "dye:yellow", preset }, - }, - paramtype2="facedir", - paramtype = "light", - sunlight_propagates = true, - }) - local diagonalbox = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.5, -0.25, 0.5, -0.8 }, - {-0.25, -0.5, 0.5 , 0, 0.5, -0.55}, - {0, -0.5, 0.5 , 0.25, 0.5, -0.3 }, - {0.25 , -0.5, 0.5, 0.5, 0.5, -0.05} - } - } - minetest.register_node(modprefix..":platform_45_"..nodename, { - description = attrans("@1 Platform (45 degree)", desc), - groups = {cracky = 1, not_blocking_trains = 1, platform=2}, - sounds = ndef.sounds, - drawtype = "mesh", - mesh = "advtrains_platform_diag.b3d", - selection_box = diagonalbox, - collision_box = diagonalbox, - tiles = {btex, btex.."^advtrains_platform_diag.png"}, - paramtype2 = "facedir", - paramtype = "light", - sunlight_propagates = true, - }) - local diagonalbox_low = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.5, -0.25, 0, -0.8 }, - {-0.25, -0.5, 0.5 , 0, 0, -0.55}, - {0, -0.5, 0.5 , 0.25, 0, -0.3 }, - {0.25 , -0.5, 0.5, 0.5, 0, -0.05} + }) + end + + if ch_core.is_shape_allowed(preset, "advtrains", "platform_high") then + minetest.register_node(modprefix .. ":platform_high_"..nodename, { + description = attrans("@1 Platform (high)", desc), + tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex}, + groups = {cracky = 1, not_blocking_trains = 1, platform=2}, + sounds = ndef.sounds, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, 0.3, 0, 0.5, 0.5, 0.5}, + {-0.5, -0.5, 0.1 , 0.5, 0.3, 0.5} + }, + }, + paramtype2="facedir", + paramtype = "light", + sunlight_propagates = true, + }) + minetest.register_craft({ + type="shapeless", + output = modprefix .. ":platform_high_"..nodename.." 4", + recipe = { + "dye:yellow", preset, preset + }, + }) + end + + if ch_core.is_shape_allowed(preset, "advtrains", "platform_45_high") then + minetest.register_node(modprefix..":platform_45_"..nodename, { + description = attrans("@1 Platform (45 degree)", desc), + groups = {cracky = 1, not_blocking_trains = 1, platform=2}, + sounds = ndef.sounds, + drawtype = "mesh", + mesh = "advtrains_platform_diag.b3d", + selection_box = diagonalbox, + collision_box = diagonalbox, + tiles = {btex, btex.."^advtrains_platform_diag.png"}, + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + }) + minetest.register_craft({ + type="shapeless", + output = modprefix .. ":platform_45_"..nodename.." 2", + recipe = { + "dye:yellow", preset, preset, preset } - } - minetest.register_node(modprefix..":platform_45_low_"..nodename, { - description = attrans("@1 Platform (low, 45 degree)", desc), - groups = {cracky = 1, not_blocking_trains = 1, platform=2}, - sounds = ndef.sounds, - drawtype = "mesh", - mesh = "advtrains_platform_diag_low.b3d", - selection_box = diagonalbox_low, - collision_box = diagonalbox_low, - tiles = {btex, btex.."^advtrains_platform_diag.png"}, - paramtype2 = "facedir", - paramtype = "light", - sunlight_propagates = true, - }) - minetest.register_craft({ - type="shapeless", - output = modprefix .. ":platform_high_"..nodename.." 4", - recipe = { - "dye:yellow", preset, preset - }, - }) - minetest.register_craft({ - type="shapeless", - output = modprefix .. ":platform_low_"..nodename.." 4", - recipe = { - "dye:yellow", preset - }, - }) - minetest.register_craft({ - type="shapeless", - output = modprefix .. ":platform_45_"..nodename.." 2", - recipe = { - "dye:yellow", preset, preset, preset - } - }) - minetest.register_craft({ - type="shapeless", - output = modprefix .. ":platform_45_low_"..nodename.." 2", - recipe = { modprefix .. ":platform_45_"..nodename }, - }) + }) + end + + if ch_core.is_shape_allowed(preset, "advtrains", "platform_45_low") then + minetest.register_node(modprefix..":platform_45_low_"..nodename, { + description = attrans("@1 Platform (low, 45 degree)", desc), + groups = {cracky = 1, not_blocking_trains = 1, platform=2}, + sounds = ndef.sounds, + drawtype = "mesh", + mesh = "advtrains_platform_diag_low.b3d", + selection_box = diagonalbox_low, + collision_box = diagonalbox_low, + tiles = {btex, btex.."^advtrains_platform_diag.png"}, + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + }) + minetest.register_craft({ + type="shapeless", + output = modprefix .. ":platform_45_low_"..nodename.." 2", + recipe = { modprefix .. ":platform_45_"..nodename }, + }) + end +end + +for _, material in ipairs(ch_core.get_materials_from_shapes_db("advtrains")) do + if minetest.registered_nodes[material] then + advtrains.register_platform("advtrains", material) + end end -advtrains.register_platform("advtrains", "default:stonebrick") +-- advtrains.register_platform("advtrains", "default:stonebrick") -- advtrains.register_platform("advtrains", "default:sandstonebrick") +--[[ local platform_materials = { "basic_materials:cement_block", "basic_materials:concrete_block", @@ -163,6 +185,7 @@ local platform_materials = { "default:pine_wood", "default:steelblock", "default:stone", + "default:stonebrick", "default:stone_block", "default:wood", "moretrees:cedar_planks", @@ -201,3 +224,4 @@ for _, name in ipairs(platform_materials) do minetest.log("warning", nodename.." not find as a node to build a platform") end end +]] |