mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-02-21 12:30:24 +01:00
circular saw works now; still need to do compatabilit and testing
This commit is contained in:
parent
b9eed16713
commit
a2c8e2db8e
@ -37,7 +37,11 @@ local function register_stairs(name, def)
|
||||
end
|
||||
|
||||
if moreblocks.has.stairsplus then
|
||||
stairsplus.api.register_group(itemstring, "common")
|
||||
if stairsplus.settings.legacy_mode then
|
||||
stairsplus.api.register_group(itemstring, "legacy")
|
||||
else
|
||||
stairsplus.api.register_group(itemstring, "common")
|
||||
end
|
||||
|
||||
elseif moreblocks.has.stairs then
|
||||
stairs.register_stair_and_slab(
|
||||
|
@ -3,8 +3,8 @@ local api = stairsplus.api
|
||||
local table_is_empty = stairsplus.util.table_is_empty
|
||||
|
||||
function api.register_alias_single(old_node, new_node, shape)
|
||||
local old_shaped_node = api.format_name(shape, old_node)
|
||||
local new_shaped_node = api.format_name(shape, new_node)
|
||||
local old_shaped_node = api.format_name(old_node, shape)
|
||||
local new_shaped_node = api.format_name(new_node, shape)
|
||||
|
||||
minetest.register_alias(old_shaped_node, new_shaped_node)
|
||||
end
|
||||
@ -16,8 +16,8 @@ function api.register_alias_all(old_node, new_node)
|
||||
end
|
||||
|
||||
function api.register_alias_force_single(old_node, new_node, shape)
|
||||
local old_shaped_node = api.format_name(shape, old_node)
|
||||
local new_shaped_node = api.format_name(shape, new_node)
|
||||
local old_shaped_node = api.format_name(old_node, shape)
|
||||
local new_shaped_node = api.format_name(new_node, shape)
|
||||
|
||||
minetest.register_alias_force(old_shaped_node, new_shaped_node)
|
||||
|
||||
|
@ -25,14 +25,63 @@ local function scale_light(light_source, shape_def)
|
||||
return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
|
||||
end
|
||||
|
||||
function api.format_name(shape, node)
|
||||
function api.format_name(node, shape)
|
||||
local mod, name = node:match("^([^:]+):(.*)$")
|
||||
local shape_def = api.registered_shapes[shape]
|
||||
return ("%s:%s"):format(mod, shape_def.name_format:format(name))
|
||||
end
|
||||
|
||||
local function check_node_validity(node_def)
|
||||
if node_def.type ~= "node" then
|
||||
error(("cannot register non-node %q w/ stairsplus"):format(node))
|
||||
end
|
||||
|
||||
if (
|
||||
node_def.drawtype == "airlike" or
|
||||
node_def.drawtype == "liquid" or
|
||||
node_def.drawtype == "flowingliquid" or
|
||||
node_def.drawtype == "torchlike" or
|
||||
node_def.drawtype == "signlike" or
|
||||
node_def.drawtype == "plantlike" or
|
||||
node_def.drawtype == "firelike" or
|
||||
node_def.drawtype == "fencelike" or
|
||||
node_def.drawtype == "raillike" or
|
||||
node_def.drawtype == "nodebox" or
|
||||
node_def.drawtype == "mesh" or
|
||||
node_def.drawtype == "plantlike_rooted"
|
||||
) then
|
||||
error(("cannot register %q w/ drawtype %q w/ stairsplus"):format(node, node_def.drawtype))
|
||||
end
|
||||
|
||||
if (
|
||||
node_def.paramtype2 == "flowingliquid" or
|
||||
node_def.paramtype2 == "wallmounted" or
|
||||
node_def.paramtype2 == "leveled" or
|
||||
node_def.paramtype2 == "degrotate" or
|
||||
node_def.paramtype2 == "meshoptions" or
|
||||
node_def.paramtype2 == "color" or
|
||||
node_def.paramtype2 == "colorfacedir" or
|
||||
node_def.paramtype2 == "colorwallmounted" or
|
||||
node_def.paramtype2 == "glasslikeliquidlevel" or
|
||||
node_def.paramtype2 == "colordegrotate"
|
||||
) then
|
||||
error(("cannot register %q w/ paramtype2 %q w/ stairsplus"):format(node, node_def.paramtype2))
|
||||
end
|
||||
end
|
||||
|
||||
function api.register_single(node, shape, overrides)
|
||||
local node_def = table.copy(minetest.registered_nodes[node])
|
||||
check_node_validity(node_def)
|
||||
|
||||
if shape ~= "micro_8" and not (api.nodes_by_shape.micro_8 or {})[node] then
|
||||
-- always make sure a microblock exists
|
||||
api.register_single(node, "micro_8", overrides)
|
||||
end
|
||||
|
||||
if (api.nodes_by_shape[shape] or {})[node] then
|
||||
return -- already registered
|
||||
end
|
||||
|
||||
local shape_def = api.registered_shapes[shape]
|
||||
|
||||
local groups = {
|
||||
@ -46,35 +95,47 @@ function api.register_single(node, shape, overrides)
|
||||
|
||||
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),
|
||||
tiles = node_def.tiles,
|
||||
overlay_tiles = node_def.overlay_tiles,
|
||||
use_texture_alpha = node_def.use_texture_alpha,
|
||||
color = node_def.color,
|
||||
stack_max = node_def.stack_max,
|
||||
sound = node_def.sound,
|
||||
is_ground_content = node_def.is_ground_content,
|
||||
walkable = node_def.walkable,
|
||||
pointable = node_def.pointable,
|
||||
diggable = node_def.diggable,
|
||||
climbable = node_def.climbable,
|
||||
move_resistance = node_def.move_resistance,
|
||||
groups = groups,
|
||||
}
|
||||
|
||||
local tiles = node_def.tiles
|
||||
if #tiles > 1 and (node_def.drawtype or ""):match("glass") then
|
||||
def.tiles = {tiles[1]}
|
||||
else
|
||||
def.tiles = tiles
|
||||
if (node_def.drawtype or ""):match("glass") then
|
||||
if #def.tiles > 1 then
|
||||
def.tiles = {def.tiles[1]}
|
||||
end
|
||||
|
||||
if def.overlay_tiles and #def.overlay_tiles > 1 then
|
||||
def.overlay_tiles = {def.overlay_tiles[1]}
|
||||
end
|
||||
end
|
||||
|
||||
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)
|
||||
local item = api.get_shaped_node(node_def.drop, shape)
|
||||
if item then
|
||||
def.drop = item
|
||||
end
|
||||
@ -82,7 +143,7 @@ function api.register_single(node, shape, overrides)
|
||||
|
||||
table_set_all(def, overrides or {})
|
||||
|
||||
local shaped_name = api.format_name(shape, node)
|
||||
local shaped_name = api.format_name(node, shape)
|
||||
minetest.register_node(":" .. shaped_name, def)
|
||||
|
||||
if shape_def.aliases then
|
||||
@ -122,6 +183,12 @@ function api.register_group(node, group, overrides)
|
||||
end
|
||||
end
|
||||
|
||||
function api.register_groups(node, groups, overrides)
|
||||
for _, group in ipairs(groups) do
|
||||
api.register_group(node, group, overrides)
|
||||
end
|
||||
end
|
||||
|
||||
function api.get_shapes(node)
|
||||
return table_sort_keys(api.shapes_by_node[node])
|
||||
end
|
||||
@ -130,11 +197,11 @@ function api.get_shapes_hash(node)
|
||||
return api.shapes_by_node[node]
|
||||
end
|
||||
|
||||
function api.get_shaped_name(node, shape_or_item)
|
||||
function api.get_shaped_node(node, shape_or_item)
|
||||
local t = ItemStack(shape_or_item):to_table()
|
||||
|
||||
if api.registered_shapes[t.name] then
|
||||
t.name = api.format_name(t.name, node)
|
||||
t.name = api.format_name(node, t.name)
|
||||
|
||||
elseif t.name == "node" then
|
||||
t.name = node
|
||||
@ -143,9 +210,33 @@ function api.get_shaped_name(node, shape_or_item)
|
||||
return ItemStack(t):to_string()
|
||||
end
|
||||
|
||||
function api.get_micronode(node)
|
||||
return api.format_name(node, "micro_8")
|
||||
end
|
||||
|
||||
api.node_by_shaped_node = {}
|
||||
api.shape_by_shaped_node = {}
|
||||
|
||||
function api.get_node_of_shaped_node(shaped_node)
|
||||
return api.node_by_shaped_node[shaped_node]
|
||||
end
|
||||
|
||||
function api.get_shape_of_shaped_node(shaped_node)
|
||||
return api.shape_by_shaped_node[shaped_node]
|
||||
end
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
stairsplus.log("info", "registering schema crafts")
|
||||
for node in pairs(api.shapes_by_node) do
|
||||
for node, shapes in pairs(api.shapes_by_node) do
|
||||
api.register_schema_crafts_for_node(node)
|
||||
|
||||
for shape in pairs(shapes) do
|
||||
local shaped_node = api.format_name(node, shape)
|
||||
api.node_by_shaped_node[shaped_node] = node
|
||||
api.shape_by_shaped_node[shaped_node] = shape
|
||||
end
|
||||
|
||||
api.node_by_shaped_node[node] = node
|
||||
api.shape_by_shaped_node[node] = "node"
|
||||
end
|
||||
end)
|
||||
|
@ -131,14 +131,14 @@ 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)
|
||||
recipe.output = api.get_shaped_node(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)
|
||||
replacement[i] = api.get_shaped_node(node, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -147,7 +147,7 @@ local function register_for_schema(node, shapes, schema)
|
||||
if recipe.type == "shapeless" then
|
||||
for i, item in ipairs(recipe.recipe) do
|
||||
if shapes[item] then
|
||||
recipe.recipe[i] = api.get_shaped_name(node, item)
|
||||
recipe.recipe[i] = api.get_shaped_node(node, item)
|
||||
end
|
||||
end
|
||||
|
||||
@ -155,7 +155,7 @@ local function register_for_schema(node, shapes, schema)
|
||||
for _, row in ipairs(schema.recipe) do
|
||||
for i, item in ipairs(row) do
|
||||
if shapes[item] then
|
||||
row[i] = api.get_shaped_name(node, item)
|
||||
row[i] = api.get_shaped_node(node, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -202,9 +202,9 @@ function api.register_crafts_for_shapes(def)
|
||||
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),
|
||||
output = api.get_shaped_node(def.output, shape),
|
||||
recipe = api.get_shaped_node(def.recipe, shape),
|
||||
cooktime = def.cooktime(api.registered_shapes[shape].eighths),
|
||||
})
|
||||
end
|
||||
|
||||
@ -214,8 +214,8 @@ function api.register_crafts_for_shapes(def)
|
||||
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),
|
||||
recipe = api.get_shaped_node(def.recipe, shape),
|
||||
burntime = def.burntime(api.registered_shapes[shape].eighths),
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -3,222 +3,278 @@
|
||||
local api = stairsplus.api
|
||||
|
||||
local S = stairsplus.S
|
||||
|
||||
function api.register_station(name, shape_groups, def)
|
||||
minetest.register_node(name, def)
|
||||
end
|
||||
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
local circular_saw = {}
|
||||
local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99
|
||||
|
||||
local station = {}
|
||||
|
||||
-- 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
|
||||
local function get_cost(shaped_node)
|
||||
if shaped_node == "" 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
|
||||
local shape = api.get_shape_of_shaped_node(shaped_node)
|
||||
if shape == "node" then
|
||||
return 8
|
||||
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
|
||||
local shape_def = api.registered_shapes[shape]
|
||||
return shape_def and shape_def.eighths
|
||||
end
|
||||
|
||||
local function get_current_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local input_stack = inv:get_stack("input", 1)
|
||||
if not input_stack:is_empty() then
|
||||
return input_stack:get_name()
|
||||
end
|
||||
|
||||
local micro_stack = inv:get_stack("micro", 1)
|
||||
if not micro_stack:is_empty() then
|
||||
return api.get_node_of_shaped_node(micro_stack:get_name())
|
||||
end
|
||||
|
||||
local recycle_stack = inv:get_stack("recycle", 1)
|
||||
if not recycle_stack:is_empty() then
|
||||
return api.get_node_of_shaped_node(recycle_stack:get_name())
|
||||
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:
|
||||
function station.update_infotext(pos)
|
||||
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
|
||||
local parts = {}
|
||||
if station.can_dig(pos) then
|
||||
table.insert(parts, S("Circular Saw is empty"))
|
||||
end
|
||||
|
||||
local owner = meta:get_string("owner")
|
||||
if owner ~= "" then
|
||||
table.insert(parts, S("(owned by @1)", meta:get_string("owner")))
|
||||
end
|
||||
|
||||
meta:set_string("infotext", table.concat(parts, " "))
|
||||
end
|
||||
|
||||
function circular_saw.allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
-- Player has taken something out of the box or placed something inside
|
||||
-- that amounts to count microblocks:
|
||||
function station.update_inventory(pos, taken_stack)
|
||||
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)
|
||||
local node = get_current_node(pos)
|
||||
|
||||
-- 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)
|
||||
if not node then
|
||||
for i = 1, inv:get_size("output") do
|
||||
inv:set_stack("output", i, ItemStack())
|
||||
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()
|
||||
local input_stack = inv:get_stack("input", 1)
|
||||
local micro_stack = inv:get_stack("micro", 1)
|
||||
local recycle_stack = inv:get_stack("recycle", 1)
|
||||
|
||||
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())
|
||||
local current_value = 8 * input_stack:get_count() + micro_stack:get_count()
|
||||
local new_value = current_value + get_cost(recycle_stack:get_name()) * recycle_stack:get_count()
|
||||
if taken_stack then
|
||||
new_value = new_value - get_cost(taken_stack:get_name()) * taken_stack:get_count()
|
||||
end
|
||||
local new_micros = new_value % 8
|
||||
local new_blocks = math.floor(new_value / 8)
|
||||
|
||||
inv:set_stack("input", 1, ItemStack({name = node, count = new_blocks}))
|
||||
inv:set_stack("micro", 1, ItemStack({name = api.get_micronode(node), count = new_micros}))
|
||||
inv:set_stack("recycle", 1, ItemStack())
|
||||
|
||||
if new_value == 0 then
|
||||
for i = 1, inv:get_size("output") do
|
||||
inv:set_stack("output", i, "")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local valid_shapes = api.shapes_by_node[node]
|
||||
local shape_groups = minetest.registered_nodes[minetest.get_node(pos).name]._stairsplus_shape_groups
|
||||
|
||||
local max_offered = meta:get_int("max_offered")
|
||||
|
||||
local i = 1
|
||||
for _, group in ipairs(shape_groups) do
|
||||
for _, shape in ipairs(api.shapes_by_group[group]) do
|
||||
if valid_shapes[shape] then
|
||||
local shape_def = api.registered_shapes[shape]
|
||||
local shaped_node = api.format_name(node, shape)
|
||||
local stack_max = math.min(max_offered, ItemStack(shaped_node):get_stack_max())
|
||||
local count = math.min(stack_max, math.floor(new_value / shape_def.eighths))
|
||||
local stack
|
||||
if count > 0 then
|
||||
stack = ItemStack({name = shaped_node, count = count})
|
||||
else
|
||||
stack = ""
|
||||
end
|
||||
inv:set_stack("output", i, stack)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for j = i, inv:get_size("output") do
|
||||
inv:set_stack("output", j, "")
|
||||
end
|
||||
-- The recycle field plays no role here since it is processed immediately.
|
||||
end
|
||||
|
||||
function circular_saw.on_construct(pos)
|
||||
-- The amount of items offered per shape can be configured:
|
||||
function station.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_int("max_offered", max)
|
||||
-- Update to show the correct number of items:
|
||||
station.update_inventory(pos)
|
||||
station.update_infotext(pos)
|
||||
end
|
||||
end
|
||||
|
||||
-- Moving the inventory of the station 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 station.allow_metadata_inventory_move()
|
||||
return 0
|
||||
end
|
||||
|
||||
function station.allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if listname ~= "recycle" then
|
||||
return 0
|
||||
end
|
||||
|
||||
local shaped_node = stack:get_name()
|
||||
local node = api.get_node_of_shaped_node(shaped_node)
|
||||
local shape = api.get_shape_of_shaped_node(shaped_node)
|
||||
|
||||
if not (node and shape) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local current_node = get_current_node(pos)
|
||||
|
||||
if current_node and node ~= current_node then
|
||||
return 0
|
||||
end
|
||||
|
||||
local count = stack:get_count()
|
||||
local cost = get_cost(shaped_node)
|
||||
|
||||
local input_stack = inv:get_stack("input", 1)
|
||||
local micro_stack = inv:get_stack("micro", 1)
|
||||
|
||||
local current_value = 8 * input_stack:get_count() + micro_stack:get_count()
|
||||
local max_value = 8 * ItemStack(node):get_stack_max() + 7
|
||||
|
||||
local available_value = max_value - current_value
|
||||
local available_count = math.floor(available_value / cost)
|
||||
|
||||
return math.min(count, available_count)
|
||||
end
|
||||
|
||||
function station.on_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
station.update_inventory(pos)
|
||||
station.update_infotext(pos)
|
||||
end
|
||||
|
||||
function station.on_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if listname == "output" then
|
||||
station.update_inventory(pos, stack)
|
||||
else
|
||||
station.update_inventory(pos)
|
||||
end
|
||||
|
||||
station.update_infotext(pos)
|
||||
end
|
||||
|
||||
function station.build_formspec()
|
||||
local fancy_inv = ""
|
||||
if stairsplus.has.default 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"))
|
||||
return ([[
|
||||
size[11,10]
|
||||
%s
|
||||
label[0,0;%s]
|
||||
list[current_name;input;1.7,0;1,1;]
|
||||
label[0,1;%s]
|
||||
list[current_name;micro;1.7,1;1,1;]
|
||||
label[0,2;%s]
|
||||
list[current_name;recycle;1.7,2;1,1;]
|
||||
field[0.3,3.5;1,1;max_offered;%s:;${max_offered}]
|
||||
button[1,3.2;1.7,1;Set;%s]
|
||||
|
||||
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;recycle]
|
||||
|
||||
listring[current_name;micro]
|
||||
listring[current_player;main]
|
||||
|
||||
listring[current_name;input]
|
||||
listring[current_player;main]
|
||||
]]):format(
|
||||
fancy_inv, S("Nodes"), F(S("Microblocks")), F(S("Input")), F(S("Max")), F(S("Set"))
|
||||
)
|
||||
end
|
||||
|
||||
function station.on_construct(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
meta:set_string("formspec", station.build_formspec())
|
||||
meta:set_string("max_offered", default_stack_max) -- How many items of this kind are offered by default?
|
||||
|
||||
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)
|
||||
station.update_infotext(pos)
|
||||
end
|
||||
|
||||
function circular_saw.can_dig(pos, player)
|
||||
function station.after_place_node(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if minetest.is_player(placer) then
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
end
|
||||
end
|
||||
|
||||
function station.can_dig(pos)
|
||||
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
|
||||
return inv:is_empty("input") and inv:is_empty("micro")
|
||||
end
|
||||
|
||||
function api.register_station(name, shape_groups, def)
|
||||
def.after_place_node = def.after_place_node or station.after_place_node
|
||||
def.on_construct = def.on_construct or station.on_construct
|
||||
def.can_dig = def.can_dig or station.can_dig
|
||||
def.on_receive_fields = def.on_receive_fields or station.on_receive_fields
|
||||
def.allow_metadata_inventory_move = def.allow_metadata_inventory_move or station.allow_metadata_inventory_move
|
||||
def.allow_metadata_inventory_put = def.allow_metadata_inventory_put or station.allow_metadata_inventory_put
|
||||
def.allow_metadata_inventory_take = def.allow_metadata_inventory_take or station.allow_metadata_inventory_take
|
||||
def.on_metadata_inventory_put = def.on_metadata_inventory_put or station.on_metadata_inventory_put
|
||||
def.on_metadata_inventory_take = def.on_metadata_inventory_take or station.on_metadata_inventory_take
|
||||
def._stairsplus_shape_groups = shape_groups
|
||||
|
||||
minetest.register_node(name, def)
|
||||
end
|
||||
|
||||
api.station = station
|
||||
|
@ -8,13 +8,7 @@ local api = stairsplus.api
|
||||
local S = stairsplus.S
|
||||
local cm = stairsplus.resources.craft_materials
|
||||
|
||||
api.register_station("stairsplus:circular_saw", {
|
||||
micros = 1,
|
||||
panels = 1,
|
||||
slabs = 1,
|
||||
slopes = 1,
|
||||
stairs = 1,
|
||||
}, {
|
||||
api.register_station("stairsplus:circular_saw", {"legacy"}, {
|
||||
description = S("Circular Saw"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -3,8 +3,14 @@
|
||||
-- existing servers
|
||||
local api = stairsplus.api
|
||||
|
||||
local legacy_mode = stairsplus.settings.legacy_mode
|
||||
|
||||
function stairsplus:register_all(modname, subname, recipeitem, fields)
|
||||
api.register_all(recipeitem, fields)
|
||||
if legacy_mode then
|
||||
api.register_group(recipeitem, "legacy", fields)
|
||||
else
|
||||
api.register_group(recipeitem, "common", fields)
|
||||
end
|
||||
|
||||
local old_name = ("%s:%s"):format(modname, subname)
|
||||
if old_name ~= recipeitem then
|
||||
|
@ -1,7 +1,7 @@
|
||||
stairsplus.api.register_shape("micro_1", {
|
||||
name_format = "micro_%s_1",
|
||||
description = "@1 1/16 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -13,7 +13,7 @@ stairsplus.api.register_shape("micro_1", {
|
||||
stairsplus.api.register_shape("micro_2", {
|
||||
name_format = "micro_%s_2",
|
||||
description = "@1 1/8 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -25,7 +25,7 @@ stairsplus.api.register_shape("micro_2", {
|
||||
stairsplus.api.register_shape("micro_4", {
|
||||
name_format = "micro_%s_4",
|
||||
description = "@1 1/4 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -38,7 +38,7 @@ 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},
|
||||
shape_groups = {micro = 1, obligatory = 1, common = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -50,7 +50,7 @@ stairsplus.api.register_shape("micro_8", {
|
||||
stairsplus.api.register_shape("micro_12", {
|
||||
name_format = "micro_%s_12",
|
||||
description = "@1 3/4 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -62,7 +62,7 @@ stairsplus.api.register_shape("micro_12", {
|
||||
stairsplus.api.register_shape("micro_14", {
|
||||
name_format = "micro_%s_14",
|
||||
description = "@1 7/8 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -74,7 +74,7 @@ stairsplus.api.register_shape("micro_14", {
|
||||
stairsplus.api.register_shape("micro_15", {
|
||||
name_format = "micro_%s_5",
|
||||
description = "@1 15/16 Microblock",
|
||||
shape_groups = {micro = 1},
|
||||
shape_groups = {micro = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
stairsplus.api.register_shape("panel_1", {
|
||||
name_format = "panel_%s_1",
|
||||
description = "@1 1/16 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -13,7 +13,7 @@ stairsplus.api.register_shape("panel_1", {
|
||||
stairsplus.api.register_shape("panel_2", {
|
||||
name_format = "panel_%s_2",
|
||||
description = "@1 1/8 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -25,7 +25,7 @@ stairsplus.api.register_shape("panel_2", {
|
||||
stairsplus.api.register_shape("panel_4", {
|
||||
name_format = "panel_%s_4",
|
||||
description = "@1 1/4 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -38,7 +38,7 @@ 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},
|
||||
shape_groups = {panel = 1, common = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -50,7 +50,7 @@ stairsplus.api.register_shape("panel_8", {
|
||||
stairsplus.api.register_shape("panel_12", {
|
||||
name_format = "panel_%s_12",
|
||||
description = "@1 3/4 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -62,7 +62,7 @@ stairsplus.api.register_shape("panel_12", {
|
||||
stairsplus.api.register_shape("panel_14", {
|
||||
name_format = "panel_%s_14",
|
||||
description = "@1 7/8 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -74,7 +74,7 @@ stairsplus.api.register_shape("panel_14", {
|
||||
stairsplus.api.register_shape("panel_15", {
|
||||
name_format = "panel_%s_15",
|
||||
description = "@1 15/16 Panel",
|
||||
shape_groups = {panel = 1},
|
||||
shape_groups = {panel = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
stairsplus.api.register_shape("slab_1", {
|
||||
name_format = "slab_%s_1",
|
||||
description = "@1 1/16 Slab",
|
||||
shape_groups = {slab = 1, common = 1},
|
||||
shape_groups = {slab = 1, common = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -13,7 +13,7 @@ stairsplus.api.register_shape("slab_1", {
|
||||
stairsplus.api.register_shape("slab_2", {
|
||||
name_format = "slab_%s_2",
|
||||
description = "@1 1/8 Slab",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -26,7 +26,7 @@ stairsplus.api.register_shape("slab_4", {
|
||||
name_format = "slab_%s_4",
|
||||
aliases = {"slab_%s_quarter"},
|
||||
description = "@1 1/4 Slab",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -39,7 +39,7 @@ 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},
|
||||
shape_groups = {slab = 1, common = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -52,7 +52,7 @@ 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},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -64,7 +64,7 @@ stairsplus.api.register_shape("slab_12", {
|
||||
stairsplus.api.register_shape("slab_14", {
|
||||
name_format = "slab_%s_14",
|
||||
description = "@1 7/8 Slab",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 7,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -76,7 +76,7 @@ stairsplus.api.register_shape("slab_14", {
|
||||
stairsplus.api.register_shape("slab_15", {
|
||||
name_format = "slab_%s_15",
|
||||
description = "@1 15/16 Slab",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 7,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -90,7 +90,7 @@ stairsplus.api.register_shape("slab_15", {
|
||||
stairsplus.api.register_shape("slab_two_sides", {
|
||||
name_format = "slab_%s_two_sides",
|
||||
description = "@1 1/16 Slab Two Sides",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -105,7 +105,7 @@ stairsplus.api.register_shape("slab_two_sides", {
|
||||
stairsplus.api.register_shape("slab_three_sides", {
|
||||
name_format = "slab_%s_three_sides",
|
||||
description = "@1 1/16 Slab Three Sides",
|
||||
shape_groups = {slab = 1},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -121,7 +121,7 @@ stairsplus.api.register_shape("slab_three_sides", {
|
||||
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},
|
||||
shape_groups = {slab = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -11,7 +11,7 @@ local box_slope = {
|
||||
stairsplus.api.register_shape("slope", {
|
||||
name_format = "slope_%s",
|
||||
description = "@1 Slope",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope.obj",
|
||||
@ -32,7 +32,7 @@ local box_slope_half = {
|
||||
stairsplus.api.register_shape("slope_half", {
|
||||
name_format = "slope_%s_half",
|
||||
description = "@1 1/2 Slope",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_half.obj",
|
||||
@ -53,7 +53,7 @@ local box_slope_half_raised = {
|
||||
stairsplus.api.register_shape("slope_half_raised", {
|
||||
name_format = "slope_%s_half_raised",
|
||||
description = "@1 1/2 Slope Raised",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_half_raised.obj",
|
||||
@ -77,7 +77,7 @@ local box_slope_inner = {
|
||||
stairsplus.api.register_shape("slope_inner", {
|
||||
name_format = "slope_%s_inner",
|
||||
description = "@1 Slope Inner",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner.obj",
|
||||
@ -88,7 +88,7 @@ stairsplus.api.register_shape("slope_inner", {
|
||||
stairsplus.api.register_shape("slope_inner_cut", {
|
||||
name_format = "slope_%s_inner_cut",
|
||||
description = "@1 Slope Inner Cut",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner_cut.obj",
|
||||
@ -112,7 +112,7 @@ local box_slope_inner_half = {
|
||||
stairsplus.api.register_shape("slope_inner_half", {
|
||||
name_format = "slope_%s_inner_half",
|
||||
description = "@1 Slope Inner Half",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner_half.obj",
|
||||
@ -123,7 +123,7 @@ stairsplus.api.register_shape("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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner_cut_half.obj",
|
||||
@ -147,7 +147,7 @@ local box_slope_inner_half_raised = {
|
||||
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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner_half_raised.obj",
|
||||
@ -158,7 +158,7 @@ stairsplus.api.register_shape("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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 7,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_inner_cut_half_raised.obj",
|
||||
@ -181,7 +181,7 @@ local box_slope_outer = {
|
||||
stairsplus.api.register_shape("slope_outer", {
|
||||
name_format = "slope_%s_outer",
|
||||
description = "@1 Slope Outer",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer.obj",
|
||||
@ -192,7 +192,7 @@ stairsplus.api.register_shape("slope_outer", {
|
||||
stairsplus.api.register_shape("slope_outer_cut", {
|
||||
name_format = "slope_%s_outer_cut",
|
||||
description = "@1 Slope Outer Cut",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer_cut.obj",
|
||||
@ -203,7 +203,7 @@ stairsplus.api.register_shape("slope_outer_cut", {
|
||||
stairsplus.api.register_shape("slope_cut", {
|
||||
name_format = "slope_%s_cut",
|
||||
description = "@1 Slope Cut",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_cut.obj",
|
||||
@ -224,7 +224,7 @@ local box_slope_outer_half = {
|
||||
stairsplus.api.register_shape("slope_outer_half", {
|
||||
name_format = "slope_%s_outer_half",
|
||||
description = "@1 Slope Outer Half",
|
||||
shape_groups = {slope = 1, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer_half.obj",
|
||||
@ -235,7 +235,7 @@ stairsplus.api.register_shape("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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer_cut_half.obj",
|
||||
@ -256,7 +256,7 @@ local box_slope_outer_half_raised = {
|
||||
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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer_half_raised.obj",
|
||||
@ -267,7 +267,7 @@ stairsplus.api.register_shape("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, common = 1},
|
||||
shape_groups = {slope = 1, common = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairsplus_slope_outer_cut_half_raised.obj",
|
||||
|
@ -1,7 +1,7 @@
|
||||
stairsplus.api.register_shape("stair", {
|
||||
name_format = "stair_%s",
|
||||
description = "@1 Stair",
|
||||
shape_groups = {stair = 1, common = 1},
|
||||
shape_groups = {stair = 1, common = 1, legacy = 1},
|
||||
eighths = 6,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -16,7 +16,7 @@ stairsplus.api.register_shape("stair", {
|
||||
stairsplus.api.register_shape("stair_half", {
|
||||
name_format = "stair_%s_half",
|
||||
description = "@1 Half Stair",
|
||||
shape_groups = {stair = 1},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -31,7 +31,7 @@ stairsplus.api.register_shape("stair_half", {
|
||||
stairsplus.api.register_shape("stair_right_half", {
|
||||
name_format = "stair_%s_right_half",
|
||||
description = "@1 Right Half Stair",
|
||||
shape_groups = {stair = 1},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 3,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -46,7 +46,7 @@ stairsplus.api.register_shape("stair_right_half", {
|
||||
stairsplus.api.register_shape("stair_inner", {
|
||||
name_format = "stair_%s_inner",
|
||||
description = "@1 Inner Stair",
|
||||
shape_groups = {stair = 1, common = 1},
|
||||
shape_groups = {stair = 1, common = 1, legacy = 1},
|
||||
eighths = 5,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -62,7 +62,7 @@ stairsplus.api.register_shape("stair_inner", {
|
||||
stairsplus.api.register_shape("stair_outer", {
|
||||
name_format = "stair_%s_outer",
|
||||
description = "@1 Outer Stair",
|
||||
shape_groups = {stair = 1, common = 1},
|
||||
shape_groups = {stair = 1, common = 1, legacy = 1},
|
||||
eighths = 5,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -77,7 +77,7 @@ stairsplus.api.register_shape("stair_outer", {
|
||||
stairsplus.api.register_shape("stair_alt_1", {
|
||||
name_format = "stair_%s_alt_1",
|
||||
description = "@1 1/16 Alt Stair",
|
||||
shape_groups = {stair = 1},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -92,7 +92,7 @@ stairsplus.api.register_shape("stair_alt_1", {
|
||||
stairsplus.api.register_shape("stair_alt_2", {
|
||||
name_format = "stair_%s_alt_2",
|
||||
description = "@1 1/8 Alt Stair",
|
||||
shape_groups = {stair = 1},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 1,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -107,7 +107,7 @@ stairsplus.api.register_shape("stair_alt_2", {
|
||||
stairsplus.api.register_shape("stair_alt_4", {
|
||||
name_format = "stair_%s_alt_4",
|
||||
description = "@1 1/4 Alt Stair",
|
||||
shape_groups = {stair = 1},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 2,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -123,7 +123,7 @@ 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},
|
||||
shape_groups = {stair = 1, legacy = 1},
|
||||
eighths = 4,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user