mirror of
				https://github.com/minetest-mods/moreblocks.git
				synced 2025-11-03 23:25:24 +01:00 
			
		
		
		
	checkpoint. stairsplus is done, excluding the circular saw, and testing
This commit is contained in:
		@@ -16,6 +16,7 @@ stds.minetest = {
 | 
				
			|||||||
		"ItemStack",
 | 
							"ItemStack",
 | 
				
			||||||
		"default",
 | 
							"default",
 | 
				
			||||||
		"table",
 | 
							"table",
 | 
				
			||||||
 | 
							"math",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
# API documentation for Stairs+
 | 
					# API documentation for Stairs+
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# legacy API
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `stairsplus:register_all(modname, subname, recipeitem, fields)`
 | 
					* `stairsplus:register_all(modname, subname, recipeitem, fields)`
 | 
				
			||||||
  Registers a stair, slab, panel, microblock, and any other types of
 | 
					  Registers a stair, slab, panel, microblock, and any other types of
 | 
				
			||||||
  nodes to be added in the future.
 | 
					  nodes to be added in the future.
 | 
				
			||||||
@@ -14,71 +16,4 @@
 | 
				
			|||||||
  })
 | 
					  })
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following register only a particular type of microblock.
 | 
					need to also support legacy aliasing
 | 
				
			||||||
You will probably never want to use them directly:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* `stairsplus:register_stair(modname, subname, recipeitem, fields)`
 | 
					 | 
				
			||||||
* `stairsplus:register_slab(modname, subname, recipeitem, fields)`
 | 
					 | 
				
			||||||
* `stairsplus:register_panel(modname, subname, recipeitem, fields)`
 | 
					 | 
				
			||||||
* `stairsplus:register_micro(modname, subname, recipeitem, fields)`
 | 
					 | 
				
			||||||
* `stairsplus:register_slope(modname, subname, recipeitem, fields)`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you only want to register a subset of stairsplus nodes,
 | 
					 | 
				
			||||||
you can use the `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)` function.
 | 
					 | 
				
			||||||
