diff --git a/common.lua b/common.lua index 7eaa95a..9ea769a 100644 --- a/common.lua +++ b/common.lua @@ -18,3 +18,23 @@ function scifi_nodes.get_switch_rules(param2) end return rules end + +scifi_nodes.slope_selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} + } +} + +scifi_nodes.slope_collision_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} + } +} diff --git a/init.lua b/init.lua index f9f0696..d664994 100644 --- a/init.lua +++ b/init.lua @@ -30,6 +30,7 @@ dofile(MP.."/nodeboxes.lua") dofile(MP.."/palm_scanner.lua") dofile(MP.."/digicode.lua") dofile(MP.."/octagon_panes.lua") +dofile(MP.."/octagon_glass.lua") dofile(MP.."/forcefield.lua") dofile(MP.."/crafts.lua") diff --git a/models.lua b/models.lua index 98a4049..54e68dd 100644 --- a/models.lua +++ b/models.lua @@ -16,24 +16,8 @@ function scifi_nodes.register_slope(name, desc, texture, light, soundtype) drawtype = "mesh", mesh = "scifi_nodes_slope.obj", tiles = texture, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.25, 0.5}, - {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} - } - }, - collision_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.25, 0.5}, - {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} - } - }, + selection_box = scifi_nodes.slope_selection_box, + collision_box = scifi_nodes.slope_collision_box, paramtype = "light", paramtype2 = "facedir", use_texture_alpha = "clip", diff --git a/nodes.lua b/nodes.lua index 299f305..38dfe9a 100644 --- a/nodes.lua +++ b/nodes.lua @@ -369,95 +369,6 @@ minetest.register_node("scifi_nodes:grnpipe2", { on_place = minetest.rotate_node }) -minetest.register_node("scifi_nodes:octrng", { - description = "Orange Octagon Glass", - sunlight_propagates = true, - drawtype = "glasslike", - tiles = { - "scifi_nodes_octrng.png", - }, - paramtype = "light", - paramtype2 = "facedir", - use_texture_alpha = "blend", - light_source = 10, - groups = {cracky=2, dig_generic = 3}, - is_ground_content = false, - sounds = scifi_nodes.node_sound_glass_defaults(), -}) - -minetest.register_node("scifi_nodes:octgrn", { - description = "Green Octagon Glass", - sunlight_propagates = true, - drawtype = "glasslike", - tiles = { - "scifi_nodes_octgrn.png", - }, - paramtype = "light", - paramtype2 = "facedir", - use_texture_alpha = "blend", - light_source = 10, - groups = {cracky=2, dig_generic = 3}, - is_ground_content = false, - sounds = scifi_nodes.node_sound_glass_defaults(), -}) - -minetest.register_node("scifi_nodes:octbl", { - description = "Blue Octagon Glass", - sunlight_propagates = true, - drawtype = "glasslike", - tiles = { - "scifi_nodes_octbl.png", - }, - paramtype = "light", - paramtype2 = "facedir", - use_texture_alpha = "blend", - light_source = 10, - groups = {cracky=2, dig_generic = 3}, - is_ground_content = false, - sounds = scifi_nodes.node_sound_glass_defaults(), -}) - -minetest.register_node("scifi_nodes:octppl", { - description = "Purple Octagon Glass", - sunlight_propagates = true, - drawtype = "glasslike", - tiles = { - "scifi_nodes_octppl.png", - }, - paramtype = "light", - paramtype2 = "facedir", - use_texture_alpha = "blend", - light_source = 10, - groups = {cracky=2, dig_generic = 3}, - is_ground_content = false, - sounds = scifi_nodes.node_sound_glass_defaults(), -}) - -if has_unifieddyes_mod then - minetest.register_node("scifi_nodes:octwht", { - description = "Octagon Glass", - sunlight_propagates = true, - drawtype = "glasslike", - tiles = { - "scifi_nodes_octwht.png", - }, - palette = "unifieddyes_palette_extended.png", - paramtype = "light", - paramtype2 = "color", - use_texture_alpha = "blend", - light_source = 10, - groups = { - cracky = 2, - dig_generic = 3, - ud_param2_colorable = 1 - }, - is_ground_content = false, - sounds = scifi_nodes.node_sound_glass_defaults(), - on_construct = unifieddyes.on_construct, - on_dig = unifieddyes.on_dig - }) -end - minetest.register_node("scifi_nodes:tower", { description = "Wind tower", sunlight_propagates = false, diff --git a/octagon_glass.lua b/octagon_glass.lua new file mode 100644 index 0000000..a9ced5f --- /dev/null +++ b/octagon_glass.lua @@ -0,0 +1,73 @@ +local has_unifieddyes_mod = minetest.get_modpath("unifieddyes") + +local function register_glass(key, name) + local tiles = {"scifi_nodes_" .. key .. ".png"} + + minetest.register_node("scifi_nodes:" .. key, { + description = name .. " Octagon Glass", + sunlight_propagates = true, + drawtype = "glasslike", + tiles = tiles, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "blend", + light_source = 10, + groups = { + cracky = 2, + dig_generic = 3 + }, + is_ground_content = false, + sounds = scifi_nodes.node_sound_glass_defaults(), + }) + + minetest.register_node("scifi_nodes:" .. key .. "_slope", { + description = "Octagon Glass slope", + sunlight_propagates = true, + drawtype = "mesh", + mesh = "scifi_nodes_slope.obj", + tiles = tiles, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "blend", + light_source = 10, + groups = { + cracky = 2, + dig_generic = 3 + }, + selection_box = scifi_nodes.slope_selection_box, + collision_box = scifi_nodes.slope_collision_box, + is_ground_content = false, + sounds = scifi_nodes.node_sound_glass_defaults() + }) +end + +register_glass("octppl", "Purple") +register_glass("octbl", "Blue") +register_glass("octgrn", "Green") +register_glass("octrng", "Orange") +register_glass("octwht", "White") + +if has_unifieddyes_mod then + minetest.register_node("scifi_nodes:octwht", { + description = "Octagon Glass", + sunlight_propagates = true, + drawtype = "glasslike", + tiles = { + "scifi_nodes_octwht.png", + }, + palette = "unifieddyes_palette_extended.png", + paramtype = "light", + paramtype2 = "color", + use_texture_alpha = "blend", + light_source = 10, + groups = { + cracky = 2, + dig_generic = 3, + ud_param2_colorable = 1 + }, + is_ground_content = false, + sounds = scifi_nodes.node_sound_glass_defaults(), + on_construct = unifieddyes.on_construct, + on_dig = unifieddyes.on_dig + }) +end \ No newline at end of file