1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2025-01-07 15:30:17 +01:00

improve octagon glass pane slope / refactor node- and selectionbox code

This commit is contained in:
BuckarooBanzay 2025-01-04 19:50:33 +01:00
parent 36b0c5cc05
commit 62037ad60a
5 changed files with 61 additions and 35 deletions

View File

@ -19,7 +19,7 @@ function scifi_nodes.get_switch_rules(param2)
return rules
end
scifi_nodes.slope_selection_box = {
scifi_nodes.slope_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
@ -29,12 +29,12 @@ scifi_nodes.slope_selection_box = {
}
}
scifi_nodes.slope_collision_box = {
scifi_nodes.slope_box_simple = {
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.5, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.25, -0.25, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.25, 0.25},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
}
}

View File

@ -16,8 +16,8 @@ function scifi_nodes.register_slope(name, desc, texture, light, soundtype)
drawtype = "mesh",
mesh = "scifi_nodes_slope.obj",
tiles = texture,
selection_box = scifi_nodes.slope_selection_box,
collision_box = scifi_nodes.slope_collision_box,
selection_box = scifi_nodes.slope_box,
collision_box = scifi_nodes.slope_box,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",

View File

@ -0,0 +1,12 @@
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

View File

@ -19,26 +19,6 @@ local function register_glass(key, name)
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")

View File

@ -1,13 +1,15 @@
local function register(basename, description, texture)
local function register(basename, color, texture)
local nodename_single = "scifi_nodes:" .. basename .. "_pane"
local nodename_double = "scifi_nodes:" .. basename .. "_pane_double"
local nodename_offset = "scifi_nodes:" .. basename .. "_pane_offset"
local nodename_slope = "scifi_nodes:" .. basename .. "_slope"
local recipe_ingredient = "scifi_nodes:" .. basename
local base_decription = color .. " octagon glass"
-- single height
minetest.register_node(nodename_single, {
description = description,
description = base_decription .. " pane",
drawtype = "nodebox",
tiles = {
texture
@ -35,7 +37,7 @@ local function register(basename, description, texture)
-- double height
minetest.register_node(nodename_double, {
description = description,
description = base_decription .. " pane (double)",
drawtype = "nodebox",
tiles = {
texture
@ -63,7 +65,7 @@ local function register(basename, description, texture)
-- single height with offset
minetest.register_node(nodename_offset, {
description = description,
description = base_decription .. " pane (offset)",
drawtype = "nodebox",
tiles = {
texture
@ -90,6 +92,28 @@ local function register(basename, description, texture)
sounds = scifi_nodes.node_sound_glass_defaults()
})
-- slope pane
minetest.register_node(nodename_slope, {
description = base_decription .. " pane (slope)",
sunlight_propagates = true,
drawtype = "mesh",
mesh = "scifi_nodes_slope_simple.obj",
tiles = {
texture
},
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "blend",
light_source = 10,
groups = {
cracky = 2,
dig_generic = 3
},
selection_box = scifi_nodes.slope_box_simple,
collision_box = scifi_nodes.slope_box_simple,
is_ground_content = false,
sounds = scifi_nodes.node_sound_glass_defaults()
})
-- register recipes
minetest.register_craft({
@ -99,6 +123,15 @@ local function register(basename, description, texture)
},
})
minetest.register_craft({
output = nodename_slope .. " 16",
recipe = {
{"", "", recipe_ingredient},
{"", recipe_ingredient, ""},
{recipe_ingredient, "", ""}
},
})
minetest.register_craft({
output = nodename_double .. " 16",
recipe = {
@ -114,8 +147,9 @@ local function register(basename, description, texture)
})
end
register("octrng", "Orange Octagon Glass pane", "scifi_nodes_octrng.png")
register("octgrn", "Green Octagon Glass pane", "scifi_nodes_octgrn.png")
register("octbl", "Blue Octagon Glass pane", "scifi_nodes_octbl.png")
register("octppl", "Purple Octagon Glass pane", "scifi_nodes_octppl.png")
register("octrng", "Orange", "scifi_nodes_octrng.png")
register("octgrn", "Green", "scifi_nodes_octgrn.png")
register("octbl", "Blue", "scifi_nodes_octbl.png")
register("octppl", "Purple", "scifi_nodes_octppl.png")
register("octwht", "White", "scifi_nodes_octwht.png")
register("glass", "Dark Glass pane", "scifi_nodes_glass.png")