The subset table should have the following format:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```lua
 | 
					 | 
				
			||||||
    local subset = {
 | 
					 | 
				
			||||||
    	{ "micro", "" },
 | 
					 | 
				
			||||||
    	{ "micro", "_1" },
 | 
					 | 
				
			||||||
    	{ "micro", "_2" },
 | 
					 | 
				
			||||||
    	{ "micro", "_4" },
 | 
					 | 
				
			||||||
    	{ "micro", "_12" },
 | 
					 | 
				
			||||||
    	{ "micro", "_14" },
 | 
					 | 
				
			||||||
    	{ "micro", "_15" },
 | 
					 | 
				
			||||||
    	{ "panel", "" },
 | 
					 | 
				
			||||||
    	{ "panel", "_1" },
 | 
					 | 
				
			||||||
    	{ "panel", "_2" },
 | 
					 | 
				
			||||||
    	{ "panel", "_4" },
 | 
					 | 
				
			||||||
    	{ "panel", "_12" },
 | 
					 | 
				
			||||||
    	{ "panel", "_14" },
 | 
					 | 
				
			||||||
    	{ "panel", "_15" },
 | 
					 | 
				
			||||||
    	{ "slab",  "" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_quarter" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_three_quarter" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_1" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_2" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_14" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_15" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_two_sides" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_three_sides" },
 | 
					 | 
				
			||||||
    	{ "slab",  "_three_sides_u" },
 | 
					 | 
				
			||||||
    	{ "slope", "" },
 | 
					 | 
				
			||||||
    	{ "slope", "_half" },
 | 
					 | 
				
			||||||
    	{ "slope", "_half_raised" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner_half" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner_half_raised" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner_cut" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner_cut_half" },
 | 
					 | 
				
			||||||
    	{ "slope", "_inner_cut_half_raised" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer_half" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer_half_raised" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer_cut" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer_cut_half" },
 | 
					 | 
				
			||||||
    	{ "slope", "_outer_cut_half_raised" },
 | 
					 | 
				
			||||||
    	{ "slope", "_cut" },
 | 
					 | 
				
			||||||
    	{ "stair", "" },
 | 
					 | 
				
			||||||
    	{ "stair", "_half" },
 | 
					 | 
				
			||||||
    	{ "stair", "_right_half" },
 | 
					 | 
				
			||||||
    	{ "stair", "_inner" },
 | 
					 | 
				
			||||||
    	{ "stair", "_outer" },
 | 
					 | 
				
			||||||
    	{ "stair", "_alt" },
 | 
					 | 
				
			||||||
    	{ "stair", "_alt_1" },
 | 
					 | 
				
			||||||
    	{ "stair", "_alt_2" },
 | 
					 | 
				
			||||||
    	{ "stair", "_alt_4" },
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can remove entries as needed.
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,4 @@
 | 
				
			|||||||
minetest.register_alias("circular_saw", "stairsplus:circular_saw")
 | 
					minetest.register_alias("circular_saw", "stairsplus:circular_saw")
 | 
				
			||||||
minetest.register_alias("moreblocks:circular_saw", "stairsplus:circular_saw")
 | 
					minetest.register_alias("moreblocks:circular_saw", "stairsplus:circular_saw")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for _, t in pairs(stairsplus.circular_saw.names) do
 | 
					
 | 
				
			||||||
	minetest.register_alias("moreblocks:" .. t[1] .. "_jungle_wood" .. t[2],
 | 
					 | 
				
			||||||
		"stairsplus:" .. t[1] .. "_junglewood" .. t[2])
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								stairsplus/api/alias.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								stairsplus/api/alias.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_alias_all(old_node, new_node)
 | 
				
			||||||
 | 
						local old_mod, old_name = old_node:match("^([^:]+:(.*)$")
 | 
				
			||||||
 | 
						local new_mod, new_name = new_node:match("^([^:]+:(.*)$")
 | 
				
			||||||
 | 
						for _, shape_def in pairs(stairsplus.api.registered_shapes) do
 | 
				
			||||||
 | 
							minetest.register_alias(
 | 
				
			||||||
 | 
								("%s:%s"):format(old_mod, shape_def.name_format:format(old_name)),
 | 
				
			||||||
 | 
								("%s:%s"):format(new_mod, shape_def.name_format:format(new_name))
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_alias_force_all(old_node, new_node)
 | 
				
			||||||
 | 
						local old_mod, old_name = old_node:match("^([^:]+:(.*)$")
 | 
				
			||||||
 | 
						local new_mod, new_name = new_node:match("^([^:]+:(.*)$")
 | 
				
			||||||
 | 
						for _, shape_def in pairs(stairsplus.api.registered_shapes) do
 | 
				
			||||||
 | 
							minetest.register_alias_force(
 | 
				
			||||||
 | 
								("%s:%s"):format(old_mod, shape_def.name_format:format(old_name)),
 | 
				
			||||||
 | 
								("%s:%s"):format(new_mod, shape_def.name_format:format(new_name))
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -1 +1,100 @@
 | 
				
			|||||||
-- for registering variants of a specific node
 | 
					-- for registering variants of a specific node
 | 
				
			||||||
 | 
					--[[
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					]]
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local legacy_mode = stairsplus.settings.legacy_mode
 | 
				
			||||||
 | 
					local in_creative_inventory = stairsplus.settings.in_creative_inventory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local S = stairsplus.S
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function scale_light(light_source, shape_def)
 | 
				
			||||||
 | 
						if not light_source or light_source == 0 then
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
 | 
						elseif legacy_mode then
 | 
				
			||||||
 | 
							return light_source - 1
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_single(node, shape, overrides)
 | 
				
			||||||
 | 
						local mod, name = node:match("^([^:]+):(.*)$")
 | 
				
			||||||
 | 
						local node_def = table.copy(minetest.registered_nodes[node])
 | 
				
			||||||
 | 
						local shape_def = api.registered_shapes[shape]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						local groups = {
 | 
				
			||||||
 | 
							[shape] = 1,
 | 
				
			||||||
 | 
							not_in_creative_inventory = in_creative_inventory,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for group, value in pairs(node_def.groups) do
 | 
				
			||||||
 | 
							groups[shape_def.name_format:format(group)] = value
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						local def = {
 | 
				
			||||||
 | 
							description = S(shape_def.description, node_def.description or node),
 | 
				
			||||||
 | 
							drawtype = shape_def.drawtype,
 | 
				
			||||||
 | 
							mesh = shape_def.mesh,
 | 
				
			||||||
 | 
							node_box = shape_def.node_box,
 | 
				
			||||||
 | 
							collision_box = shape_def.collision_box,
 | 
				
			||||||
 | 
							selection_box = shape_def.selection_box,
 | 
				
			||||||
 | 
							groups = groups,
 | 
				
			||||||
 | 
							use_texture_alpha = node_def.use_texture_alpha,
 | 
				
			||||||
 | 
							paramtype = shape_def.paramtype or "light",
 | 
				
			||||||
 | 
							paramtype2 = shape_def.paramtype2 or "facedir",
 | 
				
			||||||
 | 
							light_source = scale_light(node_def.light_source, shape_def),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if node_def.short_description then
 | 
				
			||||||
 | 
							def.short_description = S(shape_def.description, node_def.short_description)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if def.use_texture_alpha == nil then
 | 
				
			||||||
 | 
							def.use_texture_alpha = node_def.use_texture_alpha
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if node_def.drop then
 | 
				
			||||||
 | 
							local item = api.get_shaped_name(node_def.drop, shape)
 | 
				
			||||||
 | 
							if item then
 | 
				
			||||||
 | 
								def.drop = item
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for k, v in pairs(overrides or {}) do
 | 
				
			||||||
 | 
							def[k] = v
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						minetest.register_node((":%s:%s"):format(mod, shape_def.name_format:format(name)), def)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if shape_def.aliases then
 | 
				
			||||||
 | 
							for _, alias in ipairs(shape_def.aliases) do
 | 
				
			||||||
 | 
								minetest.register_alias(
 | 
				
			||||||
 | 
									("%s:%s"):format(mod, alias:format(name)),
 | 
				
			||||||
 | 
									("%s:%s"):format(mod, shape_def.name_format:format(name))
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_all(node, overrides)
 | 
				
			||||||
 | 
						for shape in pairs(api.registered_shapes) do
 | 
				
			||||||
 | 
							api.register_single(node, shape, overrides)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						api.register_schema_crafts_for_node(node)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_custom(node, list, overrides)
 | 
				
			||||||
 | 
						for _, shape in ipairs(list) do
 | 
				
			||||||
 | 
							api.register_single(node, shape, overrides)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						api.register_schema_crafts_for_node(node)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_group(node, group, overrides)
 | 
				
			||||||
 | 
						for _, shape in ipairs(api.shapes_by_group[group] or {}) do
 | 
				
			||||||
 | 
							api.register_single(node, shape, overrides)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						api.register_schema_crafts_for_node(node)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,235 @@
 | 
				
			|||||||
-- for registering recipe schemas
 | 
					-- for registering recipe schemas
 | 
				
			||||||
-- should register schemas w/ unified_inventory and i3 and whatever else,
 | 
					-- should register schemas w/ unified_inventory and i3 and whatever else,
 | 
				
			||||||
-- and hide the recipes for the individual nodes (possibly a setting for such)
 | 
					-- and hide the recipes for the individual nodes (possibly a setting for such)
 | 
				
			||||||
 | 
					--[[
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.register_craft_schema({
 | 
				
			||||||
 | 
						output = "panel_8 6",
 | 
				
			||||||
 | 
						input = {{"node", "node", "node"}},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 7",
 | 
				
			||||||
 | 
						input = {"stair_inner"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.register_schema_crafts_for_node("default:coalblock")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.register_crafts_for_shapes({
 | 
				
			||||||
 | 
						type = "cooking",
 | 
				
			||||||
 | 
						output = "default:stone",
 | 
				
			||||||
 | 
						recipe = "default:cobblestone",
 | 
				
			||||||
 | 
						cooktime = function(eights) return 3 * eights / 8 end,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.register_crafts_for_shapes({
 | 
				
			||||||
 | 
						type = "fuel",
 | 
				
			||||||
 | 
						recipe = "default:coalblock",
 | 
				
			||||||
 | 
						burntime = function(eights) return 370 * eights / 8 end,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					]]
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					error("TODO: ugh, forgot to handle when output has > 1 item")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function is_valid_shape(item)
 | 
				
			||||||
 | 
						return api.registered_shapes[item]
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function is_normal_item(item)
 | 
				
			||||||
 | 
						return item == "" or item:match(":")
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function is_valid_item(item)
 | 
				
			||||||
 | 
						return is_valid_shape(item) or is_normal_item(item)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function verify_schema(schema)
 | 
				
			||||||
 | 
						local problems = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if not (schema.type == "shaped" or schema.type == "shapeless" or schema.type == nil) then
 | 
				
			||||||
 | 
							table.insert(problems, ("unimplemented schema type %q"):format(schema.type))
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if not is_valid_item(schema.output) then
 | 
				
			||||||
 | 
							table.insert(problems, ("don't know how to handle output %q"):format(schema.output))
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if schema.replacements then
 | 
				
			||||||
 | 
							for _, replacement in ipairs(schema.replacements) do
 | 
				
			||||||
 | 
								for _, item in ipairs(replacement) do
 | 
				
			||||||
 | 
									if not is_valid_item(schema.output) then
 | 
				
			||||||
 | 
										table.insert(problems, ("don't know how to handle replacement item %q"):format(item))
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if schema.type == "shapeless" then
 | 
				
			||||||
 | 
							for _, item in ipairs(schema.input) do
 | 
				
			||||||
 | 
								if not is_valid_item(schema.output) then
 | 
				
			||||||
 | 
									table.insert(problems, ("don't know how to handle craft item %q"):format(item))
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							for _, row in ipairs(schema.input) do
 | 
				
			||||||
 | 
								for _, item in ipairs(row) do
 | 
				
			||||||
 | 
									if not is_valid_item(schema.output) then
 | 
				
			||||||
 | 
										table.insert(problems, ("don't know how to handle craft item %q"):format(item))
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if #problems > 0 then
 | 
				
			||||||
 | 
							return table.concat(problems, ", ")
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					api.registered_recipe_schemas = {}
 | 
				
			||||||
 | 
					function api.register_craft_schema(schema)
 | 
				
			||||||
 | 
						local problems = verify_schema(schema)
 | 
				
			||||||
 | 
						if problems then
 | 
				
			||||||
 | 
							error(problems)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						table.insert(api.registered_recipe_schemas, schema)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function has_the_right_shape(item, shapes)
 | 
				
			||||||
 | 
						return shapes[item] or item == "" or item:match(":")
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function has_the_right_shapes(schema, shapes)
 | 
				
			||||||
 | 
						if not has_the_right_shape(schema.output, shapes) then
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if schema.replacements then
 | 
				
			||||||
 | 
							for _, replacement in ipairs(schema.replacements) do
 | 
				
			||||||
 | 
								for _, item in ipairs(replacement) do
 | 
				
			||||||
 | 
									if not has_the_right_shape(item, shapes) then
 | 
				
			||||||
 | 
										return false
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if schema.type == "shapeless" then
 | 
				
			||||||
 | 
							for _, item in ipairs(schema.input) do
 | 
				
			||||||
 | 
								if not has_the_right_shape(item, shapes) then
 | 
				
			||||||
 | 
									return false
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						elseif schema.type == "shaped" or schema.type == nil then
 | 
				
			||||||
 | 
							for _, row in ipairs(schema.input) do
 | 
				
			||||||
 | 
								for _, item in ipairs(row) do
 | 
				
			||||||
 | 
									if not has_the_right_shape(item, shapes) then
 | 
				
			||||||
 | 
										return false
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return true
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function register_for_schema(node, shapes, schema)
 | 
				
			||||||
 | 
						local recipe = table.copy(schema)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if shapes[recipe.output] then
 | 
				
			||||||
 | 
							recipe.output = api.get_shaped_name(node, recipe.output)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if recipe.replacements then
 | 
				
			||||||
 | 
							for _, replacement in ipairs(recipe.replacements) do
 | 
				
			||||||
 | 
								for i, item in ipairs(replacement) do
 | 
				
			||||||
 | 
									if shapes[item] then
 | 
				
			||||||
 | 
										replacement[i] = api.get_shaped_name(node, item)
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if recipe.type == "shapeless" then
 | 
				
			||||||
 | 
							for i, item in ipairs(recipe.input) do
 | 
				
			||||||
 | 
								if shapes[item] then
 | 
				
			||||||
 | 
									recipe.input[i] = api.get_shaped_name(node, item)
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						elseif recipe.type == "shaped" or recipe.type == nil then
 | 
				
			||||||
 | 
							for _, row in ipairs(schema.input) do
 | 
				
			||||||
 | 
								for i, item in ipairs(row) do
 | 
				
			||||||
 | 
									if shapes[item] then
 | 
				
			||||||
 | 
										row[i] = api.get_shaped_name(node, item)
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						minetest.register_craft(recipe)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_schema_crafts_for_node(node)
 | 
				
			||||||
 | 
						local shapes = api.get_shapes_hash(node)
 | 
				
			||||||
 | 
						for _, schema in ipairs(api.registered_recipe_schemas) do
 | 
				
			||||||
 | 
							if has_the_right_shapes(schema, shapes) then
 | 
				
			||||||
 | 
								register_for_schema(node, shapes, schema)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function shapes_match(a, b)
 | 
				
			||||||
 | 
						local a_shapes = api.get_shapes(a)
 | 
				
			||||||
 | 
						local b_shapes = api.get_shapes(b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if #a_shapes ~= #b_shapes then
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for i = 1, #a_shapes do
 | 
				
			||||||
 | 
							if a_shapes[i] ~= b_shapes[i] then
 | 
				
			||||||
 | 
								return false
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return true
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_crafts_for_shapes(def)
 | 
				
			||||||
 | 
						if def.type == "cooking" then
 | 
				
			||||||
 | 
							assert(
 | 
				
			||||||
 | 
								shapes_match(def.output, def.recipe),
 | 
				
			||||||
 | 
								("error: shapes of %s and %s do not match"):format(def.output, def.recipe)
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							local shapes = api.get_shapes(def.recipe)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, shape in ipairs(shapes) do
 | 
				
			||||||
 | 
								minetest.register_craft({
 | 
				
			||||||
 | 
									type = "cooking",
 | 
				
			||||||
 | 
									output = api.get_shaped_name(def.output, shape),
 | 
				
			||||||
 | 
									recipe = api.get_shaped_name(def.recipe, shape),
 | 
				
			||||||
 | 
									cooktime = def.cooktime(api.registered_shapes[shape].eigths),
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						elseif def.type == "fuel" then
 | 
				
			||||||
 | 
							local shapes = api.get_shapes(def.recipe)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for _, shape in ipairs(shapes) do
 | 
				
			||||||
 | 
								minetest.register_craft({
 | 
				
			||||||
 | 
									type = "fuel",
 | 
				
			||||||
 | 
									recipe = api.get_shaped_name(def.recipe, shape),
 | 
				
			||||||
 | 
									burntime = def.burntime(api.registered_shapes[shape].eigths),
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							error(("unsupported recipe type %s"):format(def.type))
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,2 +1,14 @@
 | 
				
			|||||||
-- register shapes (e.g. 1/16 slab, 1/8 slab, 1/4 slab, etc)
 | 
					-- register shapes (e.g. 1/16 slab, 1/8 slab, 1/4 slab, etc)
 | 
				
			||||||
-- register shape groups (e.g. slab, stair, etc.)
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.registered_shapes = {}
 | 
				
			||||||
 | 
					stairsplus.api.shapes_by_group = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function stairsplus.api.register_shape(name , def)
 | 
				
			||||||
 | 
						stairsplus.api.registered_shapes[name] = def
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for group in pairs(def.shape_groups or {}) do
 | 
				
			||||||
 | 
							local shapes = stairsplus.api.shapes_by_group[group] or {}
 | 
				
			||||||
 | 
							table.insert(shapes, name)
 | 
				
			||||||
 | 
							stairsplus.api.shapes_by_group[group] = shapes
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1,224 @@
 | 
				
			|||||||
-- for creating the circular saw and similar nodes
 | 
					-- for creating the circular saw and similar nodes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api.register_station(name, shape_groups, def)
 | 
				
			||||||
 | 
						minetest.register_node(name, def)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local F = minetest.formspec_escape
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local circular_saw = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- The amount of items offered per shape can be configured:
 | 
				
			||||||
 | 
					function circular_saw.on_receive_fields(pos, formname, fields, sender)
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local max = tonumber(fields.max_offered)
 | 
				
			||||||
 | 
						if max and max > 0 then
 | 
				
			||||||
 | 
							meta:set_string("max_offered", max)
 | 
				
			||||||
 | 
							-- Update to show the correct number of items:
 | 
				
			||||||
 | 
							circular_saw:update_inventory(pos, 0)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Moving the inventory of the circular_saw around is not allowed because it
 | 
				
			||||||
 | 
					-- is a fictional inventory. Moving inventory around would be rather
 | 
				
			||||||
 | 
					-- impractical and make things more difficult to calculate:
 | 
				
			||||||
 | 
					function circular_saw.allow_metadata_inventory_move(
 | 
				
			||||||
 | 
						pos, from_list, from_index, to_list, to_index, count, player)
 | 
				
			||||||
 | 
						return 0
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Only input- and recycle-slot are intended as input slots:
 | 
				
			||||||
 | 
					function circular_saw.allow_metadata_inventory_put(
 | 
				
			||||||
 | 
						pos, listname, index, stack, player)
 | 
				
			||||||
 | 
						-- The player is not allowed to put something in there:
 | 
				
			||||||
 | 
						if listname == "output" or listname == "micro" then
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						local stackname = stack:get_name()
 | 
				
			||||||
 | 
						local count = stack:get_count()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- Only allow those items that are offered in the output inventory to be recycled:
 | 
				
			||||||
 | 
						if listname == "recycle" then
 | 
				
			||||||
 | 
							if not inv:contains_item("output", stackname) then
 | 
				
			||||||
 | 
								return 0
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							local stackmax = stack:get_stack_max()
 | 
				
			||||||
 | 
							local instack = inv:get_stack("input", 1)
 | 
				
			||||||
 | 
							local microstack = inv:get_stack("micro", 1)
 | 
				
			||||||
 | 
							local incount = instack:get_count()
 | 
				
			||||||
 | 
							local incost = (incount * 8) + microstack:get_count()
 | 
				
			||||||
 | 
							local maxcost = (stackmax * 8) + 7
 | 
				
			||||||
 | 
							local cost = circular_saw:get_cost(inv, stackname)
 | 
				
			||||||
 | 
							if (incost + cost) > maxcost then
 | 
				
			||||||
 | 
								return math.max((maxcost - incost) / cost, 0)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							return count
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- Only accept certain blocks as input which are known to be craftable into stairs:
 | 
				
			||||||
 | 
						if listname == "input" then
 | 
				
			||||||
 | 
							if not inv:is_empty("input") then
 | 
				
			||||||
 | 
								if inv:get_stack("input", index):get_name() ~= stackname then
 | 
				
			||||||
 | 
									return 0
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							if not inv:is_empty("micro") then
 | 
				
			||||||
 | 
								local microstackname = inv:get_stack("micro", 1):get_name():gsub("^.+:micro_", "", 1)
 | 
				
			||||||
 | 
								local cutstackname = stackname:gsub("^.+:", "", 1)
 | 
				
			||||||
 | 
								if microstackname ~= cutstackname then
 | 
				
			||||||
 | 
									return 0
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							for name, t in pairs(circular_saw.known_nodes) do
 | 
				
			||||||
 | 
								if name == stackname and inv:room_for_item("input", stack) then
 | 
				
			||||||
 | 
									return count
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Taking is allowed from all slots (even the internal microblock slot).
 | 
				
			||||||
 | 
					-- Putting something in is slightly more complicated than taking anything
 | 
				
			||||||
 | 
					-- because we have to make sure it is of a suitable material:
 | 
				
			||||||
 | 
					function circular_saw.on_metadata_inventory_put(
 | 
				
			||||||
 | 
						pos, listname, index, stack, player)
 | 
				
			||||||
 | 
						-- We need to find out if the circular_saw is already set to a
 | 
				
			||||||
 | 
						-- specific material or not:
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						local stackname = stack:get_name()
 | 
				
			||||||
 | 
						local count = stack:get_count()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- Putting something into the input slot is only possible if that had
 | 
				
			||||||
 | 
						-- been empty before or did contain something of the same material:
 | 
				
			||||||
 | 
						if listname == "input" then
 | 
				
			||||||
 | 
							-- Each new block is worth 8 microblocks:
 | 
				
			||||||
 | 
							circular_saw:update_inventory(pos, 8 * count)
 | 
				
			||||||
 | 
						elseif listname == "recycle" then
 | 
				
			||||||
 | 
							-- Lets look which shape this represents:
 | 
				
			||||||
 | 
							local cost = circular_saw:get_cost(inv, stackname)
 | 
				
			||||||
 | 
							local input_stack = inv:get_stack("input", 1)
 | 
				
			||||||
 | 
							-- check if this would not exceed input itemstack max_stacks
 | 
				
			||||||
 | 
							if input_stack:get_count() + ((cost * count) / 8) <= input_stack:get_stack_max() then
 | 
				
			||||||
 | 
								circular_saw:update_inventory(pos, cost * count)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function circular_saw.allow_metadata_inventory_take(pos, listname, index, stack, player)
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						local input_stack = inv:get_stack(listname, index)
 | 
				
			||||||
 | 
						local player_inv = player:get_inventory()
 | 
				
			||||||
 | 
						if not player_inv:room_for_item("main", input_stack) then
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							return stack:get_count()
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function circular_saw.on_metadata_inventory_take(
 | 
				
			||||||
 | 
						pos, listname, index, stack, player)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- Prevent (inbuilt) swapping between inventories with different blocks
 | 
				
			||||||
 | 
						-- corrupting player inventory or Saw with 'unknown' items.
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						local input_stack = inv:get_stack(listname, index)
 | 
				
			||||||
 | 
						if not input_stack:is_empty() and input_stack:get_name() ~= stack:get_name() then
 | 
				
			||||||
 | 
							local player_inv = player:get_inventory()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							-- Prevent arbitrary item duplication.
 | 
				
			||||||
 | 
							inv:remove_item(listname, input_stack)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if player_inv:room_for_item("main", input_stack) then
 | 
				
			||||||
 | 
								player_inv:add_item("main", input_stack)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							circular_saw:reset(pos)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						-- If it is one of the offered stairs: find out how many
 | 
				
			||||||
 | 
						-- microblocks have to be subtracted:
 | 
				
			||||||
 | 
						if listname == "output" then
 | 
				
			||||||
 | 
							-- We do know how much each block at each position costs:
 | 
				
			||||||
 | 
							local cost = circular_saw.cost_in_microblocks[index]
 | 
				
			||||||
 | 
								* stack:get_count()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							circular_saw:update_inventory(pos, -cost)
 | 
				
			||||||
 | 
						elseif listname == "micro" then
 | 
				
			||||||
 | 
							-- Each microblock costs 1 microblock:
 | 
				
			||||||
 | 
							circular_saw:update_inventory(pos, -stack:get_count())
 | 
				
			||||||
 | 
						elseif listname == "input" then
 | 
				
			||||||
 | 
							-- Each normal (= full) block taken costs 8 microblocks:
 | 
				
			||||||
 | 
							circular_saw:update_inventory(pos, 8 * -stack:get_count())
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						-- The recycle field plays no role here since it is processed immediately.
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function circular_saw.on_construct(pos)
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local fancy_inv = ""
 | 
				
			||||||
 | 
						if has_default_mod then
 | 
				
			||||||
 | 
							-- prepend background and slot styles from default if available
 | 
				
			||||||
 | 
							fancy_inv = default.gui_bg .. default.gui_bg_img .. default.gui_slots
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						meta:set_string(
 | 
				
			||||||
 | 
						--FIXME Not work with @n in this part bug in minetest/minetest#7450.
 | 
				
			||||||
 | 
							"formspec", "size[11,10]" .. fancy_inv ..
 | 
				
			||||||
 | 
								"label[0,0;" .. S("Input material") .. "]" ..
 | 
				
			||||||
 | 
								"list[current_name;input;1.7,0;1,1;]" ..
 | 
				
			||||||
 | 
								"label[0,1;" .. F(S("Left-over")) .. "]" ..
 | 
				
			||||||
 | 
								"list[current_name;micro;1.7,1;1,1;]" ..
 | 
				
			||||||
 | 
								"label[0,2;" .. F(S("Recycle output")) .. "]" ..
 | 
				
			||||||
 | 
								"list[current_name;recycle;1.7,2;1,1;]" ..
 | 
				
			||||||
 | 
								"field[0.3,3.5;1,1;max_offered;" .. F(S("Max")) .. ":;${max_offered}]" ..
 | 
				
			||||||
 | 
								"button[1,3.2;1.7,1;Set;" .. F(S("Set")) .. "]" ..
 | 
				
			||||||
 | 
								"list[current_name;output;2.8,0;8,6;]" ..
 | 
				
			||||||
 | 
								"list[current_player;main;1.5,6.25;8,4;]" ..
 | 
				
			||||||
 | 
								"listring[current_name;output]" ..
 | 
				
			||||||
 | 
								"listring[current_player;main]" ..
 | 
				
			||||||
 | 
								"listring[current_name;input]" ..
 | 
				
			||||||
 | 
								"listring[current_player;main]" ..
 | 
				
			||||||
 | 
								"listring[current_name;micro]" ..
 | 
				
			||||||
 | 
								"listring[current_player;main]" ..
 | 
				
			||||||
 | 
								"listring[current_name;recycle]" ..
 | 
				
			||||||
 | 
								"listring[current_player;main]"
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						meta:set_int("anz", 0) -- No microblocks inside yet.
 | 
				
			||||||
 | 
						meta:set_string("max_offered", 99) -- How many items of this kind are offered by default?
 | 
				
			||||||
 | 
						meta:set_string("infotext", S("Circular Saw is empty"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						inv:set_size("input", 1)    -- Input slot for full blocks of material x.
 | 
				
			||||||
 | 
						inv:set_size("micro", 1)    -- Storage for 1-7 surplus microblocks.
 | 
				
			||||||
 | 
						inv:set_size("recycle", 1)  -- Surplus partial blocks can be placed here.
 | 
				
			||||||
 | 
						inv:set_size("output", 6 * 8) -- 6x8 versions of stair-parts of material x.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						circular_saw:reset(pos)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function circular_saw.can_dig(pos, player)
 | 
				
			||||||
 | 
						local meta = minetest.get_meta(pos)
 | 
				
			||||||
 | 
						local inv = meta:get_inventory()
 | 
				
			||||||
 | 
						if not inv:is_empty("input") or
 | 
				
			||||||
 | 
							not inv:is_empty("micro") or
 | 
				
			||||||
 | 
							not inv:is_empty("recycle") then
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						-- Can be dug by anyone when empty, not only by the owner:
 | 
				
			||||||
 | 
						return true
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,430 +4,17 @@ More Blocks: circular saw
 | 
				
			|||||||
Copyright © 2011-2020 Hugo Locurcio, Sokomine and contributors.
 | 
					Copyright © 2011-2020 Hugo Locurcio, Sokomine and contributors.
 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					Licensed under the zlib license. See LICENSE.md for more information.
 | 
				
			||||||
--]]
 | 
					--]]
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					local S = stairsplus.S
 | 
				
			||||||
 | 
					local cm = stairsplus.resources.craft_materials
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local S = moreblocks.S
 | 
					api.register_station("stairsplus:circular_saw", {
 | 
				
			||||||
local F = minetest.formspec_escape
 | 
							micros = 1,
 | 
				
			||||||
 | 
							panels = 1,
 | 
				
			||||||
local circular_saw = {}
 | 
							slabs = 1,
 | 
				
			||||||
 | 
							slopes = 1,
 | 
				
			||||||
circular_saw.known_stairs = setmetatable({}, {
 | 
							stairs = 1,
 | 
				
			||||||
	__newindex = function(k, v)
 | 
						}, {
 | 
				
			||||||
		local modname = minetest.get_current_modname()
 | 
					 | 
				
			||||||
		print(("WARNING: mod %s tried to add node %s to the circular saw manually."):format(modname, v))
 | 
					 | 
				
			||||||
	end,
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- This is populated by stairsplus:register_all:
 | 
					 | 
				
			||||||
circular_saw.known_nodes = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- How many microblocks does this shape at the output inventory cost:
 | 
					 | 
				
			||||||
-- It may cause slight loss, but no gain.
 | 
					 | 
				
			||||||
circular_saw.cost_in_microblocks = {
 | 
					 | 
				
			||||||
	1, 1, 1, 1, 1, 1, 1, 2,
 | 
					 | 
				
			||||||
	2, 3, 2, 4, 2, 4, 5, 6,
 | 
					 | 
				
			||||||
	7, 1, 1, 2, 4, 6, 7, 8,
 | 
					 | 
				
			||||||
	1, 2, 2, 3, 1, 1, 2, 4,
 | 
					 | 
				
			||||||
	4, 2, 6, 7, 3, 7, 7, 4,
 | 
					 | 
				
			||||||
	8, 3, 2, 6, 2, 1, 3, 4
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
circular_saw.names = {
 | 
					 | 
				
			||||||
	{"micro", "_1"},
 | 
					 | 
				
			||||||
	{"panel", "_1"},
 | 
					 | 
				
			||||||
	{"micro", "_2"},
 | 
					 | 
				
			||||||
	{"panel", "_2"},
 | 
					 | 
				
			||||||
	{"micro", "_4"},
 | 
					 | 
				
			||||||
	{"panel", "_4"},
 | 
					 | 
				
			||||||
	{"micro", ""},
 | 
					 | 
				
			||||||
	{"panel", ""},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	{"micro", "_12"},
 | 
					 | 
				
			||||||
	{"panel", "_12"},
 | 
					 | 
				
			||||||
	{"micro", "_14"},
 | 
					 | 
				
			||||||
	{"panel", "_14"},
 | 
					 | 
				
			||||||
	{"micro", "_15"},
 | 
					 | 
				
			||||||
	{"panel", "_15"},
 | 
					 | 
				
			||||||
	{"stair", "_outer"},
 | 
					 | 
				
			||||||
	{"stair", ""},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	{"stair", "_inner"},
 | 
					 | 
				
			||||||
	{"slab", "_1"},
 | 
					 | 
				
			||||||
	{"slab", "_2"},
 | 
					 | 
				
			||||||
	{"slab", "_quarter"},
 | 
					 | 
				
			||||||
	{"slab", ""},
 | 
					 | 
				
			||||||
	{"slab", "_three_quarter"},
 | 
					 | 
				
			||||||
	{"slab", "_14"},
 | 
					 | 
				
			||||||
	{"slab", "_15"},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	{"slab", "_two_sides"},
 | 
					 | 
				
			||||||
	{"slab", "_three_sides"},
 | 
					 | 
				
			||||||
	{"slab", "_three_sides_u"},
 | 
					 | 
				
			||||||
	{"stair", "_half"},
 | 
					 | 
				
			||||||
	{"stair", "_alt_1"},
 | 
					 | 
				
			||||||
	{"stair", "_alt_2"},
 | 
					 | 
				
			||||||
	{"stair", "_alt_4"},
 | 
					 | 
				
			||||||
	{"stair", "_alt"},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	{"slope", ""},
 | 
					 | 
				
			||||||
	{"slope", "_half"},
 | 
					 | 
				
			||||||
	{"slope", "_half_raised"},
 | 
					 | 
				
			||||||
	{"slope", "_inner"},
 | 
					 | 
				
			||||||
	{"slope", "_inner_half"},
 | 
					 | 
				
			||||||
	{"slope", "_inner_half_raised"},
 | 
					 | 
				
			||||||
	{"slope", "_inner_cut"},
 | 
					 | 
				
			||||||
	{"slope", "_inner_cut_half"},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	{"slope", "_inner_cut_half_raised"},
 | 
					 | 
				
			||||||
	{"slope", "_outer"},
 | 
					 | 
				
			||||||
	{"slope", "_outer_half"},
 | 
					 | 
				
			||||||
	{"slope", "_outer_half_raised"},
 | 
					 | 
				
			||||||
	{"slope", "_outer_cut"},
 | 
					 | 
				
			||||||
	{"slope", "_outer_cut_half"},
 | 
					 | 
				
			||||||
	{"slope", "_outer_cut_half_raised"},
 | 
					 | 
				
			||||||
	{"slope", "_cut"},
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw:get_cost(inv, stackname)
 | 
					 | 
				
			||||||
	local name = minetest.registered_aliases[stackname] or stackname
 | 
					 | 
				
			||||||
	for i, item in pairs(inv:get_list("output")) do
 | 
					 | 
				
			||||||
		if item:get_name() == name then
 | 
					 | 
				
			||||||
			return circular_saw.cost_in_microblocks[i]
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw:get_output_inv(modname, material, amount, max)
 | 
					 | 
				
			||||||
	if (not max or max < 1 or max > 99) then
 | 
					 | 
				
			||||||
		max = 99
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local list = {}
 | 
					 | 
				
			||||||
	local pos = #list
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- If there is nothing inside, display empty inventory:
 | 
					 | 
				
			||||||
	if amount < 1 then
 | 
					 | 
				
			||||||
		return list
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for i = 1, #circular_saw.names do
 | 
					 | 
				
			||||||
		local t = circular_saw.names[i]
 | 
					 | 
				
			||||||
		local cost = circular_saw.cost_in_microblocks[i]
 | 
					 | 
				
			||||||
		local balance = math.min(math.floor(amount / cost), max)
 | 
					 | 
				
			||||||
		local nodename = modname .. ":" .. t[1] .. "_" .. material .. t[2]
 | 
					 | 
				
			||||||
		if minetest.registered_nodes[nodename] then
 | 
					 | 
				
			||||||
			pos = pos + 1
 | 
					 | 
				
			||||||
			list[pos] = nodename .. " " .. balance
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	return list
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Reset empty circular_saw after last full block has been taken out
 | 
					 | 
				
			||||||
-- (or the circular_saw has been placed the first time)
 | 
					 | 
				
			||||||
-- Note: max_offered is not reset:
 | 
					 | 
				
			||||||
function circular_saw:reset(pos)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	local owned_by = meta:get_string("owner")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if owned_by and owned_by ~= "" then
 | 
					 | 
				
			||||||
		owned_by = (" (" .. S("owned by @1", meta:get_string("owner")) .. ")")
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		owned_by = ""
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	inv:set_list("input", {})
 | 
					 | 
				
			||||||
	inv:set_list("micro", {})
 | 
					 | 
				
			||||||
	inv:set_list("output", {})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	meta:set_int("anz", 0)
 | 
					 | 
				
			||||||
	meta:set_string("infotext", S("Circular Saw is empty") .. owned_by)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Player has taken something out of the box or placed something inside
 | 
					 | 
				
			||||||
-- that amounts to count microblocks:
 | 
					 | 
				
			||||||
function circular_saw:update_inventory(pos, amount)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	amount = meta:get_int("anz") + amount
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- The material is recycled automatically.
 | 
					 | 
				
			||||||
	inv:set_list("recycle", {})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if amount < 1 then
 | 
					 | 
				
			||||||
		-- If the last block is taken out.
 | 
					 | 
				
			||||||
		self:reset(pos)
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local stack = inv:get_stack("input", 1)
 | 
					 | 
				
			||||||
	-- At least one "normal" block is necessary to see what kind of stairs are requested.
 | 
					 | 
				
			||||||
	if stack:is_empty() then
 | 
					 | 
				
			||||||
		-- Any microblocks not taken out yet are now lost.
 | 
					 | 
				
			||||||
		-- (covers material loss in the machine)
 | 
					 | 
				
			||||||
		self:reset(pos)
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	local node_name = stack:get_name() or ""
 | 
					 | 
				
			||||||
	local node_def = stack:get_definition()
 | 
					 | 
				
			||||||
	local name_parts = circular_saw.known_nodes[node_name] or ""
 | 
					 | 
				
			||||||
	local modname = name_parts[1] or ""
 | 
					 | 
				
			||||||
	local material = name_parts[2] or ""
 | 
					 | 
				
			||||||
	local owned_by = meta:get_string("owner")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if owned_by and owned_by ~= "" then
 | 
					 | 
				
			||||||
		owned_by = (" (" .. S("owned by @1", meta:get_string("owner")) .. ")")
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		owned_by = ""
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	inv:set_list("input", { -- Display as many full blocks as possible:
 | 
					 | 
				
			||||||
		node_name .. " " .. math.floor(amount / 8)
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- The stairnodes made of default nodes use moreblocks namespace, other mods keep own:
 | 
					 | 
				
			||||||
	if modname == "default" then
 | 
					 | 
				
			||||||
		modname = "moreblocks"
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	-- print("circular_saw set to " .. modname .. " : "
 | 
					 | 
				
			||||||
	--	.. material .. " with " .. (amount) .. " microblocks.")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- 0-7 microblocks may remain left-over:
 | 
					 | 
				
			||||||
	inv:set_list("micro", {
 | 
					 | 
				
			||||||
		modname .. ":micro_" .. material .. " " .. (amount % 8)
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
	-- Display:
 | 
					 | 
				
			||||||
	inv:set_list("output",
 | 
					 | 
				
			||||||
		self:get_output_inv(modname, material, amount,
 | 
					 | 
				
			||||||
			meta:get_int("max_offered")))
 | 
					 | 
				
			||||||
	-- Store how many microblocks are available:
 | 
					 | 
				
			||||||
	meta:set_int("anz", amount)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	meta:set_string("infotext",
 | 
					 | 
				
			||||||
		S("Circular Saw is working on @1",
 | 
					 | 
				
			||||||
			node_def and node_def.description or material
 | 
					 | 
				
			||||||
		) .. owned_by
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- The amount of items offered per shape can be configured:
 | 
					 | 
				
			||||||
function circular_saw.on_receive_fields(pos, formname, fields, sender)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local max = tonumber(fields.max_offered)
 | 
					 | 
				
			||||||
	if max and max > 0 then
 | 
					 | 
				
			||||||
		meta:set_string("max_offered", max)
 | 
					 | 
				
			||||||
		-- Update to show the correct number of items:
 | 
					 | 
				
			||||||
		circular_saw:update_inventory(pos, 0)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Moving the inventory of the circular_saw around is not allowed because it
 | 
					 | 
				
			||||||
-- is a fictional inventory. Moving inventory around would be rather
 | 
					 | 
				
			||||||
-- impractical and make things more difficult to calculate:
 | 
					 | 
				
			||||||
function circular_saw.allow_metadata_inventory_move(
 | 
					 | 
				
			||||||
	pos, from_list, from_index, to_list, to_index, count, player)
 | 
					 | 
				
			||||||
	return 0
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Only input- and recycle-slot are intended as input slots:
 | 
					 | 
				
			||||||
function circular_saw.allow_metadata_inventory_put(
 | 
					 | 
				
			||||||
	pos, listname, index, stack, player)
 | 
					 | 
				
			||||||
	-- The player is not allowed to put something in there:
 | 
					 | 
				
			||||||
	if listname == "output" or listname == "micro" then
 | 
					 | 
				
			||||||
		return 0
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	local stackname = stack:get_name()
 | 
					 | 
				
			||||||
	local count = stack:get_count()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- Only allow those items that are offered in the output inventory to be recycled:
 | 
					 | 
				
			||||||
	if listname == "recycle" then
 | 
					 | 
				
			||||||
		if not inv:contains_item("output", stackname) then
 | 
					 | 
				
			||||||
			return 0
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
		local stackmax = stack:get_stack_max()
 | 
					 | 
				
			||||||
		local instack = inv:get_stack("input", 1)
 | 
					 | 
				
			||||||
		local microstack = inv:get_stack("micro", 1)
 | 
					 | 
				
			||||||
		local incount = instack:get_count()
 | 
					 | 
				
			||||||
		local incost = (incount * 8) + microstack:get_count()
 | 
					 | 
				
			||||||
		local maxcost = (stackmax * 8) + 7
 | 
					 | 
				
			||||||
		local cost = circular_saw:get_cost(inv, stackname)
 | 
					 | 
				
			||||||
		if (incost + cost) > maxcost then
 | 
					 | 
				
			||||||
			return math.max((maxcost - incost) / cost, 0)
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
		return count
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- Only accept certain blocks as input which are known to be craftable into stairs:
 | 
					 | 
				
			||||||
	if listname == "input" then
 | 
					 | 
				
			||||||
		if not inv:is_empty("input") then
 | 
					 | 
				
			||||||
			if inv:get_stack("input", index):get_name() ~= stackname then
 | 
					 | 
				
			||||||
				return 0
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
		if not inv:is_empty("micro") then
 | 
					 | 
				
			||||||
			local microstackname = inv:get_stack("micro", 1):get_name():gsub("^.+:micro_", "", 1)
 | 
					 | 
				
			||||||
			local cutstackname = stackname:gsub("^.+:", "", 1)
 | 
					 | 
				
			||||||
			if microstackname ~= cutstackname then
 | 
					 | 
				
			||||||
				return 0
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
		for name, t in pairs(circular_saw.known_nodes) do
 | 
					 | 
				
			||||||
			if name == stackname and inv:room_for_item("input", stack) then
 | 
					 | 
				
			||||||
				return count
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
		return 0
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Taking is allowed from all slots (even the internal microblock slot).
 | 
					 | 
				
			||||||
-- Putting something in is slightly more complicated than taking anything
 | 
					 | 
				
			||||||
-- because we have to make sure it is of a suitable material:
 | 
					 | 
				
			||||||
function circular_saw.on_metadata_inventory_put(
 | 
					 | 
				
			||||||
	pos, listname, index, stack, player)
 | 
					 | 
				
			||||||
	-- We need to find out if the circular_saw is already set to a
 | 
					 | 
				
			||||||
	-- specific material or not:
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	local stackname = stack:get_name()
 | 
					 | 
				
			||||||
	local count = stack:get_count()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- Putting something into the input slot is only possible if that had
 | 
					 | 
				
			||||||
	-- been empty before or did contain something of the same material:
 | 
					 | 
				
			||||||
	if listname == "input" then
 | 
					 | 
				
			||||||
		-- Each new block is worth 8 microblocks:
 | 
					 | 
				
			||||||
		circular_saw:update_inventory(pos, 8 * count)
 | 
					 | 
				
			||||||
	elseif listname == "recycle" then
 | 
					 | 
				
			||||||
		-- Lets look which shape this represents:
 | 
					 | 
				
			||||||
		local cost = circular_saw:get_cost(inv, stackname)
 | 
					 | 
				
			||||||
		local input_stack = inv:get_stack("input", 1)
 | 
					 | 
				
			||||||
		-- check if this would not exceed input itemstack max_stacks
 | 
					 | 
				
			||||||
		if input_stack:get_count() + ((cost * count) / 8) <= input_stack:get_stack_max() then
 | 
					 | 
				
			||||||
			circular_saw:update_inventory(pos, cost * count)
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw.allow_metadata_inventory_take(pos, listname, index, stack, player)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	local input_stack = inv:get_stack(listname, index)
 | 
					 | 
				
			||||||
	local player_inv = player:get_inventory()
 | 
					 | 
				
			||||||
	if not player_inv:room_for_item("main", input_stack) then
 | 
					 | 
				
			||||||
		return 0
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		return stack:get_count()
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw.on_metadata_inventory_take(
 | 
					 | 
				
			||||||
	pos, listname, index, stack, player)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- Prevent (inbuilt) swapping between inventories with different blocks
 | 
					 | 
				
			||||||
	-- corrupting player inventory or Saw with 'unknown' items.
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	local input_stack = inv:get_stack(listname, index)
 | 
					 | 
				
			||||||
	if not input_stack:is_empty() and input_stack:get_name() ~= stack:get_name() then
 | 
					 | 
				
			||||||
		local player_inv = player:get_inventory()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		-- Prevent arbitrary item duplication.
 | 
					 | 
				
			||||||
		inv:remove_item(listname, input_stack)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if player_inv:room_for_item("main", input_stack) then
 | 
					 | 
				
			||||||
			player_inv:add_item("main", input_stack)
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		circular_saw:reset(pos)
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- If it is one of the offered stairs: find out how many
 | 
					 | 
				
			||||||
	-- microblocks have to be subtracted:
 | 
					 | 
				
			||||||
	if listname == "output" then
 | 
					 | 
				
			||||||
		-- We do know how much each block at each position costs:
 | 
					 | 
				
			||||||
		local cost = circular_saw.cost_in_microblocks[index]
 | 
					 | 
				
			||||||
			* stack:get_count()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		circular_saw:update_inventory(pos, -cost)
 | 
					 | 
				
			||||||
	elseif listname == "micro" then
 | 
					 | 
				
			||||||
		-- Each microblock costs 1 microblock:
 | 
					 | 
				
			||||||
		circular_saw:update_inventory(pos, -stack:get_count())
 | 
					 | 
				
			||||||
	elseif listname == "input" then
 | 
					 | 
				
			||||||
		-- Each normal (= full) block taken costs 8 microblocks:
 | 
					 | 
				
			||||||
		circular_saw:update_inventory(pos, 8 * -stack:get_count())
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	-- The recycle field plays no role here since it is processed immediately.
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local has_default_mod = minetest.get_modpath("default")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw.on_construct(pos)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local fancy_inv = ""
 | 
					 | 
				
			||||||
	if has_default_mod then
 | 
					 | 
				
			||||||
		-- prepend background and slot styles from default if available
 | 
					 | 
				
			||||||
		fancy_inv = default.gui_bg .. default.gui_bg_img .. default.gui_slots
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	meta:set_string(
 | 
					 | 
				
			||||||
	--FIXME Not work with @n in this part bug in minetest/minetest#7450.
 | 
					 | 
				
			||||||
		"formspec", "size[11,10]" .. fancy_inv ..
 | 
					 | 
				
			||||||
			"label[0,0;" .. S("Input material") .. "]" ..
 | 
					 | 
				
			||||||
			"list[current_name;input;1.7,0;1,1;]" ..
 | 
					 | 
				
			||||||
			"label[0,1;" .. F(S("Left-over")) .. "]" ..
 | 
					 | 
				
			||||||
			"list[current_name;micro;1.7,1;1,1;]" ..
 | 
					 | 
				
			||||||
			"label[0,2;" .. F(S("Recycle output")) .. "]" ..
 | 
					 | 
				
			||||||
			"list[current_name;recycle;1.7,2;1,1;]" ..
 | 
					 | 
				
			||||||
			"field[0.3,3.5;1,1;max_offered;" .. F(S("Max")) .. ":;${max_offered}]" ..
 | 
					 | 
				
			||||||
			"button[1,3.2;1.7,1;Set;" .. F(S("Set")) .. "]" ..
 | 
					 | 
				
			||||||
			"list[current_name;output;2.8,0;8,6;]" ..
 | 
					 | 
				
			||||||
			"list[current_player;main;1.5,6.25;8,4;]" ..
 | 
					 | 
				
			||||||
			"listring[current_name;output]" ..
 | 
					 | 
				
			||||||
			"listring[current_player;main]" ..
 | 
					 | 
				
			||||||
			"listring[current_name;input]" ..
 | 
					 | 
				
			||||||
			"listring[current_player;main]" ..
 | 
					 | 
				
			||||||
			"listring[current_name;micro]" ..
 | 
					 | 
				
			||||||
			"listring[current_player;main]" ..
 | 
					 | 
				
			||||||
			"listring[current_name;recycle]" ..
 | 
					 | 
				
			||||||
			"listring[current_player;main]"
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	meta:set_int("anz", 0) -- No microblocks inside yet.
 | 
					 | 
				
			||||||
	meta:set_string("max_offered", 99) -- How many items of this kind are offered by default?
 | 
					 | 
				
			||||||
	meta:set_string("infotext", S("Circular Saw is empty"))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	inv:set_size("input", 1)    -- Input slot for full blocks of material x.
 | 
					 | 
				
			||||||
	inv:set_size("micro", 1)    -- Storage for 1-7 surplus microblocks.
 | 
					 | 
				
			||||||
	inv:set_size("recycle", 1)  -- Surplus partial blocks can be placed here.
 | 
					 | 
				
			||||||
	inv:set_size("output", 6 * 8) -- 6x8 versions of stair-parts of material x.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw:reset(pos)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function circular_saw.can_dig(pos, player)
 | 
					 | 
				
			||||||
	local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
	local inv = meta:get_inventory()
 | 
					 | 
				
			||||||
	if not inv:is_empty("input") or
 | 
					 | 
				
			||||||
		not inv:is_empty("micro") or
 | 
					 | 
				
			||||||
		not inv:is_empty("recycle") then
 | 
					 | 
				
			||||||
		return false
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
	-- Can be dug by anyone when empty, not only by the owner:
 | 
					 | 
				
			||||||
	return true
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
minetest.register_node("moreblocks:circular_saw", {
 | 
					 | 
				
			||||||
	description = S("Circular Saw"),
 | 
						description = S("Circular Saw"),
 | 
				
			||||||
	drawtype = "nodebox",
 | 
						drawtype = "nodebox",
 | 
				
			||||||
	node_box = {
 | 
						node_box = {
 | 
				
			||||||
@@ -443,40 +30,27 @@ minetest.register_node("moreblocks:circular_saw", {
 | 
				
			|||||||
			{-0.25, -0.0625, -0.25, 0.25, 0.25, 0.25}, -- Motor case
 | 
								{-0.25, -0.0625, -0.25, 0.25, 0.25, 0.25}, -- Motor case
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	tiles = {"moreblocks_circular_saw_top.png",
 | 
						tiles = {
 | 
				
			||||||
 | 
							"moreblocks_circular_saw_top.png",
 | 
				
			||||||
		"moreblocks_circular_saw_bottom.png",
 | 
							"moreblocks_circular_saw_bottom.png",
 | 
				
			||||||
	         "moreblocks_circular_saw_side.png"},
 | 
							"moreblocks_circular_saw_side.png"
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
	paramtype = "light",
 | 
						paramtype = "light",
 | 
				
			||||||
	sunlight_propagates = true,
 | 
						sunlight_propagates = true,
 | 
				
			||||||
	paramtype2 = "facedir",
 | 
						paramtype2 = "facedir",
 | 
				
			||||||
	groups = {choppy = 2, oddly_breakable_by_hand = 2},
 | 
						groups = {choppy = 2, oddly_breakable_by_hand = 2},
 | 
				
			||||||
	sounds = moreblocks.node_sound_wood_defaults(),
 | 
						sounds = moreblocks.resources.sounds.wood,
 | 
				
			||||||
	on_construct = circular_saw.on_construct,
 | 
					 | 
				
			||||||
	can_dig = circular_saw.can_dig,
 | 
					 | 
				
			||||||
	-- Set the owner of this circular saw.
 | 
					 | 
				
			||||||
	after_place_node = function(pos, placer)
 | 
					 | 
				
			||||||
		local meta = minetest.get_meta(pos)
 | 
					 | 
				
			||||||
		local owner = placer and placer:get_player_name() or ""
 | 
					 | 
				
			||||||
		local owned_by = owner
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if owner ~= "" then
 | 
					 | 
				
			||||||
			owned_by = (" (%s)"):format(S("owned by @1", owner))
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		meta:set_string("owner", owner)
 | 
					 | 
				
			||||||
		meta:set_string("infotext", S("Circular Saw is empty") .. owned_by)
 | 
					 | 
				
			||||||
	end,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- The amount of items offered per shape can be configured:
 | 
					 | 
				
			||||||
	on_receive_fields = circular_saw.on_receive_fields,
 | 
					 | 
				
			||||||
	allow_metadata_inventory_move = circular_saw.allow_metadata_inventory_move,
 | 
					 | 
				
			||||||
	-- Only input- and recycle-slot are intended as input slots:
 | 
					 | 
				
			||||||
	allow_metadata_inventory_put = circular_saw.allow_metadata_inventory_put,
 | 
					 | 
				
			||||||
	allow_metadata_inventory_take = circular_saw.allow_metadata_inventory_take,
 | 
					 | 
				
			||||||
	-- Taking is allowed from all slots (even the internal microblock slot). Moving is forbidden.
 | 
					 | 
				
			||||||
	-- Putting something in is slightly more complicated than taking anything because we have to make sure it is of a suitable material:
 | 
					 | 
				
			||||||
	on_metadata_inventory_put = circular_saw.on_metadata_inventory_put,
 | 
					 | 
				
			||||||
	on_metadata_inventory_take = circular_saw.on_metadata_inventory_take,
 | 
					 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stairplus.circular_saw = circular_saw
 | 
					if cm.steel_ingot then
 | 
				
			||||||
 | 
						if moreblocks.settings.circular_saw_crafting then
 | 
				
			||||||
 | 
							minetest.register_craft({
 | 
				
			||||||
 | 
								output = "stairsplus:circular_saw",
 | 
				
			||||||
 | 
								recipe = {
 | 
				
			||||||
 | 
									{"", cm.steel_ingot, ""},
 | 
				
			||||||
 | 
									{"group:wood", "group:wood", "group:wood"},
 | 
				
			||||||
 | 
									{"group:wood", "", "group:wood"},
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,183 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: registrations
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local S = moreblocks.S
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local descriptions = {
 | 
					 | 
				
			||||||
	["micro"] = "Microblock",
 | 
					 | 
				
			||||||
	["slab"] = "Slab",
 | 
					 | 
				
			||||||
	["slope"] = "Slope",
 | 
					 | 
				
			||||||
	["panel"] = "Panel",
 | 
					 | 
				
			||||||
	["stair"] = "Stairs",
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Extends the standad rotate_node placement so that it takes into account
 | 
					 | 
				
			||||||
-- the side (top/bottom or left/right) of the face being pointed at.
 | 
					 | 
				
			||||||
-- As with the standard rotate_node, sneak can be used to force the perpendicular
 | 
					 | 
				
			||||||
-- placement (wall placement on floor/ceiling, floor/ceiling placement on walls).
 | 
					 | 
				
			||||||
-- Additionally, the aux / sprint / special key can be used to place the node
 | 
					 | 
				
			||||||
-- as if from the opposite side.
 | 
					 | 
				
			||||||
--
 | 
					 | 
				
			||||||
-- When placing a node next to one of the same category (e.g. slab to slab or
 | 
					 | 
				
			||||||
-- stair to stair), the default placement (regardless of sneak) is to copy the
 | 
					 | 
				
			||||||
-- under node's param2, flipping if placed above or below it. The aux key disable
 | 
					 | 
				
			||||||
-- this behavior.
 | 
					 | 
				
			||||||
local wall_right_dirmap = {9, 18, 7, 12}
 | 
					 | 
				
			||||||
local wall_left_dirmap = {11, 16, 5, 14}
 | 
					 | 
				
			||||||
local ceil_dirmap = {20, 23, 22, 21}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- extract the stairsplus category from a node name
 | 
					 | 
				
			||||||
-- assumes the name is in the form mod_name:category_original_ndoe_name
 | 
					 | 
				
			||||||
local function name_to_category(name)
 | 
					 | 
				
			||||||
	local colon = name:find(":") or 0
 | 
					 | 
				
			||||||
	colon = colon + 1
 | 
					 | 
				
			||||||
	local under = name:find("_", colon)
 | 
					 | 
				
			||||||
	return name:sub(colon, under)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stairsplus.rotate_node_aux = function(itemstack, placer, pointed_thing)
 | 
					 | 
				
			||||||
	local sneak = placer and placer:get_player_control().sneak
 | 
					 | 
				
			||||||
	local aux = placer and placer:get_player_control().aux1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- category for what we are placing
 | 
					 | 
				
			||||||
	local item_prefix = name_to_category(itemstack:get_name())
 | 
					 | 
				
			||||||
	-- category for what we are placing against
 | 
					 | 
				
			||||||
	local under = pointed_thing.under
 | 
					 | 
				
			||||||
	local under_node = minetest.get_node(under)
 | 
					 | 
				
			||||||
	local under_prefix = under_node and name_to_category(under_node.name)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local same_cat = item_prefix == under_prefix
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- standard (floor) facedir, also used for sneak placement against the lower half of the wall
 | 
					 | 
				
			||||||
	local p2 = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- check which face and which quadrant we are interested in
 | 
					 | 
				
			||||||
	-- this is used both to check if we're handling parallel placement in the same-category case,
 | 
					 | 
				
			||||||
	-- and in general for sneak placement
 | 
					 | 
				
			||||||
	local face_pos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
 | 
					 | 
				
			||||||
	local face_off = vector.subtract(face_pos, under)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- we cannot trust face_off to tell us the correct directionif the
 | 
					 | 
				
			||||||
	-- under node has a non-standard shape, so use the distance between under and above
 | 
					 | 
				
			||||||
	local wallmounted = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.above, under))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if same_cat and not aux then
 | 
					 | 
				
			||||||
		p2 = under_node.param2
 | 
					 | 
				
			||||||
		-- flip if placing above or below an upright or upside-down node
 | 
					 | 
				
			||||||
		-- TODO should we also flip when placing next to a side-mounted node?
 | 
					 | 
				
			||||||
		if wallmounted < 2 then
 | 
					 | 
				
			||||||
			if p2 < 4 then
 | 
					 | 
				
			||||||
				p2 = (p2 + 2) % 4
 | 
					 | 
				
			||||||
				p2 = ceil_dirmap[p2 + 1]
 | 
					 | 
				
			||||||
			elseif p2 > 19 then
 | 
					 | 
				
			||||||
				p2 = ceil_dirmap[p2 - 19] - 20
 | 
					 | 
				
			||||||
				p2 = (p2 + 2) % 4
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		-- for same-cat placement, aux is used to disable param2 copying
 | 
					 | 
				
			||||||
		if same_cat then
 | 
					 | 
				
			||||||
			aux = not aux
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		local remap = nil
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		-- standard placement against the wall
 | 
					 | 
				
			||||||
		local use_wallmap = (wallmounted > 1 and not sneak) or (wallmounted < 2 and sneak)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		-- standard placement against the ceiling, or sneak placement against the upper half of the wall
 | 
					 | 
				
			||||||
		local use_ceilmap = wallmounted == 1 and not sneak
 | 
					 | 
				
			||||||
		use_ceilmap = use_ceilmap or (wallmounted > 1 and sneak and face_off.y > 0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if use_wallmap then
 | 
					 | 
				
			||||||
			local left = (p2 == 0 and face_off.x < 0) or
 | 
					 | 
				
			||||||
				(p2 == 1 and face_off.z > 0) or
 | 
					 | 
				
			||||||
				(p2 == 2 and face_off.x > 0) or
 | 
					 | 
				
			||||||
				(p2 == 3 and face_off.z < 0)
 | 
					 | 
				
			||||||
			if aux then
 | 
					 | 
				
			||||||
				left = not left
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
			remap = left and wall_left_dirmap or wall_right_dirmap
 | 
					 | 
				
			||||||
		elseif use_ceilmap then
 | 
					 | 
				
			||||||
			remap = ceil_dirmap
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if aux then
 | 
					 | 
				
			||||||
			p2 = (p2 + 2) % 4
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if remap then
 | 
					 | 
				
			||||||
			p2 = remap[p2 + 1]
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return minetest.item_place(itemstack, placer, pointed_thing, p2)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local src_def = minetest.registered_nodes[recipeitem] or {}
 | 
					 | 
				
			||||||
	local desc_base = S("@1 " .. descriptions[category], fields.description)
 | 
					 | 
				
			||||||
	local def = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if category ~= "slab" then
 | 
					 | 
				
			||||||
		def = table.copy(info)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- copy fields to def
 | 
					 | 
				
			||||||
	for k, v in pairs(fields) do
 | 
					 | 
				
			||||||
		def[k] = v
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	def.drawtype = "nodebox"
 | 
					 | 
				
			||||||
	def.paramtype = "light"
 | 
					 | 
				
			||||||
	def.paramtype2 = def.paramtype2 or "facedir"
 | 
					 | 
				
			||||||
	if def.use_texture_alpha == nil then
 | 
					 | 
				
			||||||
		def.use_texture_alpha = src_def.use_texture_alpha
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- This makes node rotation work on placement
 | 
					 | 
				
			||||||
	def.place_param2 = nil
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	-- Darken light sources slightly to make up for their smaller visual size
 | 
					 | 
				
			||||||
	def.light_source = math.max(0, (def.light_source or 0) - 1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	def.on_place = stairsplus.rotate_node_aux
 | 
					 | 
				
			||||||
	def.groups = stairsplus:prepare_groups(fields.groups)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if category == "slab" then
 | 
					 | 
				
			||||||
		if type(info) ~= "table" then
 | 
					 | 
				
			||||||
			def.node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, -0.5, 0.5, (info / 16) - 0.5, 0.5},
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			def.description = ("%s (%d/16)"):format(desc_base, info)
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			def.node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = info,
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b)
 | 
					 | 
				
			||||||
				return a:upper() .. b
 | 
					 | 
				
			||||||
			end)
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		def.description = desc_base
 | 
					 | 
				
			||||||
		if category == "slope" then
 | 
					 | 
				
			||||||
			def.drawtype = "mesh"
 | 
					 | 
				
			||||||
		elseif category == "stair" and alternate == "" then
 | 
					 | 
				
			||||||
			def.groups.stair = 1
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if fields.drop and not (type(fields.drop) == "table") then
 | 
					 | 
				
			||||||
		def.drop = modname .. ":" .. category .. "_" .. fields.drop .. alternate
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	minetest.register_node(":" .. modname .. ":" .. category .. "_" .. subname .. alternate, def)
 | 
					 | 
				
			||||||
	stairsplus.register_recipes(category, alternate, modname, subname, recipeitem)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,3 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.dofile("compat", "stairs")
 | 
				
			||||||
 | 
					stairsplus.dofile("compat", "legacy")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- stairsplus.dofile("compat", "inventory_managers")
 | 
				
			||||||
-- unified_inventory, sfinv, i3
 | 
					-- unified_inventory, sfinv, i3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,27 @@
 | 
				
			|||||||
-- legacy: register all the expected variants for e.g. default, wool, gloopblocks, etc.
 | 
					-- legacy: register all the expected variants for e.g. default, wool, gloopblocks, etc.
 | 
				
			||||||
-- provide a configuration option to *disable* legacy. it must be enabled by default, to prevent breaking
 | 
					-- provide a configuration option to *disable* legacy. it must be enabled by default, to prevent breaking
 | 
				
			||||||
-- existing servers
 | 
					-- existing servers
 | 
				
			||||||
 | 
					local api = stairsplus.api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function stairsplus:register_all(modname, subname, recipeitem, fields)
 | 
				
			||||||
 | 
						api.register_all(recipeitem, fields)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    local old_name = ("%s:%s"):format(modname, subname)
 | 
				
			||||||
 | 
						if old_name ~= recipeitem then
 | 
				
			||||||
 | 
							api.register_alias_all(old_name, recipeitem)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
 | 
				
			||||||
 | 
						api.register_alias_all(
 | 
				
			||||||
 | 
							("%s:%s"):format(modname_old, subname_old),
 | 
				
			||||||
 | 
							("%s:%s"):format(modname_new, subname_new)
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
 | 
				
			||||||
 | 
						api.register_alias_force_all(
 | 
				
			||||||
 | 
							("%s:%s"):format(modname_old, subname_old),
 | 
				
			||||||
 | 
							("%s:%s"):format(modname_new, subname_new)
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										393
									
								
								stairsplus/craft_schemas.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										393
									
								
								stairsplus/craft_schemas.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,393 @@
 | 
				
			|||||||
 | 
					local register_craft_schema = stairsplus.api.register_craft_schema
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 7",
 | 
				
			||||||
 | 
						recipe = {"stair_inner"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 6",
 | 
				
			||||||
 | 
						recipe = {"stair"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 5",
 | 
				
			||||||
 | 
						recipe = {"stair_outer"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 4",
 | 
				
			||||||
 | 
						recipe = {"slab_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 4",
 | 
				
			||||||
 | 
						recipe = {"stair_alt_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 3",
 | 
				
			||||||
 | 
						recipe = {"stair_right_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "micro_8 2",
 | 
				
			||||||
 | 
						recipe = {"panel_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "panel_8 12",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"node", ""},
 | 
				
			||||||
 | 
							{"node", "node"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "panel_8 12",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"", "node"},
 | 
				
			||||||
 | 
							{"node", "node"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "panel_8",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"panel_8", "panel_8", "panel_8", "panel_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "slab_8 6",
 | 
				
			||||||
 | 
						recipe = {{"node", "node", "node"}},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {{"panel_8", "panel_8"}},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"panel_8"},
 | 
				
			||||||
 | 
							{"panel_8"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slab_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8 3",
 | 
				
			||||||
 | 
						recipe = {"stair", "stair"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"slab_4", "slab_4"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"slab_2", "slab_2", "slab_2", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8 2",
 | 
				
			||||||
 | 
						recipe = {"slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"slope_half", "slope_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_half", "slope_inner_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_8",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_cut_half", "slope_inner_cut_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_4", "slab_4", "slab_4", "slab_4"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_12", "slab_4"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_4",
 | 
				
			||||||
 | 
						recipe = {"slab_2", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_4 2",
 | 
				
			||||||
 | 
						recipe = {"slab_1", "slab_1", "slab_1", "slab_1"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_12",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slab_4"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_12",
 | 
				
			||||||
 | 
						recipe = {"slab_4", "slab_4", "slab_4"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_12",
 | 
				
			||||||
 | 
						recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_14", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_2 2",
 | 
				
			||||||
 | 
						recipe = {"slab_1", "slab_1"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_14",
 | 
				
			||||||
 | 
						recipe = {"slab_12", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_14",
 | 
				
			||||||
 | 
						recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slab_15", "slab_1"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slab_15",
 | 
				
			||||||
 | 
						recipe = {"slab_14", "slab_1"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope", "slope"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_half", "slope_half_raised"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_half", "slope_half", "slope_half", "slope_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_outer", "slope_inner"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_half", "slope_inner_half_raised"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_half_raised", "slope_inner_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_cut", "slope_inner_cut"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_outer_cut_half", "slope_inner_cut_half_raised"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "node",
 | 
				
			||||||
 | 
						recipe = {"slope_cut", "slope_cut"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slope_half_raised",
 | 
				
			||||||
 | 
						recipe = {"slope_half", "slope_half", "slope_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slope_half_raised",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slope_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slope_inner_half_raised",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slope_inner_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slope_outer_half_raised",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slope_outer_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "slope_inner_cut_half_raised",
 | 
				
			||||||
 | 
						recipe = {"slab_8", "slope_inner_cut_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "stair 8",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"node", "", ""},
 | 
				
			||||||
 | 
							{"node", "node", ""},
 | 
				
			||||||
 | 
							{"node", "node", "node"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						output = "stair 8",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"", "", "node"},
 | 
				
			||||||
 | 
							{"", "node", "node"},
 | 
				
			||||||
 | 
							{"node", "node", "node"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair",
 | 
				
			||||||
 | 
						recipe = {"panel_8", "slab_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair",
 | 
				
			||||||
 | 
						recipe = {"panel_8", "panel_8", "panel_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair",
 | 
				
			||||||
 | 
						recipe = {"panel_8", "panel_8", "panel_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_inner",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_outer",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "slab_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_outer",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_half",
 | 
				
			||||||
 | 
						recipe = {"micro_8", "micro_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_half",
 | 
				
			||||||
 | 
						recipe = {"panel_8", "micro_8"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({
 | 
				
			||||||
 | 
						type = "shapeless",
 | 
				
			||||||
 | 
						output = "stair_right_half",
 | 
				
			||||||
 | 
						recipe = {"stair_half"},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					register_craft_schema({ -- See mirrored variation of the recipe below.
 | 
				
			||||||
 | 
						output = "stair_alt_8",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"panel_8", ""},
 | 
				
			||||||
 | 
							{"", "panel_8"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					register_craft_schema({ -- Mirrored variation of the recipe above.
 | 
				
			||||||
 | 
						output = "stair_alt_8",
 | 
				
			||||||
 | 
						recipe = {
 | 
				
			||||||
 | 
							{"", "panel_8"},
 | 
				
			||||||
 | 
							{"panel_8", ""},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
local cm = stairsplus.resources.craft_materials
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if cm.steel_ingot then
 | 
					 | 
				
			||||||
	if moreblocks.settings.circular_saw_crafting then
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			output = "stairsplus:circular_saw",
 | 
					 | 
				
			||||||
			recipe = {
 | 
					 | 
				
			||||||
				{"", cm.steel_ingot, ""},
 | 
					 | 
				
			||||||
				{"group:wood", "group:wood", "group:wood"},
 | 
					 | 
				
			||||||
				{"group:wood", "", "group:wood"},
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,96 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: microblock definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
--[[
 | 
					 | 
				
			||||||
Subset table should have the following format: (You can remove entries as needed.)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local subset = {
 | 
					 | 
				
			||||||
	{ "micro", "" },
 | 
					 | 
				
			||||||
	{ "micro", "_1" },
 | 
					 | 
				
			||||||
	{ "micro", "_2" },
 | 
					 | 
				
			||||||
	{ "micro", "_4" },
 | 
					 | 
				
			||||||
	{ "micro", "_12" },
 | 
					 | 
				
			||||||
	{ "micro", "_14" },
 | 
					 | 
				
			||||||
	{ "micro", "_15" },
 | 
					 | 
				
			||||||
	{ "panel", "" },
 | 
					 | 
				
			||||||
	{ "panel", "_1" },
 | 
					 | 
				
			||||||
	{ "panel", "_2" },
 | 
					 | 
				
			||||||
	{ "panel", "_4" },
 | 
					 | 
				
			||||||
	{ "panel", "_12" },
 | 
					 | 
				
			||||||
	{ "panel", "_14" },
 | 
					 | 
				
			||||||
	{ "panel", "_15" },
 | 
					 | 
				
			||||||
	{ "slab",  "" },
 | 
					 | 
				
			||||||
	{ "slab",  "_quarter" },
 | 
					 | 
				
			||||||
	{ "slab",  "_three_quarter" },
 | 
					 | 
				
			||||||
	{ "slab",  "_1" },
 | 
					 | 
				
			||||||
	{ "slab",  "_2" },
 | 
					 | 
				
			||||||
	{ "slab",  "_14" },
 | 
					 | 
				
			||||||
	{ "slab",  "_15" },
 | 
					 | 
				
			||||||
	{ "slab",  "_two_sides" },
 | 
					 | 
				
			||||||
	{ "slab",  "_three_sides" },
 | 
					 | 
				
			||||||
	{ "slab",  "_three_sides_u" },
 | 
					 | 
				
			||||||
	{ "slope", "" },
 | 
					 | 
				
			||||||
	{ "slope", "_half" },
 | 
					 | 
				
			||||||
	{ "slope", "_half_raised" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner_half" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner_half_raised" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner_cut" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner_cut_half" },
 | 
					 | 
				
			||||||
	{ "slope", "_inner_cut_half_raised" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer_half" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer_half_raised" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer_cut" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer_cut_half" },
 | 
					 | 
				
			||||||
	{ "slope", "_outer_cut_half_raised" },
 | 
					 | 
				
			||||||
	{ "slope", "_cut" },
 | 
					 | 
				
			||||||
	{ "stair", "" },
 | 
					 | 
				
			||||||
	{ "stair", "_half" },
 | 
					 | 
				
			||||||
	{ "stair", "_right_half" },
 | 
					 | 
				
			||||||
	{ "stair", "_inner" },
 | 
					 | 
				
			||||||
	{ "stair", "_outer" },
 | 
					 | 
				
			||||||
	{ "stair", "_alt" },
 | 
					 | 
				
			||||||
	{ "stair", "_alt_1" },
 | 
					 | 
				
			||||||
	{ "stair", "_alt_2" },
 | 
					 | 
				
			||||||
	{ "stair", "_alt_4" },
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_custom_subset(subset, modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_custom_subset(subset, modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local subset_copy = table.copy(subset)
 | 
					 | 
				
			||||||
	for k, v in pairs(subset_copy) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2])
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_custom_subset_alias_force(subset, modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local subset_copy = table.copy(subset)
 | 
					 | 
				
			||||||
	for k, v in pairs(subset_copy) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2])
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local subset_copy = table.copy(subset)
 | 
					 | 
				
			||||||
	for k, v in pairs(subset_copy) do
 | 
					 | 
				
			||||||
		stairsplus.register_single(v[1], v[2], stairsplus.defs[v[1]][v[2]], modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,409 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: registrations
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope = {
 | 
					 | 
				
			||||||
	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}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_half = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.25, 0, 0.5, -0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.125, 0.25, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_half_raised = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, 0, 0.5, 0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_inner = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.25, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.25, 0, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0, -0.5, 0, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0, 0, 0.5, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, -0.5, -0.25, 0.5, 0.5},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_inner_half = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.375, -0.5, 0.25, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.25, -0.5, 0, -0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.25, 0, 0.5, -0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.125, 0.25, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.125, -0.5, -0.25, 0, 0.5},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_inner_half_raised = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.125, -0.5, 0.25, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, -0.5, 0, 0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, 0, 0.5, 0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.375, -0.5, -0.25, 0.5, 0.5},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_outer = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.25, -0.25, 0.25, 0, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0, 0, 0, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_outer_half = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.375, -0.25, 0.25, -0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.25, 0, 0, -0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, -0.125, 0.25, -0.25, 0, 0.5}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local box_slope_outer_half_raised = {
 | 
					 | 
				
			||||||
	type = "fixed",
 | 
					 | 
				
			||||||
	fixed = {
 | 
					 | 
				
			||||||
		{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.125, -0.25, 0.25, 0.25, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.25, 0, 0, 0.375, 0.5},
 | 
					 | 
				
			||||||
		{-0.5, 0.375, 0.25, -0.25, 0.5, 0.5}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stairsplus.defs = {
 | 
					 | 
				
			||||||
	["micro"] = {
 | 
					 | 
				
			||||||
		[""] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_1"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_2"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_4"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_12"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_14"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_15"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	["panel"] = {
 | 
					 | 
				
			||||||
		[""] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_1"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_2"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_4"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_12"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_14"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_15"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	["slab"] = {
 | 
					 | 
				
			||||||
		[""] = 8,
 | 
					 | 
				
			||||||
		["_quarter"] = 4,
 | 
					 | 
				
			||||||
		["_three_quarter"] = 12,
 | 
					 | 
				
			||||||
		["_1"] = 1,
 | 
					 | 
				
			||||||
		["_2"] = 2,
 | 
					 | 
				
			||||||
		["_14"] = 14,
 | 
					 | 
				
			||||||
		["_15"] = 15,
 | 
					 | 
				
			||||||
		["_two_sides"] = {
 | 
					 | 
				
			||||||
			{-0.5, -0.5, -0.5, 0.5, -7 / 16, 7 / 16},
 | 
					 | 
				
			||||||
			{-0.5, -0.5, 7 / 16, 0.5, 0.5, 0.5}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_three_sides"] = {
 | 
					 | 
				
			||||||
			{-7 / 16, -0.5, -0.5, 0.5, -7 / 16, 7 / 16},
 | 
					 | 
				
			||||||
			{-7 / 16, -0.5, 7 / 16, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
			{-0.5, -0.5, -0.5, -7 / 16, 0.5, 0.5}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_three_sides_u"] = {
 | 
					 | 
				
			||||||
			{-0.5, -0.5, -0.5, 0.5, 0.5, -7 / 16},
 | 
					 | 
				
			||||||
			{-0.5, -0.5, -7 / 16, 0.5, -7 / 16, 7 / 16},
 | 
					 | 
				
			||||||
			{-0.5, -0.5, 7 / 16, 0.5, 0.5, 0.5}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	["slope"] = {
 | 
					 | 
				
			||||||
		[""] = {
 | 
					 | 
				
			||||||
			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,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		["_inner"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_inner_half"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner_half.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner_half,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner_half,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_inner_half_raised"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner_half_raised.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner_half_raised,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner_half_raised,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		["_inner_cut"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner_cut.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_inner_cut_half"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner_cut_half.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner_half,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner_half,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_inner_cut_half_raised"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_inner_cut_half_raised.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_inner_half_raised,
 | 
					 | 
				
			||||||
			selection_box = box_slope_inner_half_raised,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		["_outer"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_outer_half"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer_half.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer_half,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer_half,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_outer_half_raised"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer_half_raised.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer_half_raised,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer_half_raised,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		--==============================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		["_outer_cut"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer_cut.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_outer_cut_half"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer_cut_half.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer_half,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer_half,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_outer_cut_half_raised"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_outer_cut_half_raised.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer_half_raised,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer_half_raised,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_cut"] = {
 | 
					 | 
				
			||||||
			mesh = "moreblocks_slope_cut.obj",
 | 
					 | 
				
			||||||
			collision_box = box_slope_outer,
 | 
					 | 
				
			||||||
			selection_box = box_slope_outer,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	["stair"] = {
 | 
					 | 
				
			||||||
		[""] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
					{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_half"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.5, -0.5, 0, 0, 0.5},
 | 
					 | 
				
			||||||
					{-0.5, 0, 0, 0, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_right_half"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{0, -0.5, -0.5, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
					{0, 0, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_inner"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
					{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
					{-0.5, 0, -0.5, 0, 0.5, 0},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_outer"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
					 | 
				
			||||||
					{-0.5, 0, 0, 0, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_alt"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.5, -0.5, 0.5, 0, 0},
 | 
					 | 
				
			||||||
					{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_alt_1"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.0625, -0.5, 0.5, 0, 0},
 | 
					 | 
				
			||||||
					{-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_alt_2"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.125, -0.5, 0.5, 0, 0},
 | 
					 | 
				
			||||||
					{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		["_alt_4"] = {
 | 
					 | 
				
			||||||
			node_box = {
 | 
					 | 
				
			||||||
				type = "fixed",
 | 
					 | 
				
			||||||
				fixed = {
 | 
					 | 
				
			||||||
					{-0.5, -0.25, -0.5, 0.5, 0, 0},
 | 
					 | 
				
			||||||
					{-0.5, 0.25, 0, 0.5, 0.5, 0.5},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
for type, a in pairs(stairsplus.defs) do
 | 
					 | 
				
			||||||
	for name, b in pairs(stairsplus.defs[type]) do
 | 
					 | 
				
			||||||
		table.insert(stairsplus.shapes_list, {type .. "_", name})
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -38,66 +38,11 @@ stairsplus = {
 | 
				
			|||||||
	end,
 | 
						end,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stairsplus.shapes_list = {}
 | 
					stairsplus.dofile("settings")
 | 
				
			||||||
 | 
					stairsplus.dofile("util")
 | 
				
			||||||
 | 
					stairsplus.dofile("resources", "init")
 | 
				
			||||||
function stairsplus:prepare_groups(groups)
 | 
					stairsplus.dofile("api", "init")
 | 
				
			||||||
	local result = {}
 | 
					stairsplus.dofile("shapes", "init")
 | 
				
			||||||
	if groups then
 | 
					stairsplus.dofile("craft_schemas")
 | 
				
			||||||
		for k, v in pairs(groups) do
 | 
					stairsplus.dofile("circular_saw")
 | 
				
			||||||
			if k ~= "wood" and k ~= "stone" and k ~= "wool" and k ~= "tree" then
 | 
					stairsplus.dofile("compat", "init")
 | 
				
			||||||
				result[k] = v
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if not stairsplus.settings.in_creative_inventory then
 | 
					 | 
				
			||||||
		result.not_in_creative_inventory = 1
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return result
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_all(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	self:register_stair(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	self:register_slab(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	self:register_slope(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	self:register_panel(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	self:register_micro(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_all(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dofile(modpath .. "/defs.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/recipes.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/common.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/stairs.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/slabs.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/slopes.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/panels.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/microblocks.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/custom.lua")
 | 
					 | 
				
			||||||
dofile(modpath .. "/registrations.lua")
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: microblock definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Node will be called <modname>:micro_<subname>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_micro(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_micro(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["micro"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["micro"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_micro(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["micro"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		stairsplus.register_single("micro", alternate, def, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: panel definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Node will be called <modname>:panel_<subname>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_panel(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_panel(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["panel"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["panel"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_panel(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["panel"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		stairsplus.register_single("panel", alternate, def, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,443 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: Stairs+
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stairsplus.register_recipes = function(category, alternate, modname, subname, recipeitem)
 | 
					 | 
				
			||||||
	if category == "micro" and alternate == "" then
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 7",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":stair_" .. subname .. "_inner"},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 6",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":stair_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 5",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":stair_" .. subname .. "_outer"},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 4",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":slab_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 4",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":stair_" .. subname .. "_alt"},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 3",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":stair_" .. subname .. "_right_half"},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":micro_" .. subname .. " 2",
 | 
					 | 
				
			||||||
			recipe = {modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = recipeitem,
 | 
					 | 
				
			||||||
			recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_alias(modname .. ":micro_" .. subname .. "_bottom", modname .. ":micro_" .. subname)
 | 
					 | 
				
			||||||
	elseif category == "panel" and alternate == "" then
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			output = modname .. ":panel_" .. subname .. " 12",
 | 
					 | 
				
			||||||
			recipe = {
 | 
					 | 
				
			||||||
				{recipeitem, ""},
 | 
					 | 
				
			||||||
				{recipeitem, recipeitem},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			output = modname .. ":panel_" .. subname .. " 12",
 | 
					 | 
				
			||||||
			recipe = {
 | 
					 | 
				
			||||||
				{"", recipeitem},
 | 
					 | 
				
			||||||
				{recipeitem, recipeitem},
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = modname .. ":panel_" .. subname,
 | 
					 | 
				
			||||||
			recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_craft({
 | 
					 | 
				
			||||||
			type = "shapeless",
 | 
					 | 
				
			||||||
			output = recipeitem,
 | 
					 | 
				
			||||||
			recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		minetest.register_alias(modname .. ":panel_" .. subname .. "_bottom", modname .. ":panel_" .. subname)
 | 
					 | 
				
			||||||
	elseif category == "slab" then
 | 
					 | 
				
			||||||
		if alternate == "" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. " 6",
 | 
					 | 
				
			||||||
				recipe = {{recipeitem, recipeitem, recipeitem}},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			-- uncomment this rule when conflict is no longer likely to happen
 | 
					 | 
				
			||||||
			--	https://github.com/minetest/minetest/issues/2881
 | 
					 | 
				
			||||||
			-- minetest.register_craft({
 | 
					 | 
				
			||||||
			--	type = "shapeless",
 | 
					 | 
				
			||||||
			--	output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
			--	recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
			-- })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			-- then remove these two
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {{modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {
 | 
					 | 
				
			||||||
					{modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
					{modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
			------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. " 3",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_quarter" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_quarter"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_quarter",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_quarter",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_three_quarter" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_three_quarter",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname .. "_quarter"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_three_quarter",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter", modname .. ":slab_" .. subname .. "_quarter"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_three_quarter",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_2" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_2",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_1", modname .. ":slab_" .. subname .. "_1"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_14" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_14",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_three_quarter", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_14",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2", modname .. ":slab_" .. subname .. "_2"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_15" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_15", modname .. ":slab_" .. subname .. "_1"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slab_" .. subname .. "_15",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname .. "_14", modname .. ":slab_" .. subname .. "_1"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	elseif category == "slope" then
 | 
					 | 
				
			||||||
		if alternate == "" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
 | 
					 | 
				
			||||||
				          modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer", modname .. ":slope_" .. subname .. "_inner"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_half", modname .. ":slope_" .. subname .. "_inner_half_raised"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_inner_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_half_raised", modname .. ":slope_" .. subname .. "_inner_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer_cut" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_cut", modname .. ":slope_" .. subname .. "_inner_cut"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer_cut_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half_raised"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_cut" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = recipeitem,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_cut", modname .. ":slope_" .. subname .. "_cut"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_half_raised" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slope_" .. subname .. "_half_raised",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
 | 
					 | 
				
			||||||
				          modname .. ":slope_" .. subname .. "_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slope_" .. subname .. "_half_raised",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_inner_half_raised" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slope_" .. subname .. "_inner_half_raised",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer_half_raised" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slope_" .. subname .. "_outer_half_raised",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_outer_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_inner_cut_half_raised" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":slope_" .. subname .. "_inner_cut_half_raised",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_cut_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	elseif category == "stair" then
 | 
					 | 
				
			||||||
		if alternate == "" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. " 8",
 | 
					 | 
				
			||||||
				recipe = {
 | 
					 | 
				
			||||||
					{recipeitem, "", ""},
 | 
					 | 
				
			||||||
					{recipeitem, recipeitem, ""},
 | 
					 | 
				
			||||||
					{recipeitem, recipeitem, recipeitem},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. " 8",
 | 
					 | 
				
			||||||
				recipe = {
 | 
					 | 
				
			||||||
					{"", "", recipeitem},
 | 
					 | 
				
			||||||
					{"", recipeitem, recipeitem},
 | 
					 | 
				
			||||||
					{recipeitem, recipeitem, recipeitem},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname,
 | 
					 | 
				
			||||||
				recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_inner" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_inner",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_outer" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_outer",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_outer",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_half",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_half",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_right_half" then
 | 
					 | 
				
			||||||
			minetest.register_craft({
 | 
					 | 
				
			||||||
				type = "shapeless",
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_right_half",
 | 
					 | 
				
			||||||
				recipe = {modname .. ":stair_" .. subname .. "_half"},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		elseif alternate == "_alt" then
 | 
					 | 
				
			||||||
			minetest.register_craft({ -- See mirrored variation of the recipe below.
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_alt",
 | 
					 | 
				
			||||||
				recipe = {
 | 
					 | 
				
			||||||
					{modname .. ":panel_" .. subname, ""},
 | 
					 | 
				
			||||||
					{"", modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			minetest.register_craft({ -- Mirrored variation of the recipe above.
 | 
					 | 
				
			||||||
				output = modname .. ":stair_" .. subname .. "_alt",
 | 
					 | 
				
			||||||
				recipe = {
 | 
					 | 
				
			||||||
					{"", modname .. ":panel_" .. subname},
 | 
					 | 
				
			||||||
					{modname .. ":panel_" .. subname, ""},
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
local table_set_all = moreblocks.util.table_set_all
 | 
					local table_set_all = stairsplus.util.table_set_all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
moreblocks.resources.sounds = {}
 | 
					stairsplus.resources.sounds = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if moreblocks.has.default then
 | 
					if stairsplus.has.default then
 | 
				
			||||||
	table_set_all(moreblocks.resources.sounds, {
 | 
						table_set_all(stairsplus.resources.sounds, {
 | 
				
			||||||
		wood = default.node_sound_wood_defaults(),
 | 
							wood = default.node_sound_wood_defaults(),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,7 @@ stairsplus.settings = {
 | 
				
			|||||||
	circular_saw_crafting = minetest.settings:get_bool("stairsplus.circular_saw_crafting", true),
 | 
						circular_saw_crafting = minetest.settings:get_bool("stairsplus.circular_saw_crafting", true),
 | 
				
			||||||
	expect_infinite_stacks = minetest.settings:get_bool("stairsplus.expect_infinite_stacks",
 | 
						expect_infinite_stacks = minetest.settings:get_bool("stairsplus.expect_infinite_stacks",
 | 
				
			||||||
		minetest.settings:get_bool("creative_mode", false)
 | 
							minetest.settings:get_bool("creative_mode", false)
 | 
				
			||||||
	)
 | 
						),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						legacy_mode = minetest.settings:get_bool("stairsplus.legacy_mode", true),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								stairsplus/shapes/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								stairsplus/shapes/init.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					stairsplus.dofile("shapes", "micros")
 | 
				
			||||||
 | 
					stairsplus.dofile("shapes", "panels")
 | 
				
			||||||
 | 
					stairsplus.dofile("shapes", "slabs")
 | 
				
			||||||
 | 
					stairsplus.dofile("shapes", "slopes")
 | 
				
			||||||
 | 
					stairsplus.dofile("shapes", "stairs")
 | 
				
			||||||
							
								
								
									
										85
									
								
								stairsplus/shapes/micros.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								stairsplus/shapes/micros.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_1", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_1",
 | 
				
			||||||
 | 
						description = "@1 1/16 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_2", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_2",
 | 
				
			||||||
 | 
						description = "@1 1/8 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_4", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_4",
 | 
				
			||||||
 | 
						description = "@1 1/4 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_8", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_8",
 | 
				
			||||||
 | 
						aliases = {"micro_%s", "micro_%s_bottom"},
 | 
				
			||||||
 | 
						description = "@1 Microblock",  -- leave out the 1/2 to not confuse people too much...
 | 
				
			||||||
 | 
						shape_groups = {micro = 1, obligatory = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_12", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_12",
 | 
				
			||||||
 | 
						description = "@1 3/4 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_14", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_14",
 | 
				
			||||||
 | 
						description = "@1 7/8 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("micro_15", {
 | 
				
			||||||
 | 
						name_format = "micro_%s_5",
 | 
				
			||||||
 | 
						description = "@1 15/16 Microblock",
 | 
				
			||||||
 | 
						shape_groups = {micro = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										85
									
								
								stairsplus/shapes/panels.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								stairsplus/shapes/panels.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_1", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_1",
 | 
				
			||||||
 | 
						description = "@1 1/16 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_2", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_2",
 | 
				
			||||||
 | 
						description = "@1 1/8 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_4", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_4",
 | 
				
			||||||
 | 
						description = "@1 1/4 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_8", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_8",
 | 
				
			||||||
 | 
						aliases = {"panel_%s", "panel_bottom_%s"},
 | 
				
			||||||
 | 
						description = "@1 1/2 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_12", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_12",
 | 
				
			||||||
 | 
						description = "@1 3/4 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_14", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_14",
 | 
				
			||||||
 | 
						description = "@1 7/8 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("panel_15", {
 | 
				
			||||||
 | 
						name_format = "panel_%s_15",
 | 
				
			||||||
 | 
						description = "@1 15/16 Panel",
 | 
				
			||||||
 | 
						shape_groups = {panel = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										136
									
								
								stairsplus/shapes/slabs.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								stairsplus/shapes/slabs.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_1", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_1",
 | 
				
			||||||
 | 
						description = "@1 1/16 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_2", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_2",
 | 
				
			||||||
 | 
						description = "@1 1/8 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_4", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_4",
 | 
				
			||||||
 | 
						aliases = {"slab_%s_quarter"},
 | 
				
			||||||
 | 
						description = "@1 1/4 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_8", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_8",
 | 
				
			||||||
 | 
						aliases = {"slab_%s"},
 | 
				
			||||||
 | 
						description = "@1 1/2 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_12", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_12",
 | 
				
			||||||
 | 
						aliases = {"slab_%s_three_quarter"},
 | 
				
			||||||
 | 
						description = "@1 3/4 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_14", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_14",
 | 
				
			||||||
 | 
						description = "@1 7/8 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 7,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, 0.375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_15", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_15",
 | 
				
			||||||
 | 
						description = "@1 15/16 Slab",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 7,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- these terrible things
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_two_sides", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_two_sides",
 | 
				
			||||||
 | 
						description = "@1 1/16 Slab Two Sides",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, -7 / 16, 7 / 16},
 | 
				
			||||||
 | 
								{-0.5, -0.5, 7 / 16, 0.5, 0.5, 0.5}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_three_sides", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_three_sides",
 | 
				
			||||||
 | 
						description = "@1 1/16 Slab Three Sides",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-7 / 16, -0.5, -0.5, 0.5, -7 / 16, 7 / 16},
 | 
				
			||||||
 | 
								{-7 / 16, -0.5, 7 / 16, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, -7 / 16, 0.5, 0.5}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slab_three_sides_u", {
 | 
				
			||||||
 | 
						name_format = "slab_%s_three_sides_u",
 | 
				
			||||||
 | 
						description = "@1 1/16 Slab Three Sides U",
 | 
				
			||||||
 | 
						shape_groups = {slab = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, 0.5, -7 / 16},
 | 
				
			||||||
 | 
								{-0.5, -0.5, -7 / 16, 0.5, -7 / 16, 7 / 16},
 | 
				
			||||||
 | 
								{-0.5, -0.5, 7 / 16, 0.5, 0.5, 0.5}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										277
									
								
								stairsplus/shapes/slopes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										277
									
								
								stairsplus/shapes/slopes.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,277 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope = {
 | 
				
			||||||
 | 
						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}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope", {
 | 
				
			||||||
 | 
						name_format = "slope_%s",
 | 
				
			||||||
 | 
						description = "@1 Slope",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope,
 | 
				
			||||||
 | 
						selection_box = box_slope,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_half = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.25, 0, 0.5, -0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.125, 0.25, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_half", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_half",
 | 
				
			||||||
 | 
						description = "@1 1/2 Slope",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_half.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_half,
 | 
				
			||||||
 | 
						selection_box = box_slope_half,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_half_raised = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, 0, 0.5, 0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_half_raised", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_half_raised",
 | 
				
			||||||
 | 
						description = "@1 1/2 Slope Raised",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_half_raised.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_half_raised,
 | 
				
			||||||
 | 
						selection_box = box_slope_half_raised,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_inner = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.25, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.25, 0, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0, -0.5, 0, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0, 0, 0.5, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, -0.5, -0.25, 0.5, 0.5},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner_cut", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner_cut",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner Cut",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner_cut.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_inner_half = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.375, -0.5, 0.25, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.25, -0.5, 0, -0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.25, 0, 0.5, -0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.125, 0.25, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.125, -0.5, -0.25, 0, 0.5},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner_half", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner_half",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner Half",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner_half.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner_half,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner_half,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner_cut_half", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner_cut_half",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner Cut Half",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner_cut_half.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner_half,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner_half,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_inner_half_raised = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.125, -0.5, 0.25, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, -0.5, 0, 0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, 0, 0.5, 0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.375, -0.5, -0.25, 0.5, 0.5},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner_half_raised", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner_half_raised",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner Half Raised",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner_half_raised.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner_half_raised,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner_half_raised,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_inner_cut_half_raised", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_inner_cut_half_raised",
 | 
				
			||||||
 | 
						description = "@1 Slope Inner Cut Half Raised",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 7,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_inner_cut_half_raised.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_inner_half_raised,
 | 
				
			||||||
 | 
						selection_box = box_slope_inner_half_raised,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--==============================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_outer = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.25, -0.25, 0.25, 0, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0, 0, 0, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer_cut", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer_cut",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer Cut",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer_cut.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_cut", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_cut",
 | 
				
			||||||
 | 
						description = "@1 Slope Cut",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_cut.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_outer_half = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.375, -0.25, 0.25, -0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.25, 0, 0, -0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, -0.125, 0.25, -0.25, 0, 0.5}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer_half", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer_half",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer Half",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer_half.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer_half,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer_half,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer_cut_half", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer_cut_half",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer Cut Half",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer_cut_half.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer_half,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer_half,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local box_slope_outer_half_raised = {
 | 
				
			||||||
 | 
						type = "fixed",
 | 
				
			||||||
 | 
						fixed = {
 | 
				
			||||||
 | 
							{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.125, -0.25, 0.25, 0.25, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.25, 0, 0, 0.375, 0.5},
 | 
				
			||||||
 | 
							{-0.5, 0.375, 0.25, -0.25, 0.5, 0.5}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer_half_raised", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer_half_raised",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer Half Raised",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer_half_raised.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer_half_raised,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer_half_raised,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("slope_outer_cut_half_raised", {
 | 
				
			||||||
 | 
						name_format = "slope_%s_outer_cut_half_raised",
 | 
				
			||||||
 | 
						description = "@1 Slope Outer Cut Half Raised",
 | 
				
			||||||
 | 
						shape_groups = {slope = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "mesh",
 | 
				
			||||||
 | 
						mesh = "moreblocks_slope_outer_cut_half_raised.obj",
 | 
				
			||||||
 | 
						collision_box = box_slope_outer_half_raised,
 | 
				
			||||||
 | 
						selection_box = box_slope_outer_half_raised,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										136
									
								
								stairsplus/shapes/stairs.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								stairsplus/shapes/stairs.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					stairsplus.api.register_shape("stair", {
 | 
				
			||||||
 | 
						name_format = "stair_%s",
 | 
				
			||||||
 | 
						description = "@1 Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 6,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
								{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_half", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_half",
 | 
				
			||||||
 | 
						description = "@1 Half Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0, 0, 0.5},
 | 
				
			||||||
 | 
								{-0.5, 0, 0, 0, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_right_half", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_right_half",
 | 
				
			||||||
 | 
						description = "@1 Right Half Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 3,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{0, -0.5, -0.5, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
								{0, 0, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_inner", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_inner",
 | 
				
			||||||
 | 
						description = "@1 Inner Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 5,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
								{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
								{-0.5, 0, -0.5, 0, 0.5, 0},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_outer", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_outer",
 | 
				
			||||||
 | 
						description = "@1 Outer Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1, common = 1},
 | 
				
			||||||
 | 
						eighths = 5,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
 | 
				
			||||||
 | 
								{-0.5, 0, 0, 0, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_alt_1", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_alt_1",
 | 
				
			||||||
 | 
						description = "@1 1/16 Alt Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.0625, -0.5, 0.5, 0, 0},
 | 
				
			||||||
 | 
								{-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_alt_2", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_alt_2",
 | 
				
			||||||
 | 
						description = "@1 1/8 Alt Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 1,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.125, -0.5, 0.5, 0, 0},
 | 
				
			||||||
 | 
								{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_alt_4", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_alt_4",
 | 
				
			||||||
 | 
						description = "@1 1/4 Alt Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 2,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.25, -0.5, 0.5, 0, 0},
 | 
				
			||||||
 | 
								{-0.5, 0.25, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stairsplus.api.register_shape("stair_alt_8", {
 | 
				
			||||||
 | 
						name_format = "stair_%s_alt_8",
 | 
				
			||||||
 | 
						aliases = {"stair_%s_alt"},
 | 
				
			||||||
 | 
						description = "@1 1/2 Alt Stair",
 | 
				
			||||||
 | 
						shape_groups = {stair = 1},
 | 
				
			||||||
 | 
						eighths = 4,
 | 
				
			||||||
 | 
						drawtype = "nodebox",
 | 
				
			||||||
 | 
						node_box = {
 | 
				
			||||||
 | 
							type = "fixed",
 | 
				
			||||||
 | 
							fixed = {
 | 
				
			||||||
 | 
								{-0.5, -0.5, -0.5, 0.5, 0, 0},
 | 
				
			||||||
 | 
								{-0.5, 0, 0, 0.5, 0.5, 0.5},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: slab definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Node will be called <modname>:slab_<subname>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_slab(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_slab(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slab"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slab"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slab(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slab"])
 | 
					 | 
				
			||||||
	for alternate, shape in pairs(defs) do
 | 
					 | 
				
			||||||
		stairsplus.register_single("slab", alternate, shape, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: slope definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Node will be called <modname>:slope_<subname>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_slope(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_slope(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slope"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slope"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_slope(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["slope"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		stairsplus.register_single("slope", alternate, def, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
--[[
 | 
					 | 
				
			||||||
More Blocks: stair definitions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
 | 
					 | 
				
			||||||
Licensed under the zlib license. See LICENSE.md for more information.
 | 
					 | 
				
			||||||
--]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Node will be called <modname>:stair_<subname>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function register_stair(modname, subname, recipeitem, groups, images, description, drop, light)
 | 
					 | 
				
			||||||
	stairsplus:register_stair(modname, subname, recipeitem, {
 | 
					 | 
				
			||||||
		groups = groups,
 | 
					 | 
				
			||||||
		tiles = images,
 | 
					 | 
				
			||||||
		description = description,
 | 
					 | 
				
			||||||
		drop = drop,
 | 
					 | 
				
			||||||
		light_source = light,
 | 
					 | 
				
			||||||
		sounds = moreblocks.node_sound_stone_defaults(),
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["stair"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["stair"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		minetest.register_alias_force(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stairsplus:register_stair(modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	local defs = table.copy(stairsplus.defs["stair"])
 | 
					 | 
				
			||||||
	for alternate, def in pairs(defs) do
 | 
					 | 
				
			||||||
		stairsplus.register_single("stair", alternate, def, modname, subname, recipeitem, fields)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	circular_saw.known_nodes[recipeitem] = {modname, subname}
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
							
								
								
									
										8
									
								
								stairsplus/util.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								stairsplus/util.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					stairsplus.util = {
 | 
				
			||||||
 | 
						table_set_all = function(t, other_table)
 | 
				
			||||||
 | 
							for key, value in pairs(other_table) do
 | 
				
			||||||
 | 
								t[key] = value
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
							return t
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user