mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-12 13:00:24 +02:00
nonfunctional checkpoint
This commit is contained in:
29
stairsplus/.luacheckrc
Normal file
29
stairsplus/.luacheckrc
Normal file
@ -0,0 +1,29 @@
|
||||
std = "lua51+luajit+minetest+stairsplus"
|
||||
unused_args = false
|
||||
max_line_length = 120
|
||||
|
||||
stds.minetest = {
|
||||
read_globals = {
|
||||
"DIR_DELIM",
|
||||
"minetest",
|
||||
"core",
|
||||
"dump",
|
||||
"vector",
|
||||
"nodeupdate",
|
||||
"VoxelManip",
|
||||
"VoxelArea",
|
||||
"PseudoRandom",
|
||||
"ItemStack",
|
||||
"default",
|
||||
"table",
|
||||
}
|
||||
}
|
||||
|
||||
stds.stairsplus = {
|
||||
globals = {
|
||||
"stairsplus",
|
||||
},
|
||||
read_globals = {
|
||||
"default",
|
||||
},
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
# API documentation for Stairs+
|
||||
|
||||
* `stairsplus:register_all(modname, subname, recipeitem, fields)`
|
||||
Registers a stair, slab, panel, microblock, and any other types of
|
||||
nodes to be added in the future.
|
||||
This also registers the node with the circular saw.
|
||||
Example:
|
||||
```lua
|
||||
stairsplus:register_all("moreblocks", "wood", "default:wood", {
|
||||
description = "Wooden",
|
||||
tiles = {"default_wood.png"},
|
||||
groups = {oddly_breakabe_by_hand=1},
|
||||
sounds = moreblocks.node_sound_wood_defaults(),
|
||||
})
|
||||
```
|
||||
Registers a stair, slab, panel, microblock, and any other types of
|
||||
nodes to be added in the future.
|
||||
This also registers the node with the circular saw.
|
||||
Example:
|
||||
```lua
|
||||
stairsplus:register_all("moreblocks", "wood", "default:wood", {
|
||||
description = "Wooden",
|
||||
tiles = {"default_wood.png"},
|
||||
groups = {oddly_breakabe_by_hand=1},
|
||||
sounds = moreblocks.node_sound_wood_defaults(),
|
||||
})
|
||||
```
|
||||
|
||||
The following register only a particular type of microblock.
|
||||
You will probably never want to use them directly:
|
||||
|
||||
@ -79,4 +80,5 @@ The subset table should have the following format:
|
||||
{ "stair", "_alt_4" },
|
||||
}
|
||||
```
|
||||
|
||||
You can remove entries as needed.
|
||||
|
2
stairsplus/aliases.lua
Normal file
2
stairsplus/aliases.lua
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
minetest.register_alias("moreblocks:circular_saw", "stairsplus:circular_saw")
|
482
stairsplus/circular_saw.lua
Normal file
482
stairsplus/circular_saw.lua
Normal file
@ -0,0 +1,482 @@
|
||||
--[[
|
||||
More Blocks: circular saw
|
||||
|
||||
Copyright © 2011-2020 Hugo Locurcio, Sokomine and contributors.
|
||||
Licensed under the zlib license. See LICENSE.md for more information.
|
||||
--]]
|
||||
|
||||
local S = moreblocks.S
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
local circular_saw = {}
|
||||
|
||||
circular_saw.known_stairs = setmetatable({}, {
|
||||
__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"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4, -0.5, -0.4, -0.25, 0.25, -0.25}, -- Leg
|
||||
{0.25, -0.5, 0.25, 0.4, 0.25, 0.4}, -- Leg
|
||||
{-0.4, -0.5, 0.25, -0.25, 0.25, 0.4}, -- Leg
|
||||
{0.25, -0.5, -0.4, 0.4, 0.25, -0.25}, -- Leg
|
||||
{-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- Tabletop
|
||||
{-0.01, 0.4375, -0.125, 0.01, 0.5, 0.125}, -- Saw blade (top)
|
||||
{-0.01, 0.375, -0.1875, 0.01, 0.4375, 0.1875}, -- Saw blade (bottom)
|
||||
{-0.25, -0.0625, -0.25, 0.25, 0.25, 0.25}, -- Motor case
|
||||
},
|
||||
},
|
||||
tiles = {"moreblocks_circular_saw_top.png",
|
||||
"moreblocks_circular_saw_bottom.png",
|
||||
"moreblocks_circular_saw_side.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
sounds = moreblocks.node_sound_wood_defaults(),
|
||||
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
|
@ -121,7 +121,7 @@ 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 desc_base = S("@1 " .. descriptions[category], fields.description)
|
||||
local def = {}
|
||||
|
||||
if category ~= "slab" then
|
||||
@ -153,7 +153,7 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam
|
||||
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},
|
||||
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
|
||||
@ -161,7 +161,9 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam
|
||||
type = "fixed",
|
||||
fixed = info,
|
||||
}
|
||||
def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end)
|
||||
def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b)
|
||||
return a:upper() .. b
|
||||
end)
|
||||
end
|
||||
else
|
||||
def.description = desc_base
|
||||
@ -173,9 +175,9 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam
|
||||
end
|
||||
|
||||
if fields.drop and not (type(fields.drop) == "table") then
|
||||
def.drop = modname.. ":" .. category .. "_" .. fields.drop .. alternate
|
||||
def.drop = modname .. ":" .. category .. "_" .. fields.drop .. alternate
|
||||
end
|
||||
|
||||
minetest.register_node(":" ..modname.. ":" .. category .. "_" .. subname .. alternate, def)
|
||||
minetest.register_node(":" .. modname .. ":" .. category .. "_" .. subname .. alternate, def)
|
||||
stairsplus.register_recipes(category, alternate, modname, subname, recipeitem)
|
||||
end
|
||||
|
14
stairsplus/crafting.lua
Normal file
14
stairsplus/crafting.lua
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
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
|
@ -9,30 +9,30 @@ 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}
|
||||
{-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},
|
||||
{-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},
|
||||
{-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},
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,30 +82,30 @@ local 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}
|
||||
{-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}
|
||||
{-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}
|
||||
{-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}
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,18 +207,18 @@ stairsplus.defs = {
|
||||
["_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 }
|
||||
{-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 }
|
||||
{-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 }
|
||||
{-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"] = {
|
||||
@ -402,8 +402,8 @@ stairsplus.defs = {
|
||||
},
|
||||
}
|
||||
|
||||
for type,a in pairs(stairsplus.defs) do
|
||||
for name,b in pairs(stairsplus.defs[type]) do
|
||||
table.insert(stairsplus.shapes_list, { type .. "_", name })
|
||||
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
|
||||
|
@ -7,7 +7,7 @@ Licensed under the zlib license. See LICENSE.md for more information.
|
||||
|
||||
-- Nodes will be called <modname>:{stair,slab,panel,micro,slope}_<subname>
|
||||
|
||||
local modpath = minetest.get_modpath("moreblocks").. "/stairsplus"
|
||||
local modpath = minetest.get_modpath("moreblocks") .. "/stairsplus"
|
||||
|
||||
stairsplus = {}
|
||||
stairsplus.expect_infinite_stacks = false
|
||||
@ -15,7 +15,7 @@ stairsplus.expect_infinite_stacks = false
|
||||
stairsplus.shapes_list = {}
|
||||
|
||||
if
|
||||
not minetest.get_modpath("unified_inventory")
|
||||
not minetest.get_modpath("unified_inventory")
|
||||
and minetest.settings:get_bool("creative_mode")
|
||||
then
|
||||
stairsplus.expect_infinite_stacks = true
|
||||
|
33
stairsplus/locale/stairsplus.de.tr
Normal file
33
stairsplus/locale/stairsplus.de.tr
Normal file
@ -0,0 +1,33 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# German translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# Xanthin, 2014.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=Kreissäge
|
||||
Input material=Ausgangs-@nmaterial
|
||||
Left-over=Rest
|
||||
Max=Anzahl
|
||||
Recycle output=Wiederver-@nwerten
|
||||
Set=Ok
|
||||
owned by @1=gehört @1
|
||||
Circular Saw is empty=Kreissäge ist leer
|
||||
Circular Saw is working on @1=Kreissäge arbeitet mit @1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=@1mikroblock
|
||||
@1 Slab=@1platte
|
||||
@1 Slope=@1neigung
|
||||
@1 Panel=@1paneel
|
||||
@1 Stairs=@1treppe
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
34
stairsplus/locale/stairsplus.es.tr
Normal file
34
stairsplus/locale/stairsplus.es.tr
Normal file
@ -0,0 +1,34 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# Spanish translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# kaeza, 2013.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
# Carlos Barraza 2020.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=Sierra circular
|
||||
Input material=Material de@nentrada
|
||||
Left-over=Sobrante
|
||||
Max=Maximo
|
||||
Recycle output=Reciclar@nsalida
|
||||
Set=Establecer
|
||||
owned by @1=protegido por @1
|
||||
Circular Saw is empty=La sierra circular está vacia
|
||||
Circular Saw is working on @1=Sierra circular trabajando en @1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=Microbloque de @1
|
||||
@1 Slab=Losa de @1
|
||||
@1 Slope=Pendiente de @1
|
||||
@1 Panel=Panel de @1
|
||||
@1 Stairs=Escalera de @1
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=Concreto
|
||||
Cement=Cemento
|
||||
Brass Block=Bloque de latón
|
34
stairsplus/locale/stairsplus.fr.tr
Normal file
34
stairsplus/locale/stairsplus.fr.tr
Normal file
@ -0,0 +1,34 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# French translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# Hugo Locurcio <hugo.locurcio@hugo.pro>, 2013-2019.
|
||||
# Jat15, 2013.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=Scie circulaire
|
||||
Input material=Matériau@nd'entrée
|
||||
Left-over=Reste
|
||||
Max=Max
|
||||
Recycle output=Sortie à@nrecycler
|
||||
Set=Définir
|
||||
owned by @1=propriété de @1
|
||||
Circular Saw is empty=Scie circulaire vide
|
||||
Circular Saw is working on @1=Scie circulaire manipulant @1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=Microbloc en @1
|
||||
@1 Slab=Demi-dalle en @1
|
||||
@1 Slope=Pente en @1
|
||||
@1 Panel=Barre en @1
|
||||
@1 Stairs=Escaliers en @1
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
33
stairsplus/locale/stairsplus.it.tr
Normal file
33
stairsplus/locale/stairsplus.it.tr
Normal file
@ -0,0 +1,33 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# Italian translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# Emon, 2016.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=Sega circolare
|
||||
Input material=Materiale@niniziale
|
||||
Left-over=Scarto
|
||||
Max=Max.
|
||||
Recycle output=Ricicla@nfinale
|
||||
Set=Imp.
|
||||
owned by @1=
|
||||
Circular Saw is empty=Sega circolare, vuota
|
||||
Circular Saw is working on @1=Sega circolare, in funzione su @1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=Microblocco @1
|
||||
@1 Slab=Lastra - @1
|
||||
@1 Slope=
|
||||
@1 Panel=Pannello - @1
|
||||
@1 Stairs=Scale - @1
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
33
stairsplus/locale/stairsplus.pl.tr
Normal file
33
stairsplus/locale/stairsplus.pl.tr
Normal file
@ -0,0 +1,33 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# Polish translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# mat9117, 2019
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=Piła tarczowa
|
||||
Input material=wejście@nmateriał
|
||||
Left-over=Resztki
|
||||
Max=Maks
|
||||
Recycle output=Przetwarzanie@nWyjście
|
||||
Set=Ustaw
|
||||
owned by @1=Należy do @1
|
||||
Circular Saw is empty=Piła tarczowa jest pusta
|
||||
Circular Saw is working on @1=Piła tarczowa pracuje na @1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=@1 Mikroblok
|
||||
@1 Slab=@1 Płyta
|
||||
@1 Slope=@1 Spad
|
||||
@1 Panel=@1 Panel
|
||||
@1 Stairs=@1 Schody
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
34
stairsplus/locale/stairsplus.ru.tr
Normal file
34
stairsplus/locale/stairsplus.ru.tr
Normal file
@ -0,0 +1,34 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# Russian translation for MOREBLOCKS minetest mod.
|
||||
# Copyright (C) 2018 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the MOREBLOCKS package.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
#
|
||||
#, fuzzy
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=циркулярная пила
|
||||
Input material=Входной@nматериал
|
||||
Left-over=Остатки
|
||||
Max=Кол.
|
||||
Recycle output=Пере-@nобработка
|
||||
Set=ОК
|
||||
owned by @1=принадлежит @1
|
||||
Circular Saw is empty=циркулярная пила пустая
|
||||
Circular Saw is working on @1=циркулярная пила, @1 в обработке
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=@1 (микроблок)
|
||||
@1 Slab=@1 (плита)
|
||||
@1 Slope=@1 (наклон)
|
||||
@1 Panel=@1 (панель)
|
||||
@1 Stairs=@1 (лестница)
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
27
stairsplus/locale/stairsplus.template.tr
Normal file
27
stairsplus/locale/stairsplus.template.tr
Normal file
@ -0,0 +1,27 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=
|
||||
Input material=
|
||||
Left-over=
|
||||
Max=
|
||||
Recycle output=
|
||||
Set=
|
||||
owned by @1=
|
||||
Circular Saw is empty=
|
||||
Circular Saw is working on @1=
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=
|
||||
@1 Slab=
|
||||
@1 Slope=
|
||||
@1 Panel=
|
||||
@1 Stairs=
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
32
stairsplus/locale/stairsplus.zh_CN.tr
Normal file
32
stairsplus/locale/stairsplus.zh_CN.tr
Normal file
@ -0,0 +1,32 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# zh_CN translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# IFRFSX <IFRFSX@protonmail.com>, 2020.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=圆锯
|
||||
Input material=输入@n材料
|
||||
Left-over=剩余材料
|
||||
Max=最大值
|
||||
Recycle output=回收@n输出物
|
||||
Set=设置
|
||||
owned by @1=属于@1所有
|
||||
Circular Saw is empty=圆锯是空的
|
||||
Circular Saw is working on @1=圆锯正在加工@1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=@1小方块
|
||||
@1 Slab=@1台阶
|
||||
@1 Slope=@1斜坡
|
||||
@1 Panel=@1嵌板
|
||||
@1 Stairs=@1楼梯
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
32
stairsplus/locale/stairsplus.zh_TW.tr
Normal file
32
stairsplus/locale/stairsplus.zh_TW.tr
Normal file
@ -0,0 +1,32 @@
|
||||
# textdomain: moreblocks
|
||||
|
||||
# zh_TW translation for More Blocks.
|
||||
# Copyright © 2011-2020 Hugo Locurcio and contributors
|
||||
# This file is distributed under the same license as the More Blocks package.
|
||||
# IFRFSX <IFRFSX@protonmail.com>, 2020.
|
||||
|
||||
#: circular_saw.lua
|
||||
|
||||
Circular Saw=圓鋸
|
||||
Input material=輸入@n材料
|
||||
Left-over=剩餘材料
|
||||
Max=最大值
|
||||
Recycle output=回收@n輸出物
|
||||
Set=設置
|
||||
owned by @1=屬於@1所有
|
||||
Circular Saw is empty=圓鋸是空的
|
||||
Circular Saw is working on @1=圓鋸正在加工@1
|
||||
|
||||
#: stairsplus/common.lua
|
||||
|
||||
@1 Microblock=@1小方塊
|
||||
@1 Slab=@1臺階
|
||||
@1 Slope=@1斜坡
|
||||
@1 Panel=@1嵌板
|
||||
@1 Stairs=@1樓梯
|
||||
|
||||
#: stairsplus/registrations.lua
|
||||
|
||||
Concrete=
|
||||
Cement=
|
||||
Brass Block=
|
4
stairsplus/mod.conf
Normal file
4
stairsplus/mod.conf
Normal file
@ -0,0 +1,4 @@
|
||||
name = stairsplus
|
||||
title = Stairs+
|
||||
description = Microblock API
|
||||
optional_depends = basic_materials, default, gloopblocks, stairs, technic, prefab, wool
|
27
stairsplus/node_with_stairs.lua
Normal file
27
stairsplus/node_with_stairs.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local function is_glasslike(def)
|
||||
return #def.tiles > 1 and (
|
||||
def.drawtype == "glasslike_framed" or
|
||||
def.drawtype == "glasslike_framed_optional"
|
||||
)
|
||||
end
|
||||
|
||||
function moreblocks.api.register_node_and_stairs(mod, name, def)
|
||||
local itemstring = ("%s:%s"):format(mod, name)
|
||||
minetest.register_node(itemstring, def)
|
||||
|
||||
-- Use the primary tile for all sides of cut glasslike nodes.
|
||||
-- This makes them easier to see
|
||||
if is_glasslike(def) then
|
||||
def = table.copy(def)
|
||||
def.tiles = {def.tiles[1]}
|
||||
end
|
||||
|
||||
stairsplus:register_all(mod, name, itemstring, {
|
||||
description = def.description,
|
||||
groups = def.groups,
|
||||
tiles = def.tiles,
|
||||
sunlight_propagates = def.sunlight_propagates,
|
||||
light_source = def.light_source,
|
||||
sounds = def.sounds,
|
||||
})
|
||||
end
|
@ -86,7 +86,7 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re
|
||||
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
|
||||
})
|
||||
|
||||
minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname)
|
||||
minetest.register_alias(modname .. ":panel_" .. subname .. "_bottom", modname .. ":panel_" .. subname)
|
||||
elseif category == "slab" then
|
||||
if alternate == "" then
|
||||
minetest.register_craft({
|
||||
@ -156,19 +156,19 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = modname .. ":slab_" .. subname,
|
||||
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
|
||||
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"},
|
||||
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"},
|
||||
recipe = {modname .. ":slope_" .. subname .. "_outer_cut_half", modname .. ":slope_" .. subname .. "_inner_cut_half"},
|
||||
})
|
||||
elseif alternate == "_quarter" then
|
||||
minetest.register_craft({
|
||||
@ -260,87 +260,87 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = recipeitem,
|
||||
recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
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"},
|
||||
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_cut_half"},
|
||||
})
|
||||
end
|
||||
elseif category == "stair" then
|
||||
@ -427,14 +427,14 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re
|
||||
output = modname .. ":stair_" .. subname .. "_alt",
|
||||
recipe = {
|
||||
{modname .. ":panel_" .. subname, ""},
|
||||
{"" , 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},
|
||||
{modname .. ":panel_" .. subname, ""},
|
||||
},
|
||||
})
|
||||
|
@ -75,7 +75,7 @@ if minetest.get_modpath("default") then
|
||||
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
|
||||
minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer")
|
||||
minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner")
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
end
|
||||
end
|
||||
|
||||
@ -93,7 +93,7 @@ if minetest.get_modpath("farming") then
|
||||
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
|
||||
minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer")
|
||||
minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner")
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
end
|
||||
end
|
||||
|
||||
@ -116,28 +116,28 @@ end
|
||||
-- for backwards compatibility
|
||||
|
||||
if minetest.get_modpath("basic_materials") then
|
||||
stairsplus:register_all("technic","concrete","basic_materials:concrete_block",{
|
||||
stairsplus:register_all("technic", "concrete", "basic_materials:concrete_block", {
|
||||
description = S("Concrete"),
|
||||
tiles = {"basic_materials_concrete_block.png",},
|
||||
groups = {cracky=1, level=2, concrete=1},
|
||||
tiles = {"basic_materials_concrete_block.png", },
|
||||
groups = {cracky = 1, level = 2, concrete = 1},
|
||||
sounds = moreblocks.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_alias("prefab:concrete_stair","technic:stair_concrete")
|
||||
minetest.register_alias("prefab:concrete_slab","technic:slab_concrete")
|
||||
minetest.register_alias("prefab:concrete_stair", "technic:stair_concrete")
|
||||
minetest.register_alias("prefab:concrete_slab", "technic:slab_concrete")
|
||||
|
||||
stairsplus:register_all("gloopblocks", "cement", "basic_materials:cement_block", {
|
||||
description = S("Cement"),
|
||||
tiles = {"basic_materials_cement_block.png"},
|
||||
groups = {cracky=2, not_in_creative_inventory=1},
|
||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||
sounds = moreblocks.node_sound_stone_defaults(),
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "brass_block", "basic_materials:brass_block", {
|
||||
description= S("Brass Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"basic_materials_brass_block.png"},
|
||||
description = S("Brass Block"),
|
||||
groups = {cracky = 1, not_in_creative_inventory = 1},
|
||||
tiles = {"basic_materials_brass_block.png"},
|
||||
})
|
||||
|
||||
end
|
||||
@ -158,6 +158,6 @@ minetest.register_lbm({
|
||||
|
||||
})
|
||||
minetest.log('action', "LBM replaced " .. node.name ..
|
||||
" at " .. minetest.pos_to_string(pos))
|
||||
" at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
||||
|
4
stairsplus/settings.lua
Normal file
4
stairsplus/settings.lua
Normal file
@ -0,0 +1,4 @@
|
||||
stairsplus.settings = {
|
||||
in_creative_inventory = minetest.settings:get_bool("stairsplus.in_creative_inventory", false),
|
||||
circular_saw_crafting = minetest.settings:get_bool("stairsplus.circular_saw_crafting", true)
|
||||
}
|
0
stairsplus/settingtypes.txt
Normal file
0
stairsplus/settingtypes.txt
Normal file
Reference in New Issue
Block a user