recipes added

This commit is contained in:
Joachim Stolberg 2019-03-29 20:20:51 +01:00
parent f5537b1818
commit 68be1d80d4
6 changed files with 177 additions and 24 deletions

View File

@ -34,7 +34,7 @@ end
local function formspec1(pos, mem)
mem.running = mem.running or false
local cmnd = mem.running and "stop;"..I("Stop") or "start;"..I("Start")
local cmnd = mem.running and "stop;"..I("Return") or "start;"..I("Launch")
return "size[10,8]"..
default.gui_bg..
default.gui_bg_img..
@ -55,7 +55,7 @@ end
local function formspec2(pos, mem)
mem.running = mem.running or false
local cmnd = mem.running and "stop;"..I("Stop") or "start;"..I("Start")
local cmnd = mem.running and "stop;"..I("Return") or "start;"..I("Launch")
local output = M(pos):get_string("output")
output = minetest.formspec_escape(output)
return "size[10,8]"..
@ -95,12 +95,6 @@ local function start_robot(pos)
local meta = minetest.get_meta(pos)
local number = meta:get_string("number")
-- print("start_robot")
-- if not check_fuel(pos, meta) then
-- local number = meta:get_string("number")
-- meta:set_string("infotext", "Robot Base "..number..": no fuel")
-- return false
-- end
mem.running = true
meta:set_string("formspec", formspec1(pos, mem))
reset_robot(pos, mem)
@ -142,20 +136,53 @@ local function on_receive_fields(pos, formname, fields, player)
meta:set_string("formspec", formspec1(pos, mem))
elseif fields.tab == "2" then
meta:set_string("formspec", formspec2(pos, mem))
elseif fields.start == I("Start") then
elseif fields.start == I("Launch") then
start_robot(pos)
elseif fields.stop == I("Stop") then
elseif fields.stop == I("Return") then
signs_bot.stop_robot(pos, mem)
end
end
local function allow_metadata_inventory(pos, listname, index, stack, player)
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local mem = tubelib2.get_mem(pos)
if mem.running then
return 0
end
local name = stack:get_name()
if minetest.get_item_group(name, "sign_bot_sign") ~= 1 then
return 0
end
return stack:get_count()
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local mem = tubelib2.get_mem(pos)
if mem.running then
return 0
end
return stack:get_count()
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local mem = tubelib2.get_mem(pos)
if mem.running then
return 0
end
if from_list ~= to_list then
return 0
end
return count
end
minetest.register_node("signs_bot:box", {
description = I("Signs Bot Box"),
stack_max = 1,
@ -189,8 +216,9 @@ minetest.register_node("signs_bot:box", {
end,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory,
allow_metadata_inventory_take = allow_metadata_inventory,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take,
allow_metadata_inventory_move = allow_metadata_inventory_move,
on_dig = function(pos, node, puncher, pointed_thing)
if minetest.is_protected(pos, puncher:get_player_name()) then
@ -214,9 +242,12 @@ minetest.register_node("signs_bot:box", {
})
--minetest.register_craft({
-- type = "shapeless",
-- output = "signs_bot:robot",
-- recipe = {"smartline:controller"}
--})
minetest.register_craft({
output = "signs_bot:box",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"basic_materials:gear_steel", "default:mese_crystal", "basic_materials:gear_steel"},
{"default:tin_ingot", "basic_materials:silicon", "default:tin_ingot"}
}
})

View File

@ -57,3 +57,12 @@ minetest.register_node("signs_bot:bot_flap", {
groups = {choppy = 2, oddly_breakable_by_hand = 2, wood = 1, sign_bot_sign = 1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "signs_bot:bot_flap",
recipe = {
{"signs_bot:sign_cmnd", "group:wood", "default:steel_ingot"},
{"", "", ""},
{"", "", ""}
}
})

View File

@ -32,7 +32,9 @@ local formspec = "size[8,7.3]"..
"list[context;temp;3,1;1,1;]"..
"label[0.3,2;"..I("Output:").."]"..
"list[context;outp;3,2;1,1;]"..
"label[4.5,1;"..I("Template is the\nprogrammed sign\nto be copied").."]"..
"label[4,0;"..I("1. Place one sign to be\n used as template.\n")..
I("2. Add 'command signs' to\n the input inventory.\n")..
I("3. Take the copies\n from the output inventory.").."]"..
"list[current_player;main;0,3.5;8,4;]"..
"listring[context;inp]"..
"listring[current_player;main]"..
@ -40,7 +42,23 @@ local formspec = "size[8,7.3]"..
"listring[context;outp]"
local function allow_metadata_inventory(pos, listname, index, stack, player)
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
if listname == "outp" then
return 0
end
if minetest.get_item_group(stack:get_name(), "sign_bot_sign") ~= 1 then
return 0
end
if listname == "temp" then
return 1
end
return stack:get_count()
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
@ -100,8 +118,8 @@ minetest.register_node("signs_bot:duplicator", {
meta:set_string("formspec", formspec)
end,
allow_metadata_inventory_put = allow_metadata_inventory,
allow_metadata_inventory_take = allow_metadata_inventory,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_put = on_metadata_inventory_put,
can_dig = function(pos, player)
@ -119,3 +137,13 @@ minetest.register_node("signs_bot:duplicator", {
sounds = default.node_sound_metal_defaults(),
})
minetest.register_craft({
output = "signs_bot:duplicator",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"", "basic_materials:gear_steel", ""},
{"default:tin_ingot", "", "default:tin_ingot"}
}
})

View File

@ -62,12 +62,12 @@ local function switch_sign_changer(pos, new_idx)
local param2 = minetest.get_node(pos).param2
local sign = lib.dig_sign(pos1)
if sign then
M(pos):set_int("sign_param2", param2)
M(pos):set_int("sign_param2_"..old_idx, param2)
put_inv_sign(pos, old_idx, sign)
end
sign = get_inv_sign(pos, new_idx)
if sign:get_count() == 1 then
lib.place_sign(pos1, sign, M(pos):get_int("sign_param2"))
lib.place_sign(pos1, sign, M(pos):get_int("sign_param2_"..new_idx))
end
end
@ -271,3 +271,30 @@ minetest.register_node("signs_bot:connector", {
node_placement_prediction = "",
stack_max = 1,
})
minetest.register_craft({
output = "signs_bot:changer1",
recipe = {
{"", "", ""},
{"dye:yellow", "group:wood", "dye:black"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}
}
})
minetest.register_craft({
output = "signs_bot:bot_sensor",
recipe = {
{"", "", ""},
{"dye:black", "group:wood", "dye:yellow"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}
}
})
minetest.register_craft({
output = "signs_bot:connector",
recipe = {
{"basic_materials:plastic_strip", "dye:black", ""},
{"", "basic_materials:silicon", ""},
{"", "", "basic_materials:plastic_strip"}
}
})

View File

@ -133,6 +133,9 @@ minetest.register_node("signs_bot:sign_cmnd", {
end,
on_receive_fields = function(pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then
return
end
local meta = minetest.get_meta(pos)
if fields.check then
check_and_store(pos, meta, fields)
@ -271,3 +274,13 @@ function signs_bot.trash_sign(base_pos, robot_pos, param2, slot)
end
return false
end
minetest.register_craft({
output = "signs_bot:sign_cmnd 4",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", "dye:yellow"},
{"", "", ""}
}
})

View File

@ -73,6 +73,15 @@ register_sign({
image = "signs_bot_sign_right.png",
})
minetest.register_craft({
output = "signs_bot:sign_right 6",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", "dye:black"},
{"", "", ""}
}
})
register_sign({
name = "sign_left",
description = I('Sign "turn left"'),
@ -80,6 +89,15 @@ register_sign({
image = "signs_bot_sign_left.png",
})
minetest.register_craft({
output = "signs_bot:sign_left 6",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", ""},
{"dye:black", "", ""}
}
})
register_sign({
name = "sign_take",
description = I('Sign "take item"'),
@ -87,6 +105,15 @@ register_sign({
image = "signs_bot_sign_take.png",
})
minetest.register_craft({
output = "signs_bot:sign_take 6",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", ""},
{"", "dye:black", ""}
}
})
register_sign({
name = "sign_add",
description = I('Sign "add item"'),
@ -94,9 +121,27 @@ register_sign({
image = "signs_bot_sign_add.png",
})
minetest.register_craft({
output = "signs_bot:sign_add 6",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", ""},
{"", "", "dye:black"}
}
})
register_sign({
name = "sign_stop",
description = I('Sign "stop"'),
commands = "stop",
image = "signs_bot_sign_stop.png",
})
minetest.register_craft({
output = "signs_bot:sign_stop 6",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:black", "default:stick", "dye:yellow"},
{"", "", ""}
}
})