mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-03 08:30:40 +02:00
almost done, mostly documentation left
This commit is contained in:
@ -1,12 +1,56 @@
|
||||
--[[
|
||||
More Blocks: circular saw
|
||||
|
||||
Copyright © 2011-2020 Hugo Locurcio, Sokomine and contributors.
|
||||
Licensed under the zlib license. See LICENSE.md for more information.
|
||||
--]]
|
||||
local api = stairsplus.api
|
||||
local station = api.station
|
||||
|
||||
local S = stairsplus.S
|
||||
local cm = stairsplus.resources.craft_materials
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
local formspec_style = stairsplus.resources.formspec_style
|
||||
|
||||
local function update_infotext(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
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
|
||||
|
||||
local function build_formspec()
|
||||
return ([[
|
||||
size[12,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;9,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(
|
||||
formspec_style, S("Nodes"), F(S("Microblocks")), F(S("Input")), F(S("Max")), F(S("Set"))
|
||||
)
|
||||
end
|
||||
|
||||
api.register_station("stairsplus:circular_saw", {"legacy"}, {
|
||||
description = S("Circular Saw"),
|
||||
@ -34,17 +78,31 @@ api.register_station("stairsplus:circular_saw", {"legacy"}, {
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
sounds = stairsplus.resources.sounds.wood,
|
||||
|
||||
build_formspec = build_formspec,
|
||||
update_infotext = update_infotext,
|
||||
})
|
||||
|
||||
if cm.steel_ingot then
|
||||
if stairsplus.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
|
||||
local cm = stairsplus.resources.craft_materials
|
||||
|
||||
if stairsplus.settings.circular_saw_crafting and cm.steel_ingot then
|
||||
minetest.register_craft({
|
||||
output = "stairsplus:circular_saw",
|
||||
recipe = {
|
||||
{"", cm.steel_ingot, ""},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"group:wood", "", "group:wood"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Upgrade legacy saws",
|
||||
name = "stairsplus:replace_legacy_saws",
|
||||
nodenames = {"stairsplus:circular_saw"},
|
||||
run_at_every_load = false,
|
||||
action = function(pos, node)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
def.on_construct(pos)
|
||||
end,
|
||||
})
|
||||
|
Reference in New Issue
Block a user