aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOch Noe <och_noe@forksworld.de>2020-02-16 22:37:43 +0100
committerOch Noe <och_noe@forksworld.de>2020-02-16 22:37:43 +0100
commit51509e9f0a476727c74d814c67d63fb621a45a2e (patch)
tree42feb08ddc74c9495cb1b647adafd5c5ab3d4ea6
parent04bdfe3804d99fa6a3564036692419529724b5a9 (diff)
downloadmoreblocks-51509e9f0a476727c74d814c67d63fb621a45a2e.tar.gz
moreblocks-51509e9f0a476727c74d814c67d63fb621a45a2e.tar.bz2
moreblocks-51509e9f0a476727c74d814c67d63fb621a45a2e.zip
minimap_shapes are now working
-rw-r--r--nodes.lua169
1 files changed, 141 insertions, 28 deletions
diff --git a/nodes.lua b/nodes.lua
index a83496b..a10a2e1 100644
--- a/nodes.lua
+++ b/nodes.lua
@@ -2,7 +2,7 @@
More Blocks: node definitions
Copyright (c) 2011-2017 Hugo Locurcio and contributors.
- 2018,2019 Och_Noe
+ 2018-2020 Och_Noe
Licensed under the zlib license. See LICENSE.md for more information.
--]]
@@ -85,6 +85,102 @@ local box_slope_third_top = {
}
}
+local minimal_slopes_defs = {
+ [""] = {
+ mesh = "moreblocks_slope.obj",
+ collision_box = box_slope,
+ selection_box = box_slope,
+
+ },
+ ["_half"] = {
+ mesh = "moreblocks_slope_half.obj",
+ collision_box = box_slope_half,
+ selection_box = box_slope_half,
+ },
+ ["_half_raised"] = {
+ mesh = "moreblocks_slope_half_raised.obj",
+ collision_box = box_slope_half_raised,
+ selection_box = box_slope_half_raised,
+ },
+
+ }
+
+local function register_minimal_shapes(modname, subname, recipeitem, fields)
+ local defs = minimal_slopes_defs
+ local desc = S("%s Slope"):format(fields.description)
+ for alternate, def in pairs(defs) do
+ for k, v in pairs(fields) do
+ def[k] = v
+ end
+ def.drawtype = "mesh"
+ def.paramtype = "light"
+ def.paramtype2 = def.paramtype2 or "facedir"
+ def.on_place = minetest.rotate_node
+ def.description = desc
+ def.use_texture_alpha = fields.use_texture_alpha
+ def.groups = stairsplus:prepare_groups(fields.groups)
+ if fields.drop and not (type(fields.drop) == "table") then
+ def.drop = modname.. ":slope_" ..fields.drop..alternate
+ end
+ minetest.register_node(":" ..modname.. ":slope_" ..subname..alternate, def)
+ end
+
+
+ minetest.register_craft({
+ recipe = {
+ { "","","" },
+ { "","",recipeitem, },
+ { "", recipeitem, recipeitem },
+ },
+ output = modname .. ":slope_" .. subname
+ })
+
+ minetest.register_craft({
+ recipe = {
+ { "","","" },
+ { "","","", },
+ { "", recipeitem, recipeitem },
+ },
+ output = modname .. ":slope_" .. subname .. "_half 12"
+ })
+
+ minetest.register_craft({
+ recipe = {
+ { "","",recipeitem, },
+ { "","","" },
+ { "", recipeitem, recipeitem },
+ },
+ output = modname .. ":slope_" .. subname .. "_half_raised 4"
+ })
+
+
+ minetest.register_craft({
+ type = "shapeless",
+ output = recipeitem,
+ recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname},
+ })
+
+ minetest.register_craft({
+ type = "shapeless",
+ output = recipeitem,
+ recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"},
+ })
+
+
+
+
+
+ -- 100% slope 1 node
+
+
+ -- 50% slope 2 nodes
+
+
+ -- 50% slab 1 node
+
+
+end
+
local nodes = {
["wood_tile"] = {
@@ -608,6 +704,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -621,6 +718,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -634,6 +732,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -647,6 +746,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -660,6 +760,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -673,6 +774,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -686,6 +788,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -699,6 +802,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -712,6 +816,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -725,6 +830,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -738,6 +844,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -751,6 +858,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -764,6 +872,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -777,6 +886,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -790,6 +900,7 @@ local nodes = {
use_texture_alpha = true,
paramtype = "light",
no_stairs = true,
+ minimal_shapes = true,
sunlight_propagates = true,
groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3},
sounds = sound_glass,
@@ -943,22 +1054,36 @@ for name, def in pairs(nodes) do
def.tiles = def.tiles or {"moreblocks_" ..name.. ".png"}
minetest.register_node("moreblocks:" ..name, def)
minetest.register_alias(name, "moreblocks:" ..name)
+ local groups = {}
+ local temp_tiles = def.tiles
+ if def.one_texture then
+ temp_tiles = { def.tiles[1]}
+ end
+ for k, v in pairs(def.groups) do groups[k] = v end
if not def.no_stairs then
- local groups = {}
- temp_tiles = def.tiles
- if def.one_texture then
- temp_tiles = { def.tiles[1]}
- end
- for k, v in pairs(def.groups) do groups[k] = v end
- stairsplus:register_all("moreblocks", name, "moreblocks:" ..name, {
- description = def.description,
- groups = groups,
- tiles = temp_tiles,
- sunlight_propagates = def.sunlight_propagates,
- light_source = def.light_source,
- sounds = def.sounds,
- use_texture_alpha = def.use_texture_alpha
- })
+ stairsplus:register_all("moreblocks", name, "moreblocks:" ..name, {
+ description = def.description,
+ groups = groups,
+ tiles = temp_tiles,
+ sunlight_propagates = def.sunlight_propagates,
+ light_source = def.light_source,
+ sounds = def.sounds,
+ use_texture_alpha = def.use_texture_alpha
+ })
+ else
+ if def.train_slopes then
+ end
+ if def.minimal_shapes then
+ register_minimal_shapes("moreblocks", name, "moreblocks:" ..name, {
+ description = def.description,
+ groups = groups,
+ tiles = temp_tiles,
+ sunlight_propagates = def.sunlight_propagates,
+ light_source = def.light_source,
+ sounds = def.sounds,
+ use_texture_alpha = def.use_texture_alpha
+ })
+ end
end
end
@@ -976,15 +1101,3 @@ minetest.register_craftitem("moreblocks:nothing", {
})
-
-
-
-
-
-
-
-
-
-
-
-