recipes added
This commit is contained in:
parent
f5537b1818
commit
68be1d80d4
67
basis.lua
67
basis.lua
@ -34,7 +34,7 @@ end
|
|||||||
|
|
||||||
local function formspec1(pos, mem)
|
local function formspec1(pos, mem)
|
||||||
mem.running = mem.running or false
|
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]"..
|
return "size[10,8]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
@ -55,7 +55,7 @@ end
|
|||||||
|
|
||||||
local function formspec2(pos, mem)
|
local function formspec2(pos, mem)
|
||||||
mem.running = mem.running or false
|
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")
|
local output = M(pos):get_string("output")
|
||||||
output = minetest.formspec_escape(output)
|
output = minetest.formspec_escape(output)
|
||||||
return "size[10,8]"..
|
return "size[10,8]"..
|
||||||
@ -95,12 +95,6 @@ local function start_robot(pos)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local number = meta:get_string("number")
|
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
|
mem.running = true
|
||||||
meta:set_string("formspec", formspec1(pos, mem))
|
meta:set_string("formspec", formspec1(pos, mem))
|
||||||
reset_robot(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))
|
meta:set_string("formspec", formspec1(pos, mem))
|
||||||
elseif fields.tab == "2" then
|
elseif fields.tab == "2" then
|
||||||
meta:set_string("formspec", formspec2(pos, mem))
|
meta:set_string("formspec", formspec2(pos, mem))
|
||||||
elseif fields.start == I("Start") then
|
elseif fields.start == I("Launch") then
|
||||||
start_robot(pos)
|
start_robot(pos)
|
||||||
elseif fields.stop == I("Stop") then
|
elseif fields.stop == I("Return") then
|
||||||
signs_bot.stop_robot(pos, mem)
|
signs_bot.stop_robot(pos, mem)
|
||||||
end
|
end
|
||||||
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
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
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()
|
return stack:get_count()
|
||||||
end
|
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", {
|
minetest.register_node("signs_bot:box", {
|
||||||
description = I("Signs Bot Box"),
|
description = I("Signs Bot Box"),
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
@ -189,8 +216,9 @@ minetest.register_node("signs_bot:box", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
|
|
||||||
on_dig = function(pos, node, puncher, pointed_thing)
|
on_dig = function(pos, node, puncher, pointed_thing)
|
||||||
if minetest.is_protected(pos, puncher:get_player_name()) then
|
if minetest.is_protected(pos, puncher:get_player_name()) then
|
||||||
@ -214,9 +242,12 @@ minetest.register_node("signs_bot:box", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
--minetest.register_craft({
|
minetest.register_craft({
|
||||||
-- type = "shapeless",
|
output = "signs_bot:box",
|
||||||
-- output = "signs_bot:robot",
|
recipe = {
|
||||||
-- recipe = {"smartline:controller"}
|
{"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"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -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},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, wood = 1, sign_bot_sign = 1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "signs_bot:bot_flap",
|
||||||
|
recipe = {
|
||||||
|
{"signs_bot:sign_cmnd", "group:wood", "default:steel_ingot"},
|
||||||
|
{"", "", ""},
|
||||||
|
{"", "", ""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -32,7 +32,9 @@ local formspec = "size[8,7.3]"..
|
|||||||
"list[context;temp;3,1;1,1;]"..
|
"list[context;temp;3,1;1,1;]"..
|
||||||
"label[0.3,2;"..I("Output:").."]"..
|
"label[0.3,2;"..I("Output:").."]"..
|
||||||
"list[context;outp;3,2;1,1;]"..
|
"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;]"..
|
"list[current_player;main;0,3.5;8,4;]"..
|
||||||
"listring[context;inp]"..
|
"listring[context;inp]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
@ -40,7 +42,23 @@ local formspec = "size[8,7.3]"..
|
|||||||
"listring[context;outp]"
|
"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
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
@ -100,8 +118,8 @@ minetest.register_node("signs_bot:duplicator", {
|
|||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
on_metadata_inventory_put = on_metadata_inventory_put,
|
on_metadata_inventory_put = on_metadata_inventory_put,
|
||||||
|
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
@ -119,3 +137,13 @@ minetest.register_node("signs_bot:duplicator", {
|
|||||||
sounds = default.node_sound_metal_defaults(),
|
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"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
31
logic.lua
31
logic.lua
@ -62,12 +62,12 @@ local function switch_sign_changer(pos, new_idx)
|
|||||||
local param2 = minetest.get_node(pos).param2
|
local param2 = minetest.get_node(pos).param2
|
||||||
local sign = lib.dig_sign(pos1)
|
local sign = lib.dig_sign(pos1)
|
||||||
if sign then
|
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)
|
put_inv_sign(pos, old_idx, sign)
|
||||||
end
|
end
|
||||||
sign = get_inv_sign(pos, new_idx)
|
sign = get_inv_sign(pos, new_idx)
|
||||||
if sign:get_count() == 1 then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -271,3 +271,30 @@ minetest.register_node("signs_bot:connector", {
|
|||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
stack_max = 1,
|
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"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -133,6 +133,9 @@ minetest.register_node("signs_bot:sign_cmnd", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
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)
|
local meta = minetest.get_meta(pos)
|
||||||
if fields.check then
|
if fields.check then
|
||||||
check_and_store(pos, meta, fields)
|
check_and_store(pos, meta, fields)
|
||||||
@ -271,3 +274,13 @@ function signs_bot.trash_sign(base_pos, robot_pos, param2, slot)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "signs_bot:sign_cmnd 4",
|
||||||
|
recipe = {
|
||||||
|
{"group:wood", "default:stick", "group:wood"},
|
||||||
|
{"dye:yellow", "default:stick", "dye:yellow"},
|
||||||
|
{"", "", ""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
45
signs.lua
45
signs.lua
@ -73,6 +73,15 @@ register_sign({
|
|||||||
image = "signs_bot_sign_right.png",
|
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({
|
register_sign({
|
||||||
name = "sign_left",
|
name = "sign_left",
|
||||||
description = I('Sign "turn left"'),
|
description = I('Sign "turn left"'),
|
||||||
@ -80,6 +89,15 @@ register_sign({
|
|||||||
image = "signs_bot_sign_left.png",
|
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({
|
register_sign({
|
||||||
name = "sign_take",
|
name = "sign_take",
|
||||||
description = I('Sign "take item"'),
|
description = I('Sign "take item"'),
|
||||||
@ -87,6 +105,15 @@ register_sign({
|
|||||||
image = "signs_bot_sign_take.png",
|
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({
|
register_sign({
|
||||||
name = "sign_add",
|
name = "sign_add",
|
||||||
description = I('Sign "add item"'),
|
description = I('Sign "add item"'),
|
||||||
@ -94,9 +121,27 @@ register_sign({
|
|||||||
image = "signs_bot_sign_add.png",
|
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({
|
register_sign({
|
||||||
name = "sign_stop",
|
name = "sign_stop",
|
||||||
description = I('Sign "stop"'),
|
description = I('Sign "stop"'),
|
||||||
commands = "stop",
|
commands = "stop",
|
||||||
image = "signs_bot_sign_stop.png",
|
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"},
|
||||||
|
{"", "", ""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user