built on 24/09/2022 11:01:30
This commit is contained in:
parent
641e79e084
commit
f441d7daa5
@ -47,6 +47,12 @@ ta4_jetpack requires the modpack 3d_armor. 3d_armor is itself a modpack and can'
|
|||||||
### History
|
### History
|
||||||
|
|
||||||
|
|
||||||
|
#### 2022-08-17
|
||||||
|
|
||||||
|
Updated Mods:
|
||||||
|
- techage (fix "Invalid field use_texture_alpha" errors)
|
||||||
|
|
||||||
|
|
||||||
#### 2022-08-06
|
#### 2022-08-06
|
||||||
|
|
||||||
Updated Mods:
|
Updated Mods:
|
||||||
|
@ -1 +1 @@
|
|||||||
name = lcdlib
|
name = lcdlib
|
||||||
|
@ -80,7 +80,7 @@ All this testing nodes can be enabled via mod settings `networks_test_enabled =
|
|||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
Copyright (C) 2021 Joachim Stolberg
|
Copyright (C) 2021-2022 Joachim Stolberg
|
||||||
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
|
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
|
||||||
Textures: CC BY-SA 3.0
|
Textures: CC BY-SA 3.0
|
||||||
|
|
||||||
@ -128,3 +128,6 @@ Required: tubelib2
|
|||||||
|
|
||||||
**2022-01-06 V0.11**
|
**2022-01-06 V0.11**
|
||||||
- Support for junction rotation added
|
- Support for junction rotation added
|
||||||
|
|
||||||
|
**2022-09-10 V0.12**
|
||||||
|
- New API function `networks.liquid.get_liquids` added
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
networks = {}
|
networks = {}
|
||||||
|
|
||||||
-- Version for compatibility checks, see readme.md/history
|
-- Version for compatibility checks, see readme.md/history
|
||||||
networks.version = 0.11
|
networks.version = 0.12
|
||||||
|
|
||||||
if not minetest.global_exists("tubelib2") or tubelib2.version < 2.2 then
|
if not minetest.global_exists("tubelib2") or tubelib2.version < 2.2 then
|
||||||
minetest.log("error", "[networks] Networks requires tubelib2 version 2.2 or newer!")
|
minetest.log("error", "[networks] Networks requires tubelib2 version 2.2 or newer!")
|
||||||
|
@ -265,3 +265,31 @@ function networks.liquid.turn_valve_off(pos, tlib2, name_off, name_on)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- Info/Tools
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- Return list of liquids of connected tanks
|
||||||
|
-- Node at pos must be a pump
|
||||||
|
function networks.liquid.get_liquids(pos, tlib2)
|
||||||
|
local tbl = {}
|
||||||
|
for _, dir in ipairs(networks.get_node_connection_dirs(pos, tlib2.tube_type)) do
|
||||||
|
for _,item in ipairs(get_network_table(pos, tlib2, dir, "tank")) do
|
||||||
|
local liq = LQD(item.pos)
|
||||||
|
if liq and liq.peek then
|
||||||
|
local liq_name = liq.peek(item.pos, item.indir)
|
||||||
|
if liq_name then
|
||||||
|
local def = minetest.registered_items[liq_name] or minetest.registered_craftitems[liq_name]
|
||||||
|
if def then
|
||||||
|
tbl[def.description] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local out = {}
|
||||||
|
for k,v in pairs(tbl) do
|
||||||
|
out[#out + 1] = k
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
@ -57,7 +57,8 @@ The mod has an in-game help to all blocks and signs. Therefore, it is highly rec
|
|||||||
The commands are also all described as help in the "Sign command" node.
|
The commands are also all described as help in the "Sign command" node.
|
||||||
All blocks or signs that are set are taken from the bot inventory.
|
All blocks or signs that are set are taken from the bot inventory.
|
||||||
Any blocks or signs removed will be added back to the Bot Inventory.
|
Any blocks or signs removed will be added back to the Bot Inventory.
|
||||||
For all Inventory commands applies: If the inventory stack specified by <slot> is full, so that nothing more can be done, or just empty, so that nothing more can be removed, the next slot will automatically be used.
|
`<slot>` is always the bot internal inventory stack (1..8).
|
||||||
|
For all Inventory commands applies: If the bot inventory stack specified by `<slot>` is full, so that nothing more can be done, or just empty, so that nothing more can be removed, the next slot will automatically be used.
|
||||||
|
|
||||||
move <steps> - to follow one or more steps forward without signs
|
move <steps> - to follow one or more steps forward without signs
|
||||||
cond_move - walk to the next sign and work it off
|
cond_move - walk to the next sign and work it off
|
||||||
@ -69,6 +70,7 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
|
|||||||
pause <sec> - wait one or more seconds
|
pause <sec> - wait one or more seconds
|
||||||
move_up - move up (maximum 2 times)
|
move_up - move up (maximum 2 times)
|
||||||
move_down - move down
|
move_down - move down
|
||||||
|
fall_down - fall into a hole/chasm (up to 10 blocks)
|
||||||
take_item <num> <slot> - take one or more items from a box
|
take_item <num> <slot> - take one or more items from a box
|
||||||
add_item <num> <slot> - put one or more items in a box
|
add_item <num> <slot> - put one or more items in a box
|
||||||
add_fuel <num> <slot> - for furnaces or similar
|
add_fuel <num> <slot> - for furnaces or similar
|
||||||
@ -106,6 +108,20 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
|
|||||||
flame_on - Make fire
|
flame_on - Make fire
|
||||||
flame_off - Put out the fire
|
flame_off - Put out the fire
|
||||||
|
|
||||||
|
#### Techage specific commands
|
||||||
|
|
||||||
|
ignite - Ignite the techage charcoal lighter
|
||||||
|
low_batt <percent> - Turn the bot off if the battery power is below the
|
||||||
|
given value in percent (1..99)
|
||||||
|
jump_low_batt <percent> <label> - Jump to <label> if the battery power is below the
|
||||||
|
given value in percent (1..99)
|
||||||
|
(see "Flow control commands")
|
||||||
|
send_cmnd <receiver> <command> - Send a techage command to a given node.
|
||||||
|
Receiver is addressed by the techage node number.
|
||||||
|
For commands with two or more words, use the '*' character
|
||||||
|
instead of spaces, e.g.: send_cmnd 3465 pull*default:dirt*2
|
||||||
|
|
||||||
|
|
||||||
#### Flow control commands
|
#### Flow control commands
|
||||||
|
|
||||||
jump <label> -- jump command, <label> is a word from the characters a-z or A-Z
|
jump <label> -- jump command, <label> is a word from the characters a-z or A-Z
|
||||||
@ -115,6 +131,16 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
|
|||||||
end -- end of a loop block
|
end -- end of a loop block
|
||||||
call <label> -- call of a function (with return via the command 'return')
|
call <label> -- call of a function (with return via the command 'return')
|
||||||
|
|
||||||
|
#### Further jump commands
|
||||||
|
|
||||||
|
jump_check_item <num> <slot> <label> - Check if there are <num> items in the chest like node.
|
||||||
|
If not, jump to <label>.
|
||||||
|
<slot> is the bot inventory slot (1..8) to specify the item,
|
||||||
|
or 0 for any item.
|
||||||
|
jump_low_batt <percent> <label> - See "Techage specific commands"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Example with a function at the beginning:
|
Example with a function at the beginning:
|
||||||
|
|
||||||
jump main -- jump to the label 'main'
|
jump main -- jump to the label 'main'
|
||||||
@ -149,7 +175,7 @@ Or alternatively with the function at the end:
|
|||||||
return -- end of 'foo'. Jump back
|
return -- end of 'foo'. Jump back
|
||||||
|
|
||||||
### License
|
### License
|
||||||
Copyright (C) 2019-2021 Joachim Stolberg
|
Copyright (C) 2019-2022 Joachim Stolberg
|
||||||
Copyright (C) 2021 Michal 'Micu' Cieslakiewicz (soup commands)
|
Copyright (C) 2021 Michal 'Micu' Cieslakiewicz (soup commands)
|
||||||
Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt
|
Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt
|
||||||
|
|
||||||
@ -185,5 +211,6 @@ optional: farming redo, node_io, doc, techage, minecart, xdecor, compost
|
|||||||
- 2021-08-22 v1.09 * Add soup commands and signs, add aspen sign
|
- 2021-08-22 v1.09 * Add soup commands and signs, add aspen sign
|
||||||
- 2021-09-18 v1.10 * Add techage command 'set <num>' to the Bot Control Unit
|
- 2021-09-18 v1.10 * Add techage command 'set <num>' to the Bot Control Unit
|
||||||
- 2022-03-19 V1.11 * Extend farming (and add ethereal) support (Thanks to nixnoxus)
|
- 2022-03-19 V1.11 * Extend farming (and add ethereal) support (Thanks to nixnoxus)
|
||||||
|
- 2022-09-11 V1.12 * Add commands `jump_low_batt` , `jump_check_item`, and `fall_down`
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Robot basis block
|
Signs Bot: Robot basis block
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -38,7 +38,7 @@ function signs_bot.bot_inv_item_name(pos, slot)
|
|||||||
local name = inv:get_stack("filter", slot):get_name()
|
local name = inv:get_stack("filter", slot):get_name()
|
||||||
if name ~= "" then return name end
|
if name ~= "" then return name end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- put items into the bot inventory and return leftover
|
-- put items into the bot inventory and return leftover
|
||||||
function signs_bot.bot_inv_put_item(pos, slot, items)
|
function signs_bot.bot_inv_put_item(pos, slot, items)
|
||||||
if not items then return end
|
if not items then return end
|
||||||
@ -73,7 +73,7 @@ local function take_items(inv, slot, num)
|
|||||||
else
|
else
|
||||||
inv:set_stack("main", slot, nil)
|
inv:set_stack("main", slot, nil)
|
||||||
local rest = num - stack:get_count()
|
local rest = num - stack:get_count()
|
||||||
local taken = inv:remove_item("main", ItemStack(stack:get_name().." "..rest))
|
local taken = inv:remove_item("main", ItemStack(stack:get_name().." "..rest))
|
||||||
stack:set_count(stack:get_count() + taken:get_count())
|
stack:set_count(stack:get_count() + taken:get_count())
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
@ -124,11 +124,11 @@ local function status(mem)
|
|||||||
return S("charging")
|
return S("charging")
|
||||||
end
|
end
|
||||||
return S("stopped")
|
return S("stopped")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function formspec(pos, mem)
|
local function formspec(pos, mem)
|
||||||
mem.running = mem.running or false
|
mem.running = mem.running or false
|
||||||
local cmnd = mem.running and "stop;"..S("Off") or "start;"..S("On")
|
local cmnd = mem.running and "stop;"..S("Off") or "start;"..S("On")
|
||||||
local bot = not mem.running and "image[0.6,0;1,1;signs_bot_bot_inv.png]" or ""
|
local bot = not mem.running and "image[0.6,0;1,1;signs_bot_bot_inv.png]" or ""
|
||||||
local current_capa = mem.capa or (signs_bot.MAX_CAPA * 0.9)
|
local current_capa = mem.capa or (signs_bot.MAX_CAPA * 0.9)
|
||||||
return "size[9,8.2]"..
|
return "size[9,8.2]"..
|
||||||
@ -209,7 +209,7 @@ local function reset_robot(pos, mem)
|
|||||||
mem.robot_param2 = (minetest.get_node(pos).param2 + 1) % 4
|
mem.robot_param2 = (minetest.get_node(pos).param2 + 1) % 4
|
||||||
mem.robot_pos = lib.next_pos(pos, mem.robot_param2, 1)
|
mem.robot_pos = lib.next_pos(pos, mem.robot_param2, 1)
|
||||||
local pos_below = {x=mem.robot_pos.x, y=mem.robot_pos.y-1, z=mem.robot_pos.z}
|
local pos_below = {x=mem.robot_pos.x, y=mem.robot_pos.y-1, z=mem.robot_pos.z}
|
||||||
signs_bot.place_robot(mem.robot_pos, pos_below, mem.robot_param2)
|
signs_bot.place_robot(mem.robot_pos, pos_below, mem.robot_param2)
|
||||||
end
|
end
|
||||||
|
|
||||||
function signs_bot.start_robot(base_pos)
|
function signs_bot.start_robot(base_pos)
|
||||||
@ -306,7 +306,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
if fields.update then
|
if fields.update then
|
||||||
meta:set_string("formspec", formspec(pos, mem))
|
meta:set_string("formspec", formspec(pos, mem))
|
||||||
elseif fields.config then
|
elseif fields.config then
|
||||||
@ -337,7 +337,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||||||
if listname == "sign" and minetest.get_item_group(name, "sign_bot_sign") ~= 1 then
|
if listname == "sign" and minetest.get_item_group(name, "sign_bot_sign") ~= 1 then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if listname == "main" and bot_inv_item_name(pos, index) and
|
if listname == "main" and bot_inv_item_name(pos, index) and
|
||||||
name ~= bot_inv_item_name(pos, index) then
|
name ~= bot_inv_item_name(pos, index) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
@ -376,7 +376,7 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
|||||||
end
|
end
|
||||||
local inv = M(pos):get_inventory()
|
local inv = M(pos):get_inventory()
|
||||||
local name = inv:get_stack(from_list, from_index):get_name()
|
local name = inv:get_stack(from_list, from_index):get_name()
|
||||||
if to_list == "main" and bot_inv_item_name(pos, to_index) and
|
if to_list == "main" and bot_inv_item_name(pos, to_index) and
|
||||||
name ~= bot_inv_item_name(pos, to_index) then
|
name ~= bot_inv_item_name(pos, to_index) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
@ -388,7 +388,7 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
local drop = "signs_bot:box"
|
local drop = "signs_bot:box"
|
||||||
if minetest.global_exists("techage") then
|
if minetest.global_exists("techage") then
|
||||||
@ -415,7 +415,7 @@ minetest.register_node("signs_bot:box", {
|
|||||||
inv:set_size('sign', 6)
|
inv:set_size('sign', 6)
|
||||||
inv:set_size('filter', 8)
|
inv:set_size('filter', 8)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
if not placer or not placer:is_player() then
|
if not placer or not placer:is_player() then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
@ -448,7 +448,7 @@ minetest.register_node("signs_bot:box", {
|
|||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
|
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return
|
return
|
||||||
@ -460,11 +460,11 @@ minetest.register_node("signs_bot:box", {
|
|||||||
local inv = M(pos):get_inventory()
|
local inv = M(pos):get_inventory()
|
||||||
return inv:is_empty("main") and inv:is_empty("sign")
|
return inv:is_empty("main") and inv:is_empty("sign")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_dig = function(pos, node, puncher, pointed_thing)
|
on_dig = function(pos, node, puncher, pointed_thing)
|
||||||
minetest.node_dig(pos, node, puncher, pointed_thing)
|
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
if minetest.global_exists("techage") then
|
if minetest.global_exists("techage") then
|
||||||
techage.ElectricCable:after_dig_node(pos)
|
techage.ElectricCable:after_dig_node(pos)
|
||||||
@ -476,7 +476,7 @@ minetest.register_node("signs_bot:box", {
|
|||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = drop,
|
drop = drop,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
@ -513,7 +513,7 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:box",
|
item = "signs_bot:box",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Box is the housing of the bot."),
|
S("The Box is the housing of the bot."),
|
||||||
S("Place the box and start the bot by means of the 'On' button."),
|
S("Place the box and start the bot by means of the 'On' button."),
|
||||||
S("If the mod techage is installed, the bot needs electrical power."),
|
S("If the mod techage is installed, the bot needs electrical power."),
|
||||||
"",
|
"",
|
||||||
S("The bot leaves the box on the right side."),
|
S("The bot leaves the box on the right side."),
|
||||||
@ -524,7 +524,7 @@ if minetest.get_modpath("doc") then
|
|||||||
S("The box inventory simulates the inventory of the bot."),
|
S("The box inventory simulates the inventory of the bot."),
|
||||||
S("You will not be able to access the inventory, if the bot is running."),
|
S("You will not be able to access the inventory, if the bot is running."),
|
||||||
S("The bot can carry up to 8 stacks and 6 signs with it."),
|
S("The bot can carry up to 8 stacks and 6 signs with it."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPLv3
|
GPLv3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Bot Flap
|
Signs Bot: Bot Flap
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -70,7 +70,7 @@ if minetest.get_modpath("doc") then
|
|||||||
S("The flap is a simple block used as door for the bot."),
|
S("The flap is a simple block used as door for the bot."),
|
||||||
S("Place the flap in any wall, and the bot will automatically open"),
|
S("Place the flap in any wall, and the bot will automatically open"),
|
||||||
S("and close the flap as it passes through it."),
|
S("and close the flap as it passes through it."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot Sensor
|
Bot Sensor
|
||||||
(passive node, the Bot detects the sensor and sends the signal)
|
(passive node, the Bot detects the sensor and sends the signal)
|
||||||
]]--
|
]]--
|
||||||
@ -22,7 +22,7 @@ local S = signs_bot.S
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, cmnd)
|
local function update_infotext(pos, dest_pos, cmnd)
|
||||||
M(pos):set_string("infotext", S("Bot Sensor: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
M(pos):set_string("infotext", S("Bot Sensor: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("signs_bot:bot_sensor", {
|
minetest.register_node("signs_bot:bot_sensor", {
|
||||||
description = S("Bot Sensor"),
|
description = S("Bot Sensor"),
|
||||||
@ -43,12 +43,12 @@ minetest.register_node("signs_bot:bot_sensor", {
|
|||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("infotext", S("Bot Sensor: Not connected"))
|
meta:set_string("infotext", S("Bot Sensor: Not connected"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -78,21 +78,21 @@ minetest.register_node("signs_bot:bot_sensor_on", {
|
|||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Called from the Bot
|
-- Called from the Bot
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
signs_bot.send_signal(pos)
|
signs_bot.send_signal(pos)
|
||||||
signs_bot.lib.activate_extender_nodes(pos, true)
|
signs_bot.lib.activate_extender_nodes(pos, true)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local node = tubelib2.get_node_lvm(pos)
|
local node = tubelib2.get_node_lvm(pos)
|
||||||
node.name = "signs_bot:bot_sensor"
|
node.name = "signs_bot:bot_sensor"
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -122,9 +122,9 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:bot_sensor",
|
item = "signs_bot:bot_sensor",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot Sensor detects any bot and sends a signal, if a bot is nearby."),
|
S("The Bot Sensor detects any bot and sends a signal, if a bot is nearby."),
|
||||||
S("the sensor range is one node/meter."),
|
S("the sensor range is one node/meter."),
|
||||||
S("The sensor direction does not care."),
|
S("The sensor direction does not care."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Cart Sensor
|
Cart Sensor
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -26,7 +26,7 @@ local CYCLE_TIME = 2
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, dest_idx)
|
local function update_infotext(pos, dest_pos, dest_idx)
|
||||||
M(pos):set_string("infotext", S("Cart Sensor: Connected with").." "..P2S(dest_pos).." / "..dest_idx)
|
M(pos):set_string("infotext", S("Cart Sensor: Connected with").." "..P2S(dest_pos).." / "..dest_idx)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function swap_node(pos, name)
|
local function swap_node(pos, name)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
@ -37,7 +37,7 @@ local function swap_node(pos, name)
|
|||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos)
|
local function node_timer(pos)
|
||||||
if minecart.is_cart_available(pos, M(pos):get_int("param2"), 1) then
|
if minecart.is_cart_available(pos, M(pos):get_int("param2"), 1) then
|
||||||
if swap_node(pos, "signs_bot:cart_sensor_on") then
|
if swap_node(pos, "signs_bot:cart_sensor_on") then
|
||||||
@ -69,7 +69,7 @@ minetest.register_node("signs_bot:cart_sensor", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("infotext", S("Cart Sensor: Not connected"))
|
meta:set_string("infotext", S("Cart Sensor: Not connected"))
|
||||||
@ -77,7 +77,7 @@ minetest.register_node("signs_bot:cart_sensor", {
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
meta:set_int("param2", (node.param2 + 2) % 4)
|
meta:set_int("param2", (node.param2 + 2) % 4)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -108,7 +108,7 @@ minetest.register_node("signs_bot:cart_sensor_on", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -152,9 +152,9 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:cart_sensor",
|
item = "signs_bot:cart_sensor",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby."),
|
S("The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby."),
|
||||||
S("the sensor range is one node/meter."),
|
S("the sensor range is one node/meter."),
|
||||||
S("The sensor has an active side (red) that must point to the rail/cart."),
|
S("The sensor has an active side (red) that must point to the rail/cart."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Changer/Control Unit for Bot Control
|
Signs Changer/Control Unit for Bot Control
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -129,7 +129,7 @@ for idx = 1,4 do
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('sign', 4)
|
inv:set_size('sign', 4)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
@ -140,7 +140,7 @@ for idx = 1,4 do
|
|||||||
techage.logic.infotext(meta, S("Bot Control Unit"))
|
techage.logic.infotext(meta, S("Bot Control Unit"))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
signs_bot_get_signal = signs_bot_get_signal,
|
signs_bot_get_signal = signs_bot_get_signal,
|
||||||
signs_bot_on_signal = signs_bot_on_signal,
|
signs_bot_on_signal = signs_bot_on_signal,
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
allow_metadata_inventory_put = allow_metadata_inventory,
|
||||||
@ -176,14 +176,14 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:changer1",
|
item = "signs_bot:changer1",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot Control Unit is used to lead the bot by means of signs."),
|
S("The Bot Control Unit is used to lead the bot by means of signs."),
|
||||||
S("The unit can be loaded with up to 4 different signs and can be programmed by means of sensors."),
|
S("The unit can be loaded with up to 4 different signs and can be programmed by means of sensors."),
|
||||||
"",
|
"",
|
||||||
S("To load the unit, place a sign on the red side of the unit and click on the unit."),
|
S("To load the unit, place a sign on the red side of the unit and click on the unit."),
|
||||||
S("The sign disappears / is moved to the inventory of the unit."),
|
S("The sign disappears / is moved to the inventory of the unit."),
|
||||||
S("This can be repeated 3 times."),
|
S("This can be repeated 3 times."),
|
||||||
"",
|
"",
|
||||||
S("Use the connection tool to connect up to 4 sensors with the Bot Control Unit."),
|
S("Use the connection tool to connect up to 4 sensors with the Bot Control Unit."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -204,5 +204,5 @@ if minetest.get_modpath("techage") then
|
|||||||
return "unsupported"
|
return "unsupported"
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot Chest
|
Signs Bot Chest
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -51,8 +51,8 @@ local function update_infotext(pos, dest_pos, cmnd)
|
|||||||
local state = get_inv_state(pos)
|
local state = get_inv_state(pos)
|
||||||
meta:set_string("infotext", S("Bot Chest: Sends signal to").." "..P2S(dest_pos).." / "..cmnd..", if "..state)
|
meta:set_string("infotext", S("Bot Chest: Sends signal to").." "..P2S(dest_pos).." / "..cmnd..", if "..state)
|
||||||
meta:set_string("state", state)
|
meta:set_string("state", state)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function formspec()
|
local function formspec()
|
||||||
return "size[9,8]"..
|
return "size[9,8]"..
|
||||||
@ -83,7 +83,7 @@ if NODE_IO then
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('main', 32)
|
inv:set_size('main', 32)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
mem.running = false
|
mem.running = false
|
||||||
@ -147,7 +147,7 @@ if NODE_IO then
|
|||||||
return left_over
|
return left_over
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -173,7 +173,7 @@ else
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size('main', 32)
|
inv:set_size('main', 32)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
mem.running = false
|
mem.running = false
|
||||||
@ -212,7 +212,7 @@ else
|
|||||||
groups = {cracky = 1, sign_bot_sensor = 1},
|
groups = {cracky = 1, sign_bot_sensor = 1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_inventory({"signs_bot:chest"}, {
|
signs_bot.register_inventory({"signs_bot:chest"}, {
|
||||||
put = {
|
put = {
|
||||||
@ -220,7 +220,7 @@ signs_bot.register_inventory({"signs_bot:chest"}, {
|
|||||||
local owner = M(pos):get_string("owner")
|
local owner = M(pos):get_string("owner")
|
||||||
minetest.after(1, check_state, pos)
|
minetest.after(1, check_state, pos)
|
||||||
return owner == player_name
|
return owner == player_name
|
||||||
end,
|
end,
|
||||||
listname = "main",
|
listname = "main",
|
||||||
},
|
},
|
||||||
take = {
|
take = {
|
||||||
@ -228,7 +228,7 @@ signs_bot.register_inventory({"signs_bot:chest"}, {
|
|||||||
local owner = M(pos):get_string("owner")
|
local owner = M(pos):get_string("owner")
|
||||||
minetest.after(1, check_state, pos)
|
minetest.after(1, check_state, pos)
|
||||||
return owner == player_name
|
return owner == player_name
|
||||||
end,
|
end,
|
||||||
listname = "main",
|
listname = "main",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -249,11 +249,11 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:chest",
|
item = "signs_bot:chest",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Signs Bot Chest is a special chest with sensor function."),
|
S("The Signs Bot Chest is a special chest with sensor function."),
|
||||||
S("It sends a signal depending on the chest state."),
|
S("It sends a signal depending on the chest state."),
|
||||||
S("Possible states are 'empty', 'not empty', 'almost full'"),
|
S("Possible states are 'empty', 'not empty', 'almost full'"),
|
||||||
"",
|
"",
|
||||||
S("A typical use case is to turn off the bot, when the chest is almost full or empty."),
|
S("A typical use case is to turn off the bot, when the chest is almost full or empty."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot farming commands
|
Bot farming commands
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ local function planting(base_pos, mem, slot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("sow_seed", {
|
signs_bot.register_botcommand("sow_seed", {
|
||||||
mod = "farming",
|
mod = "farming",
|
||||||
@ -83,7 +83,7 @@ signs_bot.register_botcommand("sow_seed", {
|
|||||||
local function harvesting(base_pos, mem)
|
local function harvesting(base_pos, mem)
|
||||||
local pos = mem.pos_tbl and mem.pos_tbl[mem.steps]
|
local pos = mem.pos_tbl and mem.pos_tbl[mem.steps]
|
||||||
mem.steps = (mem.steps or 1) + 1
|
mem.steps = (mem.steps or 1) + 1
|
||||||
|
|
||||||
if pos and lib.not_protected(base_pos, pos) then
|
if pos and lib.not_protected(base_pos, pos) then
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if signs_bot.FarmingCrop[node.name] then
|
if signs_bot.FarmingCrop[node.name] then
|
||||||
@ -135,15 +135,15 @@ local function plant_sapling(base_pos, mem, slot)
|
|||||||
local item = stack and signs_bot.TreeSaplings[stack:get_name()]
|
local item = stack and signs_bot.TreeSaplings[stack:get_name()]
|
||||||
if item and item.sapling then
|
if item and item.sapling then
|
||||||
minetest.set_node(pos, {name = item.sapling, paramtype2 = "wallmounted", param2 = 1})
|
minetest.set_node(pos, {name = item.sapling, paramtype2 = "wallmounted", param2 = 1})
|
||||||
if item.t1 ~= nil then
|
if item.t1 ~= nil then
|
||||||
-- We have to simulate "on_place" and start the timer by hand
|
-- We have to simulate "on_place" and start the timer by hand
|
||||||
-- because the after_place_node function checks player rights and can't therefore
|
-- because the after_place_node function checks player rights and can't therefore
|
||||||
-- be used.
|
-- be used.
|
||||||
minetest.get_node_timer(pos):start(math.random(item.t1, item.t2))
|
minetest.get_node_timer(pos):start(math.random(item.t1, item.t2))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("plant_sapling", {
|
signs_bot.register_botcommand("plant_sapling", {
|
||||||
mod = "farming",
|
mod = "farming",
|
||||||
@ -171,9 +171,9 @@ place_sign 1
|
|||||||
turn_around]]
|
turn_around]]
|
||||||
|
|
||||||
signs_bot.register_sign({
|
signs_bot.register_sign({
|
||||||
name = "farming",
|
name = "farming",
|
||||||
description = S('Sign "farming"'),
|
description = S('Sign "farming"'),
|
||||||
commands = CMD,
|
commands = CMD,
|
||||||
image = "signs_bot_sign_farming.png",
|
image = "signs_bot_sign_farming.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -193,10 +193,10 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:farming",
|
item = "signs_bot:farming",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Used to harvest and seed a 3x3 field."),
|
S("Used to harvest and seed a 3x3 field."),
|
||||||
S("Place the sign in front of the field."),
|
S("Place the sign in front of the field."),
|
||||||
S("The seed to be placed has to be in the first inventory slot of the bot."),
|
S("The seed to be placed has to be in the first inventory slot of the bot."),
|
||||||
S("When finished, the bot turns."),
|
S("When finished, the bot turns."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot flower cutting command
|
Bot flower cutting command
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ end
|
|||||||
local function harvesting(base_pos, mem)
|
local function harvesting(base_pos, mem)
|
||||||
local pos = mem.pos_tbl and mem.pos_tbl[mem.steps]
|
local pos = mem.pos_tbl and mem.pos_tbl[mem.steps]
|
||||||
mem.steps = (mem.steps or 1) + 1
|
mem.steps = (mem.steps or 1) + 1
|
||||||
|
|
||||||
if pos and lib.not_protected(base_pos, pos) then
|
if pos and lib.not_protected(base_pos, pos) then
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if node.name ~= "default:papyrus" then
|
if node.name ~= "default:papyrus" then
|
||||||
@ -117,9 +117,9 @@ place_sign 1
|
|||||||
turn_around]]
|
turn_around]]
|
||||||
|
|
||||||
signs_bot.register_sign({
|
signs_bot.register_sign({
|
||||||
name = "flowers",
|
name = "flowers",
|
||||||
description = S('Sign "flowers"'),
|
description = S('Sign "flowers"'),
|
||||||
commands = CMD,
|
commands = CMD,
|
||||||
image = "signs_bot_sign_flowers.png",
|
image = "signs_bot_sign_flowers.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -139,9 +139,9 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:flowers",
|
item = "signs_bot:flowers",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Used to cut flowers on a 3x3 field."),
|
S("Used to cut flowers on a 3x3 field."),
|
||||||
S("Place the sign in front of the field."),
|
S("Place the sign in front of the field."),
|
||||||
S("When finished, the bot turns."),
|
S("When finished, the bot turns."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: More commands
|
Signs Bot: More commands
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -28,9 +28,9 @@ local RegisteredInventories = {}
|
|||||||
function signs_bot.robot_take(base_pos, robot_pos, param2, want_count, slot)
|
function signs_bot.robot_take(base_pos, robot_pos, param2, want_count, slot)
|
||||||
local target_pos = lib.next_pos(robot_pos, param2)
|
local target_pos = lib.next_pos(robot_pos, param2)
|
||||||
local node = tubelib2.get_node_lvm(target_pos)
|
local node = tubelib2.get_node_lvm(target_pos)
|
||||||
local def = RegisteredInventories[node.name]
|
local def = RegisteredInventories[node.name]
|
||||||
local owner = M(base_pos):get_string("owner")
|
local owner = M(base_pos):get_string("owner")
|
||||||
|
|
||||||
-- Is known type of inventory node?
|
-- Is known type of inventory node?
|
||||||
if def and (not def.allow_take or def.allow_take(target_pos, nil, owner)) then
|
if def and (not def.allow_take or def.allow_take(target_pos, nil, owner)) then
|
||||||
local src_inv = minetest.get_inventory({type="node", pos=target_pos})
|
local src_inv = minetest.get_inventory({type="node", pos=target_pos})
|
||||||
@ -40,7 +40,7 @@ function signs_bot.robot_take(base_pos, robot_pos, param2, want_count, slot)
|
|||||||
local taken = src_inv:remove_item(def.take_listname, ItemStack(item_name.." "..want_count))
|
local taken = src_inv:remove_item(def.take_listname, ItemStack(item_name.." "..want_count))
|
||||||
local leftover = signs_bot.bot_inv_put_item(base_pos, slot, taken)
|
local leftover = signs_bot.bot_inv_put_item(base_pos, slot, taken)
|
||||||
src_inv:add_item(def.take_listname, leftover)
|
src_inv:add_item(def.take_listname, leftover)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ function signs_bot.robot_put(base_pos, robot_pos, param2, num, slot)
|
|||||||
local def = RegisteredInventories[node.name]
|
local def = RegisteredInventories[node.name]
|
||||||
local owner = M(base_pos):get_string("owner")
|
local owner = M(base_pos):get_string("owner")
|
||||||
local taken = signs_bot.bot_inv_take_item(base_pos, slot, num)
|
local taken = signs_bot.bot_inv_take_item(base_pos, slot, num)
|
||||||
|
|
||||||
-- Is known type of inventory node?
|
-- Is known type of inventory node?
|
||||||
if taken and def and (not def.allow_put or def.allow_put(target_pos, taken, owner)) then
|
if taken and def and (not def.allow_put or def.allow_put(target_pos, taken, owner)) then
|
||||||
local dst_inv = minetest.get_inventory({type="node", pos=target_pos})
|
local dst_inv = minetest.get_inventory({type="node", pos=target_pos})
|
||||||
@ -65,6 +65,23 @@ function signs_bot.robot_put(base_pos, robot_pos, param2, num, slot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function signs_bot.robot_peek(base_pos, robot_pos, param2, want_count, slot)
|
||||||
|
local target_pos = lib.next_pos(robot_pos, param2)
|
||||||
|
local node = tubelib2.get_node_lvm(target_pos)
|
||||||
|
local def = RegisteredInventories[node.name]
|
||||||
|
local owner = M(base_pos):get_string("owner")
|
||||||
|
|
||||||
|
-- Is known type of inventory node?
|
||||||
|
if def and (not def.allow_take or def.allow_take(target_pos, nil, owner)) then
|
||||||
|
local src_inv = minetest.get_inventory({type="node", pos=target_pos})
|
||||||
|
-- take specified item_name from bot slot configuration OR any item from the chest
|
||||||
|
local item_name = signs_bot.bot_inv_item_name(base_pos, slot) or lib.peek_inv(src_inv, def.take_listname)
|
||||||
|
if item_name then
|
||||||
|
return src_inv:contains_item(def.take_listname, ItemStack(item_name.." "..want_count))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- From robot to furnace
|
-- From robot to furnace
|
||||||
function signs_bot.robot_put_fuel(base_pos, robot_pos, param2, num, slot)
|
function signs_bot.robot_put_fuel(base_pos, robot_pos, param2, num, slot)
|
||||||
local target_pos = lib.next_pos(robot_pos, param2)
|
local target_pos = lib.next_pos(robot_pos, param2)
|
||||||
@ -72,7 +89,7 @@ function signs_bot.robot_put_fuel(base_pos, robot_pos, param2, num, slot)
|
|||||||
local def = RegisteredInventories[node.name]
|
local def = RegisteredInventories[node.name]
|
||||||
local owner = M(base_pos):get_string("owner")
|
local owner = M(base_pos):get_string("owner")
|
||||||
local taken = signs_bot.bot_inv_take_item(base_pos, slot, num)
|
local taken = signs_bot.bot_inv_take_item(base_pos, slot, num)
|
||||||
|
|
||||||
-- Is known type of inventory node?
|
-- Is known type of inventory node?
|
||||||
if taken and def and (not def.allow_fuel or def.allow_fuel(target_pos, taken, owner)) then
|
if taken and def and (not def.allow_fuel or def.allow_fuel(target_pos, taken, owner)) then
|
||||||
local dst_inv = minetest.get_inventory({type="node", pos=target_pos})
|
local dst_inv = minetest.get_inventory({type="node", pos=target_pos})
|
||||||
@ -85,18 +102,18 @@ end
|
|||||||
|
|
||||||
signs_bot.register_botcommand("take_item", {
|
signs_bot.register_botcommand("take_item", {
|
||||||
mod = "item",
|
mod = "item",
|
||||||
params = "<num> <slot>",
|
params = "<num> <slot>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("Take <num> items from a chest like node\nand put it into the item inventory.\n"..
|
description = S("Take <num> items from a chest like node\nand put it into the item inventory.\n"..
|
||||||
"<slot> is the inventory slot (1..8) or 0 for any one"),
|
"<slot> is the bot inventory slot\n(1..8) or 0 for any one"),
|
||||||
check = function(num, slot)
|
check = function(num, slot)
|
||||||
num = tonumber(num) or 1
|
num = tonumber(num) or 1
|
||||||
if num < 1 or num > 99 then
|
if num < 1 or num > 99 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if slot < 0 or slot > 8 then
|
if slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
@ -107,21 +124,50 @@ signs_bot.register_botcommand("take_item", {
|
|||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("add_item", {
|
signs_bot.register_botcommand("jump_check_item", {
|
||||||
mod = "item",
|
mod = "item",
|
||||||
params = "<num> <slot>",
|
params = "<num> <slot> <label>",
|
||||||
num_param = 2,
|
num_param = 3,
|
||||||
description = S("Add <num> items to a chest like node\ntaken from the item inventory.\n"..
|
description = S("Check if there are <num>\n"..
|
||||||
"<slot> is the inventory slot (1..8) or 0 for any one"),
|
"items in the chest like node.\n"..
|
||||||
check = function(num, slot)
|
"If not, jump to <label>\n"..
|
||||||
|
"<slot> is the bot inventory slot\n"..
|
||||||
|
"(1..8) to specify the item, or 0 for any item"),
|
||||||
|
check = function(num, slot, lbl)
|
||||||
num = tonumber(num) or 1
|
num = tonumber(num) or 1
|
||||||
if num < 1 or num > 99 then
|
if num < 1 or num > 99 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if slot < 0 or slot > 8 then
|
if slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
|
return signs_bot.check_label(lbl)
|
||||||
|
end,
|
||||||
|
cmnd = function(base_pos, mem, num, slot, addr)
|
||||||
|
num = tonumber(num) or 1
|
||||||
|
if not signs_bot.robot_peek(base_pos, mem.robot_pos, mem.robot_param2, num, slot) then
|
||||||
|
mem.pc = (addr or 4) - 4
|
||||||
|
end
|
||||||
|
return signs_bot.DONE
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
signs_bot.register_botcommand("add_item", {
|
||||||
|
mod = "item",
|
||||||
|
params = "<num> <slot>",
|
||||||
|
num_param = 2,
|
||||||
|
description = S("Add <num> items to a chest like node\ntaken from the item inventory.\n"..
|
||||||
|
"<slot> is the bot inventory slot (1..8) or 0 for any one"),
|
||||||
|
check = function(num, slot)
|
||||||
|
num = tonumber(num) or 1
|
||||||
|
if num < 1 or num > 99 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
slot = tonumber(slot) or 0
|
||||||
|
if slot < 0 or slot > 8 then
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
@ -132,21 +178,21 @@ signs_bot.register_botcommand("add_item", {
|
|||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("add_fuel", {
|
signs_bot.register_botcommand("add_fuel", {
|
||||||
mod = "item",
|
mod = "item",
|
||||||
params = "<num> <slot>",
|
params = "<num> <slot>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("Add <num> fuel to a furnace like node\ntaken from the item inventory.\n"..
|
description = S("Add <num> fuel to a furnace like node\ntaken from the item inventory.\n"..
|
||||||
"<slot> is the inventory slot (1..8) or 0 for any one"),
|
"<slot> is the bot inventory slot (1..8) or 0 for any one"),
|
||||||
check = function(num, slot)
|
check = function(num, slot)
|
||||||
num = tonumber(num) or 1
|
num = tonumber(num) or 1
|
||||||
if num < 1 or num > 99 then
|
if num < 1 or num > 99 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if slot < 0 or slot > 8 then
|
if slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
@ -164,20 +210,20 @@ signs_bot.register_botcommand("cond_take_item", {
|
|||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("deprecated, use bot inventory configuration instead"),
|
description = S("deprecated, use bot inventory configuration instead"),
|
||||||
check = function(num, slot)
|
check = function(num, slot)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
cmnd = function(base_pos, mem, num, slot)
|
cmnd = function(base_pos, mem, num, slot)
|
||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("cond_add_item", {
|
signs_bot.register_botcommand("cond_add_item", {
|
||||||
mod = "item",
|
mod = "item",
|
||||||
params = "<num> <slot>",
|
params = "<num> <slot>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("deprecated, use bot inventory configuration instead"),
|
description = S("deprecated, use bot inventory configuration instead"),
|
||||||
check = function(num, slot)
|
check = function(num, slot)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
cmnd = function(base_pos, mem, num, slot)
|
cmnd = function(base_pos, mem, num, slot)
|
||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
@ -190,7 +236,7 @@ signs_bot.register_botcommand("pickup_items", {
|
|||||||
num_param = 1,
|
num_param = 1,
|
||||||
description = S("Pick up all objects\n"..
|
description = S("Pick up all objects\n"..
|
||||||
"in a 3x3 field.\n"..
|
"in a 3x3 field.\n"..
|
||||||
"<slot> is the inventory slot (1..8) or 0 for any one"),
|
"<slot> is the bot inventory slot (1..8) or 0 for any one"),
|
||||||
check = function(slot)
|
check = function(slot)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
return slot >= 0 and slot < 9
|
return slot >= 0 and slot < 9
|
||||||
@ -211,21 +257,21 @@ signs_bot.register_botcommand("pickup_items", {
|
|||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("drop_items", {
|
signs_bot.register_botcommand("drop_items", {
|
||||||
mod = "item",
|
mod = "item",
|
||||||
params = "<num> <slot>",
|
params = "<num> <slot>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("Drop items in front of the bot.\n"..
|
description = S("Drop items in front of the bot.\n"..
|
||||||
"<slot> is the inventory slot (1..8) or 0 for any one"),
|
"<slot> is the bot inventory slot (1..8) or 0 for any one"),
|
||||||
check = function(num, slot)
|
check = function(num, slot)
|
||||||
num = tonumber(num) or 1
|
num = tonumber(num) or 1
|
||||||
if num < 1 or num > 99 then
|
if num < 1 or num > 99 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if slot < 0 or slot > 8 then
|
if slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
@ -256,15 +302,15 @@ end
|
|||||||
-- def is a table with following data:
|
-- def is a table with following data:
|
||||||
-- {
|
-- {
|
||||||
-- put = {
|
-- put = {
|
||||||
-- allow_inventory_put = func(pos, stack, player_name),
|
-- allow_inventory_put = func(pos, stack, player_name),
|
||||||
-- listname = "src",
|
-- listname = "src",
|
||||||
-- },
|
-- },
|
||||||
-- take = {
|
-- take = {
|
||||||
-- allow_inventory_take = func(pos, stack, player_name),
|
-- allow_inventory_take = func(pos, stack, player_name),
|
||||||
-- listname = "dst",
|
-- listname = "dst",
|
||||||
|
|
||||||
-- fuel = {
|
-- fuel = {
|
||||||
-- allow_inventory_put = func(pos, stack, player_name),
|
-- allow_inventory_put = func(pos, stack, player_name),
|
||||||
-- listname = "fuel",
|
-- listname = "fuel",
|
||||||
-- },
|
-- },
|
||||||
-- }
|
-- }
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot move commands
|
Bot move commands
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -24,17 +24,17 @@ local function node_and_pos(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Positions to check:
|
-- Positions to check:
|
||||||
-- 5 6
|
-- 5 6
|
||||||
-- [R]1
|
-- [R]1
|
||||||
-- 3 2
|
-- 3 2
|
||||||
-- 4
|
-- 4
|
||||||
function signs_bot.move_robot(mem)
|
function signs_bot.move_robot(mem)
|
||||||
local param2 = mem.robot_param2
|
local param2 = mem.robot_param2
|
||||||
local pos = mem.robot_pos
|
local pos = mem.robot_pos
|
||||||
local node1, pos1 = node_and_pos(lib.next_pos(pos, param2))
|
local node1, pos1 = node_and_pos(lib.next_pos(pos, param2))
|
||||||
local node2, pos2 = node_and_pos({x=pos1.x, y=pos1.y-1, z=pos1.z})
|
local node2, pos2 = node_and_pos({x=pos1.x, y=pos1.y-1, z=pos1.z})
|
||||||
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
|
|
||||||
--
|
--
|
||||||
-- One step forward (pos1)
|
-- One step forward (pos1)
|
||||||
--
|
--
|
||||||
@ -57,17 +57,17 @@ function signs_bot.move_robot(mem)
|
|||||||
minetest.sound_play('signs_bot_step', {pos = pos1})
|
minetest.sound_play('signs_bot_step', {pos = pos1})
|
||||||
return pos1
|
return pos1
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- One step up (pos5)
|
-- One step up (pos5)
|
||||||
--
|
--
|
||||||
local node6, pos6 = node_and_pos({x=pos1.x, y=pos1.y+1, z=pos1.z})
|
local node6, pos6 = node_and_pos({x=pos1.x, y=pos1.y+1, z=pos1.z})
|
||||||
if lib.check_pos(pos6, node6, node1, param2) then
|
if lib.check_pos(pos6, node6, node1, param2) then
|
||||||
local node5, pos5 = node_and_pos({x=pos.x, y=pos.y+1, z=pos.z})
|
local node5, pos5 = node_and_pos({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
if node5.name == "air" then
|
if node5.name == "air" then
|
||||||
if node3.name == "signs_bot:robot_leg" then
|
if node3.name == "signs_bot:robot_leg" then
|
||||||
return nil
|
return nil
|
||||||
elseif node3.name == "signs_bot:robot_foot" then
|
elseif node3.name == "signs_bot:robot_foot" then
|
||||||
minetest.swap_node(pos3, {name="signs_bot:robot_leg"})
|
minetest.swap_node(pos3, {name="signs_bot:robot_leg"})
|
||||||
else
|
else
|
||||||
minetest.swap_node(pos, {name="signs_bot:robot_foot"})
|
minetest.swap_node(pos, {name="signs_bot:robot_foot"})
|
||||||
@ -77,12 +77,12 @@ function signs_bot.move_robot(mem)
|
|||||||
return pos5
|
return pos5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- One step down I (pos3)
|
-- One step down I (pos3)
|
||||||
--
|
--
|
||||||
local node4, pos4 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
local node4, pos4 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
||||||
if lib.check_pos(pos3, node3, node4, param2) then --
|
if lib.check_pos(pos3, node3, node4, param2) then --
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.set_node(pos3, {name="signs_bot:robot", param2=param2})
|
minetest.set_node(pos3, {name="signs_bot:robot", param2=param2})
|
||||||
minetest.sound_play('signs_bot_step', {pos = pos3})
|
minetest.sound_play('signs_bot_step', {pos = pos3})
|
||||||
@ -98,8 +98,8 @@ function signs_bot.move_robot(mem)
|
|||||||
minetest.sound_play('signs_bot_step', {pos = pos3})
|
minetest.sound_play('signs_bot_step', {pos = pos3})
|
||||||
return pos3
|
return pos3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function backward_robot(mem)
|
local function backward_robot(mem)
|
||||||
local param2 = mem.robot_param2
|
local param2 = mem.robot_param2
|
||||||
@ -109,7 +109,7 @@ local function backward_robot(mem)
|
|||||||
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
local node4, pos4 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
local node4, pos4 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
||||||
local new_pos = nil
|
local new_pos = nil
|
||||||
|
|
||||||
if lib.check_pos(pos1, node1, node2, param2) then
|
if lib.check_pos(pos1, node1, node2, param2) then
|
||||||
if node3.name == "signs_bot:robot_foot" or node3.name == "signs_bot:robot_leg" then
|
if node3.name == "signs_bot:robot_foot" or node3.name == "signs_bot:robot_leg" then
|
||||||
minetest.remove_node(pos3)
|
minetest.remove_node(pos3)
|
||||||
@ -123,7 +123,7 @@ local function backward_robot(mem)
|
|||||||
mem.stored_node = node1
|
mem.stored_node = node1
|
||||||
return pos1
|
return pos1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("backward", {
|
signs_bot.register_botcommand("backward", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
@ -148,7 +148,7 @@ local function turn_robot(pos, param2, dir)
|
|||||||
minetest.swap_node(pos, {name="signs_bot:robot", param2=param2})
|
minetest.swap_node(pos, {name="signs_bot:robot", param2=param2})
|
||||||
minetest.sound_play('signs_bot_step', {pos = pos, gain = 0.6})
|
minetest.sound_play('signs_bot_step', {pos = pos, gain = 0.6})
|
||||||
return param2
|
return param2
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("turn_left", {
|
signs_bot.register_botcommand("turn_left", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
@ -187,15 +187,15 @@ signs_bot.register_botcommand("turn_around", {
|
|||||||
|
|
||||||
-- Positions to check:
|
-- Positions to check:
|
||||||
-- 1
|
-- 1
|
||||||
-- [R]
|
-- [R]
|
||||||
-- 2
|
-- 2
|
||||||
local function robot_up(pos, param2)
|
local function robot_up(pos, param2)
|
||||||
local node1, pos1 = node_and_pos({x=pos.x, y=pos.y+1, z=pos.z})
|
local node1, pos1 = node_and_pos({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
local node2, pos2 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
local node2, pos2 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
if lib.check_pos(pos1, node1, node2, param2) then
|
if lib.check_pos(pos1, node1, node2, param2) then
|
||||||
if node2.name == "signs_bot:robot_leg" then
|
if node2.name == "signs_bot:robot_leg" then
|
||||||
return nil
|
return nil
|
||||||
elseif node2.name == "signs_bot:robot_foot" then
|
elseif node2.name == "signs_bot:robot_foot" then
|
||||||
minetest.swap_node(pos, {name="signs_bot:robot_leg"})
|
minetest.swap_node(pos, {name="signs_bot:robot_leg"})
|
||||||
else
|
else
|
||||||
minetest.swap_node(pos, {name="signs_bot:robot_foot"})
|
minetest.swap_node(pos, {name="signs_bot:robot_foot"})
|
||||||
@ -205,7 +205,7 @@ local function robot_up(pos, param2)
|
|||||||
return pos1
|
return pos1
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("move_up", {
|
signs_bot.register_botcommand("move_up", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
@ -222,7 +222,7 @@ signs_bot.register_botcommand("move_up", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Positions to check:
|
-- Positions to check:
|
||||||
-- [R]
|
-- [R]
|
||||||
-- 1
|
-- 1
|
||||||
-- 2
|
-- 2
|
||||||
-- 3
|
-- 3
|
||||||
@ -230,7 +230,7 @@ local function robot_down(pos, param2)
|
|||||||
local node1, pos1 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
local node1, pos1 = node_and_pos({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
local node2, pos2 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
local node2, pos2 = node_and_pos({x=pos.x, y=pos.y-2, z=pos.z})
|
||||||
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-3, z=pos.z})
|
local node3, pos3 = node_and_pos({x=pos.x, y=pos.y-3, z=pos.z})
|
||||||
if lib.check_pos(pos1, node1, node2, param2)
|
if lib.check_pos(pos1, node1, node2, param2)
|
||||||
or (node1.name == "air" and lib.check_pos(pos2, node2, node3, param2))
|
or (node1.name == "air" and lib.check_pos(pos2, node2, node3, param2))
|
||||||
or (node1.name == "signs_bot:robot_leg" or node1.name == "signs_bot:robot_foot") then
|
or (node1.name == "signs_bot:robot_leg" or node1.name == "signs_bot:robot_foot") then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
@ -239,7 +239,7 @@ local function robot_down(pos, param2)
|
|||||||
return pos1
|
return pos1
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
signs_bot.register_botcommand("move_down", {
|
signs_bot.register_botcommand("move_down", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
@ -255,6 +255,36 @@ signs_bot.register_botcommand("move_down", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
signs_bot.register_botcommand("fall_down", {
|
||||||
|
mod = "move",
|
||||||
|
params = "",
|
||||||
|
num_param = 0,
|
||||||
|
description = S("Fall into a hole/chasm (up to 10 blocks)"),
|
||||||
|
cmnd = function(base_pos, mem)
|
||||||
|
if not mem.bot_falling then
|
||||||
|
local pos1 = {x=mem.robot_pos.x, y=mem.robot_pos.y-1, z=mem.robot_pos.z}
|
||||||
|
local pos2 = {x=mem.robot_pos.x, y=mem.robot_pos.y-10, z=mem.robot_pos.z}
|
||||||
|
local sts, pos3 = minetest.line_of_sight(pos1, pos2)
|
||||||
|
if sts == false then
|
||||||
|
sts, _ = minetest.spawn_falling_node(mem.robot_pos)
|
||||||
|
if sts then
|
||||||
|
mem.bot_falling = 2
|
||||||
|
mem.robot_pos = {x=pos3.x, y=pos3.y+1, z=pos3.z}
|
||||||
|
return signs_bot.BUSY
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return signs_bot.ERROR, "Too deep"
|
||||||
|
else
|
||||||
|
mem.bot_falling = mem.bot_falling - 1
|
||||||
|
if mem.bot_falling <= 0 then
|
||||||
|
mem.bot_falling = nil
|
||||||
|
return signs_bot.DONE
|
||||||
|
end
|
||||||
|
return signs_bot.BUSY
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("pause", {
|
signs_bot.register_botcommand("pause", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
params = "<sec>",
|
params = "<sec>",
|
||||||
@ -305,5 +335,5 @@ signs_bot.register_botcommand("turn_off", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot cloning/pattern commands, signs, and nodes
|
Bot cloning/pattern commands, signs, and nodes
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -50,7 +50,7 @@ for _,row in ipairs(Param2Matrix) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function param2_conversion(node, offs)
|
local function param2_conversion(node, offs)
|
||||||
local ndef = minetest.registered_nodes[node.name]
|
local ndef = minetest.registered_nodes[node.name]
|
||||||
if not ndef or not ndef.paramtype2 then return end
|
if not ndef or not ndef.paramtype2 then return end
|
||||||
if ndef.paramtype2 == "facedir" then
|
if ndef.paramtype2 == "facedir" then
|
||||||
@ -59,7 +59,7 @@ local function param2_conversion(node, offs)
|
|||||||
node.param2 = tWallmountedRot[(node.param2 + offs - 2) % 4]
|
node.param2 = tWallmountedRot[(node.param2 + offs - 2) % 4]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Inventory functions
|
-- Inventory functions
|
||||||
--
|
--
|
||||||
@ -94,11 +94,11 @@ local function pattern_copy(base_pos, mem)
|
|||||||
local src_pos = mem.src_pos_tbl[mem.steps]
|
local src_pos = mem.src_pos_tbl[mem.steps]
|
||||||
local dst_pos = mem.dst_pos_tbl[mem.steps]
|
local dst_pos = mem.dst_pos_tbl[mem.steps]
|
||||||
mem.steps = mem.steps + 1
|
mem.steps = mem.steps + 1
|
||||||
|
|
||||||
if lib.not_protected(base_pos, dst_pos) then
|
if lib.not_protected(base_pos, dst_pos) then
|
||||||
local src_node = tubelib2.get_node_lvm(src_pos)
|
local src_node = tubelib2.get_node_lvm(src_pos)
|
||||||
src_node.name = inv_get_item(base_pos, src_node.name)
|
src_node.name = inv_get_item(base_pos, src_node.name)
|
||||||
|
|
||||||
local dst_node = tubelib2.get_node_lvm(dst_pos)
|
local dst_node = tubelib2.get_node_lvm(dst_pos)
|
||||||
inv_put_item(base_pos, mem, dst_node.name)
|
inv_put_item(base_pos, mem, dst_node.name)
|
||||||
param2_conversion(src_node, mem.dir_offs)
|
param2_conversion(src_node, mem.dir_offs)
|
||||||
@ -106,7 +106,7 @@ local function pattern_copy(base_pos, mem)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
signs_bot.register_botcommand("pattern", {
|
signs_bot.register_botcommand("pattern", {
|
||||||
mod = "copy",
|
mod = "copy",
|
||||||
params = "",
|
params = "",
|
||||||
@ -171,9 +171,9 @@ minetest.register_node("signs_bot:missing", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_sign({
|
signs_bot.register_sign({
|
||||||
name = "pattern",
|
name = "pattern",
|
||||||
description = S('Sign "pattern"'),
|
description = S('Sign "pattern"'),
|
||||||
commands = "pattern\nturn_around",
|
commands = "pattern\nturn_around",
|
||||||
image = "signs_bot_sign_pattern.png",
|
image = "signs_bot_sign_pattern.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -200,9 +200,9 @@ place_sign 1
|
|||||||
turn_around]]
|
turn_around]]
|
||||||
|
|
||||||
signs_bot.register_sign({
|
signs_bot.register_sign({
|
||||||
name = "copy3x3x3",
|
name = "copy3x3x3",
|
||||||
description = S('Sign "copy 3x3x3"'),
|
description = S('Sign "copy 3x3x3"'),
|
||||||
commands = CMND,
|
commands = CMND,
|
||||||
image = "signs_bot_sign_copy3x3x3.png",
|
image = "signs_bot_sign_copy3x3x3.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -222,10 +222,10 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:pattern",
|
item = "signs_bot:pattern",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Used to make a copy of a 3x3x3 cube."),
|
S("Used to make a copy of a 3x3x3 cube."),
|
||||||
S("Place the sign in front of the pattern to be copied."),
|
S("Place the sign in front of the pattern to be copied."),
|
||||||
S("Use the copy sign to make the copy of this pattern on a different location."),
|
S("Use the copy sign to make the copy of this pattern on a different location."),
|
||||||
S("The bot must first reach the pattern sign, then the copy sign."),
|
S("The bot must first reach the pattern sign, then the copy sign."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -237,9 +237,9 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:copy3x3x3",
|
item = "signs_bot:copy3x3x3",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Used to make a copy of a 3x3x3 cube."),
|
S("Used to make a copy of a 3x3x3 cube."),
|
||||||
S("Place the sign in front of the location, where the copy should be made."),
|
S("Place the sign in front of the location, where the copy should be made."),
|
||||||
S("Use the pattern sign to mark the pattern."),
|
S("Use the pattern sign to mark the pattern."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot place/remove commands
|
Bot place/remove commands
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -56,8 +56,8 @@ local function place_item(base_pos, robot_pos, param2, slot, route, level)
|
|||||||
local taken = signs_bot.bot_inv_take_item(base_pos, slot, 1)
|
local taken = signs_bot.bot_inv_take_item(base_pos, slot, 1)
|
||||||
if taken then
|
if taken then
|
||||||
local name = taken:get_name()
|
local name = taken:get_name()
|
||||||
if name == "default:torch" then
|
if name == "default:torch" then
|
||||||
name = "signs_bot:torch"
|
name = "signs_bot:torch"
|
||||||
end
|
end
|
||||||
local def = minetest.registered_nodes[name]
|
local def = minetest.registered_nodes[name]
|
||||||
if not def then return end
|
if not def then return end
|
||||||
@ -83,8 +83,8 @@ signs_bot.register_botcommand("place_front", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -94,7 +94,7 @@ signs_bot.register_botcommand("place_front", {
|
|||||||
return place_item(base_pos, mem.robot_pos, mem.robot_param2, slot, {0}, level)
|
return place_item(base_pos, mem.robot_pos, mem.robot_param2, slot, {0}, level)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("place_left", {
|
signs_bot.register_botcommand("place_left", {
|
||||||
mod = "place",
|
mod = "place",
|
||||||
params = "<slot> <lvl>",
|
params = "<slot> <lvl>",
|
||||||
@ -104,8 +104,8 @@ signs_bot.register_botcommand("place_left", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -115,7 +115,7 @@ signs_bot.register_botcommand("place_left", {
|
|||||||
return place_item(base_pos, mem.robot_pos, mem.robot_param2, slot, {3,0}, level)
|
return place_item(base_pos, mem.robot_pos, mem.robot_param2, slot, {3,0}, level)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("place_right", {
|
signs_bot.register_botcommand("place_right", {
|
||||||
mod = "place",
|
mod = "place",
|
||||||
params = "<slot> <lvl>",
|
params = "<slot> <lvl>",
|
||||||
@ -125,8 +125,8 @@ signs_bot.register_botcommand("place_right", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -232,8 +232,8 @@ signs_bot.register_botcommand("dig_front", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -254,8 +254,8 @@ signs_bot.register_botcommand("dig_left", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -276,8 +276,8 @@ signs_bot.register_botcommand("dig_right", {
|
|||||||
"<lvl> is one of: -1 0 +1"),
|
"<lvl> is one of: -1 0 +1"),
|
||||||
check = function(slot, lvl)
|
check = function(slot, lvl)
|
||||||
slot = tonumber(slot) or 0
|
slot = tonumber(slot) or 0
|
||||||
if not slot or slot < 0 or slot > 8 then
|
if not slot or slot < 0 or slot > 8 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return tValidLevels[lvl] ~= nil
|
return tValidLevels[lvl] ~= nil
|
||||||
end,
|
end,
|
||||||
@ -375,7 +375,7 @@ end
|
|||||||
|
|
||||||
signs_bot.register_botcommand("rotate_item", {
|
signs_bot.register_botcommand("rotate_item", {
|
||||||
mod = "place",
|
mod = "place",
|
||||||
params = "<lvl> <steps>",
|
params = "<lvl> <steps>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S("Rotate the block in front of the robot\n"..
|
description = S("Rotate the block in front of the robot\n"..
|
||||||
"<lvl> is one of: -1 0 +1\n"..
|
"<lvl> is one of: -1 0 +1\n"..
|
||||||
@ -393,7 +393,7 @@ signs_bot.register_botcommand("rotate_item", {
|
|||||||
return rotate_item(base_pos, mem.robot_pos, mem.robot_param2, {0}, level, steps)
|
return rotate_item(base_pos, mem.robot_pos, mem.robot_param2, {0}, level, steps)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Simplified torch which can be placed w/o a fake player
|
-- Simplified torch which can be placed w/o a fake player
|
||||||
minetest.register_node("signs_bot:torch", {
|
minetest.register_node("signs_bot:torch", {
|
||||||
description = S("Bot torch"),
|
description = S("Bot torch"),
|
||||||
@ -412,12 +412,12 @@ minetest.register_node("signs_bot:torch", {
|
|||||||
connect_back = {{-1/16, -1/16, -1/16, 1/16, 1/16, 8/16}},
|
connect_back = {{-1/16, -1/16, -1/16, 1/16, 1/16, 8/16}},
|
||||||
connect_right = {{-1/16, -1/16, -1/16, 8/16, 1/16, 1/16}},
|
connect_right = {{-1/16, -1/16, -1/16, 8/16, 1/16, 1/16}},
|
||||||
},
|
},
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"signs_bot_torch_top.png",
|
"signs_bot_torch_top.png",
|
||||||
"signs_bot_torch_bottom.png",
|
"signs_bot_torch_bottom.png",
|
||||||
{
|
{
|
||||||
image = "signs_bot_torch_animated.png",
|
image = "signs_bot_torch_animated.png",
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
@ -426,10 +426,10 @@ minetest.register_node("signs_bot:torch", {
|
|||||||
length = 4.0,
|
length = 4.0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
connects_to = {
|
connects_to = {
|
||||||
"group:pane", "group:stone", "group:glass", "group:wood", "group:tree",
|
"group:pane", "group:stone", "group:glass", "group:wood", "group:tree",
|
||||||
"group:bakedclay", "group:soil"},
|
"group:bakedclay", "group:soil"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot sign commands and nodes
|
Bot sign commands and nodes
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -24,7 +24,7 @@ local sCmnds = ""
|
|||||||
local lCmnds = {}
|
local lCmnds = {}
|
||||||
local tCmndIdx = {}
|
local tCmndIdx = {}
|
||||||
|
|
||||||
minetest.after(2, function()
|
minetest.after(2, function()
|
||||||
for idx,cmnd in ipairs(signs_bot.get_commands()) do
|
for idx,cmnd in ipairs(signs_bot.get_commands()) do
|
||||||
cmnd = minetest.formspec_escape(cmnd)
|
cmnd = minetest.formspec_escape(cmnd)
|
||||||
lCmnds[#lCmnds+1] = cmnd
|
lCmnds[#lCmnds+1] = cmnd
|
||||||
@ -75,7 +75,7 @@ local function add_arrow(text, line_num)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return table.concat(tbl, "\n")
|
return table.concat(tbl, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_syntax(pos, meta, text)
|
local function check_syntax(pos, meta, text)
|
||||||
local res,err_msg, line_num = signs_bot.check_commands(pos, text)
|
local res,err_msg, line_num = signs_bot.check_commands(pos, text)
|
||||||
@ -92,9 +92,9 @@ local function append_line(pos, meta, line)
|
|||||||
meta:set_string("signs_bot_cmnd", text)
|
meta:set_string("signs_bot_cmnd", text)
|
||||||
meta:set_int("err_code", 1) -- zero means OK
|
meta:set_int("err_code", 1) -- zero means OK
|
||||||
meta:set_string("err_msg", S("please check the added line(s)"))
|
meta:set_string("err_msg", S("please check the added line(s)"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_and_store(pos, meta, fields)
|
local function check_and_store(pos, meta, fields)
|
||||||
meta:set_string("sign_name", fields.name)
|
meta:set_string("sign_name", fields.name)
|
||||||
meta:set_string("signs_bot_cmnd", fields.cmnd)
|
meta:set_string("signs_bot_cmnd", fields.cmnd)
|
||||||
check_syntax(pos, meta, fields.cmnd)
|
check_syntax(pos, meta, fields.cmnd)
|
||||||
@ -138,7 +138,7 @@ minetest.register_node("signs_bot:sign_cmnd", {
|
|||||||
nmeta:set_string("infotext", nmeta:get_string("sign_name"))
|
nmeta:set_string("infotext", nmeta:get_string("sign_name"))
|
||||||
nmeta:set_string("formspec", formspec1(nmeta))
|
nmeta:set_string("formspec", formspec1(nmeta))
|
||||||
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
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return
|
return
|
||||||
@ -169,7 +169,7 @@ minetest.register_node("signs_bot:sign_cmnd", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = lib.after_dig_sign_node,
|
after_dig_node = lib.after_dig_sign_node,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
use_texture_alpha = signs_bot.CLIP,
|
use_texture_alpha = signs_bot.CLIP,
|
||||||
@ -191,7 +191,7 @@ local function get_inv_sign(base_pos, slot)
|
|||||||
return taken
|
return taken
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Put one sign into the robot signs inventory
|
-- Put one sign into the robot signs inventory
|
||||||
local function put_inv_sign(base_pos, slot, item)
|
local function put_inv_sign(base_pos, slot, item)
|
||||||
local inv = minetest.get_inventory({type="node", pos=base_pos})
|
local inv = minetest.get_inventory({type="node", pos=base_pos})
|
||||||
@ -285,7 +285,7 @@ local function dig_sign(base_pos, robot_pos, param2, slot)
|
|||||||
meta:set_string("cmnd", cmnd)
|
meta:set_string("cmnd", cmnd)
|
||||||
meta:set_int("err_code", err_code)
|
meta:set_int("err_code", err_code)
|
||||||
minetest.remove_node(pos1)
|
minetest.remove_node(pos1)
|
||||||
if not put_inv_sign(base_pos, slot, sign) then
|
if not put_inv_sign(base_pos, slot, sign) then
|
||||||
signs_bot.lib.drop_items(robot_pos, sign)
|
signs_bot.lib.drop_items(robot_pos, sign)
|
||||||
return signs_bot.ERROR, S("Error: Signs inventory slot is occupied")
|
return signs_bot.ERROR, S("Error: Signs inventory slot is occupied")
|
||||||
end
|
end
|
||||||
@ -332,7 +332,7 @@ end
|
|||||||
|
|
||||||
signs_bot.register_botcommand("trash_sign", {
|
signs_bot.register_botcommand("trash_sign", {
|
||||||
mod = "sign",
|
mod = "sign",
|
||||||
params = "<slot>",
|
params = "<slot>",
|
||||||
num_param = 1,
|
num_param = 1,
|
||||||
description = S("Dig the sign in front of the robot\n"..
|
description = S("Dig the sign in front of the robot\n"..
|
||||||
"and add the cleared sign to\nthe item iventory.\n"..
|
"and add the cleared sign to\nthe item iventory.\n"..
|
||||||
@ -346,7 +346,7 @@ signs_bot.register_botcommand("trash_sign", {
|
|||||||
return trash_sign(base_pos, mem.robot_pos, mem.robot_param2, slot)
|
return trash_sign(base_pos, mem.robot_pos, mem.robot_param2, slot)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "signs_bot:sign_cmnd 4",
|
output = "signs_bot:sign_cmnd 4",
|
||||||
@ -364,10 +364,10 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:sign_cmnd",
|
item = "signs_bot:sign_cmnd",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The 'command' sign can be programmed by the player."),
|
S("The 'command' sign can be programmed by the player."),
|
||||||
S("Place the sign in front of you and use the node menu to program your sequence of bot commands."),
|
S("Place the sign in front of you and use the node menu to program your sequence of bot commands."),
|
||||||
S("The menu has an edit field for your commands and a help page with all available commands."),
|
S("The menu has an edit field for your commands and a help page with all available commands."),
|
||||||
S("The help page has a copy button to simplify the programming."),
|
S("The help page has a copy button to simplify the programming."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot soup cooking commands
|
Bot soup cooking commands
|
||||||
|
|
||||||
Allows bot to use pot (xdecor:cauldron) to cook a vegetable soup
|
Allows bot to use pot (xdecor:cauldron) to cook a vegetable soup
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot tree cutting signs
|
Bot tree cutting signs
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ turn_around]]
|
|||||||
|
|
||||||
local HELP = table.concat({
|
local HELP = table.concat({
|
||||||
S("Used to harvest an aspen or pine tree trunk"),
|
S("Used to harvest an aspen or pine tree trunk"),
|
||||||
S("- Place the sign in front of the tree."),
|
S("- Place the sign in front of the tree."),
|
||||||
S("- Place a chest to the right of the sign."),
|
S("- Place a chest to the right of the sign."),
|
||||||
S("- Put a dirt stack (10 items min.) into the chest."),
|
S("- Put a dirt stack (10 items min.) into the chest."),
|
||||||
S("- Preconfigure slot 1 of the bot inventory with dirt"),
|
S("- Preconfigure slot 1 of the bot inventory with dirt"),
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Robot command interpreter
|
Signs Bot: Robot command interpreter
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -30,6 +30,9 @@ signs_bot.NEW = ci.NEW
|
|||||||
signs_bot.ERROR = ci.ERROR
|
signs_bot.ERROR = ci.ERROR
|
||||||
signs_bot.TURN_OFF = ci.TURN_OFF
|
signs_bot.TURN_OFF = ci.TURN_OFF
|
||||||
|
|
||||||
|
-- API functions
|
||||||
|
signs_bot.check_label = ci.check_label
|
||||||
|
|
||||||
local tCommands = {}
|
local tCommands = {}
|
||||||
local SortedKeys = {}
|
local SortedKeys = {}
|
||||||
local SortedMods = {}
|
local SortedMods = {}
|
||||||
@ -79,7 +82,7 @@ function signs_bot.get_commands()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
function signs_bot.get_help_text(cmnd)
|
function signs_bot.get_help_text(cmnd)
|
||||||
if cmnd then
|
if cmnd then
|
||||||
@ -90,8 +93,8 @@ function signs_bot.get_help_text(cmnd)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return S("unknown command")
|
return S("unknown command")
|
||||||
end
|
end
|
||||||
|
|
||||||
function signs_bot.check_commands(pos, text)
|
function signs_bot.check_commands(pos, text)
|
||||||
return ci.check_script(text)
|
return ci.check_script(text)
|
||||||
end
|
end
|
||||||
@ -107,7 +110,7 @@ local function check_sign(pos, mem)
|
|||||||
if meta:get_int("err_code") ~= 0 then -- code not valid?
|
if meta:get_int("err_code") ~= 0 then -- code not valid?
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local node = tubelib2.get_node_lvm(pos)
|
local node = tubelib2.get_node_lvm(pos)
|
||||||
-- correct sign direction?
|
-- correct sign direction?
|
||||||
if mem.robot_param2 == node.param2 then
|
if mem.robot_param2 == node.param2 then
|
||||||
@ -187,7 +190,7 @@ function signs_bot.run_next_command(base_pos, mem)
|
|||||||
signs_bot.stop_robot(base_pos, mem)
|
signs_bot.stop_robot(base_pos, mem)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if not power_consumption(mem) then
|
if not power_consumption(mem) then
|
||||||
signs_bot.stop_robot(base_pos, mem)
|
signs_bot.stop_robot(base_pos, mem)
|
||||||
mem.bot_state = "nopower"
|
mem.bot_state = "nopower"
|
||||||
return bot_error(base_pos, mem, "No power")
|
return bot_error(base_pos, mem, "No power")
|
||||||
@ -201,33 +204,33 @@ end
|
|||||||
|
|
||||||
signs_bot.register_botcommand("repeat", {
|
signs_bot.register_botcommand("repeat", {
|
||||||
mod = "core",
|
mod = "core",
|
||||||
params = "<num>",
|
params = "<num>",
|
||||||
description = S("start of a 'repeat..end' block"),
|
description = S("start of a 'repeat..end' block"),
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("end", {
|
signs_bot.register_botcommand("end", {
|
||||||
mod = "core",
|
mod = "core",
|
||||||
params = "",
|
params = "",
|
||||||
description = S("end command of a 'repeat..end' block"),
|
description = S("end command of a 'repeat..end' block"),
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("call", {
|
signs_bot.register_botcommand("call", {
|
||||||
mod = "core",
|
mod = "core",
|
||||||
params = "<label>",
|
params = "<label>",
|
||||||
description = S("call a subroutine (with 'return' statement)"),
|
description = S("call a subroutine (with 'return' statement)"),
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("return", {
|
signs_bot.register_botcommand("return", {
|
||||||
mod = "core",
|
mod = "core",
|
||||||
params = "",
|
params = "",
|
||||||
description = S("return from a subroutine"),
|
description = S("return from a subroutine"),
|
||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("jump", {
|
signs_bot.register_botcommand("jump", {
|
||||||
mod = "core",
|
mod = "core",
|
||||||
params = "<label>",
|
params = "<label>",
|
||||||
description = S("jump to a label"),
|
description = S("jump to a label"),
|
||||||
})
|
})
|
||||||
|
|
||||||
local function move(mem, any_sensor)
|
local function move(mem, any_sensor)
|
||||||
local new_pos = signs_bot.move_robot(mem)
|
local new_pos = signs_bot.move_robot(mem)
|
||||||
@ -244,7 +247,7 @@ end
|
|||||||
|
|
||||||
signs_bot.register_botcommand("move", {
|
signs_bot.register_botcommand("move", {
|
||||||
mod = "move",
|
mod = "move",
|
||||||
params = "<steps>",
|
params = "<steps>",
|
||||||
num_param = 1,
|
num_param = 1,
|
||||||
description = S([[Move the robot 1..999 steps forward
|
description = S([[Move the robot 1..999 steps forward
|
||||||
without paying attention to any signs.
|
without paying attention to any signs.
|
||||||
@ -268,7 +271,7 @@ signs_bot.register_botcommand("cond_move", {
|
|||||||
num_param = 0,
|
num_param = 0,
|
||||||
description = S([[Walk until a sign or obstacle is
|
description = S([[Walk until a sign or obstacle is
|
||||||
reached. Then continue with the next command.
|
reached. Then continue with the next command.
|
||||||
When a sign has been reached,
|
When a sign has been reached,
|
||||||
the current program is ended
|
the current program is ended
|
||||||
and the bot executes the
|
and the bot executes the
|
||||||
new program from the sign]]),
|
new program from the sign]]),
|
||||||
@ -289,7 +292,7 @@ signs_bot.register_botcommand("print", {
|
|||||||
params = "<text>",
|
params = "<text>",
|
||||||
num_param = 1,
|
num_param = 1,
|
||||||
description = S([[Print given text as chat message.
|
description = S([[Print given text as chat message.
|
||||||
For two or more words, use the '*' character
|
For two or more words, use the '*' character
|
||||||
instead of spaces, like "Hello*world"]]),
|
instead of spaces, like "Hello*world"]]),
|
||||||
check = function(text)
|
check = function(text)
|
||||||
return text ~= ""
|
return text ~= ""
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Commands for the compost mod
|
Signs Bot: Commands for the compost mod
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -25,14 +25,14 @@ local function additem(mem, stack)
|
|||||||
if ndef.minecart_hopper_additem then
|
if ndef.minecart_hopper_additem then
|
||||||
return ndef.minecart_hopper_additem(pos, stack)
|
return ndef.minecart_hopper_additem(pos, stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
|
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos)
|
||||||
ndef = minetest.registered_nodes[node.name]
|
ndef = minetest.registered_nodes[node.name]
|
||||||
if ndef and ndef.minecart_hopper_additem then
|
if ndef and ndef.minecart_hopper_additem then
|
||||||
return ndef.minecart_hopper_additem(pos, stack)
|
return ndef.minecart_hopper_additem(pos, stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ local function takeitem(mem)
|
|||||||
if ndef.minecart_hopper_takeitem then
|
if ndef.minecart_hopper_takeitem then
|
||||||
return ndef.minecart_hopper_takeitem(pos, 1)
|
return ndef.minecart_hopper_takeitem(pos, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
|
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos)
|
||||||
ndef = minetest.registered_nodes[node.name]
|
ndef = minetest.registered_nodes[node.name]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Crop Sensor
|
Crop Sensor
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -25,7 +25,7 @@ local CYCLE_TIME = 4
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, dest_idx)
|
local function update_infotext(pos, dest_pos, dest_idx)
|
||||||
M(pos):set_string("infotext", S("Crop Sensor: Connected with").." "..P2S(dest_pos).." / "..dest_idx)
|
M(pos):set_string("infotext", S("Crop Sensor: Connected with").." "..P2S(dest_pos).." / "..dest_idx)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function swap_node(pos, name)
|
local function swap_node(pos, name)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
@ -39,7 +39,7 @@ local function swap_node(pos, name)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos)
|
local function node_timer(pos)
|
||||||
local pos1 = lib.next_pos(pos, M(pos):get_int("param2"))
|
local pos1 = lib.next_pos(pos, M(pos):get_int("param2"))
|
||||||
local node = minetest.get_node_or_nil(pos1)
|
local node = minetest.get_node_or_nil(pos1)
|
||||||
@ -72,7 +72,7 @@ minetest.register_node("signs_bot:crop_sensor", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("infotext", S("Crop Sensor: Not connected"))
|
meta:set_string("infotext", S("Crop Sensor: Not connected"))
|
||||||
@ -80,7 +80,7 @@ minetest.register_node("signs_bot:crop_sensor", {
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
meta:set_int("param2", (node.param2 + 2) % 4)
|
meta:set_int("param2", (node.param2 + 2) % 4)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -111,7 +111,7 @@ minetest.register_node("signs_bot:crop_sensor_on", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -155,10 +155,10 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:crop_sensor",
|
item = "signs_bot:crop_sensor",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Crop Sensor sends cyclical signals when, for example, wheat is fully grown."),
|
S("The Crop Sensor sends cyclical signals when, for example, wheat is fully grown."),
|
||||||
S("The sensor range is one node/meter."),
|
S("The sensor range is one node/meter."),
|
||||||
S("The sensor has an active side (red) that must point to the crop/field."),
|
S("The sensor has an active side (red) that must point to the crop/field."),
|
||||||
|
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signal Delayer.
|
Signal Delayer.
|
||||||
Signals are forwarded delayed. Subsequent signals are queued.
|
Signals are forwarded delayed. Subsequent signals are queued.
|
||||||
]]--
|
]]--
|
||||||
@ -24,7 +24,7 @@ local CYCLE_TIME = 2
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, cmnd)
|
local function update_infotext(pos, dest_pos, cmnd)
|
||||||
M(pos):set_string("infotext", S("Signal Delayer: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
M(pos):set_string("infotext", S("Signal Delayer: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function infotext(pos)
|
local function infotext(pos)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
@ -52,7 +52,7 @@ local function signs_bot_get_signal(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- switch to normal or loaded texture
|
-- switch to normal or loaded texture
|
||||||
local function turn_off(pos)
|
local function turn_off(pos)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if mem.queue > 0 then
|
if mem.queue > 0 then
|
||||||
@ -64,7 +64,7 @@ local function turn_off(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- switch to loaded texture
|
-- switch to loaded texture
|
||||||
local function loaded(pos)
|
local function loaded(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name == "signs_bot:delayer" or node.name == "signs_bot:delayer_on" then
|
if node.name == "signs_bot:delayer" or node.name == "signs_bot:delayer_on" then
|
||||||
node.name = "signs_bot:delayer_loaded"
|
node.name = "signs_bot:delayer_loaded"
|
||||||
@ -105,10 +105,10 @@ local function signs_bot_on_signal(pos, node, signal)
|
|||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
mem.queue = mem.queue or 0
|
mem.queue = mem.queue or 0
|
||||||
|
|
||||||
--print("signs_bot_on_signal", signal, meta:get_int("time"))
|
--print("signs_bot_on_signal", signal, meta:get_int("time"))
|
||||||
if signal ~= "do" or meta:get_int("time") == 0 then return end
|
if signal ~= "do" or meta:get_int("time") == 0 then return end
|
||||||
|
|
||||||
if mem.queue <= 0 then
|
if mem.queue <= 0 then
|
||||||
mem.queue = 1
|
mem.queue = 1
|
||||||
mem.time = meta:get_int("time")
|
mem.time = meta:get_int("time")
|
||||||
@ -152,7 +152,7 @@ minetest.register_node("signs_bot:delayer", {
|
|||||||
"signs_bot_sensor2.png^signs_bot_delayer.png",
|
"signs_bot_sensor2.png^signs_bot_delayer.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
@ -161,7 +161,7 @@ minetest.register_node("signs_bot:delayer", {
|
|||||||
infotext(pos)
|
infotext(pos)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
signs_bot_get_signal = signs_bot_get_signal,
|
signs_bot_get_signal = signs_bot_get_signal,
|
||||||
signs_bot_on_signal = signs_bot_on_signal,
|
signs_bot_on_signal = signs_bot_on_signal,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
@ -265,9 +265,9 @@ if minetest.get_modpath("doc") then
|
|||||||
data = {
|
data = {
|
||||||
item = "signs_bot:delayer",
|
item = "signs_bot:delayer",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Signals are forwarded delayed. Subsequent signals are queued."),
|
S("Signals are forwarded delayed. Subsequent signals are queued."),
|
||||||
S("The delay time can be configured."),
|
S("The delay time can be configured."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPLv3
|
GPLv3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Bot Flap
|
Signs Bot: Bot Flap
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -145,7 +145,7 @@ doc.add_category("signs_bot",
|
|||||||
name = S("Signs Bot"),
|
name = S("Signs Bot"),
|
||||||
description = S("A robot controlled by signs, used for automated work"),
|
description = S("A robot controlled by signs, used for automated work"),
|
||||||
sorting = "custom",
|
sorting = "custom",
|
||||||
sorting_data = {"start", "control", "sensor_doc", "tool",
|
sorting_data = {"start", "control", "sensor_doc", "tool",
|
||||||
"box", "bot_flap", "duplicator",
|
"box", "bot_flap", "duplicator",
|
||||||
"bot_sensor", "cart_sensor", "node_sensor", "crop_sensor", "chest", "timer",
|
"bot_sensor", "cart_sensor", "node_sensor", "crop_sensor", "chest", "timer",
|
||||||
"changer", "sensor_extender",
|
"changer", "sensor_extender",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs duplicator
|
Signs duplicator
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -46,7 +46,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||||||
if listname == "outp" then
|
if listname == "outp" then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if minetest.get_item_group(stack:get_name(), "sign_bot_sign") ~= 1
|
if minetest.get_item_group(stack:get_name(), "sign_bot_sign") ~= 1
|
||||||
and stack:get_name() ~= "default:book_written" then
|
and stack:get_name() ~= "default:book_written" then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
@ -66,7 +66,7 @@ end
|
|||||||
local function get_template_data(stack)
|
local function get_template_data(stack)
|
||||||
local name = stack:get_name()
|
local name = stack:get_name()
|
||||||
local data = stack:get_meta():to_table().fields
|
local data = stack:get_meta():to_table().fields
|
||||||
|
|
||||||
if name == "default:sign_user" or name == "signs_bot:sign_cmnd" then
|
if name == "default:sign_user" or name == "signs_bot:sign_cmnd" then
|
||||||
return data.description, data.cmnd
|
return data.description, data.cmnd
|
||||||
end
|
end
|
||||||
@ -92,7 +92,7 @@ local function move_to_output(pos)
|
|||||||
local outp_stack = inv:get_stack("outp", 1)
|
local outp_stack = inv:get_stack("outp", 1)
|
||||||
local dest_item = get_dest_item(inp_stack)
|
local dest_item = get_dest_item(inp_stack)
|
||||||
local descr, cmnd = get_template_data(temp_stack)
|
local descr, cmnd = get_template_data(temp_stack)
|
||||||
|
|
||||||
if dest_item and descr then
|
if dest_item and descr then
|
||||||
dest_item:set_count(inp_stack:get_count())
|
dest_item:set_count(inp_stack:get_count())
|
||||||
local meta = dest_item:get_meta()
|
local meta = dest_item:get_meta()
|
||||||
@ -131,11 +131,11 @@ minetest.register_node("signs_bot:duplicator", {
|
|||||||
inv:set_size('outp', 1)
|
inv:set_size('outp', 1)
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
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)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return false
|
return false
|
||||||
@ -144,7 +144,7 @@ minetest.register_node("signs_bot:duplicator", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("inp") and inv:is_empty("temp") and inv:is_empty("outp")
|
return inv:is_empty("inp") and inv:is_empty("temp") and inv:is_empty("outp")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
@ -200,7 +200,7 @@ minetest.register_node("signs_bot:sign_user", {
|
|||||||
local text = nmeta:get_string("sign_name").."\n"..imeta:get_string("cmnd")
|
local text = nmeta:get_string("sign_name").."\n"..imeta:get_string("cmnd")
|
||||||
nmeta:set_string("formspec", formspec_user(text))
|
nmeta:set_string("formspec", formspec_user(text))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = lib.after_dig_sign_node,
|
after_dig_node = lib.after_dig_sign_node,
|
||||||
drop = "",
|
drop = "",
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -212,9 +212,9 @@ minetest.register_node("signs_bot:sign_user", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
signs_bot.register_sign({
|
signs_bot.register_sign({
|
||||||
name = "sign_blank",
|
name = "sign_blank",
|
||||||
description = S('Sign "blank"'),
|
description = S('Sign "blank"'),
|
||||||
commands = "",
|
commands = "",
|
||||||
image = "signs_bot_sign_blank.png",
|
image = "signs_bot_sign_blank.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -234,13 +234,13 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:duplicator",
|
item = "signs_bot:duplicator",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Duplicator can be used to make copies of signs."),
|
S("The Duplicator can be used to make copies of signs."),
|
||||||
S("1. Put one 'cmnd' sign to be used as template into the 'Template' inventory"),
|
S("1. Put one 'cmnd' sign to be used as template into the 'Template' inventory"),
|
||||||
S("2. Add one or several 'blank signs' to the 'Input' inventory."),
|
S("2. Add one or several 'blank signs' to the 'Input' inventory."),
|
||||||
S("3. Take the copies from the 'Output' inventory."),
|
S("3. Take the copies from the 'Output' inventory."),
|
||||||
"",
|
"",
|
||||||
S("Written books [default:book_written] can alternatively be used as template"),
|
S("Written books [default:book_written] can alternatively be used as template"),
|
||||||
S("Already written signs can be used as input, too."),
|
S("Already written signs can be used as input, too."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -250,7 +250,7 @@ if minetest.get_modpath("doc") then
|
|||||||
name = S('Sign "blank"'),
|
name = S('Sign "blank"'),
|
||||||
data = {
|
data = {
|
||||||
item = "signs_bot:sign_blank",
|
item = "signs_bot:sign_blank",
|
||||||
text = S("Needed as input for the Duplicator.")
|
text = S("Needed as input for the Duplicator.")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Sensor Extender
|
Sensor Extender
|
||||||
(passive node, the Sensor detects the extender)
|
(passive node, the Sensor detects the extender)
|
||||||
]]--
|
]]--
|
||||||
@ -21,7 +21,7 @@ local S = signs_bot.S
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, cmnd)
|
local function update_infotext(pos, dest_pos, cmnd)
|
||||||
M(pos):set_string("infotext", S("Sensor Extender: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
M(pos):set_string("infotext", S("Sensor Extender: Connected with").." "..P2S(dest_pos).." / "..cmnd)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("signs_bot:sensor_extender", {
|
minetest.register_node("signs_bot:sensor_extender", {
|
||||||
description = S("Sensor Extender"),
|
description = S("Sensor Extender"),
|
||||||
@ -47,12 +47,12 @@ minetest.register_node("signs_bot:sensor_extender", {
|
|||||||
"signs_bot_extender_side.png",
|
"signs_bot_extender_side.png",
|
||||||
"signs_bot_extender_side.png",
|
"signs_bot_extender_side.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("infotext", S("Sensor Extender: Not connected"))
|
meta:set_string("infotext", S("Sensor Extender: Not connected"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -87,21 +87,21 @@ minetest.register_node("signs_bot:sensor_extender_on", {
|
|||||||
"signs_bot_extender_side.png",
|
"signs_bot_extender_side.png",
|
||||||
"signs_bot_extender_side.png",
|
"signs_bot_extender_side.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Called from the Sensor beside
|
-- Called from the Sensor beside
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
signs_bot.send_signal(pos)
|
signs_bot.send_signal(pos)
|
||||||
signs_bot.lib.activate_extender_nodes(pos)
|
signs_bot.lib.activate_extender_nodes(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local node = tubelib2.get_node_lvm(pos)
|
local node = tubelib2.get_node_lvm(pos)
|
||||||
node.name = "signs_bot:sensor_extender"
|
node.name = "signs_bot:sensor_extender"
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -130,9 +130,9 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:sensor_extender",
|
item = "signs_bot:sensor_extender",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("With the Sensor Extender, sensor signals can be sent to more than one actuator."),
|
S("With the Sensor Extender, sensor signals can be sent to more than one actuator."),
|
||||||
S("Place one or more extender nearby the sensor and connect each extender"),
|
S("Place one or more extender nearby the sensor and connect each extender"),
|
||||||
S("with one further actuator by means of the Connection Tool."),
|
S("with one further actuator by means of the Connection Tool."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
0
signs_bot/i18n.py
Normal file → Executable file
0
signs_bot/i18n.py
Normal file → Executable file
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
A robot controlled by signs
|
A robot controlled by signs
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -15,7 +15,7 @@
|
|||||||
signs_bot = {}
|
signs_bot = {}
|
||||||
|
|
||||||
-- Version for compatibility checks, see readme.md/history
|
-- Version for compatibility checks, see readme.md/history
|
||||||
signs_bot.version = 1.09
|
signs_bot.version = 1.12
|
||||||
|
|
||||||
-- Test for MT 5.4 new string mode
|
-- Test for MT 5.4 new string mode
|
||||||
signs_bot.CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
signs_bot.CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Command interpreter
|
Signs Bot: Command interpreter
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -20,7 +20,7 @@ local MAX_SIZE = 1000 -- max number of tokens
|
|||||||
local tCmdDef = {}
|
local tCmdDef = {}
|
||||||
local lCmdLookup = {}
|
local lCmdLookup = {}
|
||||||
local tSymbolTbl = {}
|
local tSymbolTbl = {}
|
||||||
local CodeCache = {}
|
local CodeCache = {}
|
||||||
|
|
||||||
local api = {}
|
local api = {}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ local function tokenizer(script)
|
|||||||
end
|
end
|
||||||
tokens[#tokens + 1] = "exit"
|
tokens[#tokens + 1] = "exit"
|
||||||
return tokens
|
return tokens
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pass1(tokens)
|
local function pass1(tokens)
|
||||||
local pc = 1
|
local pc = 1
|
||||||
@ -125,7 +125,7 @@ local function compile(script)
|
|||||||
local tokens = tokenizer(script)
|
local tokens = tokenizer(script)
|
||||||
pass1(tokens)
|
pass1(tokens)
|
||||||
return pass2(tokens)
|
return pass2(tokens)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function gen_string_cmnd(code, pc, num_param, script)
|
local function gen_string_cmnd(code, pc, num_param, script)
|
||||||
local tokens = tokenizer(script)
|
local tokens = tokenizer(script)
|
||||||
@ -149,9 +149,9 @@ local function register_command(cmnd_name, num_param, cmnd_func, check_func)
|
|||||||
assert(check_func or num_param == 0, cmnd_name..": check_func = "..dump(check_func))
|
assert(check_func or num_param == 0, cmnd_name..": check_func = "..dump(check_func))
|
||||||
lCmdLookup[#lCmdLookup + 1] = {num_param, cmnd_func, cmnd_name}
|
lCmdLookup[#lCmdLookup + 1] = {num_param, cmnd_func, cmnd_name}
|
||||||
tCmdDef[cmnd_name] = {
|
tCmdDef[cmnd_name] = {
|
||||||
num_param = num_param,
|
num_param = num_param,
|
||||||
cmnd = cmnd_func,
|
cmnd = cmnd_func,
|
||||||
name = cmnd_name,
|
name = cmnd_name,
|
||||||
check = check_func,
|
check = check_func,
|
||||||
opcode = #lCmdLookup,
|
opcode = #lCmdLookup,
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ register_command("repeat", 1,
|
|||||||
cnt = tonumber(cnt) or 0
|
cnt = tonumber(cnt) or 0
|
||||||
return cnt > 0 and cnt < 1000
|
return cnt > 0 and cnt < 1000
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
register_command("end", 0,
|
register_command("end", 0,
|
||||||
function(base_pos, mem)
|
function(base_pos, mem)
|
||||||
@ -183,7 +183,7 @@ register_command("end", 0,
|
|||||||
end
|
end
|
||||||
return api.DONE
|
return api.DONE
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
register_command("call", 1,
|
register_command("call", 1,
|
||||||
function(base_pos, mem, addr)
|
function(base_pos, mem, addr)
|
||||||
@ -197,7 +197,7 @@ register_command("call", 1,
|
|||||||
function(addr)
|
function(addr)
|
||||||
return addr and tSymbolTbl[addr..":"]
|
return addr and tSymbolTbl[addr..":"]
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
register_command("return", 0,
|
register_command("return", 0,
|
||||||
function(base_pos, mem)
|
function(base_pos, mem)
|
||||||
@ -208,7 +208,7 @@ register_command("return", 0,
|
|||||||
mem.Stack[#mem.Stack] = nil
|
mem.Stack[#mem.Stack] = nil
|
||||||
return api.DONE
|
return api.DONE
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
register_command("jump", 1,
|
register_command("jump", 1,
|
||||||
function(base_pos, mem, addr)
|
function(base_pos, mem, addr)
|
||||||
@ -218,7 +218,7 @@ register_command("jump", 1,
|
|||||||
function(addr)
|
function(addr)
|
||||||
return addr and tSymbolTbl[addr..":"]
|
return addr and tSymbolTbl[addr..":"]
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
register_command("exit", 0,
|
register_command("exit", 0,
|
||||||
function(base_pos, mem)
|
function(base_pos, mem)
|
||||||
@ -234,15 +234,20 @@ function api.register_command(cmnd_name, num_param, cmnd_func, check_func)
|
|||||||
register_command(cmnd_name, num_param, cmnd_func, check_func)
|
register_command(cmnd_name, num_param, cmnd_func, check_func)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function api.check_label(label)
|
||||||
|
return label and tSymbolTbl[label..":"] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- function returns: true/false, error_string, line-num
|
-- function returns: true/false, error_string, line-num
|
||||||
function api.check_script(script)
|
function api.check_script(script)
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
local num_token = 0
|
local num_token = 0
|
||||||
|
|
||||||
-- to fill the symbol table
|
-- to fill the symbol table
|
||||||
local tokens = tokenizer(script)
|
local tokens = tokenizer(script)
|
||||||
pass1(tokens)
|
pass1(tokens)
|
||||||
|
|
||||||
for idx, cmnd, param1, param2, param3 in get_line_tokens(script) do
|
for idx, cmnd, param1, param2, param3 in get_line_tokens(script) do
|
||||||
if tCmdDef[cmnd] then
|
if tCmdDef[cmnd] then
|
||||||
num_token = num_token + 1 + tCmdDef[cmnd].num_param
|
num_token = num_token + 1 + tCmdDef[cmnd].num_param
|
||||||
@ -270,7 +275,7 @@ function api.check_script(script)
|
|||||||
return false, S("'end' missing"), 0
|
return false, S("'end' missing"), 0
|
||||||
end
|
end
|
||||||
return true, S("Checked and approved"), 0
|
return true, S("Checked and approved"), 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function returns: true/false, error-string
|
-- function returns: true/false, error-string
|
||||||
-- default_cmnd is used for the 'cond_move'
|
-- default_cmnd is used for the 'cond_move'
|
||||||
@ -283,7 +288,7 @@ function api.run_script(base_pos, mem)
|
|||||||
local opcode = code[mem.pc]
|
local opcode = code[mem.pc]
|
||||||
if opcode then
|
if opcode then
|
||||||
local num_param, func = unpack(lCmdLookup[opcode])
|
local num_param, func = unpack(lCmdLookup[opcode])
|
||||||
|
|
||||||
--dbg_out(opcode, num_param, code, mem.pc)
|
--dbg_out(opcode, num_param, code, mem.pc)
|
||||||
local res, err = func(base_pos, mem, code[mem.pc+1], code[mem.pc+2], code[mem.pc+3])
|
local res, err = func(base_pos, mem, code[mem.pc+1], code[mem.pc+2], code[mem.pc+3])
|
||||||
if res == api.DONE then
|
if res == api.DONE then
|
||||||
@ -303,6 +308,7 @@ function api.reset_script(base_pos, mem)
|
|||||||
CodeCache[hash] = nil
|
CodeCache[hash] = nil
|
||||||
mem.pc = 1
|
mem.pc = 1
|
||||||
mem.Stack = {}
|
mem.Stack = {}
|
||||||
|
mem.bot_falling = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return api
|
return api
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Registation of standard chests and furnace
|
Registation of standard chests and furnace
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -29,14 +29,14 @@ signs_bot.register_inventory({"default:chest_locked", "default:chest_locked_open
|
|||||||
allow_inventory_put = function(pos, stack, player_name)
|
allow_inventory_put = function(pos, stack, player_name)
|
||||||
local owner = M(pos):get_string("owner")
|
local owner = M(pos):get_string("owner")
|
||||||
return owner == player_name
|
return owner == player_name
|
||||||
end,
|
end,
|
||||||
listname = "main",
|
listname = "main",
|
||||||
},
|
},
|
||||||
take = {
|
take = {
|
||||||
allow_inventory_take = function(pos, stack, player_name)
|
allow_inventory_take = function(pos, stack, player_name)
|
||||||
local owner = M(pos):get_string("owner")
|
local owner = M(pos):get_string("owner")
|
||||||
return owner == player_name
|
return owner == player_name
|
||||||
end,
|
end,
|
||||||
listname = "main",
|
listname = "main",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Library with helper functions
|
Signs Bot: Library with helper functions
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -33,13 +33,13 @@ function signs_bot.lib.register_node_to_be_dug(name)
|
|||||||
NotSoSimpleNodes[name] = true
|
NotSoSimpleNodes[name] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Determine the next robot position based on the robot position,
|
-- Determine the next robot position based on the robot position,
|
||||||
-- the robot param2.
|
-- the robot param2.
|
||||||
function signs_bot.lib.next_pos(pos, param2)
|
function signs_bot.lib.next_pos(pos, param2)
|
||||||
return vector.add(pos, Face2Dir[param2])
|
return vector.add(pos, Face2Dir[param2])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Determine the destination position based on the robot position,
|
-- Determine the destination position based on the robot position,
|
||||||
-- the robot param2, and a route table like : {0,0,3}
|
-- the robot param2, and a route table like : {0,0,3}
|
||||||
-- 0 = forward, 1 = right, 2 = backward, 3 = left
|
-- 0 = forward, 1 = right, 2 = backward, 3 = left
|
||||||
function signs_bot.lib.dest_pos(pos, param2, route)
|
function signs_bot.lib.dest_pos(pos, param2, route)
|
||||||
@ -62,7 +62,7 @@ local function poke_objects(pos, param2, objects)
|
|||||||
pos1 = vector.add(pos1, vector.multiply(Face2Dir[param2], 0.2))
|
pos1 = vector.add(pos1, vector.multiply(Face2Dir[param2], 0.2))
|
||||||
obj:move_to(pos1)
|
obj:move_to(pos1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if nodeA on posA == air-like and nodeB == solid and no player around
|
-- check if nodeA on posA == air-like and nodeB == solid and no player around
|
||||||
function signs_bot.lib.check_pos(posA, nodeA, nodeB, param2)
|
function signs_bot.lib.check_pos(posA, nodeA, nodeB, param2)
|
||||||
@ -124,7 +124,7 @@ function signs_bot.lib.is_simple_node(node)
|
|||||||
return handle_drop(ndef.drop)
|
return handle_drop(ndef.drop)
|
||||||
end
|
end
|
||||||
return ndef.drop or node.name
|
return ndef.drop or node.name
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check rights before node is dug or inventory is used
|
-- Check rights before node is dug or inventory is used
|
||||||
function signs_bot.lib.not_protected(base_pos, pos)
|
function signs_bot.lib.not_protected(base_pos, pos)
|
||||||
@ -148,7 +148,7 @@ end
|
|||||||
-- Search for items in the inventory and return the item_name or nil.
|
-- Search for items in the inventory and return the item_name or nil.
|
||||||
function signs_bot.lib.peek_inv(inv, listname)
|
function signs_bot.lib.peek_inv(inv, listname)
|
||||||
if inv:is_empty(listname) then return nil end
|
if inv:is_empty(listname) then return nil end
|
||||||
|
|
||||||
local inv_size = inv:get_size(listname)
|
local inv_size = inv:get_size(listname)
|
||||||
|
|
||||||
for idx in signs_bot.random(inv_size) do
|
for idx in signs_bot.random(inv_size) do
|
||||||
@ -174,7 +174,7 @@ end
|
|||||||
--
|
--
|
||||||
-- Place/dig signs
|
-- Place/dig signs
|
||||||
--
|
--
|
||||||
function signs_bot.lib.place_sign(pos, sign, param2)
|
function signs_bot.lib.place_sign(pos, sign, param2)
|
||||||
if sign:get_name() then
|
if sign:get_name() then
|
||||||
minetest.set_node(pos, {name=sign:get_name(), param2=param2})
|
minetest.set_node(pos, {name=sign:get_name(), param2=param2})
|
||||||
local ndef = minetest.registered_nodes[sign:get_name()]
|
local ndef = minetest.registered_nodes[sign:get_name()]
|
||||||
@ -240,8 +240,8 @@ end
|
|||||||
|
|
||||||
local NestedCounter = 0
|
local NestedCounter = 0
|
||||||
function signs_bot.lib.activate_extender_nodes(pos, is_sensor)
|
function signs_bot.lib.activate_extender_nodes(pos, is_sensor)
|
||||||
if is_sensor then
|
if is_sensor then
|
||||||
NestedCounter = 0
|
NestedCounter = 0
|
||||||
else
|
else
|
||||||
NestedCounter = NestedCounter + 1
|
NestedCounter = NestedCounter + 1
|
||||||
if NestedCounter >= 5 then
|
if NestedCounter >= 5 then
|
||||||
@ -265,11 +265,11 @@ local function start_pos(robot_pos, robot_param2, x_size, lvl_offs)
|
|||||||
else
|
else
|
||||||
return dest_pos(pos, robot_param2, {3})
|
return dest_pos(pos, robot_param2, {3})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Return a table with all positions to copy
|
-- Return a table with all positions to copy
|
||||||
--
|
--
|
||||||
function signs_bot.lib.gen_position_table(robot_pos, robot_param2, x_size, z_size, lvl_offs)
|
function signs_bot.lib.gen_position_table(robot_pos, robot_param2, x_size, z_size, lvl_offs)
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
if robot_pos and robot_param2 and x_size and z_size and lvl_offs then
|
if robot_pos and robot_param2 and x_size and z_size and lvl_offs then
|
||||||
|
@ -25,6 +25,11 @@ The box inventory simulates the inventory of the bot.=Das Inventar der Box simul
|
|||||||
You will not be able to access the inventory, if the bot is running.=Du hast keinen Zugriff auf das Inventar, sofern der Roboter unterwegs ist.
|
You will not be able to access the inventory, if the bot is running.=Du hast keinen Zugriff auf das Inventar, sofern der Roboter unterwegs ist.
|
||||||
The bot can carry up to 8 stacks and 6 signs with it.=Der Roboter kann 8 Stapel von Blöcken und 6 Zeichen transportieren.
|
The bot can carry up to 8 stacks and 6 signs with it.=Der Roboter kann 8 Stapel von Blöcken und 6 Zeichen transportieren.
|
||||||
|
|
||||||
|
### basis.lua ###
|
||||||
|
### techage.lua ###
|
||||||
|
|
||||||
|
charging=aufladen
|
||||||
|
|
||||||
### bot_flap.lua ###
|
### bot_flap.lua ###
|
||||||
|
|
||||||
Exit=Beenden
|
Exit=Beenden
|
||||||
@ -41,11 +46,6 @@ Bot Sensor: Not connected=Bot Sensor: Nicht verbunden
|
|||||||
The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=Der Roboter Sensor entdeckt jeden Roboter und sendet ein Signal, sofern ein Roboter in der Nähe ist.
|
The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=Der Roboter Sensor entdeckt jeden Roboter und sendet ein Signal, sofern ein Roboter in der Nähe ist.
|
||||||
The sensor direction does not care.=Die Ausrichtung des Sensor spielt keine Rolle.
|
The sensor direction does not care.=Die Ausrichtung des Sensor spielt keine Rolle.
|
||||||
|
|
||||||
### bot_sensor.lua ###
|
|
||||||
### cart_sensor.lua ###
|
|
||||||
|
|
||||||
the sensor range is one node/meter.=Der Sensorbereich ist einen Block/Meter groß.
|
|
||||||
|
|
||||||
### cart_sensor.lua ###
|
### cart_sensor.lua ###
|
||||||
|
|
||||||
Cart Sensor: Connected with=Wagen Sensor: Verbunden mit
|
Cart Sensor: Connected with=Wagen Sensor: Verbunden mit
|
||||||
@ -54,6 +54,11 @@ Cart Sensor: Not connected=Wagen Sensor: Nicht verbunden
|
|||||||
The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.=Der Wagen Sensor sendet ein Signal, sofern ein Wagen in der Nähe ist.
|
The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.=Der Wagen Sensor sendet ein Signal, sofern ein Wagen in der Nähe ist.
|
||||||
The sensor has an active side (red) that must point to the rail/cart.=Der Sensor hat eine aktive Seite (rot), welche zu den Schienen zeigen muss.
|
The sensor has an active side (red) that must point to the rail/cart.=Der Sensor hat eine aktive Seite (rot), welche zu den Schienen zeigen muss.
|
||||||
|
|
||||||
|
### cart_sensor.lua ###
|
||||||
|
### bot_sensor.lua ###
|
||||||
|
|
||||||
|
the sensor range is one node/meter.=Der Sensorbereich ist einen Block/Meter groß.
|
||||||
|
|
||||||
### changer.lua ###
|
### changer.lua ###
|
||||||
|
|
||||||
Signs:=Zeichen:
|
Signs:=Zeichen:
|
||||||
@ -85,27 +90,28 @@ Sign 'farming'=Zeichen 'Farming'
|
|||||||
Used to harvest and seed a 3x3 field.=Benötigt um ein 3x3 Feld zu ernten und wieder zu sähen.
|
Used to harvest and seed a 3x3 field.=Benötigt um ein 3x3 Feld zu ernten und wieder zu sähen.
|
||||||
The seed to be placed has to be in the first inventory slot of the bot.=Das Saatgut, dass gesät werden soll, muss sich an der 1. Position im Inventar befinden.
|
The seed to be placed has to be in the first inventory slot of the bot.=Das Saatgut, dass gesät werden soll, muss sich an der 1. Position im Inventar befinden.
|
||||||
|
|
||||||
### cmd_flowers.lua ###
|
|
||||||
|
|
||||||
Cutting flowers, leaves and tree blocks@nin front of the robot@non a 3x3 field.=Schneide Blumen, Blätter und Baumblöcke@nin einem 3x3 großem Feld@nvor dem Roboter.
|
|
||||||
Sign "flowers"=Zeichen "Blumen"
|
|
||||||
Sign 'flowers'=Zeichen 'Blumen'
|
|
||||||
Used to cut flowers on a 3x3 field.=Benötigt um ein 3x3 Blumenfeld zu ernten.
|
|
||||||
|
|
||||||
### cmd_flowers.lua ###
|
|
||||||
### cmd_farming.lua ###
|
### cmd_farming.lua ###
|
||||||
|
### cmd_flowers.lua ###
|
||||||
|
|
||||||
Place the sign in front of the field.=Platziere das Zeichen vor das Feld.
|
Place the sign in front of the field.=Platziere das Zeichen vor das Feld.
|
||||||
When finished, the bot turns.=Der Roboter dreht um, wenn er fertig ist.
|
When finished, the bot turns.=Der Roboter dreht um, wenn er fertig ist.
|
||||||
|
|
||||||
|
### cmd_flowers.lua ###
|
||||||
|
|
||||||
|
Cutting flowers, papyrus,@nleaves and tree blocks@nin front of the robot@non a 3x3 field.=Schneide Blumen, Papyrus,@nBlätter und Baumblöcke@nin einem 3x3 großem Feld@nvor dem Roboter.
|
||||||
|
Sign "flowers"=Zeichen "Blumen"
|
||||||
|
Sign 'flowers'=Zeichen 'Blumen'
|
||||||
|
Used to cut flowers on a 3x3 field.=Benötigt um ein 3x3 Blumenfeld zu ernten.
|
||||||
|
|
||||||
### cmd_item.lua ###
|
### cmd_item.lua ###
|
||||||
|
|
||||||
Take <num> items from a chest like node@nand put it into the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=Nehme <num> Gegenstände aus der@nKiste oder dem Kisten-ähnlichen Block@nund tue diese in das eigene Inventar@nan der Position <slot>. Slot = (1..8)@noder 0 für irgend eine Position
|
Take <num> items from a chest like node@nand put it into the item inventory.@n<slot> is the bot inventory slot@n(1..8) or 0 for any one=Nehme <num> Gegenstände aus der@nKiste oder dem Kisten-ähnlichen Block@nund tue diese in das eigene Inventar@nan der Position <slot>. Slot = (1..8)@noder 0 für irgend eine Position
|
||||||
Add <num> items to a chest like node@ntaken from the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=Lege <num> Gegenstände aus dem@neigenen Inventar in die andere Kiste.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
Check if there are <num>@nitems in the chest like node.@nIf not, jump to <label>@n<slot> is the bot inventory slot@n(1..8) to specify the item, or 0 for any item=Prüfe, ob sich <num> Gegenstände@nin dem Kisten-ähnlichen Block befinden.@nWenn nicht, springe zu <label>@n<slot> ist der Bot-Inventar-Slot@n(1..8) um einen Gegenstand auszuwählen, oder 0 für irgendeinen Gegenstand
|
||||||
Add <num> fuel to a furnace like node@ntaken from the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=Lege <num> Brennstoffe aus dem@neigenen Inventar in den anderen Block.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
Add <num> items to a chest like node@ntaken from the item inventory.@n<slot> is the bot inventory slot (1..8) or 0 for any one=Lege <num> Gegenstände aus dem@neigenen Inventar in die andere Kiste.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
||||||
|
Add <num> fuel to a furnace like node@ntaken from the item inventory.@n<slot> is the bot inventory slot (1..8) or 0 for any one=Lege <num> Brennstoffe aus dem@neigenen Inventar in den anderen Block.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
||||||
deprecated, use bot inventory configuration instead=veraltet, benutze stattdessen die Inventar Konfigurationsmöglichkeit
|
deprecated, use bot inventory configuration instead=veraltet, benutze stattdessen die Inventar Konfigurationsmöglichkeit
|
||||||
Pick up all objects@nin a 3x3 field.@n<slot> is the inventory slot (1..8) or 0 for any one=Hebe alle Objekte in einem@n3x3 Blöcke großen Feld auf@nund lege diese in das eigene@nInventar an Position <slot> (1-8)@noder 0 für irgend eine Position
|
Pick up all objects@nin a 3x3 field.@n<slot> is the bot inventory slot (1..8) or 0 for any one=Hebe alle Objekte in einem@n3x3 Blöcke großen Feld auf@nund lege diese in das eigene@nInventar an Position <slot> (1-8)@noder 0 für irgend eine Position
|
||||||
Drop items in front of the bot.@n<slot> is the inventory slot (1..8) or 0 for any one=Lasse ein Objekt aus dem eigenen@nInventar vor dem Roboter fallen.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
Drop items in front of the bot.@n<slot> is the bot inventory slot (1..8) or 0 for any one=Lasse ein Objekt aus dem eigenen@nInventar vor dem Roboter fallen.@n<slot> ist die Position im@neigenen Inventar (1--8).@noder 0 für irgend eine Position
|
||||||
Punch a rail cart to start it=Schlage den Wagen um ihn zu starten
|
Punch a rail cart to start it=Schlage den Wagen um ihn zu starten
|
||||||
|
|
||||||
### cmd_move.lua ###
|
### cmd_move.lua ###
|
||||||
@ -116,6 +122,7 @@ Turn the robot to the right=Drehe den Roboter@nnach rechts
|
|||||||
Turn the robot around=Drehe den Roboter@num (180 Grad)
|
Turn the robot around=Drehe den Roboter@num (180 Grad)
|
||||||
Move the robot upwards=Bewege den Roboter@nnach oben
|
Move the robot upwards=Bewege den Roboter@nnach oben
|
||||||
Move the robot down=Bewege den Roboter@nnach unten
|
Move the robot down=Bewege den Roboter@nnach unten
|
||||||
|
Fall into a hole/chasm (up to 10 blocks)=Falle in ein Loch/Abgrund (bis zu 10 Blöcke)
|
||||||
Stop the robot for <sec> seconds@n(1..9999)=Stoppe den Roboter@nfür <sec> Sekunden (1.9999)
|
Stop the robot for <sec> seconds@n(1..9999)=Stoppe den Roboter@nfür <sec> Sekunden (1.9999)
|
||||||
Stop the robot.=Stoppe den Roboter.
|
Stop the robot.=Stoppe den Roboter.
|
||||||
Turn the robot off@nand put it back in the box.=Schalte den Roboter aus und@nsetze ihn damit zurück in@nseine Box.
|
Turn the robot off@nand put it back in the box.=Schalte den Roboter aus und@nsetze ihn damit zurück in@nseine Box.
|
||||||
@ -151,6 +158,11 @@ Dig the block above the robot.@n<slot> is the inventory slot (1..8)=Entferne ein
|
|||||||
Rotate the block in front of the robot@n<lvl> is one of: -1 0 +1@n<steps> is one of: 1 2 3=Rotiere den Block vor dem Roboter.@nFür <lvl> ist zulässig: -1 0 +1@nFür <steps> ist zulässig: 1 2 3
|
Rotate the block in front of the robot@n<lvl> is one of: -1 0 +1@n<steps> is one of: 1 2 3=Rotiere den Block vor dem Roboter.@nFür <lvl> ist zulässig: -1 0 +1@nFür <steps> ist zulässig: 1 2 3
|
||||||
Bot torch=Bot Fackel
|
Bot torch=Bot Fackel
|
||||||
|
|
||||||
|
### cmd_place.lua ###
|
||||||
|
### cmd_soup.lua ###
|
||||||
|
|
||||||
|
Error: Position protected=Fehler: Position geschützt
|
||||||
|
|
||||||
### cmd_sign.lua ###
|
### cmd_sign.lua ###
|
||||||
|
|
||||||
Commands,Help=Kommandos,Hilfe
|
Commands,Help=Kommandos,Hilfe
|
||||||
@ -218,11 +230,6 @@ to prevent wooden sign from catching fire.=um zu verhindern, dass das Holzschild
|
|||||||
4 - empty bowl (from farming or xdecor mods)= 4 - Leere Schüssel (Von der Mod farming oder xdecor)
|
4 - empty bowl (from farming or xdecor mods)= 4 - Leere Schüssel (Von der Mod farming oder xdecor)
|
||||||
The result is one bowl with vegetable soup in selected inventory slot.=Das Ergebnis ist eine Schüssel mit Gemüsesuppe an der ausgewählten Inventarposition.
|
The result is one bowl with vegetable soup in selected inventory slot.=Das Ergebnis ist eine Schüssel mit Gemüsesuppe an der ausgewählten Inventarposition.
|
||||||
|
|
||||||
### cmd_soup.lua ###
|
|
||||||
### cmd_place.lua ###
|
|
||||||
|
|
||||||
Error: Position protected=Fehler: Position geschützt
|
|
||||||
|
|
||||||
### cmd_trees.lua ###
|
### cmd_trees.lua ###
|
||||||
|
|
||||||
Used to harvest an aspen or pine tree trunk=Wird verwendet, um einen Espen- oder Kiefernstamm zu ernten
|
Used to harvest an aspen or pine tree trunk=Wird verwendet, um einen Espen- oder Kiefernstamm zu ernten
|
||||||
@ -244,8 +251,8 @@ call a subroutine (with 'return' statement)=Aufruf einer Unterfunktion (mit 'ret
|
|||||||
return from a subroutine=Rückkehr von einer Unterfunktion
|
return from a subroutine=Rückkehr von einer Unterfunktion
|
||||||
jump to a label=Sprung zu einer Marke
|
jump to a label=Sprung zu einer Marke
|
||||||
Move the robot 1..999 steps forward@nwithout paying attention to any signs.@nUp and down movements also become@ncounted as steps.=Bewege den Roboter 1..999 Schritte@nvorwärts ohne auf Zeichen zu achten.@nAuf- und Ab-Bewegungen werden auch@nals Schritte gezählt.
|
Move the robot 1..999 steps forward@nwithout paying attention to any signs.@nUp and down movements also become@ncounted as steps.=Bewege den Roboter 1..999 Schritte@nvorwärts ohne auf Zeichen zu achten.@nAuf- und Ab-Bewegungen werden auch@nals Schritte gezählt.
|
||||||
Walk until a sign or obstacle is@nreached. Then continue with the next command.@nWhen a sign has been reached, @nthe current program is ended@nand the bot executes the@nnew program from the sign=Gehe bis ein Zeichen oder Hindernis@nerreicht wurde. Führe dann das nächste@nKommando aus. @nWurde ein Zeichen erreicht, so arbeite@ndie Kommandos des Zeichens als@nUnter-Prozess ab
|
Walk until a sign or obstacle is@nreached. Then continue with the next command.@nWhen a sign has been reached,@nthe current program is ended@nand the bot executes the@nnew program from the sign=Gehe bis ein Zeichen oder Hindernis@nerreicht wurde. Führe dann das nächste@nKommando aus. @nWurde ein Zeichen erreicht, so arbeite@ndie Kommandos des Zeichens als@nUnter-Prozess ab
|
||||||
Print given text as chat message.@nFor two or more words, use the '*' character @ninstead of spaces, like "Hello*world"=Gebe den angegebenen Text als Chat-Nachricht aus.@nFür zwei oder mehr Wörter verwende das Zeichen '*' @nanstelle von Leerzeichen, z. B. "Hallo*Welt".
|
Print given text as chat message.@nFor two or more words, use the '*' character@ninstead of spaces, like "Hello*world"=Gebe den angegebenen Text als Chat-Nachricht aus.@nFür zwei oder mehr Wörter verwende das Zeichen '*' @nanstelle von Leerzeichen, z. B. "Hallo*Welt".
|
||||||
|
|
||||||
### compost.lua ###
|
### compost.lua ###
|
||||||
|
|
||||||
@ -269,6 +276,11 @@ Signal Delayer=Signal Verzögerer
|
|||||||
Signals are forwarded delayed. Subsequent signals are queued.=Signale werden verzögert weitergeleitet. Nachfolgende Signale werden in die Warteschlange gestellt.
|
Signals are forwarded delayed. Subsequent signals are queued.=Signale werden verzögert weitergeleitet. Nachfolgende Signale werden in die Warteschlange gestellt.
|
||||||
The delay time can be configured.=Die Verzögerungszeit kann eingestellt werden.
|
The delay time can be configured.=Die Verzögerungszeit kann eingestellt werden.
|
||||||
|
|
||||||
|
### delayer.lua ###
|
||||||
|
### timer.lua ###
|
||||||
|
|
||||||
|
Start=Start
|
||||||
|
|
||||||
### doc.lua ###
|
### doc.lua ###
|
||||||
|
|
||||||
After you have placed the Signs Bot Box, you can start the bot by means of the 'On' button in the box menu.=Nachdem du die Roboter-Kiste platziert hast, kannst du den Roboter über den "An" Button im Kistenmenü starten.
|
After you have placed the Signs Bot Box, you can start the bot by means of the 'On' button in the box menu.=Nachdem du die Roboter-Kiste platziert hast, kannst du den Roboter über den "An" Button im Kistenmenü starten.
|
||||||
@ -400,11 +412,6 @@ inputs=Eingängen
|
|||||||
Signal AND=Signal UND
|
Signal AND=Signal UND
|
||||||
Signal is sent, if all input signals are received.=Signal wird gesendet, wenn all Eingangssignale empfangen wurden.
|
Signal is sent, if all input signals are received.=Signal wird gesendet, wenn all Eingangssignale empfangen wurden.
|
||||||
|
|
||||||
### logic_and.lua ###
|
|
||||||
### timer.lua ###
|
|
||||||
|
|
||||||
Connected with=Verbunden mit
|
|
||||||
|
|
||||||
### node_sensor.lua ###
|
### node_sensor.lua ###
|
||||||
|
|
||||||
Node Sensor: Connected with =Block Sensor: Verbunden mit
|
Node Sensor: Connected with =Block Sensor: Verbunden mit
|
||||||
@ -447,13 +454,9 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t
|
|||||||
no power=kein Strom
|
no power=kein Strom
|
||||||
Ignite the techage charcoal lighter=Zünde den Holzkohle-Anzünder an
|
Ignite the techage charcoal lighter=Zünde den Holzkohle-Anzünder an
|
||||||
Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=Schalte den Bot aus,@nwenn die Batterieladung kleiner@nist als der angegebene Wert@nin Prozent (1.99)
|
Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=Schalte den Bot aus,@nwenn die Batterieladung kleiner@nist als der angegebene Wert@nin Prozent (1.99)
|
||||||
|
Jump to <label> if the@nbattery power is below the@ngiven value in percent (1..99)=Springe zu <label> wenn die@nBatterieladung unter dem@ngegebenen Wert in Prozent (1..99) liegt
|
||||||
fully charged=voll geladen
|
fully charged=voll geladen
|
||||||
Sends a techage command@nto a given node. @nReceiver is addressed by@nthe techage node number.@nFor commands with two or more @nwords, use the '*' character @ninstead of spaces, e.g.: @nsend_cmnd 3465 pull*default:dirt*2=Sende ein techage Kommando@nan einen Block mit der@nangegebenen Blocknummer.@nFür Kommandos mit zwei oder mehr @nWörtern verwende das Zeichen '*' @nanstelle des Leerzeichens, wie bspw.:@nsend_cmnd 3465 pull*default:dirt*2
|
Sends a techage command@nto a given node.@nReceiver is addressed by@nthe techage node number.@nFor commands with two or more@nwords, use the '*' character@ninstead of spaces, e.g.:@nsend_cmnd 3465 pull*default:dirt*2=Sende ein techage Kommando@nan einen Block mit der@nangegebenen Blocknummer.@nFür Kommandos mit zwei oder mehr @nWörtern verwende das Zeichen '*' @nanstelle des Leerzeichens, wie bspw.:@nsend_cmnd 3465 pull*default:dirt*2
|
||||||
|
|
||||||
### techage.lua ###
|
|
||||||
### basis.lua ###
|
|
||||||
|
|
||||||
charging=aufladen
|
|
||||||
|
|
||||||
### timer.lua ###
|
### timer.lua ###
|
||||||
|
|
||||||
@ -464,10 +467,11 @@ Special kind of sensor.=Spezielle Form eines Sensors.
|
|||||||
Can be programmed with a time in seconds, e.g. to start the bot cyclically.=Kann mit einer Zeit in Sekunden programmiert werden, um bspw. den Roboter zyklisch zu starten.
|
Can be programmed with a time in seconds, e.g. to start the bot cyclically.=Kann mit einer Zeit in Sekunden programmiert werden, um bspw. den Roboter zyklisch zu starten.
|
||||||
|
|
||||||
### timer.lua ###
|
### timer.lua ###
|
||||||
### delayer.lua ###
|
### logic_and.lua ###
|
||||||
|
|
||||||
Start=Start
|
Connected with=Verbunden mit
|
||||||
|
|
||||||
### tool.lua ###
|
### tool.lua ###
|
||||||
|
|
||||||
Sensor Connection Tool=Sensor Verbindungswerkzeug
|
Sensor Connection Tool=Sensor Verbindungswerkzeug
|
||||||
|
|
||||||
|
@ -25,6 +25,11 @@ The box inventory simulates the inventory of the bot.=
|
|||||||
You will not be able to access the inventory, if the bot is running.=
|
You will not be able to access the inventory, if the bot is running.=
|
||||||
The bot can carry up to 8 stacks and 6 signs with it.=
|
The bot can carry up to 8 stacks and 6 signs with it.=
|
||||||
|
|
||||||
|
### basis.lua ###
|
||||||
|
### techage.lua ###
|
||||||
|
|
||||||
|
charging=
|
||||||
|
|
||||||
### bot_flap.lua ###
|
### bot_flap.lua ###
|
||||||
|
|
||||||
Exit=
|
Exit=
|
||||||
@ -41,11 +46,6 @@ Bot Sensor: Not connected=
|
|||||||
The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=
|
The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=
|
||||||
The sensor direction does not care.=
|
The sensor direction does not care.=
|
||||||
|
|
||||||
### bot_sensor.lua ###
|
|
||||||
### cart_sensor.lua ###
|
|
||||||
|
|
||||||
the sensor range is one node/meter.=
|
|
||||||
|
|
||||||
### cart_sensor.lua ###
|
### cart_sensor.lua ###
|
||||||
|
|
||||||
Cart Sensor: Connected with=
|
Cart Sensor: Connected with=
|
||||||
@ -54,6 +54,11 @@ Cart Sensor: Not connected=
|
|||||||
The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.=
|
The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.=
|
||||||
The sensor has an active side (red) that must point to the rail/cart.=
|
The sensor has an active side (red) that must point to the rail/cart.=
|
||||||
|
|
||||||
|
### cart_sensor.lua ###
|
||||||
|
### bot_sensor.lua ###
|
||||||
|
|
||||||
|
the sensor range is one node/meter.=
|
||||||
|
|
||||||
### changer.lua ###
|
### changer.lua ###
|
||||||
|
|
||||||
Signs:=
|
Signs:=
|
||||||
@ -85,27 +90,28 @@ Sign 'farming'=
|
|||||||
Used to harvest and seed a 3x3 field.=
|
Used to harvest and seed a 3x3 field.=
|
||||||
The seed to be placed has to be in the first inventory slot of the bot.=
|
The seed to be placed has to be in the first inventory slot of the bot.=
|
||||||
|
|
||||||
### cmd_flowers.lua ###
|
|
||||||
|
|
||||||
Cutting flowers, leaves and tree blocks@nin front of the robot@non a 3x3 field.=
|
|
||||||
Sign "flowers"=
|
|
||||||
Sign 'flowers'=
|
|
||||||
Used to cut flowers on a 3x3 field.=
|
|
||||||
|
|
||||||
### cmd_flowers.lua ###
|
|
||||||
### cmd_farming.lua ###
|
### cmd_farming.lua ###
|
||||||
|
### cmd_flowers.lua ###
|
||||||
|
|
||||||
Place the sign in front of the field.=
|
Place the sign in front of the field.=
|
||||||
When finished, the bot turns.=
|
When finished, the bot turns.=
|
||||||
|
|
||||||
|
### cmd_flowers.lua ###
|
||||||
|
|
||||||
|
Cutting flowers, papyrus,@nleaves and tree blocks@nin front of the robot@non a 3x3 field.=
|
||||||
|
Sign "flowers"=
|
||||||
|
Sign 'flowers'=
|
||||||
|
Used to cut flowers on a 3x3 field.=
|
||||||
|
|
||||||
### cmd_item.lua ###
|
### cmd_item.lua ###
|
||||||
|
|
||||||
Take <num> items from a chest like node@nand put it into the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=
|
Take <num> items from a chest like node@nand put it into the item inventory.@n<slot> is the bot inventory slot@n(1..8) or 0 for any one=
|
||||||
Add <num> items to a chest like node@ntaken from the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=
|
Check if there are <num>@nitems in the chest like node.@nIf not, jump to <label>@n<slot> is the bot inventory slot@n(1..8) to specify the item, or 0 for any item=
|
||||||
Add <num> fuel to a furnace like node@ntaken from the item inventory.@n<slot> is the inventory slot (1..8) or 0 for any one=
|
Add <num> items to a chest like node@ntaken from the item inventory.@n<slot> is the bot inventory slot (1..8) or 0 for any one=
|
||||||
|
Add <num> fuel to a furnace like node@ntaken from the item inventory.@n<slot> is the bot inventory slot (1..8) or 0 for any one=
|
||||||
deprecated, use bot inventory configuration instead=
|
deprecated, use bot inventory configuration instead=
|
||||||
Pick up all objects@nin a 3x3 field.@n<slot> is the inventory slot (1..8) or 0 for any one=
|
Pick up all objects@nin a 3x3 field.@n<slot> is the bot inventory slot (1..8) or 0 for any one=
|
||||||
Drop items in front of the bot.@n<slot> is the inventory slot (1..8) or 0 for any one=
|
Drop items in front of the bot.@n<slot> is the bot inventory slot (1..8) or 0 for any one=
|
||||||
Punch a rail cart to start it=
|
Punch a rail cart to start it=
|
||||||
|
|
||||||
### cmd_move.lua ###
|
### cmd_move.lua ###
|
||||||
@ -116,6 +122,7 @@ Turn the robot to the right=
|
|||||||
Turn the robot around=
|
Turn the robot around=
|
||||||
Move the robot upwards=
|
Move the robot upwards=
|
||||||
Move the robot down=
|
Move the robot down=
|
||||||
|
Fall into a hole/chasm (up to 10 blocks)=
|
||||||
Stop the robot for <sec> seconds@n(1..9999)=
|
Stop the robot for <sec> seconds@n(1..9999)=
|
||||||
Stop the robot.=
|
Stop the robot.=
|
||||||
Turn the robot off@nand put it back in the box.=
|
Turn the robot off@nand put it back in the box.=
|
||||||
@ -151,6 +158,11 @@ Dig the block above the robot.@n<slot> is the inventory slot (1..8)=
|
|||||||
Rotate the block in front of the robot@n<lvl> is one of: -1 0 +1@n<steps> is one of: 1 2 3=
|
Rotate the block in front of the robot@n<lvl> is one of: -1 0 +1@n<steps> is one of: 1 2 3=
|
||||||
Bot torch=
|
Bot torch=
|
||||||
|
|
||||||
|
### cmd_place.lua ###
|
||||||
|
### cmd_soup.lua ###
|
||||||
|
|
||||||
|
Error: Position protected=
|
||||||
|
|
||||||
### cmd_sign.lua ###
|
### cmd_sign.lua ###
|
||||||
|
|
||||||
Commands,Help=
|
Commands,Help=
|
||||||
@ -218,11 +230,6 @@ to prevent wooden sign from catching fire.=
|
|||||||
4 - empty bowl (from farming or xdecor mods)=
|
4 - empty bowl (from farming or xdecor mods)=
|
||||||
The result is one bowl with vegetable soup in selected inventory slot.=
|
The result is one bowl with vegetable soup in selected inventory slot.=
|
||||||
|
|
||||||
### cmd_soup.lua ###
|
|
||||||
### cmd_place.lua ###
|
|
||||||
|
|
||||||
Error: Position protected=
|
|
||||||
|
|
||||||
### cmd_trees.lua ###
|
### cmd_trees.lua ###
|
||||||
|
|
||||||
Used to harvest an aspen or pine tree trunk=
|
Used to harvest an aspen or pine tree trunk=
|
||||||
@ -244,8 +251,8 @@ call a subroutine (with 'return' statement)=
|
|||||||
return from a subroutine=
|
return from a subroutine=
|
||||||
jump to a label=
|
jump to a label=
|
||||||
Move the robot 1..999 steps forward@nwithout paying attention to any signs.@nUp and down movements also become@ncounted as steps.=
|
Move the robot 1..999 steps forward@nwithout paying attention to any signs.@nUp and down movements also become@ncounted as steps.=
|
||||||
Walk until a sign or obstacle is@nreached. Then continue with the next command.@nWhen a sign has been reached, @nthe current program is ended@nand the bot executes the@nnew program from the sign=
|
Walk until a sign or obstacle is@nreached. Then continue with the next command.@nWhen a sign has been reached,@nthe current program is ended@nand the bot executes the@nnew program from the sign=
|
||||||
Print given text as chat message.@nFor two or more words, use the '*' character @ninstead of spaces, like "Hello*world"=
|
Print given text as chat message.@nFor two or more words, use the '*' character@ninstead of spaces, like "Hello*world"=
|
||||||
|
|
||||||
### compost.lua ###
|
### compost.lua ###
|
||||||
|
|
||||||
@ -269,6 +276,11 @@ Signal Delayer=
|
|||||||
Signals are forwarded delayed. Subsequent signals are queued.=
|
Signals are forwarded delayed. Subsequent signals are queued.=
|
||||||
The delay time can be configured.=
|
The delay time can be configured.=
|
||||||
|
|
||||||
|
### delayer.lua ###
|
||||||
|
### timer.lua ###
|
||||||
|
|
||||||
|
Start=
|
||||||
|
|
||||||
### doc.lua ###
|
### doc.lua ###
|
||||||
|
|
||||||
After you have placed the Signs Bot Box, you can start the bot by means of the 'On' button in the box menu.=
|
After you have placed the Signs Bot Box, you can start the bot by means of the 'On' button in the box menu.=
|
||||||
@ -400,11 +412,6 @@ inputs=
|
|||||||
Signal AND=
|
Signal AND=
|
||||||
Signal is sent, if all input signals are received.=
|
Signal is sent, if all input signals are received.=
|
||||||
|
|
||||||
### logic_and.lua ###
|
|
||||||
### timer.lua ###
|
|
||||||
|
|
||||||
Connected with=
|
|
||||||
|
|
||||||
### node_sensor.lua ###
|
### node_sensor.lua ###
|
||||||
|
|
||||||
Node Sensor: Connected with =
|
Node Sensor: Connected with =
|
||||||
@ -447,13 +454,9 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t
|
|||||||
no power=
|
no power=
|
||||||
Ignite the techage charcoal lighter=
|
Ignite the techage charcoal lighter=
|
||||||
Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=
|
Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=
|
||||||
|
Jump to <label> if the@nbattery power is below the@ngiven value in percent (1..99)=
|
||||||
fully charged=
|
fully charged=
|
||||||
Sends a techage command@nto a given node. @nReceiver is addressed by@nthe techage node number.@nFor commands with two or more @nwords, use the '*' character @ninstead of spaces, e.g.: @nsend_cmnd 3465 pull*default:dirt*2=
|
Sends a techage command@nto a given node.@nReceiver is addressed by@nthe techage node number.@nFor commands with two or more@nwords, use the '*' character@ninstead of spaces, e.g.:@nsend_cmnd 3465 pull*default:dirt*2=
|
||||||
|
|
||||||
### techage.lua ###
|
|
||||||
### basis.lua ###
|
|
||||||
|
|
||||||
charging=
|
|
||||||
|
|
||||||
### timer.lua ###
|
### timer.lua ###
|
||||||
|
|
||||||
@ -464,9 +467,9 @@ Special kind of sensor.=
|
|||||||
Can be programmed with a time in seconds, e.g. to start the bot cyclically.=
|
Can be programmed with a time in seconds, e.g. to start the bot cyclically.=
|
||||||
|
|
||||||
### timer.lua ###
|
### timer.lua ###
|
||||||
### delayer.lua ###
|
### logic_and.lua ###
|
||||||
|
|
||||||
Start=
|
Connected with=
|
||||||
|
|
||||||
### tool.lua ###
|
### tool.lua ###
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signal AND.
|
Signal AND.
|
||||||
Signal is sent, if all input signals are received.
|
Signal is sent, if all input signals are received.
|
||||||
]]--
|
]]--
|
||||||
@ -25,7 +25,7 @@ local lib = signs_bot.lib
|
|||||||
local function inputs(tbl)
|
local function inputs(tbl)
|
||||||
local out = {}
|
local out = {}
|
||||||
for _,v in ipairs(tbl) do
|
for _,v in ipairs(tbl) do
|
||||||
if v then
|
if v then
|
||||||
out[#out + 1] = "1"
|
out[#out + 1] = "1"
|
||||||
else
|
else
|
||||||
out[#out + 1] = "0"
|
out[#out + 1] = "0"
|
||||||
@ -33,7 +33,7 @@ local function inputs(tbl)
|
|||||||
end
|
end
|
||||||
return table.concat(out, " ")
|
return table.concat(out, " ")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_infotext(pos, dest_pos, cmnd)
|
local function update_infotext(pos, dest_pos, cmnd)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
local text = table.concat({
|
local text = table.concat({
|
||||||
@ -49,7 +49,7 @@ local function update_infotext(pos, dest_pos, cmnd)
|
|||||||
inputs(mem.inputs or {})
|
inputs(mem.inputs or {})
|
||||||
}, " ")
|
}, " ")
|
||||||
M(pos):set_string("infotext", text)
|
M(pos):set_string("infotext", text)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function all_inputs(mem)
|
local function all_inputs(mem)
|
||||||
mem.inputs = mem.inputs or {}
|
mem.inputs = mem.inputs or {}
|
||||||
@ -94,7 +94,7 @@ local function signs_bot_get_signal(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- switch to normal texture
|
-- switch to normal texture
|
||||||
local function turn_off(pos)
|
local function turn_off(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name == "signs_bot:and2" or node.name == "signs_bot:and3" then
|
if node.name == "signs_bot:and2" or node.name == "signs_bot:and3" then
|
||||||
node.name = "signs_bot:and1"
|
node.name = "signs_bot:and1"
|
||||||
@ -103,7 +103,7 @@ local function turn_off(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- switch to not zero texture
|
-- switch to not zero texture
|
||||||
local function not_zero(pos)
|
local function not_zero(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name == "signs_bot:and1" or node.name == "signs_bot:and3" then
|
if node.name == "signs_bot:and1" or node.name == "signs_bot:and3" then
|
||||||
node.name = "signs_bot:and2"
|
node.name = "signs_bot:and2"
|
||||||
@ -133,7 +133,7 @@ local function signs_bot_on_signal(pos, node, signal)
|
|||||||
signal = tonumber(signal) or 1
|
signal = tonumber(signal) or 1
|
||||||
mem.inputs = mem.inputs or {}
|
mem.inputs = mem.inputs or {}
|
||||||
mem.inputs[signal] = true
|
mem.inputs[signal] = true
|
||||||
|
|
||||||
if all_inputs(mem) then
|
if all_inputs(mem) then
|
||||||
send_signal(pos)
|
send_signal(pos)
|
||||||
else
|
else
|
||||||
@ -156,14 +156,14 @@ minetest.register_node("signs_bot:and1", {
|
|||||||
"signs_bot_sensor2.png^signs_bot_and1.png",
|
"signs_bot_sensor2.png^signs_bot_and1.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
mem.inputs = {}
|
mem.inputs = {}
|
||||||
infotext(pos)
|
infotext(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
signs_bot_get_signal = signs_bot_get_signal,
|
signs_bot_get_signal = signs_bot_get_signal,
|
||||||
signs_bot_on_signal = signs_bot_on_signal,
|
signs_bot_on_signal = signs_bot_on_signal,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
@ -248,8 +248,8 @@ if minetest.get_modpath("doc") then
|
|||||||
data = {
|
data = {
|
||||||
item = "signs_bot:and1",
|
item = "signs_bot:and1",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Signal is sent, if all input signals are received."),
|
S("Signal is sent, if all input signals are received."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Node Sensor
|
Node Sensor
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -25,7 +25,7 @@ local CYCLE_TIME = 2
|
|||||||
|
|
||||||
local function update_infotext(pos, dest_pos, cmnd)
|
local function update_infotext(pos, dest_pos, cmnd)
|
||||||
M(pos):set_string("infotext", S("Node Sensor: Connected with ")..P2S(dest_pos).." / "..cmnd)
|
M(pos):set_string("infotext", S("Node Sensor: Connected with ")..P2S(dest_pos).." / "..cmnd)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function swap_node(pos, name)
|
local function swap_node(pos, name)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
@ -39,8 +39,8 @@ local function swap_node(pos, name)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local DropdownValues = {
|
local DropdownValues = {
|
||||||
[S("added")] = 1,
|
[S("added")] = 1,
|
||||||
[S("removed")] = 2,
|
[S("removed")] = 2,
|
||||||
@ -69,12 +69,12 @@ local function any_node_changed(pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local num = #minetest.find_nodes_in_area(mem.pos1, mem.pos2, {"air"})
|
local num = #minetest.find_nodes_in_area(mem.pos1, mem.pos2, {"air"})
|
||||||
|
|
||||||
if mem.num ~= num then
|
if mem.num ~= num then
|
||||||
if mem.mode == 1 and num < mem.num then
|
if mem.mode == 1 and num < mem.num then
|
||||||
mem.num = num
|
mem.num = num
|
||||||
return true
|
return true
|
||||||
elseif mem.mode == 2 and num > mem.num then
|
elseif mem.mode == 2 and num > mem.num then
|
||||||
mem.num = num
|
mem.num = num
|
||||||
return true
|
return true
|
||||||
elseif mem.mode == 3 then
|
elseif mem.mode == 3 then
|
||||||
@ -131,7 +131,7 @@ minetest.register_node("signs_bot:node_sensor", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
@ -141,7 +141,7 @@ minetest.register_node("signs_bot:node_sensor", {
|
|||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
any_node_changed(pos)
|
any_node_changed(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
@ -173,7 +173,7 @@ minetest.register_node("signs_bot:node_sensor_on", {
|
|||||||
"signs_bot_sensor1.png^[transformFXR90",
|
"signs_bot_sensor1.png^[transformFXR90",
|
||||||
"signs_bot_sensor1.png^[transformFXR180",
|
"signs_bot_sensor1.png^[transformFXR180",
|
||||||
},
|
},
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
@ -220,9 +220,9 @@ if minetest.get_modpath("doc") then
|
|||||||
S("The node sensor sends cyclical signals when it detects that nodes have appeared or disappeared,"),
|
S("The node sensor sends cyclical signals when it detects that nodes have appeared or disappeared,"),
|
||||||
S("but has to be configured accordingly."),
|
S("but has to be configured accordingly."),
|
||||||
S("Valid nodes are all kind of blocks and plants."),
|
S("Valid nodes are all kind of blocks and plants."),
|
||||||
S("The sensor range is 3 nodes/meters in one direction."),
|
S("The sensor range is 3 nodes/meters in one direction."),
|
||||||
S("The sensor has an active side (red) that must point to the observed area."),
|
S("The sensor has an active side (red) that must point to the observed area."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Node information tables for the Bot
|
Node information tables for the Bot
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -31,7 +31,7 @@ function signs_bot.register_farming_plant(inv_seed, plantlet, crop, trellis)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- inv_sapling is the sapling inventory name
|
-- inv_sapling is the sapling inventory name
|
||||||
-- sapling is what has to be placed on the ground
|
-- sapling is what has to be placed on the ground
|
||||||
-- t1/t2 is needed for trees which require the node timer
|
-- t1/t2 is needed for trees which require the node timer
|
||||||
function signs_bot.register_tree_saplings(inv_sapling, sapling, t1, t2)
|
function signs_bot.register_tree_saplings(inv_sapling, sapling, t1, t2)
|
||||||
signs_bot.TreeSaplings[inv_sapling] = {sapling = sapling, t1 = t1 or 300, t2 = t2 or 1500}
|
signs_bot.TreeSaplings[inv_sapling] = {sapling = sapling, t1 = t1 or 300, t2 = t2 or 1500}
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Random Series
|
Signs Bot: Random Series
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ local function gen_serie(inv_size)
|
|||||||
offs = offs + 1
|
offs = offs + 1
|
||||||
end
|
end
|
||||||
local index = 1
|
local index = 1
|
||||||
|
|
||||||
for n = 1, (inv_size*2) do
|
for n = 1, (inv_size*2) do
|
||||||
tbl[#tbl + 1] = index
|
tbl[#tbl + 1] = index
|
||||||
index = ((index + offs) % inv_size) + 1
|
index = ((index + offs) % inv_size) + 1
|
||||||
@ -69,4 +69,4 @@ signs_bot.random = random
|
|||||||
-- tbl[#tbl + 1] = idx
|
-- tbl[#tbl + 1] = idx
|
||||||
-- end
|
-- end
|
||||||
-- print(table.concat(tbl, ", "))
|
-- print(table.concat(tbl, ", "))
|
||||||
--end
|
--end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: The Robot itself
|
Signs Bot: The Robot itself
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -15,7 +15,7 @@
|
|||||||
local lib = signs_bot.lib
|
local lib = signs_bot.lib
|
||||||
|
|
||||||
-- Called when robot is started
|
-- Called when robot is started
|
||||||
function signs_bot.place_robot(pos1, pos2, param2)
|
function signs_bot.place_robot(pos1, pos2, param2)
|
||||||
local node1 = tubelib2.get_node_lvm(pos1)
|
local node1 = tubelib2.get_node_lvm(pos1)
|
||||||
local node2 = tubelib2.get_node_lvm(pos2)
|
local node2 = tubelib2.get_node_lvm(pos2)
|
||||||
if lib.check_pos(pos1, node1, node2, param2) then
|
if lib.check_pos(pos1, node1, node2, param2) then
|
||||||
@ -24,7 +24,7 @@ function signs_bot.place_robot(pos1, pos2, param2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Called when robot is removed
|
-- Called when robot is removed
|
||||||
function signs_bot.remove_robot(mem)
|
function signs_bot.remove_robot(mem)
|
||||||
local pos = mem.robot_pos
|
local pos = mem.robot_pos
|
||||||
local node = tubelib2.get_node_lvm(pos)
|
local node = tubelib2.get_node_lvm(pos)
|
||||||
if node.name == "signs_bot:robot" then
|
if node.name == "signs_bot:robot" then
|
||||||
@ -57,7 +57,7 @@ minetest.register_node("signs_bot:robot", {
|
|||||||
"signs_bot_robot_left.png",
|
"signs_bot_robot_left.png",
|
||||||
"signs_bot_robot_front.png",
|
"signs_bot_robot_front.png",
|
||||||
"signs_bot_robot_back.png",
|
"signs_bot_robot_back.png",
|
||||||
|
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signal function
|
Signal function
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -43,8 +43,8 @@ function signs_bot.get_signal(actuator_pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Used by the pairing tool
|
-- Used by the pairing tool
|
||||||
function signs_bot.store_signal(sensor_pos, dest_pos, signal)
|
function signs_bot.store_signal(sensor_pos, dest_pos, signal)
|
||||||
local meta = sensor_pos and M(sensor_pos)
|
local meta = sensor_pos and M(sensor_pos)
|
||||||
if meta then
|
if meta then
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: Signs
|
Signs Bot: Signs
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -116,9 +116,9 @@ signs_bot.register_signXL = register_signXL
|
|||||||
|
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_right",
|
name = "sign_right",
|
||||||
description = S('Sign "turn right"'),
|
description = S('Sign "turn right"'),
|
||||||
commands = "turn_right",
|
commands = "turn_right",
|
||||||
image = "signs_bot_sign_right.png",
|
image = "signs_bot_sign_right.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -132,9 +132,9 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_left",
|
name = "sign_left",
|
||||||
description = S('Sign "turn left"'),
|
description = S('Sign "turn left"'),
|
||||||
commands = "turn_left",
|
commands = "turn_left",
|
||||||
image = "signs_bot_sign_left.png",
|
image = "signs_bot_sign_left.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -148,9 +148,9 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_take",
|
name = "sign_take",
|
||||||
description = S('Sign "take item"'),
|
description = S('Sign "take item"'),
|
||||||
commands = "take_item 99\nturn_around",
|
commands = "take_item 99\nturn_around",
|
||||||
image = "signs_bot_sign_take.png",
|
image = "signs_bot_sign_take.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -164,9 +164,9 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_add",
|
name = "sign_add",
|
||||||
description = S('Sign "add item"'),
|
description = S('Sign "add item"'),
|
||||||
commands = "add_item 99\nturn_around",
|
commands = "add_item 99\nturn_around",
|
||||||
image = "signs_bot_sign_add.png",
|
image = "signs_bot_sign_add.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -180,9 +180,9 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_stop",
|
name = "sign_stop",
|
||||||
description = S('Sign "stop"'),
|
description = S('Sign "stop"'),
|
||||||
commands = "stop",
|
commands = "stop",
|
||||||
image = "signs_bot_sign_stop.png",
|
image = "signs_bot_sign_stop.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -197,9 +197,9 @@ minetest.register_craft({
|
|||||||
|
|
||||||
if minetest.global_exists("minecart") then
|
if minetest.global_exists("minecart") then
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_add_cart",
|
name = "sign_add_cart",
|
||||||
description = S('Sign "add to cart"'),
|
description = S('Sign "add to cart"'),
|
||||||
commands = "drop_items 99 1\npunch_cart\nturn_around",
|
commands = "drop_items 99 1\npunch_cart\nturn_around",
|
||||||
image = "signs_bot_sign_add_cart.png",
|
image = "signs_bot_sign_add_cart.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -213,9 +213,9 @@ if minetest.global_exists("minecart") then
|
|||||||
})
|
})
|
||||||
|
|
||||||
register_sign({
|
register_sign({
|
||||||
name = "sign_take_cart",
|
name = "sign_take_cart",
|
||||||
description = S('Sign "take from cart"'),
|
description = S('Sign "take from cart"'),
|
||||||
commands = "pickup_items 1\npunch_cart\nturn_around",
|
commands = "pickup_items 1\npunch_cart\nturn_around",
|
||||||
image = "signs_bot_sign_take_cart.png",
|
image = "signs_bot_sign_take_cart.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -234,14 +234,14 @@ if minetest.get_modpath("doc") then
|
|||||||
name = S('Sign "turn right"'),
|
name = S('Sign "turn right"'),
|
||||||
data = {
|
data = {
|
||||||
item = "signs_bot:sign_right",
|
item = "signs_bot:sign_right",
|
||||||
text = S("The Bot turns right when it detects this sign in front of it.")
|
text = S("The Bot turns right when it detects this sign in front of it.")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
doc.add_entry("signs_bot", "sign_left", {
|
doc.add_entry("signs_bot", "sign_left", {
|
||||||
name = S('Sign "turn left"'),
|
name = S('Sign "turn left"'),
|
||||||
data = {
|
data = {
|
||||||
item = "signs_bot:sign_left",
|
item = "signs_bot:sign_left",
|
||||||
text = S("The Bot turns left when it detects this sign in front of it.")
|
text = S("The Bot turns left when it detects this sign in front of it.")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
doc.add_entry("signs_bot", "sign_take", {
|
doc.add_entry("signs_bot", "sign_take", {
|
||||||
@ -250,8 +250,8 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:sign_take",
|
item = "signs_bot:sign_take",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot takes items out of a chest in front of it and then turns around."),
|
S("The Bot takes items out of a chest in front of it and then turns around."),
|
||||||
S("This sign has to be placed on top of the chest."),
|
S("This sign has to be placed on top of the chest."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
doc.add_entry("signs_bot", "sign_add", {
|
doc.add_entry("signs_bot", "sign_add", {
|
||||||
@ -260,15 +260,15 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:sign_add",
|
item = "signs_bot:sign_add",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot puts items into a chest in front of it and then turns around."),
|
S("The Bot puts items into a chest in front of it and then turns around."),
|
||||||
S("This sign has to be placed on top of the chest."),
|
S("This sign has to be placed on top of the chest."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
doc.add_entry("signs_bot", "sign_stop", {
|
doc.add_entry("signs_bot", "sign_stop", {
|
||||||
name = S('Sign "stop"'),
|
name = S('Sign "stop"'),
|
||||||
data = {
|
data = {
|
||||||
item = "signs_bot:sign_stop",
|
item = "signs_bot:sign_stop",
|
||||||
text = S("The Bot will stop in front of this sign until the sign is removed or the bot is turned off.")
|
text = S("The Bot will stop in front of this sign until the sign is removed or the bot is turned off.")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -280,8 +280,8 @@ if minetest.get_modpath("doc") and minetest.global_exists("minecart") then
|
|||||||
item = "signs_bot:sign_add_cart",
|
item = "signs_bot:sign_add_cart",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot puts items into a minecart in front of it, pushes the cart and then turns around."),
|
S("The Bot puts items into a minecart in front of it, pushes the cart and then turns around."),
|
||||||
S("This sign has to be placed on top of the rail at the cart end position."),
|
S("This sign has to be placed on top of the rail at the cart end position."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
doc.add_entry("signs_bot", "sign_take_cart", {
|
doc.add_entry("signs_bot", "sign_take_cart", {
|
||||||
@ -290,8 +290,8 @@ if minetest.get_modpath("doc") and minetest.global_exists("minecart") then
|
|||||||
item = "signs_bot:sign_take_cart",
|
item = "signs_bot:sign_take_cart",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("The Bot takes items out of a minecart in front of it, pushes the cart and then turns around."),
|
S("The Bot takes items out of a minecart in front of it, pushes the cart and then turns around."),
|
||||||
S("This sign has to be placed on top of the rail at the cart end position."),
|
S("This sign has to be placed on top of the rail at the cart end position."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPLv3
|
GPLv3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Signs Bot: interface for techage
|
Signs Bot: interface for techage
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -19,7 +19,7 @@ local MAX_CAPA = signs_bot.MAX_CAPA
|
|||||||
local PWR_NEEDED = 8
|
local PWR_NEEDED = 8
|
||||||
|
|
||||||
if minetest.get_modpath("techage") then
|
if minetest.get_modpath("techage") then
|
||||||
|
|
||||||
local function on_power(pos)
|
local function on_power(pos)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
mem.power_available = true
|
mem.power_available = true
|
||||||
@ -35,15 +35,16 @@ if minetest.get_modpath("techage") then
|
|||||||
|
|
||||||
local Cable = techage.ElectricCable
|
local Cable = techage.ElectricCable
|
||||||
local power = networks.power
|
local power = networks.power
|
||||||
|
|
||||||
signs_bot.register_inventory({"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
signs_bot.register_inventory({"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
||||||
"techage:ta3_silo", "techage:ta4_silo", "techage:ta4_sensor_chest"}, {
|
"techage:ta3_silo", "techage:ta4_silo", "techage:ta4_sensor_chest",
|
||||||
|
"techage:ta4_reactor"}, {
|
||||||
allow_inventory_put = function(pos, stack, player_name)
|
allow_inventory_put = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
allow_inventory_take = function(pos, stack, player_name)
|
allow_inventory_take = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
put = {
|
put = {
|
||||||
listname = "main",
|
listname = "main",
|
||||||
},
|
},
|
||||||
@ -54,10 +55,10 @@ if minetest.get_modpath("techage") then
|
|||||||
signs_bot.register_inventory({"techage:meltingpot", "techage:meltingpot_active"}, {
|
signs_bot.register_inventory({"techage:meltingpot", "techage:meltingpot_active"}, {
|
||||||
allow_inventory_put = function(pos, stack, player_name)
|
allow_inventory_put = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
allow_inventory_take = function(pos, stack, player_name)
|
allow_inventory_take = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
put = {
|
put = {
|
||||||
listname = "src",
|
listname = "src",
|
||||||
},
|
},
|
||||||
@ -70,10 +71,10 @@ if minetest.get_modpath("techage") then
|
|||||||
"techage:ta3_autocrafter_pas", "techage:ta3_autocrafter_act"}, {
|
"techage:ta3_autocrafter_pas", "techage:ta3_autocrafter_act"}, {
|
||||||
allow_inventory_put = function(pos, stack, player_name)
|
allow_inventory_put = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
allow_inventory_take = function(pos, stack, player_name)
|
allow_inventory_take = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
put = {
|
put = {
|
||||||
listname = "src",
|
listname = "src",
|
||||||
},
|
},
|
||||||
@ -88,10 +89,10 @@ if minetest.get_modpath("techage") then
|
|||||||
"techage:ta4_high_performance_distributor_pas", "techage:ta4_high_performance_distributor_act"}, {
|
"techage:ta4_high_performance_distributor_pas", "techage:ta4_high_performance_distributor_act"}, {
|
||||||
allow_inventory_put = function(pos, stack, player_name)
|
allow_inventory_put = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
allow_inventory_take = function(pos, stack, player_name)
|
allow_inventory_take = function(pos, stack, player_name)
|
||||||
return not minetest.is_protected(pos, player_name)
|
return not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
put = {
|
put = {
|
||||||
listname = "src",
|
listname = "src",
|
||||||
},
|
},
|
||||||
@ -104,7 +105,7 @@ if minetest.get_modpath("techage") then
|
|||||||
return math.min(math.ceil(((curr_val or 0) * 100.0) / (max_val or 1.0)), 100)
|
return math.min(math.ceil(((curr_val or 0) * 100.0) / (max_val or 1.0)), 100)
|
||||||
end
|
end
|
||||||
signs_bot.percent_value = percent_value
|
signs_bot.percent_value = percent_value
|
||||||
|
|
||||||
function signs_bot.formspec_battery_capa(max_capa, current_capa)
|
function signs_bot.formspec_battery_capa(max_capa, current_capa)
|
||||||
local percent = percent_value(max_capa, current_capa)
|
local percent = percent_value(max_capa, current_capa)
|
||||||
return "image[0.1,0;0.5,1;signs_bot_form_level_bg.png^[lowpart:"..
|
return "image[0.1,0;0.5,1;signs_bot_form_level_bg.png^[lowpart:"..
|
||||||
@ -113,7 +114,7 @@ if minetest.get_modpath("techage") then
|
|||||||
|
|
||||||
signs_bot.register_botcommand("ignite", {
|
signs_bot.register_botcommand("ignite", {
|
||||||
mod = "techage",
|
mod = "techage",
|
||||||
params = "",
|
params = "",
|
||||||
num_param = 0,
|
num_param = 0,
|
||||||
description = S("Ignite the techage charcoal lighter"),
|
description = S("Ignite the techage charcoal lighter"),
|
||||||
cmnd = function(base_pos, mem)
|
cmnd = function(base_pos, mem)
|
||||||
@ -129,7 +130,7 @@ if minetest.get_modpath("techage") then
|
|||||||
|
|
||||||
signs_bot.register_botcommand("low_batt", {
|
signs_bot.register_botcommand("low_batt", {
|
||||||
mod = "techage",
|
mod = "techage",
|
||||||
params = "<percent>",
|
params = "<percent>",
|
||||||
num_param = 1,
|
num_param = 1,
|
||||||
description = S("Turns the bot off if the\nbattery power is below the\ngiven value in percent (1..99)"),
|
description = S("Turns the bot off if the\nbattery power is below the\ngiven value in percent (1..99)"),
|
||||||
check = function(val)
|
check = function(val)
|
||||||
@ -147,17 +148,37 @@ if minetest.get_modpath("techage") then
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
signs_bot.register_botcommand("jump_low_batt", {
|
||||||
|
mod = "techage",
|
||||||
|
params = "<percent> <label>",
|
||||||
|
num_param = 2,
|
||||||
|
description = S("Jump to <label> if the\nbattery power is below the\ngiven value in percent (1..99)"),
|
||||||
|
check = function(val, lbl)
|
||||||
|
val = tonumber(val) or 5
|
||||||
|
return val and val > 0 and val < 100 and signs_bot.check_label(lbl)
|
||||||
|
end,
|
||||||
|
cmnd = function(base_pos, mem, val, addr)
|
||||||
|
val = tonumber(val) or 5
|
||||||
|
local pwr = percent_value(signs_bot.MAX_CAPA, mem.capa)
|
||||||
|
if pwr < val then
|
||||||
|
mem.pc = addr - 3
|
||||||
|
return signs_bot.DONE
|
||||||
|
end
|
||||||
|
return signs_bot.DONE
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
signs_bot.register_botcommand("send_cmnd", {
|
signs_bot.register_botcommand("send_cmnd", {
|
||||||
mod = "techage",
|
mod = "techage",
|
||||||
params = "<receiver> <command>",
|
params = "<receiver> <command>",
|
||||||
num_param = 2,
|
num_param = 2,
|
||||||
description = S([[Sends a techage command
|
description = S([[Sends a techage command
|
||||||
to a given node.
|
to a given node.
|
||||||
Receiver is addressed by
|
Receiver is addressed by
|
||||||
the techage node number.
|
the techage node number.
|
||||||
For commands with two or more
|
For commands with two or more
|
||||||
words, use the '*' character
|
words, use the '*' character
|
||||||
instead of spaces, e.g.:
|
instead of spaces, e.g.:
|
||||||
send_cmnd 3465 pull*default:dirt*2]]),
|
send_cmnd 3465 pull*default:dirt*2]]),
|
||||||
check = function(address, command)
|
check = function(address, command)
|
||||||
address = tonumber(address)
|
address = tonumber(address)
|
||||||
@ -173,12 +194,12 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
|||||||
return signs_bot.DONE
|
return signs_bot.DONE
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Bot in the box
|
-- Bot in the box
|
||||||
function signs_bot.while_charging(pos, mem)
|
function signs_bot.while_charging(pos, mem)
|
||||||
mem.capa = mem.capa or 0
|
mem.capa = mem.capa or 0
|
||||||
|
|
||||||
if mem.capa < signs_bot.MAX_CAPA then
|
if mem.capa < signs_bot.MAX_CAPA then
|
||||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||||
mem.capa = mem.capa + consumed
|
mem.capa = mem.capa + consumed
|
||||||
@ -192,7 +213,7 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
power.register_nodes({"signs_bot:box"}, Cable, "con")
|
power.register_nodes({"signs_bot:box"}, Cable, "con")
|
||||||
|
|
||||||
techage.register_node({"signs_bot:box"}, {
|
techage.register_node({"signs_bot:box"}, {
|
||||||
@ -215,7 +236,7 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return techage.put_items(inv, "main", stack)
|
return techage.put_items(inv, "main", stack)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
if topic == "state" then
|
if topic == "state" then
|
||||||
@ -254,7 +275,7 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
|||||||
return "unsupported"
|
return "unsupported"
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
techage.register_node({"signs_bot:chest"}, {
|
techage.register_node({"signs_bot:chest"}, {
|
||||||
on_inv_request = function(pos, in_dir, access_type)
|
on_inv_request = function(pos, in_dir, access_type)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -275,7 +296,7 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return techage.put_items(inv, "main", stack)
|
return techage.put_items(inv, "main", stack)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
techage.register_node_for_v1_transition({"signs_bot:box"}, function(pos, node)
|
techage.register_node_for_v1_transition({"signs_bot:box"}, function(pos, node)
|
||||||
power.update_network(pos, nil, Cable)
|
power.update_network(pos, nil, Cable)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Bot Timer
|
Bot Timer
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -34,7 +34,7 @@ local function update_infotext(pos, dest_pos, cmnd)
|
|||||||
text = S("Bot Timer").." (-- min): "..S("Connected with")
|
text = S("Bot Timer").." (-- min): "..S("Connected with")
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", text.." "..P2S(dest_pos).." / "..(cmnd or "none").." ")
|
meta:set_string("infotext", text.." "..P2S(dest_pos).." / "..(cmnd or "none").." ")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_infotext_local(pos)
|
local function update_infotext_local(pos)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
@ -45,7 +45,7 @@ local function update_infotext_local(pos)
|
|||||||
local signal = meta:get_string("signal_data")
|
local signal = meta:get_string("signal_data")
|
||||||
local text1 = " (-- min): "
|
local text1 = " (-- min): "
|
||||||
local text2 = "Not connected"
|
local text2 = "Not connected"
|
||||||
|
|
||||||
if dest_pos ~= "" and signal ~= "" then
|
if dest_pos ~= "" and signal ~= "" then
|
||||||
text2 = S("Connected with").." "..dest_pos.." / "..signal
|
text2 = S("Connected with").." "..dest_pos.." / "..signal
|
||||||
end
|
end
|
||||||
@ -57,7 +57,7 @@ local function update_infotext_local(pos)
|
|||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", S("Bot Timer")..text1..text2.." ")
|
meta:set_string("infotext", S("Bot Timer")..text1..text2.." ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function formspec(meta)
|
local function formspec(meta)
|
||||||
@ -72,7 +72,7 @@ local function formspec(meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- switch to normal texture
|
-- switch to normal texture
|
||||||
local function turn_off(pos)
|
local function turn_off(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
node.name = "signs_bot:timer"
|
node.name = "signs_bot:timer"
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
@ -145,13 +145,13 @@ minetest.register_node("signs_bot:timer", {
|
|||||||
"signs_bot_sensor2.png^signs_bot_timer.png",
|
"signs_bot_sensor2.png^signs_bot_timer.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("infotext", S("Bot Timer: Not connected"))
|
meta:set_string("infotext", S("Bot Timer: Not connected"))
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
@ -179,7 +179,7 @@ minetest.register_node("signs_bot:timer_on", {
|
|||||||
"signs_bot_sensor2.png^signs_bot_timer_on.png",
|
"signs_bot_sensor2.png^signs_bot_timer_on.png",
|
||||||
"signs_bot_sensor2.png",
|
"signs_bot_sensor2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
update_infotext = update_infotext,
|
update_infotext = update_infotext,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -222,8 +222,8 @@ if minetest.get_modpath("doc") then
|
|||||||
item = "signs_bot:timer",
|
item = "signs_bot:timer",
|
||||||
text = table.concat({
|
text = table.concat({
|
||||||
S("Special kind of sensor."),
|
S("Special kind of sensor."),
|
||||||
S("Can be programmed with a time in seconds, e.g. to start the bot cyclically."),
|
S("Can be programmed with a time in seconds, e.g. to start the bot cyclically."),
|
||||||
}, "\n")
|
}, "\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Sensor/Actuator Connection Tool
|
Sensor/Actuator Connection Tool
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -31,7 +31,7 @@ local function get_stored_data(placer)
|
|||||||
return minetest.string_to_pos(spos), name
|
return minetest.string_to_pos(spos), name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function store_data(placer, pos, name)
|
local function store_data(placer, pos, name)
|
||||||
local meta = placer:get_meta()
|
local meta = placer:get_meta()
|
||||||
if pos then
|
if pos then
|
||||||
@ -61,7 +61,7 @@ local function use_tool(itemstack, placer, pointed_thing)
|
|||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local pos1,ntype1 = get_stored_data(placer)
|
local pos1,ntype1 = get_stored_data(placer)
|
||||||
local pos2,ntype2 = get_current_data(pointed_thing)
|
local pos2,ntype2 = get_current_data(pointed_thing)
|
||||||
|
|
||||||
if ntype1 == "actuator" and (ntype2 == "sensor" or ntype2 == "repeater") then
|
if ntype1 == "actuator" and (ntype2 == "sensor" or ntype2 == "repeater") then
|
||||||
pairing(pos1, pos2)
|
pairing(pos1, pos2)
|
||||||
store_data(placer, nil, nil)
|
store_data(placer, nil, nil)
|
||||||
@ -88,7 +88,7 @@ local function use_tool(itemstack, placer, pointed_thing)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("signs_bot:connector", {
|
minetest.register_node("signs_bot:connector", {
|
||||||
description = S("Sensor Connection Tool"),
|
description = S("Sensor Connection Tool"),
|
||||||
|
@ -95,55 +95,57 @@ minetest.register_entity(
|
|||||||
|
|
||||||
if self.attached ~= nil then
|
if self.attached ~= nil then
|
||||||
local player = minetest.get_player_by_name(self.attached)
|
local player = minetest.get_player_by_name(self.attached)
|
||||||
local controls = player:get_player_control()
|
if player then
|
||||||
local hspeed = 5.0
|
local controls = player:get_player_control()
|
||||||
local vspeed = -1
|
local hspeed = 5.0
|
||||||
self.idle = (self.idle or 1) - 1
|
local vspeed = -1
|
||||||
|
self.idle = (self.idle or 1) - 1
|
||||||
|
|
||||||
if controls.up then
|
if controls.up then
|
||||||
vspeed = -3
|
vspeed = -3
|
||||||
hspeed = 8
|
hspeed = 8
|
||||||
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
||||||
set_player_yaw(self, player, yaw)
|
set_player_yaw(self, player, yaw)
|
||||||
self.idle = 1
|
self.idle = 1
|
||||||
elseif controls.down then
|
elseif controls.down then
|
||||||
vspeed = -0.25
|
vspeed = -0.25
|
||||||
hspeed = 2
|
hspeed = 2
|
||||||
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
||||||
set_player_yaw(self, player, yaw)
|
set_player_yaw(self, player, yaw)
|
||||||
self.idle = 1
|
self.idle = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if controls.right then
|
if controls.right then
|
||||||
yaw = yaw - math.pi / 60
|
yaw = yaw - math.pi / 60
|
||||||
vspeed = -2
|
vspeed = -2
|
||||||
hspeed = 4
|
hspeed = 4
|
||||||
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
||||||
set_player_yaw(self, player, yaw)
|
set_player_yaw(self, player, yaw)
|
||||||
self.idle = 1
|
self.idle = 1
|
||||||
elseif controls.left then
|
elseif controls.left then
|
||||||
yaw = yaw + math.pi / 60
|
yaw = yaw + math.pi / 60
|
||||||
vspeed = -2
|
vspeed = -2
|
||||||
hspeed = 4
|
hspeed = 4
|
||||||
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
||||||
set_player_yaw(self, player, yaw)
|
set_player_yaw(self, player, yaw)
|
||||||
self.idle = 1
|
self.idle = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.idle == 0 then
|
if self.idle == 0 then
|
||||||
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
player:set_look_vertical(math.tan(-vspeed / hspeed))
|
||||||
set_player_yaw(self, player, yaw)
|
set_player_yaw(self, player, yaw)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.object:set_yaw(yaw)
|
self.object:set_yaw(yaw)
|
||||||
local vel = vector.multiply(minetest.yaw_to_dir(yaw), hspeed)
|
local vel = vector.multiply(minetest.yaw_to_dir(yaw), hspeed)
|
||||||
vel.y = vspeed
|
vel.y = vspeed
|
||||||
self.object:set_velocity(vel)
|
self.object:set_velocity(vel)
|
||||||
|
|
||||||
if node_under.name ~= "air" then
|
if node_under.name ~= "air" then
|
||||||
default.player_attached[self.attached] = false
|
default.player_attached[self.attached] = false
|
||||||
local player = minetest.get_player_by_name(self.attached)
|
local player = minetest.get_player_by_name(self.attached)
|
||||||
player:get_meta():set_int("player_physics_locked", 0)
|
player:get_meta():set_int("player_physics_locked", 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
@ -155,7 +157,9 @@ minetest.register_entity(
|
|||||||
default.player_attached[self.attached] = false
|
default.player_attached[self.attached] = false
|
||||||
self.object:set_detach()
|
self.object:set_detach()
|
||||||
local player = minetest.get_player_by_name(self.attached)
|
local player = minetest.get_player_by_name(self.attached)
|
||||||
player:get_meta():set_int("player_physics_locked", 0)
|
if player then
|
||||||
|
player:get_meta():set_int("player_physics_locked", 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
@ -63,16 +63,24 @@ It is highly recommended that you install the following mods, too:
|
|||||||
* [autobahn](https://github.com/joe7575/autobahn): Street blocks and slopes with stripes for faster traveling
|
* [autobahn](https://github.com/joe7575/autobahn): Street blocks and slopes with stripes for faster traveling
|
||||||
* [[ta4_jetpack](https://github.com/joe7575/ta4_jetpack): A Jetpack with hydrogen as fuel and TA4 recipe
|
* [[ta4_jetpack](https://github.com/joe7575/ta4_jetpack): A Jetpack with hydrogen as fuel and TA4 recipe
|
||||||
|
|
||||||
For large servers with many player `lsqlite3` is recommended.
|
For large servers with many players, the following packages are recommended:
|
||||||
The package has to be installed via [luarocks](https://luarocks.org/):
|
|
||||||
|
|
||||||
luarocks install lsqlite3
|
* lua-mashal for faster serialization/deserialization of data
|
||||||
|
* lsqlite3 for storing node and network data
|
||||||
|
|
||||||
To enable this `unsafe` package, add 'techage' to the list of trusted mods in minetest.conf:
|
The packages have to be installed via [luarocks](https://luarocks.org/):
|
||||||
|
|
||||||
secure.trusted_mods = techage
|
luarocks --lua-version 5.1 install lsqlite3
|
||||||
|
luarocks --lua-version 5.1 install lua-marshal
|
||||||
|
|
||||||
For the installation of 'luarocks' (if not already available), see [luarocks](https://luarocks.org/)
|
To enable these `unsafe` packages, add 'techage' and 'lua-marshal'
|
||||||
|
to the list of trusted mods in `minetest.conf`:
|
||||||
|
|
||||||
|
secure.trusted_mods = techage,lua-marshal
|
||||||
|
|
||||||
|
and add the following line to your `world.mt` or `minetest.conf`:
|
||||||
|
|
||||||
|
techage_use_sqlite = true
|
||||||
|
|
||||||
Available worlds will be converted to 'lsqlite3', but there is no way back, so:
|
Available worlds will be converted to 'lsqlite3', but there is no way back, so:
|
||||||
|
|
||||||
@ -81,6 +89,10 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so:
|
|||||||
|
|
||||||
### History
|
### History
|
||||||
|
|
||||||
|
**2022-09-03 V1.09**
|
||||||
|
- Change the way items are pushed
|
||||||
|
- Add "Flow Limiter" mode to TA4 pump and TA4 pusher
|
||||||
|
|
||||||
**2022-06-06 V1.08**
|
**2022-06-06 V1.08**
|
||||||
- Native support for the mod Beduino added
|
- Native support for the mod Beduino added
|
||||||
|
|
||||||
|
@ -230,6 +230,8 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
|||||||
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
||||||
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
||||||
ta_rotate_node = tNode.ta_rotate_node,
|
ta_rotate_node = tNode.ta_rotate_node,
|
||||||
|
ta3_formspec = stage == 3 and tNode.ta3_formspec,
|
||||||
|
ta4_formspec = stage == 4 and tNode.ta4_formspec,
|
||||||
|
|
||||||
paramtype = tNode.paramtype,
|
paramtype = tNode.paramtype,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -271,6 +273,8 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
|||||||
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
||||||
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
||||||
ta_rotate_node = tNode.ta_rotate_node,
|
ta_rotate_node = tNode.ta_rotate_node,
|
||||||
|
ta3_formspec = stage == 3 and tNode.ta3_formspec,
|
||||||
|
ta4_formspec = stage == 4 and tNode.ta4_formspec,
|
||||||
|
|
||||||
paramtype = tNode.paramtype,
|
paramtype = tNode.paramtype,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -277,10 +277,17 @@ local function push_item(pos, base_filter, itemstack, num_items, nvm)
|
|||||||
num_of_trials = num_of_trials + 1
|
num_of_trials = num_of_trials + 1
|
||||||
local push_dir = filter[idx]
|
local push_dir = filter[idx]
|
||||||
local num_to_push = math.min(amount, num_items - num_pushed)
|
local num_to_push = math.min(amount, num_items - num_pushed)
|
||||||
if techage.push_items(pos, push_dir, itemstack:peek_item(num_to_push)) then
|
local leftover = techage.push_items(pos, push_dir, itemstack:peek_item(num_to_push))
|
||||||
num_pushed = num_pushed + num_to_push
|
local pushed
|
||||||
nvm.port_counter[push_dir] = (nvm.port_counter[push_dir] or 0) + num_to_push
|
if not leftover then
|
||||||
|
pushed = 0
|
||||||
|
elseif leftover ~= true then
|
||||||
|
pushed = num_to_push - leftover:get_count()
|
||||||
|
else -- leftover == true
|
||||||
|
pushed = num_to_push
|
||||||
end
|
end
|
||||||
|
num_pushed = num_pushed + pushed
|
||||||
|
nvm.port_counter[push_dir] = (nvm.port_counter[push_dir] or 0) + pushed
|
||||||
-- filter start offset
|
-- filter start offset
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
if idx > num_ports then
|
if idx > num_ports then
|
||||||
|
@ -73,11 +73,17 @@ minetest.register_node("techage:itemsource", {
|
|||||||
local stack = inv:get_stack('main', 1)
|
local stack = inv:get_stack('main', 1)
|
||||||
if stack:get_count() > 0 then
|
if stack:get_count() > 0 then
|
||||||
local push_dir = meta:get_int("push_dir")
|
local push_dir = meta:get_int("push_dir")
|
||||||
if techage.push_items(pos, push_dir, stack) then
|
local leftover = techage.push_items(pos, push_dir, stack)
|
||||||
local cnt = meta:get_int("counter") + stack:get_count()
|
local pushed
|
||||||
meta:set_int("counter", cnt)
|
if not leftover then
|
||||||
meta:set_string("infotext", "Techage Item Source: "..cnt)
|
pushed = 0
|
||||||
|
elseif leftover ~= true then
|
||||||
|
pushed = stack:get_count() - leftover:get_count()
|
||||||
|
else -- leftover == true
|
||||||
|
pushed = stack:get_count()
|
||||||
end
|
end
|
||||||
|
meta:set_int("counter", pushed)
|
||||||
|
meta:set_string("infotext", "Techage Item Source: "..pushed)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
@ -34,6 +34,16 @@ local STANDBY_TICKS = 2
|
|||||||
local COUNTDOWN_TICKS = 4
|
local COUNTDOWN_TICKS = 4
|
||||||
local CYCLE_TIME = 2
|
local CYCLE_TIME = 2
|
||||||
|
|
||||||
|
local WRENCH_MENU = {
|
||||||
|
{
|
||||||
|
type = "number",
|
||||||
|
name = "limit",
|
||||||
|
label = S("Number of items"),
|
||||||
|
tooltip = S("Number of items that are allowed to be pushed"),
|
||||||
|
default = "0",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local function ta4_formspec(self, pos, nvm)
|
local function ta4_formspec(self, pos, nvm)
|
||||||
if CRD(pos).stage == 4 then -- TA4 node?
|
if CRD(pos).stage == 4 then -- TA4 node?
|
||||||
return "size[8,7.2]"..
|
return "size[8,7.2]"..
|
||||||
@ -42,7 +52,8 @@ local function ta4_formspec(self, pos, nvm)
|
|||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||||
"label[3,-0.1;"..minetest.colorize("#000000", S("Pusher")).."]"..
|
"label[3,-0.1;"..minetest.colorize("#000000", S("Pusher")).."]"..
|
||||||
techage.question_mark_help(8, S("Optionally configure\nthe pusher with one item"))..
|
techage.question_mark_help(7.5, S("Optionally configure\nthe pusher with one item"))..
|
||||||
|
techage.wrench_image(7.4, -0.05) ..
|
||||||
"list[context;main;3.5,0.8;1,1;]"..
|
"list[context;main;3.5,0.8;1,1;]"..
|
||||||
"image_button[3.5,2;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
"image_button[3.5,2;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||||
"tooltip[3.5,2;1,1;"..self:get_state_tooltip(nvm).."]"..
|
"tooltip[3.5,2;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||||
@ -87,30 +98,71 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pushing(pos, crd, meta, nvm)
|
local function set_limit(pos, nvm, val)
|
||||||
local pull_dir = meta:get_int("pull_dir")
|
val = tonumber(val) or 0
|
||||||
local push_dir = meta:get_int("push_dir")
|
if val > 0 then
|
||||||
local num = nvm.item_count or nvm.num_items or crd.num_items
|
nvm.limit = val
|
||||||
|
nvm.num_items = 0
|
||||||
|
M(pos):set_int("limit", val)
|
||||||
|
else
|
||||||
|
nvm.limit = nil
|
||||||
|
nvm.num_items = nil
|
||||||
|
M(pos):set_string("limit", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function returns the number of pushed items
|
||||||
|
local function push(pos, crd, meta, nvm, pull_dir, push_dir, num)
|
||||||
local items = techage.pull_items(pos, pull_dir, num, nvm.item_name)
|
local items = techage.pull_items(pos, pull_dir, num, nvm.item_name)
|
||||||
if items ~= nil then
|
if items ~= nil then
|
||||||
if techage.push_items(pos, push_dir, items) ~= true then
|
local taken = items:get_count()
|
||||||
|
local leftover = techage.push_items(pos, push_dir, items)
|
||||||
|
if not leftover then
|
||||||
-- place item back
|
-- place item back
|
||||||
techage.unpull_items(pos, pull_dir, items)
|
techage.unpull_items(pos, pull_dir, items)
|
||||||
crd.State:blocked(pos, nvm)
|
crd.State:blocked(pos, nvm)
|
||||||
return
|
return 0
|
||||||
|
elseif leftover ~= true then
|
||||||
|
-- place item back
|
||||||
|
techage.unpull_items(pos, pull_dir, leftover)
|
||||||
|
crd.State:blocked(pos, nvm)
|
||||||
|
return taken - leftover:get_count()
|
||||||
end
|
end
|
||||||
if nvm.item_count then -- remote job?
|
return taken
|
||||||
nvm.item_count = nil
|
|
||||||
nvm.item_name = nil
|
|
||||||
crd.State:stop(pos, nvm)
|
|
||||||
local number = M(pos):get_string("node_number")
|
|
||||||
techage.send_single(number, nvm.rmt_num, "off")
|
|
||||||
else
|
|
||||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
crd.State:idle(pos, nvm)
|
crd.State:idle(pos, nvm)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local function pushing(pos, crd, meta, nvm)
|
||||||
|
local pull_dir = meta:get_int("pull_dir")
|
||||||
|
local push_dir = meta:get_int("push_dir")
|
||||||
|
|
||||||
|
if not nvm.limit then
|
||||||
|
local num = nvm.item_count or nvm.num_items or crd.num_items
|
||||||
|
num = push(pos, crd, meta, nvm, pull_dir, push_dir, num)
|
||||||
|
if num > 0 then
|
||||||
|
if nvm.item_count then
|
||||||
|
nvm.item_count = nvm.item_count - num
|
||||||
|
if nvm.item_count <= 0 then
|
||||||
|
crd.State:stop(pos, nvm)
|
||||||
|
nvm.item_count = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
|
end
|
||||||
|
elseif nvm.num_items < nvm.limit then
|
||||||
|
local num = math.min(crd.num_items, nvm.limit - nvm.num_items)
|
||||||
|
num = push(pos, crd, meta, nvm, pull_dir, push_dir, num)
|
||||||
|
if num > 0 then
|
||||||
|
nvm.num_items = nvm.num_items + num
|
||||||
|
if nvm.num_items >= nvm.limit then
|
||||||
|
crd.State:stop(pos, nvm)
|
||||||
|
else
|
||||||
|
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function keep_running(pos, elapsed)
|
local function keep_running(pos, elapsed)
|
||||||
@ -180,6 +232,18 @@ local function can_start(pos, nvm, state)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function ta_after_formspec(pos, fields, playername)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
set_limit(pos, nvm, fields.limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_state_change(pos, old_state, new_state)
|
||||||
|
if old_state == techage.STOPPED and new_state == techage.RUNNING then
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
set_limit(pos, nvm, M(pos):get_int("limit"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function config_item(pos, payload)
|
local function config_item(pos, payload)
|
||||||
if type(payload) == "string" then
|
if type(payload) == "string" then
|
||||||
if payload == "" then
|
if payload == "" then
|
||||||
@ -247,43 +311,56 @@ local tubing = {
|
|||||||
is_pusher = true, -- is a pulling/pushing node
|
is_pusher = true, -- is a pulling/pushing node
|
||||||
|
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
if topic == "pull" then
|
if topic == "pull" then -- Deprecated command, use config/limit/start instead
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
CRD(pos).State:stop(pos, nvm)
|
CRD(pos).State:stop(pos, nvm)
|
||||||
nvm.item_count = math.min(config_item(pos, payload), 12)
|
nvm.item_count = math.min(config_item(pos, payload), 12)
|
||||||
nvm.rmt_num = src
|
nvm.rmt_num = src
|
||||||
CRD(pos).State:start(pos, nvm)
|
CRD(pos).State:start(pos, nvm)
|
||||||
return true
|
return true
|
||||||
elseif topic == "config" then
|
elseif topic == "config" then -- Set item type
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
CRD(pos).State:stop(pos, nvm)
|
CRD(pos).State:stop(pos, nvm)
|
||||||
config_item(pos, payload)
|
config_item(pos, payload)
|
||||||
CRD(pos).State:start(pos, nvm)
|
|
||||||
return true
|
return true
|
||||||
|
elseif topic == "limit" then -- Set push limit
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
CRD(pos).State:stop(pos, nvm)
|
||||||
|
set_limit(pos, nvm, payload)
|
||||||
|
return true
|
||||||
|
elseif topic == "count" then -- Get number of push items
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return nvm.num_items or 0
|
||||||
else
|
else
|
||||||
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||||
if topic == 64 then -- Start pusher
|
if topic == 65 then -- Set item type
|
||||||
local nvm = techage.get_nvm(pos)
|
|
||||||
CRD(pos).State:stop(pos, nvm)
|
|
||||||
nvm.item_count = math.min(config_item(pos, payload), 12)
|
|
||||||
nvm.rmt_num = src
|
|
||||||
CRD(pos).State:start(pos, nvm)
|
|
||||||
return 0
|
|
||||||
elseif topic == 65 then -- Config Pusher
|
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
CRD(pos).State:stop(pos, nvm)
|
CRD(pos).State:stop(pos, nvm)
|
||||||
config_item(pos, payload)
|
config_item(pos, payload)
|
||||||
CRD(pos).State:start(pos, nvm)
|
return 0
|
||||||
|
elseif topic == 68 then -- Set push limit
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
CRD(pos).State:stop(pos, nvm)
|
||||||
|
set_limit(pos, nvm, payload[1])
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
if nvm.limit then
|
||||||
|
nvm.num_items = 0
|
||||||
|
end
|
||||||
return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload)
|
return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_request_data = function(pos, src, topic, payload)
|
on_beduino_request_data = function(pos, src, topic, payload)
|
||||||
return CRD(pos).State:on_beduino_request_data(pos, topic, payload)
|
if topic == 150 then -- Get number of pushed items
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return 0, {nvm.num_items or 0}
|
||||||
|
else
|
||||||
|
return CRD(pos).State:on_beduino_request_data(pos, topic, payload)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +371,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
|||||||
formspec = ta4_formspec,
|
formspec = ta4_formspec,
|
||||||
tubing = tubing,
|
tubing = tubing,
|
||||||
can_start = can_start,
|
can_start = can_start,
|
||||||
|
on_state_change = on_state_change,
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
@ -321,6 +399,8 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
|||||||
node_timer = keep_running,
|
node_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
tubelib2_on_update2 = tubelib2_on_update2,
|
tubelib2_on_update2 = tubelib2_on_update2,
|
||||||
|
ta4_formspec = WRENCH_MENU,
|
||||||
|
ta_after_formspec = ta_after_formspec,
|
||||||
|
|
||||||
groups = {choppy=2, cracky=2, crumbly=2},
|
groups = {choppy=2, cracky=2, crumbly=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -133,7 +133,7 @@ local function doesItemStackMatchNvmStack(itemstack, nvmstack)
|
|||||||
|
|
||||||
-- The following seems to be the most reliable approach to compare meta.
|
-- The following seems to be the most reliable approach to compare meta.
|
||||||
local nvm_meta = ItemStack():get_meta()
|
local nvm_meta = ItemStack():get_meta()
|
||||||
nvm_meta:from_table(minetest.deserialize(nvmstack.meta))
|
nvm_meta:from_table(minetest.deserialize(nvmstack.meta or ""))
|
||||||
if not nvm_meta:equals(itemstack:get_meta()) then
|
if not nvm_meta:equals(itemstack:get_meta()) then
|
||||||
return false, "Mismatching meta"
|
return false, "Mismatching meta"
|
||||||
end
|
end
|
||||||
@ -197,7 +197,7 @@ local function take_from_chest(pos, idx, output_stack, max_total_count, keep_ass
|
|||||||
count = count,
|
count = count,
|
||||||
wear = nvm_stack.wear,
|
wear = nvm_stack.wear,
|
||||||
}))
|
}))
|
||||||
output_stack:get_meta():from_table(minetest.deserialize(nvm_stack.meta))
|
output_stack:get_meta():from_table(minetest.deserialize(nvm_stack.meta or ""))
|
||||||
nvm_stack.count = nvm_stack.count - count
|
nvm_stack.count = nvm_stack.count - count
|
||||||
if nvm_stack.count == 0 then
|
if nvm_stack.count == 0 then
|
||||||
gen_stack(nvm.inventory or {}, idx)
|
gen_stack(nvm.inventory or {}, idx)
|
||||||
@ -210,21 +210,14 @@ local function tube_add_to_chest(pos, input_stack)
|
|||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.inventory = nvm.inventory or {}
|
nvm.inventory = nvm.inventory or {}
|
||||||
|
|
||||||
-- Backup some values needed for restoring the old
|
|
||||||
-- state if items can't fully be added to chest.
|
|
||||||
local orig_count = input_stack:get_count()
|
|
||||||
local backup = table.copy(nvm.inventory)
|
|
||||||
|
|
||||||
for idx = 1,8 do
|
for idx = 1,8 do
|
||||||
input_stack:take_item(add_to_chest(pos, input_stack, idx))
|
input_stack:take_item(add_to_chest(pos, input_stack, idx))
|
||||||
end
|
end
|
||||||
|
|
||||||
if input_stack:get_count() > 0 then
|
if input_stack:get_count() > 0 then
|
||||||
nvm.inventory = backup -- Restore old nvm inventory
|
return input_stack -- Not all items were added to chest
|
||||||
input_stack:set_count(orig_count) -- Restore input_stack
|
|
||||||
return false -- No items were added to chest
|
|
||||||
else
|
else
|
||||||
return true -- Items were added successfully
|
return true -- All items were added
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ function techage.push_items(pos, out_dir, stack, idx)
|
|||||||
minetest.add_item(npos, stack)
|
minetest.add_item(npos, stack)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for recursion and too long distances
|
-- Check for recursion and too long distances
|
||||||
@ -485,7 +485,7 @@ function techage.safe_push_items(pos, out_dir, stack, idx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.unpull_items(pos, out_dir, stack)
|
function techage.unpull_items(pos, out_dir, stack)
|
||||||
@ -496,37 +496,6 @@ function techage.unpull_items(pos, out_dir, stack)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
-- Client side Push/Pull item functions for hopper like nodes
|
|
||||||
-- (nodes with no tube support)
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
|
|
||||||
function techage.neighbour_pull_items(pos, out_dir, num)
|
|
||||||
local res, npos, in_dir, name = get_next_node(pos, out_dir)
|
|
||||||
if res and NodeDef[name] and NodeDef[name].on_pull_item then
|
|
||||||
return NodeDef[name].on_pull_item(npos, in_dir, num)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function techage.neighbour_push_items(pos, out_dir, stack)
|
|
||||||
local res, npos, in_dir, name = get_next_node(pos, out_dir)
|
|
||||||
if res and NodeDef[name] and NodeDef[name].on_push_item then
|
|
||||||
return NodeDef[name].on_push_item(npos, in_dir, stack)
|
|
||||||
elseif name == "air" then
|
|
||||||
minetest.add_item(npos, stack)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function techage.neighbour_unpull_items(pos, out_dir, stack)
|
|
||||||
local res, npos, in_dir, name = get_next_node(pos, out_dir)
|
|
||||||
if res and NodeDef[name] and NodeDef[name].on_unpull_item then
|
|
||||||
return NodeDef[name].on_unpull_item(npos, in_dir, stack)
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- Server side helper functions
|
-- Server side helper functions
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
@ -554,23 +523,33 @@ function techage.get_items(pos, inv, listname, num)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Put the given stack into the given ItemList.
|
-- Put the given stack into the given ItemList/inventory.
|
||||||
-- Function returns false if ItemList is full.
|
-- Function returns:
|
||||||
|
-- - true, if all items are moved
|
||||||
|
-- - false, if no item is moved
|
||||||
|
-- - leftover, if less than all items are moved
|
||||||
|
-- (true/false is the legacy mode and can't be removed)
|
||||||
function techage.put_items(inv, listname, item, idx)
|
function techage.put_items(inv, listname, item, idx)
|
||||||
|
local leftover
|
||||||
if idx and inv and idx <= inv:get_size(listname) then
|
if idx and inv and idx <= inv:get_size(listname) then
|
||||||
local stack = inv:get_stack(listname, idx)
|
local stack = inv:get_stack(listname, idx)
|
||||||
if stack:item_fits(item) then
|
leftover = stack:add_item(item)
|
||||||
stack:add_item(item)
|
inv:set_stack(listname, idx, stack)
|
||||||
inv:set_stack(listname, idx, stack)
|
elseif inv then
|
||||||
return true
|
leftover = inv:add_item(listname, item)
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if inv and inv:room_for_item(listname, item) then
|
return false
|
||||||
inv:add_item(listname, item)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return false
|
|
||||||
|
local cnt = leftover:get_count()
|
||||||
|
if cnt == item:get_count() then
|
||||||
|
return false
|
||||||
|
elseif cnt == 0 then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return leftover
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return "full", "loaded", or "empty" depending
|
-- Return "full", "loaded", or "empty" depending
|
||||||
|
@ -76,16 +76,22 @@ function inv_lib.allow_conf_inv_move(pos, from_list, from_index, to_list, to_ind
|
|||||||
end
|
end
|
||||||
|
|
||||||
function inv_lib.put_items(pos, inv, listname, item, stacks, idx)
|
function inv_lib.put_items(pos, inv, listname, item, stacks, idx)
|
||||||
|
local name = item:get_name()
|
||||||
|
local count = item:get_count()
|
||||||
for _, i in ipairs(stacks or {}) do
|
for _, i in ipairs(stacks or {}) do
|
||||||
if not idx or idx == i then
|
if not idx or idx == i then
|
||||||
local stack = inv:get_stack(listname, i)
|
local stack = inv:get_stack(listname, i)
|
||||||
if stack:item_fits(item) then
|
local leftover = stack:add_item({name = name, count = count})
|
||||||
stack:add_item(item)
|
count = leftover:get_count()
|
||||||
inv:set_stack(listname, i, stack)
|
inv:set_stack(listname, i, stack)
|
||||||
|
if count == 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if count > 0 then
|
||||||
|
return ItemStack({name = name, count = count})
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,14 +75,15 @@ function flylib.distance(v)
|
|||||||
return math.abs(v.x) + math.abs(v.y) + math.abs(v.z)
|
return math.abs(v.x) + math.abs(v.y) + math.abs(v.z)
|
||||||
end
|
end
|
||||||
|
|
||||||
function flylib.to_vector(s)
|
function flylib.to_vector(s, max_dist)
|
||||||
local x,y,z = unpack(string.split(s, ","))
|
local x,y,z = unpack(string.split(s, ","))
|
||||||
|
x = tonumber(x) or 0
|
||||||
|
y = tonumber(y) or 0
|
||||||
|
z = tonumber(z) or 0
|
||||||
if x and y and z then
|
if x and y and z then
|
||||||
return {
|
if not max_dist or (math.abs(x) + math.abs(y) + math.abs(z)) <= max_dist then
|
||||||
x=tonumber(x) or 0,
|
return {x = x, y = y, z = z}
|
||||||
y=tonumber(y) or 0,
|
end
|
||||||
z=tonumber(z) or 0,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ function flylib.to_path(s, max_dist)
|
|||||||
tPath = tPath or {}
|
tPath = tPath or {}
|
||||||
tPath[#tPath + 1] = v
|
tPath[#tPath + 1] = v
|
||||||
else
|
else
|
||||||
return tPath, S("Error: Max. length of the flight route exceeded !!")
|
return tPath, S("Error: Max. length of the flight route exceeded by @1 blocks !!", dist - max_dist)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return tPath, S("Error: Invalid path !!")
|
return tPath, S("Error: Invalid path !!")
|
||||||
@ -676,11 +677,11 @@ local function move_nodes2(pos, meta, lpos1, line, max_speed, height)
|
|||||||
|
|
||||||
local lpos2 = {}
|
local lpos2 = {}
|
||||||
for idx = 1, #lpos1 do
|
for idx = 1, #lpos1 do
|
||||||
|
|
||||||
local pos1 = lpos1[idx]
|
local pos1 = lpos1[idx]
|
||||||
local pos2 = vector.add(lpos1[idx], line)
|
local pos2 = vector.add(lpos1[idx], line)
|
||||||
lpos2[idx] = pos2
|
lpos2[idx] = pos2
|
||||||
|
|
||||||
if not minetest.is_protected(pos1, owner) and not minetest.is_protected(pos2, owner) then
|
if not minetest.is_protected(pos1, owner) and not minetest.is_protected(pos2, owner) then
|
||||||
if is_simple_node(pos1) and is_valid_dest(pos2) then
|
if is_simple_node(pos1) and is_valid_dest(pos2) then
|
||||||
move_node(pos, idx, pos1, {line}, max_speed, height, false, false)
|
move_node(pos, idx, pos1, {line}, max_speed, height, false, false)
|
||||||
@ -700,7 +701,7 @@ local function move_nodes2(pos, meta, lpos1, line, max_speed, height)
|
|||||||
return false, lpos1
|
return false, lpos1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("status", "")
|
meta:set_string("status", "")
|
||||||
return true, lpos2
|
return true, lpos2
|
||||||
end
|
end
|
||||||
@ -794,14 +795,14 @@ end
|
|||||||
function flylib.exchange_node(pos, name, param2)
|
function flylib.exchange_node(pos, name, param2)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local move_block
|
local move_block
|
||||||
|
|
||||||
-- consider stored "objects"
|
-- consider stored "objects"
|
||||||
if meta:contains("ta_move_block") then
|
if meta:contains("ta_move_block") then
|
||||||
move_block = meta:get_string("ta_move_block")
|
move_block = meta:get_string("ta_move_block")
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.swap_node(pos, {name = name, param2 = param2})
|
minetest.swap_node(pos, {name = name, param2 = param2})
|
||||||
|
|
||||||
if move_block then
|
if move_block then
|
||||||
meta:set_string("ta_move_block", move_block)
|
meta:set_string("ta_move_block", move_block)
|
||||||
end
|
end
|
||||||
@ -810,14 +811,14 @@ end
|
|||||||
function flylib.remove_node(pos)
|
function flylib.remove_node(pos)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local move_block
|
local move_block
|
||||||
|
|
||||||
-- consider stored "objects"
|
-- consider stored "objects"
|
||||||
if meta:contains("ta_move_block") then
|
if meta:contains("ta_move_block") then
|
||||||
move_block = meta:get_string("ta_move_block")
|
move_block = meta:get_string("ta_move_block")
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
|
||||||
if move_block then
|
if move_block then
|
||||||
local node = minetest.deserialize(move_block)
|
local node = minetest.deserialize(move_block)
|
||||||
minetest.add_node(pos, node)
|
minetest.add_node(pos, node)
|
||||||
|
@ -288,7 +288,7 @@ function techage.can_dig_node(name, ndef)
|
|||||||
if SimpleNodes[name] ~= nil then
|
if SimpleNodes[name] ~= nil then
|
||||||
return SimpleNodes[name]
|
return SimpleNodes[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
if ndef.groups and ndef.groups.techage_door == 1 then
|
if ndef.groups and ndef.groups.techage_door == 1 then
|
||||||
SimpleNodes[name] = true
|
SimpleNodes[name] = true
|
||||||
return true
|
return true
|
||||||
|
@ -97,8 +97,8 @@ minetest.register_globalstep(function(dtime)
|
|||||||
SystemTime = SystemTime + dtime
|
SystemTime = SystemTime + dtime
|
||||||
local key = pop()
|
local key = pop()
|
||||||
if key and NvmStore[key] then
|
if key and NvmStore[key] then
|
||||||
-- minetest.log("warning",
|
-- minetest.log("warning",
|
||||||
-- string.format("[TA Storage] SystemTime = %.3f, #JobQueue = %d, in_use = %s",
|
-- string.format("[TA Storage] SystemTime = %.3f, #JobQueue = %d, in_use = %s",
|
||||||
-- SystemTime, last - first, NvmStore[key].in_use))
|
-- SystemTime, last - first, NvmStore[key].in_use))
|
||||||
local t = minetest.get_us_time()
|
local t = minetest.get_us_time()
|
||||||
if NvmStore[key].in_use then
|
if NvmStore[key].in_use then
|
||||||
|
@ -65,6 +65,7 @@ function api.store_mapblock_data(key, mapblock_data)
|
|||||||
if pos then
|
if pos then
|
||||||
item._POS_ = nil
|
item._POS_ = nil
|
||||||
local data = serialize(item)
|
local data = serialize(item)
|
||||||
|
item._POS_ = pos
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("ta_data", data)
|
meta:set_string("ta_data", data)
|
||||||
meta:mark_as_private("ta_data")
|
meta:mark_as_private("ta_data")
|
||||||
|
@ -72,7 +72,7 @@ end
|
|||||||
local api = {}
|
local api = {}
|
||||||
|
|
||||||
function api.store_mapblock_data(key, mapblock_data)
|
function api.store_mapblock_data(key, mapblock_data)
|
||||||
if use_marshal then
|
if use_marshal then
|
||||||
set_block(key, marshal.encode(mapblock_data))
|
set_block(key, marshal.encode(mapblock_data))
|
||||||
else
|
else
|
||||||
set_block(key, minetest.serialize(mapblock_data))
|
set_block(key, minetest.serialize(mapblock_data))
|
||||||
|
@ -169,6 +169,14 @@ function techage.recipes.get_recipe(name)
|
|||||||
return NormalizedRecipes[name]
|
return NormalizedRecipes[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function techage.recipes.set_recipe(pos, rtype, idx)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
if not nvm.running then
|
||||||
|
local recipes = Recipes[rtype] or {}
|
||||||
|
idx = tonumber(idx) or 1
|
||||||
|
nvm.recipe_idx = range(idx, 1, #recipes)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function techage.recipes.get_default_group_item_name(item_name)
|
function techage.recipes.get_default_group_item_name(item_name)
|
||||||
if item_name and item_name:sub(1, 6) == "group:" then
|
if item_name and item_name:sub(1, 6) == "group:" then
|
||||||
|
@ -16,8 +16,8 @@ local S = techage.S
|
|||||||
techage.menu = {}
|
techage.menu = {}
|
||||||
|
|
||||||
local function index(list, x)
|
local function index(list, x)
|
||||||
for idx, v in ipairs(list) do
|
for idx, v in ipairs(list or {}) do
|
||||||
if v == x then return idx end
|
if tostring(v) == x then return idx end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@ -99,7 +99,6 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
|||||||
end
|
end
|
||||||
tbl[#tbl+1] = "label[4.75," .. offs .. ";" .. val .. "]"
|
tbl[#tbl+1] = "label[4.75," .. offs .. ";" .. val .. "]"
|
||||||
elseif elem.type == "dropdown" then
|
elseif elem.type == "dropdown" then
|
||||||
local l = elem.choices:split(",")
|
|
||||||
if nvm.running or techage.is_running(nvm) then
|
if nvm.running or techage.is_running(nvm) then
|
||||||
local val = elem.default or ""
|
local val = elem.default or ""
|
||||||
if meta:contains(elem.name) then
|
if meta:contains(elem.name) then
|
||||||
@ -120,7 +119,13 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
|||||||
if meta:contains(elem.name) then
|
if meta:contains(elem.name) then
|
||||||
val = meta:get_string(elem.name) or ""
|
val = meta:get_string(elem.name) or ""
|
||||||
end
|
end
|
||||||
local idx = index(l, val) or 1
|
local idx
|
||||||
|
if elem.values then
|
||||||
|
idx = index(elem.values, val) or 1
|
||||||
|
else
|
||||||
|
local l = elem.choices:split(",")
|
||||||
|
idx = index(l, val) or 1
|
||||||
|
end
|
||||||
tbl[#tbl+1] = "dropdown[4.72," .. (offs) .. ";5.5,1.4;" .. elem.name .. ";" .. elem.choices .. ";" .. idx .. "]"
|
tbl[#tbl+1] = "dropdown[4.72," .. (offs) .. ";5.5,1.4;" .. elem.name .. ";" .. elem.choices .. ";" .. idx .. "]"
|
||||||
end
|
end
|
||||||
elseif elem.type == "items" then -- inventory
|
elseif elem.type == "items" then -- inventory
|
||||||
@ -137,9 +142,9 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
|||||||
return player_inv_needed, table.concat(tbl, "")
|
return player_inv_needed, table.concat(tbl, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function value_check(elem, value)
|
local function value_check(elem, value, player_name)
|
||||||
if elem.check then
|
if elem.check then
|
||||||
return elem.check(value)
|
return elem.check(value, player_name)
|
||||||
end
|
end
|
||||||
return value ~= nil
|
return value ~= nil
|
||||||
end
|
end
|
||||||
@ -159,7 +164,7 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
|||||||
meta:set_string(elem.name, "")
|
meta:set_string(elem.name, "")
|
||||||
elseif fields[elem.name]:find("^[%d ]+$") then
|
elseif fields[elem.name]:find("^[%d ]+$") then
|
||||||
local val = tonumber(fields[elem.name])
|
local val = tonumber(fields[elem.name])
|
||||||
if value_check(elem, val) then
|
if value_check(elem, val, player_name) then
|
||||||
meta:set_int(elem.name, val)
|
meta:set_int(elem.name, val)
|
||||||
--print("set_int", elem.name, val)
|
--print("set_int", elem.name, val)
|
||||||
else
|
else
|
||||||
@ -173,7 +178,8 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
|||||||
if fields[elem.name] then
|
if fields[elem.name] then
|
||||||
if fields[elem.name] == "" then
|
if fields[elem.name] == "" then
|
||||||
meta:set_string(elem.name, "")
|
meta:set_string(elem.name, "")
|
||||||
elseif fields[elem.name]:find("^[%d ]+$") and value_check(elem, fields[elem.name]) then
|
elseif fields[elem.name]:find("^[%d ]+$") and
|
||||||
|
value_check(elem, fields[elem.name], player_name) then
|
||||||
meta:set_string(elem.name, fields[elem.name])
|
meta:set_string(elem.name, fields[elem.name])
|
||||||
else
|
else
|
||||||
res = false
|
res = false
|
||||||
@ -184,7 +190,7 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
|||||||
meta:set_string(elem.name, "")
|
meta:set_string(elem.name, "")
|
||||||
elseif fields[elem.name] then
|
elseif fields[elem.name] then
|
||||||
local val = tonumber(fields[elem.name])
|
local val = tonumber(fields[elem.name])
|
||||||
if val and value_check(elem, val) then
|
if val and value_check(elem, val, player_name) then
|
||||||
meta:set_string(elem.name, val)
|
meta:set_string(elem.name, val)
|
||||||
else
|
else
|
||||||
res = false
|
res = false
|
||||||
@ -194,7 +200,7 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
|||||||
if fields[elem.name] == ""then
|
if fields[elem.name] == ""then
|
||||||
meta:set_string(elem.name, "")
|
meta:set_string(elem.name, "")
|
||||||
elseif fields[elem.name] then
|
elseif fields[elem.name] then
|
||||||
if value_check(elem, fields[elem.name]) then
|
if value_check(elem, fields[elem.name], player_name) then
|
||||||
meta:set_string(elem.name, fields[elem.name])
|
meta:set_string(elem.name, fields[elem.name])
|
||||||
else
|
else
|
||||||
res = false
|
res = false
|
||||||
@ -202,7 +208,14 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
|||||||
end
|
end
|
||||||
elseif elem.type == "dropdown" then
|
elseif elem.type == "dropdown" then
|
||||||
if fields[elem.name] ~= nil then
|
if fields[elem.name] ~= nil then
|
||||||
meta:set_string(elem.name, fields[elem.name])
|
if elem.values then
|
||||||
|
local l = elem.choices:split(",")
|
||||||
|
local idx = index(l, fields[elem.name]) or 1
|
||||||
|
local text = elem.values[idx]
|
||||||
|
meta:set_string(elem.name, text)
|
||||||
|
else
|
||||||
|
meta:set_string(elem.name, fields[elem.name])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif elem.type == "items" and player_name then
|
elseif elem.type == "items" and player_name then
|
||||||
local inv_name = minetest.formspec_escape(player_name) .. "_techage_wrench_menu"
|
local inv_name = minetest.formspec_escape(player_name) .. "_techage_wrench_menu"
|
||||||
|
@ -358,7 +358,12 @@ liquid.register_nodes({"techage:ta4_doser", "techage:ta4_doser_on"}, Pipe, "pump
|
|||||||
|
|
||||||
techage.register_node({"techage:ta4_doser", "techage:ta4_doser_on"}, {
|
techage.register_node({"techage:ta4_doser", "techage:ta4_doser_on"}, {
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
return State:on_receive_message(pos, topic, payload)
|
if topic == "recipe" then
|
||||||
|
techage.recipes.set_recipe(pos, "ta4_doser", payload)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return State:on_receive_message(pos, topic, payload)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||||
return State:on_beduino_receive_cmnd(pos, topic, payload)
|
return State:on_beduino_receive_cmnd(pos, topic, payload)
|
||||||
|
@ -168,6 +168,28 @@ minetest.register_node("techage:ta4_reactor", {
|
|||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
techage.register_node({"techage:ta4_reactor"}, {
|
||||||
|
on_inv_request = function(pos, in_dir, access_type)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
return meta:get_inventory(), "main"
|
||||||
|
end,
|
||||||
|
on_pull_item = function(pos, in_dir, num, item_name)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.get_items(pos, inv, "main", num)
|
||||||
|
end,
|
||||||
|
on_push_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.put_items(inv, "main", stack)
|
||||||
|
end,
|
||||||
|
on_unpull_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.put_items(inv, "main", stack)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'techage:ta4_reactor',
|
output = 'techage:ta4_reactor',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -86,7 +86,7 @@ minetest.register_node("techage:coalfirebox", {
|
|||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
if firebox.is_free_position(pos, placer:get_player_name()) then
|
if firebox.is_free_position(pos, placer:get_player_name()) then
|
||||||
techage.add_node(pos, "techage:coalfirebox")
|
techage.add_node(pos, "techage:coalfirebox", true)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.running = false
|
nvm.running = false
|
||||||
nvm.burn_cycles = 0
|
nvm.burn_cycles = 0
|
||||||
|
@ -88,7 +88,7 @@ minetest.register_node("techage:oilfirebox", {
|
|||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
if firebox.is_free_position(pos, placer:get_player_name()) then
|
if firebox.is_free_position(pos, placer:get_player_name()) then
|
||||||
techage.add_node(pos, "techage:oilfirebox")
|
techage.add_node(pos, "techage:oilfirebox", true)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.running = false
|
nvm.running = false
|
||||||
nvm.burn_cycles = 0
|
nvm.burn_cycles = 0
|
||||||
|
@ -229,6 +229,7 @@ techage.manual_DE.aTitel = {
|
|||||||
"3,TA4 Elektronikfabrik / Electronic Fab",
|
"3,TA4 Elektronikfabrik / Electronic Fab",
|
||||||
"3,TA4 Injektor / Injector",
|
"3,TA4 Injektor / Injector",
|
||||||
"3,TA4 Recycler",
|
"3,TA4 Recycler",
|
||||||
|
"3,TA4 Item Durchlaufbegrenzer / Item Flow Limiter",
|
||||||
"1,TA5: Zukunft",
|
"1,TA5: Zukunft",
|
||||||
"2,Energiequellen",
|
"2,Energiequellen",
|
||||||
"3,TA5 Fusionsreaktor",
|
"3,TA5 Fusionsreaktor",
|
||||||
@ -1042,7 +1043,7 @@ techage.manual_DE.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"Der Taster/Schalter sendet 'on'/'off' Kommandos zu den Blöcken\\, die über die Nummern konfiguriert wurden.\n"..
|
"Der Taster/Schalter sendet 'on'/'off' Kommandos zu den Blöcken\\, die über die Nummern konfiguriert wurden.\n"..
|
||||||
"Der Taster/Schalter kann als Taster (button) oder Schalter (switch) konfiguriert werden. Wird er als Taster konfiguriert\\, so kann die Zeit zwischen den 'on' und 'off' Kommandos eingestellt werden.\n"..
|
"Der Taster/Schalter kann als Taster (button) oder Schalter (switch) konfiguriert werden. Wird er als Taster konfiguriert\\, so kann die Zeit zwischen den 'on' und 'off' Kommandos eingestellt werden. Mit der Betriebsart \"on button\" wird nur ein 'on' und kein 'off' Kommandos gesendet.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Über die Checkbox \"public\" kann eingestellt werden\\, ob den Taster von jedem (gesetzt)\\, oder nur vom Besitzer selbst (nicht gesetzt) genutzt werden darf.\n"..
|
"Über die Checkbox \"public\" kann eingestellt werden\\, ob den Taster von jedem (gesetzt)\\, oder nur vom Besitzer selbst (nicht gesetzt) genutzt werden darf.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
@ -1125,7 +1126,9 @@ techage.manual_DE.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"Die Signallampe kann mit 'on'/'off' Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und\n"..
|
"Die Signallampe kann mit 'on'/'off' Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und\n"..
|
||||||
"kann mit der Spritzpistole aus der Mod \"Unified Dyes\" farbig gemacht werden.\n"..
|
"kann mit der Spritzpistole aus der Mod \"Unified Dyes\" und über Lua/Beduino Kommandos eingefärbt werden.\n"..
|
||||||
|
"\n"..
|
||||||
|
"Mit dem Chat-Kommando '/ta_color' wird die Farbpalette mit den Werten für die Lua/Beduino Kommandos angezeigt und mit '/ta_send color <num>' kann die Farbe geändert werden.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1630,7 +1633,7 @@ techage.manual_DE.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"",
|
"",
|
||||||
"Beim TA4 Taster/Schalter hat sich nur das Aussehen geändert. Die Funktionalität ist gleich wie beim TA3 Taster/Schalter.\n"..
|
"Beim TA4 Taster/Schalter hat sich nur das Aussehen geändert. Die Funktionalität ist gleich wie beim TA3 Taster/Schalter. Mit dem Schraubenschlüssel-Menü können die Daten aber nachträglich geändert werden.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1696,6 +1699,8 @@ techage.manual_DE.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"Das 'goto' Kommando wird nur angenommen\\, wenn der Sequenzer gestoppt ist.\n"..
|
"Das 'goto' Kommando wird nur angenommen\\, wenn der Sequenzer gestoppt ist.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
|
"Über das Gabelschlüssel-Menü kann beim Sequenzer die Zykluszeit (normal: 100 ms) geändert werden. \n"..
|
||||||
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"",
|
"",
|
||||||
@ -1705,7 +1710,7 @@ techage.manual_DE.aText = {
|
|||||||
"Anleitung:\n"..
|
"Anleitung:\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" - Controller setzen und die Blöcke\\, die bewegt werden sollen\\, über das Menü an-trainieren (Es können bis zu 16 Blöcke an-trainiert werden)\n"..
|
" - Controller setzen und die Blöcke\\, die bewegt werden sollen\\, über das Menü an-trainieren (Es können bis zu 16 Blöcke an-trainiert werden)\n"..
|
||||||
" - die \"Flugstrecke\" muss über eine x\\,y\\,z Angabe (relativ) eingegeben werden (die maximale Distanz beträgt 100 m)\n"..
|
" - die \"Flugstrecke\" muss über eine x\\,y\\,z Angabe (relativ) eingegeben werden (die maximale Distanz (x+y+z) beträgt 200 m)\n"..
|
||||||
" - mit den Menü-Tasten \"Bewege A-B\" sowie \"Bewege B-A\" kann die Bewegung getestet werden\n"..
|
" - mit den Menü-Tasten \"Bewege A-B\" sowie \"Bewege B-A\" kann die Bewegung getestet werden\n"..
|
||||||
" - man kann auch durch Wände oder andere Blöcke fliegen\n"..
|
" - man kann auch durch Wände oder andere Blöcke fliegen\n"..
|
||||||
" - auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle \"unsichtbar\" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht\n"..
|
" - auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle \"unsichtbar\" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht\n"..
|
||||||
@ -1892,7 +1897,13 @@ techage.manual_DE.aText = {
|
|||||||
"\n",
|
"\n",
|
||||||
"Siehe TA3 Pumpe.\n"..
|
"Siehe TA3 Pumpe.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. Zusätzlich unterstützt die Pumpe das Kommando 'flowrate'. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.\n"..
|
"Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. \n"..
|
||||||
|
"\n"..
|
||||||
|
"In der Betriebsart \"Durchflussbegrenzer\" kann die Anzahl der Einheiten\\, die von der Pumpe gepumpt werden\\, begrenzt werden. Die Betriebsart Durchflussbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden\\, indem im Menü die Anzahl an Einheiten konfiguriert wird. Sobald die konfigurierte Anzahl an Einheiten gepumpt wurden\\, schaltet sich die Pumpe ab. Wird die Pumpe wieder eingeschaltet\\, pumpt sie wieder die konfigurierte Anzahl an Einheiten und schaltet sich dann ab.\n"..
|
||||||
|
"\n"..
|
||||||
|
"Der Durchflussbegrenzer kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.\n"..
|
||||||
|
"\n"..
|
||||||
|
"Zusätzlich unterstützt die Pumpe das Kommando 'flowrate'. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1918,10 +1929,14 @@ techage.manual_DE.aText = {
|
|||||||
"Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden\\, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen.\n"..
|
"Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden\\, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen.\n"..
|
||||||
"Die Verarbeitungsleistung beträgt 12 Items alle 2 s\\, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s.\n"..
|
"Die Verarbeitungsleistung beträgt 12 Items alle 2 s\\, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:\n"..
|
"In der Betriebsart \"Durchlaufbegrenzer\" kann die Anzahl der Items\\, die von dem Schieber bewegt werden\\, begrenzt werden. Die Betriebsart Durchlaufbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden\\, indem im Menü die Anzahl an Items konfiguriert wird. Sobald die konfigurierte Anzahl an Items bewegt wurden\\, schaltet sich der Schieber ab. Wird der Schieber wieder eingeschaltet\\, bewegt er wieder die konfigurierte Anzahl an Items und schaltet sich dann ab.\n"..
|
||||||
|
"\n"..
|
||||||
|
"Der TA4 Schieber kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.\n"..
|
||||||
|
"\n"..
|
||||||
|
"Hier die zusätzlichen Kommandos für den Lua Controller:\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" - 'config' dient zur Konfiguration des Schiebers\\, analog zum manuellen Konfiguration über das Menü.\nBeispiel: '$send_cmnd(1234\\, \"config\"\\, \"default:dirt\")'\nMit '$send_cmnd(1234\\, \"config\"\\, \"\")' wird die Konfiguration gelöscht\n"..
|
" - 'config' dient zur Konfiguration des Schiebers\\, analog zum manuellen Konfiguration über das Menü.\nBeispiel: '$send_cmnd(1234\\, \"config\"\\, \"default:dirt\")'\nMit '$send_cmnd(1234\\, \"config\"\\, \"\")' wird die Konfiguration gelöscht\n"..
|
||||||
" - 'pull' dient zum Absetzen eines Auftrags an den Schieber:\nBeispiel: '$send_cmnd(1234\\, \"pull\"\\, \"default:dirt 8\")'\nAls Nummer sind Werte von 1 bis 12 zulässig. Danach geht der Schieber wieder in den 'stopped' Mode und sendet ein \"off\" Kommando zurück an den Sender des \"pull\" Kommandos.\n"..
|
" - 'limit' dient zum Setzen der Anzahl der Items für die Durchlaufbegrenzer Betriebsart:\nBeispiel: '$send_cmnd(1234\\, \"init\"\\, 7)'\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -2007,6 +2022,10 @@ techage.manual_DE.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
|
"Die Funktion entspricht der von TA3. \n"..
|
||||||
|
"\n"..
|
||||||
|
"\n"..
|
||||||
|
"\n",
|
||||||
"Maschinen zur Überwindung von Raum und Zeit\\, neue Energiequellen und andere Errungenschaften prägen dein Leben. \n"..
|
"Maschinen zur Überwindung von Raum und Zeit\\, neue Energiequellen und andere Errungenschaften prägen dein Leben. \n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Für die Herstellung und Nutzung von TA5 Maschinen und Blöcken sind Erfahrungspunkte (experience points) notwendig. Diese können nur über den Teilchenbeschleuniger aus TA4 erarbeitet werden.\n"..
|
"Für die Herstellung und Nutzung von TA5 Maschinen und Blöcken sind Erfahrungspunkte (experience points) notwendig. Diese können nur über den Teilchenbeschleuniger aus TA4 erarbeitet werden.\n"..
|
||||||
@ -2358,6 +2377,7 @@ techage.manual_DE.aItemName = {
|
|||||||
"ta4_electronicfab",
|
"ta4_electronicfab",
|
||||||
"ta4_injector",
|
"ta4_injector",
|
||||||
"ta4_recycler",
|
"ta4_recycler",
|
||||||
|
"ta4_item_flow_limiter_pas",
|
||||||
"techage_ta5",
|
"techage_ta5",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@ -2615,6 +2635,7 @@ techage.manual_DE.aPlanTable = {
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
"",
|
||||||
"ta5_fusion_reactor",
|
"ta5_fusion_reactor",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -135,6 +135,7 @@ techage.manual_EN.aTitel = {
|
|||||||
"3,TA3 Gravel Rinser",
|
"3,TA3 Gravel Rinser",
|
||||||
"3,TA3 Grinder",
|
"3,TA3 Grinder",
|
||||||
"3,TA3 Injector",
|
"3,TA3 Injector",
|
||||||
|
"3,TA3 Item Flow Limiter",
|
||||||
"2,Tools",
|
"2,Tools",
|
||||||
"3,Techage Info Tool",
|
"3,Techage Info Tool",
|
||||||
"3,TechAge Programmer",
|
"3,TechAge Programmer",
|
||||||
@ -229,6 +230,7 @@ techage.manual_EN.aTitel = {
|
|||||||
"3,TA4 Electronic Fab",
|
"3,TA4 Electronic Fab",
|
||||||
"3,TA4 Injector",
|
"3,TA4 Injector",
|
||||||
"3,TA4 Recycler",
|
"3,TA4 Recycler",
|
||||||
|
"3,TA4 Item Flow Limiter",
|
||||||
"1,TA5: Future",
|
"1,TA5: Future",
|
||||||
"2,Energy Sources",
|
"2,Energy Sources",
|
||||||
"3,TA5 Fusion Reactor",
|
"3,TA5 Fusion Reactor",
|
||||||
@ -1044,7 +1046,7 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"The button/switch sends 'on' / 'off' commands to the blocks that have been configured via the numbers.\n"..
|
"The button/switch sends 'on' / 'off' commands to the blocks that have been configured via the numbers.\n"..
|
||||||
"The button/switch can be configured as a button or a switch. If it is configured as a button\\, the time between the 'on' and 'off' commands can be set.\n"..
|
"The button/switch can be configured as a button or a switch. If it is configured as a button\\, the time between the 'on' and 'off' commands can be set. With the operating mode \"on button\" only an 'on' and no 'off' command is sent.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"The checkbox \"public\" can be used to set whether the button can be used by everyone (set) or only by the owner himself (not set).\n"..
|
"The checkbox \"public\" can be used to set whether the button can be used by everyone (set) or only by the owner himself (not set).\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
@ -1126,8 +1128,9 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"The signal lamp can be switched on or off with the 'on' / 'off' command. This lamp does not need electricity and\n"..
|
"The signal lamp can be switched on or off with the 'on' / 'off' command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes\" and via Lua/Beduino commands.\n"..
|
||||||
"can be colored with the airbrush tool of the mod Unified Dyes.\n"..
|
"\n"..
|
||||||
|
"With the chat command '/ta_color' the color palette with the values for the Lua/Beduino commands is displayed and with '/ta_send color <num>' the color can be changed.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1264,6 +1267,16 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
|
"The Flow Limiter limits the number of items that can be pushed through by using a slider. This allows the number of items that are put into an oven\\, for example\\, to be precisely adapted to the recipe.\n"..
|
||||||
|
"\n"..
|
||||||
|
"The Flow Limiter must be configured via the menu and then started. If the configured number of items has been passed\\, the block switches off. The next time the Flow Limiter is switched on\\, it again transmits the configured number of items.\n"..
|
||||||
|
"\n"..
|
||||||
|
"*Note: The Flow Limiter must be placed behind the pusher.*\n"..
|
||||||
|
"\n"..
|
||||||
|
"The Flow Limiter can also be configured and started using a Lua or Beduino controller.\n"..
|
||||||
|
"\n"..
|
||||||
|
"\n"..
|
||||||
|
"\n",
|
||||||
"",
|
"",
|
||||||
"The Techage Info Tool (open-ended wrench) has several functions. It shows the time\\, position\\, temperature and biome when an unknown block is clicked on.\n"..
|
"The Techage Info Tool (open-ended wrench) has several functions. It shows the time\\, position\\, temperature and biome when an unknown block is clicked on.\n"..
|
||||||
"If you click on a TechAge block with command interface\\, all available data will be shown (see also \"Logic / switching blocks\").\n"..
|
"If you click on a TechAge block with command interface\\, all available data will be shown (see also \"Logic / switching blocks\").\n"..
|
||||||
@ -1626,7 +1639,7 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"",
|
"",
|
||||||
"Only the appearance of the TA4 button/switch has changed. The functionality is the same as with the TA3 button/switch.\n"..
|
"Only the appearance of the TA4 button/switch has changed. The functionality is the same as with the TA3 button/switch. With the wrench menu\\, however\\, the data can be changed later.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1692,6 +1705,8 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"The 'goto' command is only accepted when the sequencer is stopped.\n"..
|
"The 'goto' command is only accepted when the sequencer is stopped.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
|
"The cycle time (default: 100 ms) can be changed for the sequencer via the open-end wrench menu.\n"..
|
||||||
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"",
|
"",
|
||||||
@ -1701,7 +1716,7 @@ techage.manual_EN.aText = {
|
|||||||
"Instructions:\n"..
|
"Instructions:\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" - Set the controller and train the blocks to be moved via the menu (up to 16 blocks can be trained)\n"..
|
" - Set the controller and train the blocks to be moved via the menu (up to 16 blocks can be trained)\n"..
|
||||||
" - the \"flight route\" must be entered via an x\\, y\\, z specification (relative) (the maximum distance is 100 m)\n"..
|
" - the \"flight route\" must be entered via an x\\, y\\, z specification (relative) (the maximum distance (x+y+z) is 200 m)\n"..
|
||||||
" - The movement can be tested with the menu buttons \"Move A-B\" and \"Move B-A\"\n"..
|
" - The movement can be tested with the menu buttons \"Move A-B\" and \"Move B-A\"\n"..
|
||||||
" - you can also fly through walls or other blocks\n"..
|
" - you can also fly through walls or other blocks\n"..
|
||||||
" - The target position for the blocks can also be occupied. In this case\\, the blocks are saved \"invisibly\". This is intended for sliding doors and the like\n"..
|
" - The target position for the blocks can also be occupied. In this case\\, the blocks are saved \"invisibly\". This is intended for sliding doors and the like\n"..
|
||||||
@ -1888,7 +1903,13 @@ techage.manual_EN.aText = {
|
|||||||
"\n",
|
"\n",
|
||||||
"See TA3 pump.\n"..
|
"See TA3 pump.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"The TA4 pump pumps 8 units of liquid every two seconds. The pump also supports the 'flowrate' command. This means that the total flow rate through the pump can be queried. \n"..
|
"The TA4 pump pumps 8 units of liquid every two seconds. \n"..
|
||||||
|
"\n"..
|
||||||
|
"In the \"Flow limiter\" mode\\, the number of units pumped by the pump can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of units in the menu. Once the configured number of units have been pumped\\, the pump will turn off. When the pump is turned on again\\, it will pump the configured number of units again and then turn off.\n"..
|
||||||
|
"\n"..
|
||||||
|
"The flow limiter can also be configured and started using a Lua or Beduino controller.\n"..
|
||||||
|
"\n"..
|
||||||
|
"The pump also supports the 'flowrate' command. This allows the total flow rate through the pump to be queried.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -1914,10 +1935,14 @@ techage.manual_EN.aText = {
|
|||||||
"The function basically corresponds to that of TA2 / TA3. In addition\\, a menu can be used to configure which objects should be taken from a TA4 chest and transported further.\n"..
|
"The function basically corresponds to that of TA2 / TA3. In addition\\, a menu can be used to configure which objects should be taken from a TA4 chest and transported further.\n"..
|
||||||
"The processing power is 12 items every 2 s\\, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s.\n"..
|
"The processing power is 12 items every 2 s\\, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"The TA4 pusher has two additional commands for the Lua controller:\n"..
|
"In the \"flow limiter\" mode\\, the number of items that are moved by the pusher can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of items in the menu. As soon as the configured number of items have been moved\\, the pusher switches off. If the pusher is switched on again\\, it moves the configured number of items again and then switches off.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" - 'config' is used to configure the pusher\\, analogous to manual configuration via the menu.\nExample: '$send_cmnd(1234\\, \"config\"\\, \"default: dirt\")'\nWith '$send_cmnd(1234\\, \"config\"\\, \"\")' the configuration is deleted\n"..
|
"The TA4 pusher can also be configured and started using a Lua or Beduino controller.\n"..
|
||||||
" - 'pull' is used to send an order to the pusher:\nExample: '$send_cmnd(1234\\, \"pull\"\\, \"default: dirt 8\")'\nValues from 1 to 12 are permitted as numbers. Then the pusher goes back to 'stopped' mode and sends an\" off \"command back to the transmitter of the\" pull \"command.\n"..
|
"\n"..
|
||||||
|
"Here are the additional commands for the Lua controller:\n"..
|
||||||
|
"\n"..
|
||||||
|
" - 'config' is used to configure the pusher\\, analogous to manual configuration via the menu.\n Example: '$send_cmnd(1234\\, \"config\"\\, \"default:dirt\")'\n With '$send_cmnd(1234\\, \"config\"\\, \"\")' the configuration is deleted\n"..
|
||||||
|
" - 'limit' is used to set the number of items for the flow limiter mode:\n Example: '$send_cmnd(1234\\, \"init\"\\, 7)'\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
@ -2004,6 +2029,10 @@ techage.manual_EN.aText = {
|
|||||||
"\n"..
|
"\n"..
|
||||||
" \n"..
|
" \n"..
|
||||||
"\n",
|
"\n",
|
||||||
|
"The function corresponds to that of TA3.\n"..
|
||||||
|
"\n"..
|
||||||
|
"\n"..
|
||||||
|
"\n",
|
||||||
"Machines to overcome space and time\\, new sources of energy and other achievements shape your life.\n"..
|
"Machines to overcome space and time\\, new sources of energy and other achievements shape your life.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Experience points are required for the manufacture and use of TA5 machines and blocks. These can only be worked out using the collider from TA4.\n"..
|
"Experience points are required for the manufacture and use of TA5 machines and blocks. These can only be worked out using the collider from TA4.\n"..
|
||||||
@ -2259,6 +2288,7 @@ techage.manual_EN.aItemName = {
|
|||||||
"ta3_gravelrinser",
|
"ta3_gravelrinser",
|
||||||
"ta3_grinder",
|
"ta3_grinder",
|
||||||
"ta3_injector",
|
"ta3_injector",
|
||||||
|
"ta3_item_flow_limiter_pas",
|
||||||
"",
|
"",
|
||||||
"ta3_end_wrench",
|
"ta3_end_wrench",
|
||||||
"ta3_programmer",
|
"ta3_programmer",
|
||||||
@ -2353,6 +2383,7 @@ techage.manual_EN.aItemName = {
|
|||||||
"ta4_electronicfab",
|
"ta4_electronicfab",
|
||||||
"ta4_injector",
|
"ta4_injector",
|
||||||
"ta4_recycler",
|
"ta4_recycler",
|
||||||
|
"ta4_item_flow_limiter_pas",
|
||||||
"techage_ta5",
|
"techage_ta5",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@ -2520,6 +2551,7 @@ techage.manual_EN.aPlanTable = {
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
"",
|
||||||
"ta4_windturbine",
|
"ta4_windturbine",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@ -2609,6 +2641,7 @@ techage.manual_EN.aPlanTable = {
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
"",
|
||||||
"ta5_fusion_reactor",
|
"ta5_fusion_reactor",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -105,7 +105,7 @@ minetest.register_node("techage:furnace_firebox", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
techage.add_node(pos, "techage:furnace_firebox")
|
techage.add_node(pos, "techage:furnace_firebox", true)
|
||||||
nvm.running = false
|
nvm.running = false
|
||||||
nvm.burn_cycles = 0
|
nvm.burn_cycles = 0
|
||||||
nvm.liquid = {}
|
nvm.liquid = {}
|
||||||
|
@ -36,8 +36,8 @@ elseif minetest.global_exists("lcdlib") and lcdlib.version < 1.01 then
|
|||||||
elseif minetest.global_exists("safer_lua") and safer_lua.version < 1.01 then
|
elseif minetest.global_exists("safer_lua") and safer_lua.version < 1.01 then
|
||||||
minetest.log("error", "[techage] Techage requires safer_lua version 1.01 or newer!")
|
minetest.log("error", "[techage] Techage requires safer_lua version 1.01 or newer!")
|
||||||
return
|
return
|
||||||
elseif minetest.global_exists("networks") and networks.version < 0.10 then
|
elseif minetest.global_exists("networks") and networks.version < 0.12 then
|
||||||
minetest.log("error", "[techage] Techage requires networks version 0.10 or newer!")
|
minetest.log("error", "[techage] Techage requires networks version 0.12 or newer!")
|
||||||
return
|
return
|
||||||
elseif minetest.global_exists("hyperloop") and hyperloop.version < 2.07 then
|
elseif minetest.global_exists("hyperloop") and hyperloop.version < 2.07 then
|
||||||
minetest.log("error", "[techage] Techage requires hyperloop version 2.07 or newer!")
|
minetest.log("error", "[techage] Techage requires hyperloop version 2.07 or newer!")
|
||||||
|
@ -86,7 +86,7 @@ local function on_punch(pos, node, puncher, pointed_thing)
|
|||||||
if inv:room_for_item("src", stack) then
|
if inv:room_for_item("src", stack) then
|
||||||
inv:add_item("src", stack)
|
inv:add_item("src", stack)
|
||||||
minetest.swap_node(pos, {name = "techage:sieve0"})
|
minetest.swap_node(pos, {name = "techage:sieve0"})
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1.5)
|
||||||
local w = puncher:get_wielded_item()
|
local w = puncher:get_wielded_item()
|
||||||
if not(minetest.setting_getbool("creative_mode")) then
|
if not(minetest.setting_getbool("creative_mode")) then
|
||||||
w:take_item(1)
|
w:take_item(1)
|
||||||
@ -163,7 +163,7 @@ techage.register_node({"techage:sieve0", "techage:sieve1", "techage:sieve2", "te
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if inv:room_for_item("src", stack) then
|
if inv:room_for_item("src", stack) then
|
||||||
inv:add_item("src", stack)
|
inv:add_item("src", stack)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1.5)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
@ -22,7 +22,7 @@ minetest.register_alias("techage:hopper_ta1", "minecart:hopper")
|
|||||||
minecart.register_inventory(
|
minecart.register_inventory(
|
||||||
{
|
{
|
||||||
"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
||||||
"techage:meltingpot", "techage:meltingpot_active",
|
"techage:meltingpot", "techage:meltingpot_active", "techage:ta4_reactor",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
put = {
|
put = {
|
||||||
@ -68,7 +68,7 @@ minecart.register_inventory(
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if inv:is_empty("src") then
|
if inv:is_empty("src") then
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(2)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -67,4 +67,4 @@ techage.register_mobs_mods("mobf_trader")
|
|||||||
techage.register_mobs_mods("ts_vehicles_cars")
|
techage.register_mobs_mods("ts_vehicles_cars")
|
||||||
|
|
||||||
-- Used as e.g. crane cable
|
-- Used as e.g. crane cable
|
||||||
techage.register_simple_nodes({"techage:power_lineS"}, true)
|
techage.register_simple_nodes({"techage:power_lineS"}, true)
|
||||||
|
@ -25,12 +25,21 @@ local COUNTDOWN_TICKS = 4
|
|||||||
local CYCLE_TIME = 2
|
local CYCLE_TIME = 2
|
||||||
local CAPA = 4
|
local CAPA = 4
|
||||||
|
|
||||||
local WRENCH_MENU = {{
|
local WRENCH_MENU = {
|
||||||
type = "output",
|
{
|
||||||
name = "flowrate",
|
type = "output",
|
||||||
label = S("Total flow rate"),
|
name = "flowrate",
|
||||||
tooltip = S("Total flow rate in liquid units"),
|
label = S("Total flow rate"),
|
||||||
}}
|
tooltip = S("Total flow rate in liquid units"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "number",
|
||||||
|
name = "limit",
|
||||||
|
label = S("Number of units"),
|
||||||
|
tooltip = S("Number of liquid units that are allowed to be pumped"),
|
||||||
|
default = "0",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local State3 = techage.NodeStates:new({
|
local State3 = techage.NodeStates:new({
|
||||||
node_name_passive = "techage:t3_pump",
|
node_name_passive = "techage:t3_pump",
|
||||||
@ -48,11 +57,9 @@ local State4 = techage.NodeStates:new({
|
|||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function pumping(pos, nvm, state, capa)
|
-- Function returns the number of pumped units
|
||||||
local mem = techage.get_mem(pos)
|
local function pump(pos, mem, nvm, state, outdir, units)
|
||||||
mem.dbg_cycles = (mem.dbg_cycles or 0) - 1
|
local taken, name = liquid.take(pos, Pipe, Flip[outdir], nil, units, mem.dbg_cycles > 0)
|
||||||
local outdir = M(pos):get_int("outdir")
|
|
||||||
local taken, name = liquid.take(pos, Pipe, Flip[outdir], nil, capa, mem.dbg_cycles > 0)
|
|
||||||
if taken > 0 then
|
if taken > 0 then
|
||||||
local leftover = liquid.put(pos, Pipe, outdir, name, taken, mem.dbg_cycles > 0)
|
local leftover = liquid.put(pos, Pipe, outdir, name, taken, mem.dbg_cycles > 0)
|
||||||
if leftover and leftover > 0 then
|
if leftover and leftover > 0 then
|
||||||
@ -66,13 +73,39 @@ local function pumping(pos, nvm, state, capa)
|
|||||||
state:blocked(pos, nvm)
|
state:blocked(pos, nvm)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
||||||
return taken - leftover
|
return taken - leftover
|
||||||
end
|
end
|
||||||
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
||||||
return taken
|
return taken
|
||||||
|
else
|
||||||
|
state:idle(pos, nvm)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function pumping(pos, nvm, state, capa)
|
||||||
|
local mem = techage.get_mem(pos)
|
||||||
|
mem.dbg_cycles = (mem.dbg_cycles or 0) - 1
|
||||||
|
local outdir = M(pos):get_int("outdir")
|
||||||
|
|
||||||
|
if not nvm.limit then
|
||||||
|
local num = pump(pos, mem, nvm, state, outdir, capa)
|
||||||
|
if num > 0 then
|
||||||
|
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
|
end
|
||||||
|
return num
|
||||||
|
elseif nvm.num_items < nvm.limit then
|
||||||
|
local num = math.min(capa, nvm.limit - nvm.num_items)
|
||||||
|
num = pump(pos, mem, nvm, state, outdir, num)
|
||||||
|
if num > 0 then
|
||||||
|
nvm.num_items = nvm.num_items + num
|
||||||
|
if nvm.num_items >= nvm.limit then
|
||||||
|
state:stop(pos, nvm)
|
||||||
|
else
|
||||||
|
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return num
|
||||||
end
|
end
|
||||||
state:idle(pos, nvm)
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -119,6 +152,14 @@ local function on_rightclick(pos, node, clicker)
|
|||||||
elseif node.name == "techage:t4_pump" then
|
elseif node.name == "techage:t4_pump" then
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
mem.dbg_cycles = 5
|
mem.dbg_cycles = 5
|
||||||
|
local val = M(pos):get_int("limit")
|
||||||
|
if val and val > 0 then
|
||||||
|
nvm.limit = val
|
||||||
|
nvm.num_items = 0
|
||||||
|
else
|
||||||
|
nvm.limit = nil
|
||||||
|
nvm.num_items = nil
|
||||||
|
end
|
||||||
State4:start(pos, nvm)
|
State4:start(pos, nvm)
|
||||||
elseif node.name == "techage:t4_pump_on" then
|
elseif node.name == "techage:t4_pump_on" then
|
||||||
State4:stop(pos, nvm)
|
State4:stop(pos, nvm)
|
||||||
@ -277,7 +318,24 @@ techage.register_node({"techage:t3_pump", "techage:t3_pump_on"}, {
|
|||||||
|
|
||||||
techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, {
|
techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, {
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
if topic == "flowrate" then
|
if topic == "limit" then -- Set pump limit
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
State4:stop(pos, nvm)
|
||||||
|
local val = tonumber(payload) or 0
|
||||||
|
if val and val > 0 then
|
||||||
|
nvm.limit = val
|
||||||
|
nvm.num_items = 0
|
||||||
|
M(pos):set_int("limit", val)
|
||||||
|
else
|
||||||
|
nvm.limit = nil
|
||||||
|
nvm.num_items = nil
|
||||||
|
M(pos):set_string("limit", "")
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
elseif topic == "count" then -- Get number of pumped units
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return nvm.num_items or 0
|
||||||
|
elseif topic == "flowrate" then -- Get total number of pumped units
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
return nvm.flowrate or 0
|
return nvm.flowrate or 0
|
||||||
else
|
else
|
||||||
@ -285,12 +343,34 @@ techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||||
return State4:on_beduino_receive_cmnd(pos, topic, payload)
|
if topic == 69 and payload then -- Set pump limit
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
State4:stop(pos, nvm)
|
||||||
|
if payload[1] > 0 then
|
||||||
|
nvm.limit = payload[1]
|
||||||
|
nvm.num_items = 0
|
||||||
|
M(pos):set_int("limit", payload[1])
|
||||||
|
else
|
||||||
|
nvm.limit = nil
|
||||||
|
nvm.num_items = nil
|
||||||
|
M(pos):set_string("limit", "")
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
if nvm.limit then
|
||||||
|
nvm.num_items = 0
|
||||||
|
end
|
||||||
|
return State4:on_beduino_receive_cmnd(pos, topic, payload)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_request_data = function(pos, src, topic, payload)
|
on_beduino_request_data = function(pos, src, topic, payload)
|
||||||
if topic == 137 then -- Total Flow Rate
|
if topic == 137 then -- Get total number of pumped units
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
return 0, {nvm.flowrate or 0}
|
return 0, {nvm.flowrate or 0}
|
||||||
|
elseif topic == 151 then -- Get number of pumped units
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return 0, {nvm.num_items or 0}
|
||||||
else
|
else
|
||||||
return State4:on_beduino_request_data(pos, topic, payload)
|
return State4:on_beduino_request_data(pos, topic, payload)
|
||||||
end
|
end
|
||||||
|
@ -114,7 +114,11 @@ TA3 Booster=TA3 Gebläse
|
|||||||
### button.lua ###
|
### button.lua ###
|
||||||
|
|
||||||
Access:=Zugriff:
|
Access:=Zugriff:
|
||||||
|
Button or switch=Taster oder Schalter
|
||||||
|
Change the block name (infotext)=Ändere den Blocknamen
|
||||||
Command to be sent=Zu sendender Befehl
|
Command to be sent=Zu sendender Befehl
|
||||||
|
Destination block number(s)=Zielblocknummer
|
||||||
|
Infotext=Infotext
|
||||||
TA3 Button/Switch=TA3 Taster/Schalter
|
TA3 Button/Switch=TA3 Taster/Schalter
|
||||||
TA4 Button/Switch=TA4 Schalter/Taster
|
TA4 Button/Switch=TA4 Schalter/Taster
|
||||||
|
|
||||||
@ -122,7 +126,11 @@ TA4 Button/Switch=TA4 Schalter/Taster
|
|||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
|
Access=Zugriff
|
||||||
|
Button protection=Tastenschutz
|
||||||
Command=Kommando
|
Command=Kommando
|
||||||
|
Number=Nummer
|
||||||
|
Type=Typ
|
||||||
|
|
||||||
### button.lua ###
|
### button.lua ###
|
||||||
### cart_detector.lua ###
|
### cart_detector.lua ###
|
||||||
@ -154,14 +162,10 @@ TA4 2x Button=TA4 2x Taster
|
|||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
Access=Zugriff
|
|
||||||
Button protection=Tastenschutz
|
|
||||||
Command to be sent (ignored for switches)=Zu sendender Befehl (wird für Schalter ignoriert)
|
Command to be sent (ignored for switches)=Zu sendender Befehl (wird für Schalter ignoriert)
|
||||||
Destination block number=Zielblocknummer
|
Destination block number=Zielblocknummer
|
||||||
Label for the button=Beschriftung für die Taste
|
Label for the button=Beschriftung für die Taste
|
||||||
Momentary button or on/off switch=Taster oder Ein-/Ausschalter
|
Momentary button or on/off switch=Taster oder Ein-/Ausschalter
|
||||||
Number=Nummer
|
|
||||||
Type=Typ
|
|
||||||
|
|
||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
@ -446,7 +450,7 @@ Firebox=Feuerkasten
|
|||||||
### fly_lib.lua ###
|
### fly_lib.lua ###
|
||||||
|
|
||||||
Destination position is protected=Zielposition ist geschützt
|
Destination position is protected=Zielposition ist geschützt
|
||||||
Error: Max. length of the flight route exceeded !!=Fehler: Max. Flugstreckenlänge überschritten !!
|
Error: Max. length of the flight route exceeded by @1 blocks !!=Fehler: max. Länge der Flugstrecke um @1 Blöcke überschritten !!
|
||||||
No valid destination position=Keine gültige Zielposition
|
No valid destination position=Keine gültige Zielposition
|
||||||
No valid node at the start position=Kein gültiger Block an der Startposition
|
No valid node at the start position=Kein gültiger Block an der Startposition
|
||||||
Start position is protected=Startposition ist geschützt
|
Start position is protected=Startposition ist geschützt
|
||||||
@ -460,7 +464,6 @@ Error: Invalid path !!=Fehler: Ungültiger Pfad !!
|
|||||||
|
|
||||||
Error: Recording is missing !!=Fehler: Aufzeichnung fehlt !!
|
Error: Recording is missing !!=Fehler: Aufzeichnung fehlt !!
|
||||||
Flight route (A to B)=Flug Route (A nach B)
|
Flight route (A to B)=Flug Route (A nach B)
|
||||||
Move=Bewege
|
|
||||||
See chat output=Siehe chat Ausgabe
|
See chat output=Siehe chat Ausgabe
|
||||||
TA5 Fly Controller=TA5 Flug Controller
|
TA5 Fly Controller=TA5 Flug Controller
|
||||||
Test=Test
|
Test=Test
|
||||||
@ -480,6 +483,7 @@ Store=Speichern
|
|||||||
Click on all blocks that shall be moved=Klicke auf alle Blöcke, die verschoben werden sollen
|
Click on all blocks that shall be moved=Klicke auf alle Blöcke, die verschoben werden sollen
|
||||||
Maximum Speed=Maximalgeschwindigkeit
|
Maximum Speed=Maximalgeschwindigkeit
|
||||||
Maximum speed for moving blocks=Maximale Geschwindigkeit für bewegliche Blöcke
|
Maximum speed for moving blocks=Maximale Geschwindigkeit für bewegliche Blöcke
|
||||||
|
Move=Bewege
|
||||||
Move A-B=Bewege A-B
|
Move A-B=Bewege A-B
|
||||||
Move B-A=Bewege B-A
|
Move B-A=Bewege B-A
|
||||||
Move block height=Move Block Höhe
|
Move block height=Move Block Höhe
|
||||||
@ -495,7 +499,6 @@ TA2 Flywheel=TA2 Schwungrad
|
|||||||
|
|
||||||
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder maximale Anzahl von Forceload Blöcken erreicht!
|
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder maximale Anzahl von Forceload Blöcken erreicht!
|
||||||
List of your Forceload Blocks:=Liste der Forceload Blöcke
|
List of your Forceload Blocks:=Liste der Forceload Blöcke
|
||||||
Priv missing=Rechte fehlen
|
|
||||||
Punch the block to make the area visible.=Schlage auf den Bock um den Bereich anzuzeigen.
|
Punch the block to make the area visible.=Schlage auf den Bock um den Bereich anzuzeigen.
|
||||||
Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken
|
Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken
|
||||||
Techage Forceload Block=Techage Forceload Block
|
Techage Forceload Block=Techage Forceload Block
|
||||||
@ -870,15 +873,27 @@ TA1 Pine Wood Board=TA1 Kiefernholzbrett
|
|||||||
|
|
||||||
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
|
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
|
||||||
|
|
||||||
|
### minichest.lua ###
|
||||||
|
|
||||||
|
Test Chest=
|
||||||
|
|
||||||
|
### minitank.lua ###
|
||||||
|
|
||||||
|
Test Mini Tank=
|
||||||
|
|
||||||
### movecontroller.lua ###
|
### movecontroller.lua ###
|
||||||
|
|
||||||
Error: Invalid distance !!=Fehler: Ungültige Entfernung !!
|
Error: Invalid distance !!=Fehler: Ungültige Entfernung !!
|
||||||
Handover to A=Übergabe an A
|
Handover to A=Übergabe an A
|
||||||
Handover to B=Übergabe an B
|
Handover to B=Übergabe an B
|
||||||
|
Move distance=Entfernung
|
||||||
Move distance (A to B)=Entfernung (A nach B)
|
Move distance (A to B)=Entfernung (A nach B)
|
||||||
Number of the next movecontroller=Nummer des nächsten Move Controllers
|
Number of the next movecontroller=Nummer des nächsten Move Controllers
|
||||||
Number of the previous movecontroller=Nummer des vorhergehenden Move Controllers
|
Number of the previous movecontroller=Nummer des vorhergehenden Move Controllers
|
||||||
Object offset=Objekt Offset
|
Object offset=Objekt Offset
|
||||||
|
Operational mode=Betriebsmodus
|
||||||
|
Reset=Rücksetzen
|
||||||
|
Switch to the remote controlled 'move xyz' mode=Wechseln in den ferngesteuerten 'move xyz'-Modus
|
||||||
TA4 Move Controller=TA4 Move Controller
|
TA4 Move Controller=TA4 Move Controller
|
||||||
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=Y-Offset für Nicht-Spieler Objekte wie Fahrzeuge (-0.5 bis 0.5)
|
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=Y-Offset für Nicht-Spieler Objekte wie Fahrzeuge (-0.5 bis 0.5)
|
||||||
|
|
||||||
@ -1010,6 +1025,8 @@ Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO
|
|||||||
|
|
||||||
### pump.lua ###
|
### pump.lua ###
|
||||||
|
|
||||||
|
Number of liquid units that are allowed to be pumped=Anzahl der Flüssigkeitseinheiten, die gepumpt werden dürfen
|
||||||
|
Number of units=Anzahl der Einheiten
|
||||||
TA3 Pump=TA3 Pumpe
|
TA3 Pump=TA3 Pumpe
|
||||||
TA4 Pump=TA4 Pumpe
|
TA4 Pump=TA4 Pumpe
|
||||||
|
|
||||||
@ -1029,7 +1046,9 @@ no oil=Kein Öl
|
|||||||
|
|
||||||
### pusher.lua ###
|
### pusher.lua ###
|
||||||
|
|
||||||
Optionally configure@nthe pusher with one item=Der Schieber kann optional@nmit einem Gegenstand@nkonfiguriert werden
|
Number of items=Anzahl der Elemente
|
||||||
|
Number of items that are allowed to be pushed=Anzahl der Elemente, die verschoben werden dürfen
|
||||||
|
Optionally configure@nthe pusher with one item=Der Schieber kann optional@nmit einem Elemente@nkonfiguriert werden
|
||||||
Pusher=Schieber
|
Pusher=Schieber
|
||||||
|
|
||||||
### quarry.lua ###
|
### quarry.lua ###
|
||||||
@ -1083,6 +1102,8 @@ Biome=Biom
|
|||||||
Node owner=Blockbesitzer
|
Node owner=Blockbesitzer
|
||||||
Position=Position
|
Position=Position
|
||||||
Position temperature=Positionstemperatur
|
Position temperature=Positionstemperatur
|
||||||
|
Pump connected to no/empty tank(s).=Pumpe an keine/leere Tank(s) angeschlossen.
|
||||||
|
Pump connected to tank(s) with: @1=Pumpe an Tank(s) angeschlossen mit: @1
|
||||||
TechAge Info Tool (use @= read status info)=TechAge Info Werkzeug
|
TechAge Info Tool (use @= read status info)=TechAge Info Werkzeug
|
||||||
TechAge Repair Kit=TechAge Reparaturset
|
TechAge Repair Kit=TechAge Reparaturset
|
||||||
|
|
||||||
@ -1120,6 +1141,7 @@ stopped=gestoppt
|
|||||||
### sequencer2.lua ###
|
### sequencer2.lua ###
|
||||||
|
|
||||||
- 'goto <num>' (jump to another line)@n= - 'goto <num>' (springe zu einer anderen Zeile)@n
|
- 'goto <num>' (jump to another line)@n= - 'goto <num>' (springe zu einer anderen Zeile)@n
|
||||||
|
- 'nop' (do nothing)@n= - 'nop' (mache nichts)@n
|
||||||
- 'send <node num> <cmnd>' (techage command)@n= - 'send <node num> <cmnd>' (techage Kommando)@n
|
- 'send <node num> <cmnd>' (techage command)@n= - 'send <node num> <cmnd>' (techage Kommando)@n
|
||||||
- 'stop' (stop the execution)@n= - 'stop' (stoppe die Ausführung)@n
|
- 'stop' (stop the execution)@n= - 'stop' (stoppe die Ausführung)@n
|
||||||
- 1 corresponds to 100 ms@n= - 1 entspricht 100 ms@n
|
- 1 corresponds to 100 ms@n= - 1 entspricht 100 ms@n
|
||||||
@ -1152,7 +1174,7 @@ TA5 Fusion Reactor Shell=TA5 Fusionsreaktor Hülle
|
|||||||
|
|
||||||
TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe
|
TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe
|
||||||
TechAge Signal Lamp=TechAge Signallampe
|
TechAge Signal Lamp=TechAge Signallampe
|
||||||
TechAge Signal Lamp (can be colored)=TechAge Signallampe (kann gefärbt werden)
|
TechAge Signal Lamp 2 =TechAge Signallampe 2
|
||||||
|
|
||||||
### signallamp_2x.lua ###
|
### signallamp_2x.lua ###
|
||||||
|
|
||||||
@ -1466,3 +1488,8 @@ Remove detector=Entferne Detektor
|
|||||||
TA4 Collider Detector Worker=TA4 Collider Detektor Worker
|
TA4 Collider Detector Worker=TA4 Collider Detektor Worker
|
||||||
[TA4] Detector is being built!=[TA4] Detektor wird gebaut!
|
[TA4] Detector is being built!=[TA4] Detektor wird gebaut!
|
||||||
[TA4] Detector is being removed!=[TA4] Detektor wird entfernt!
|
[TA4] Detector is being removed!=[TA4] Detektor wird entfernt!
|
||||||
|
|
||||||
|
|
||||||
|
##### not used anymore #####
|
||||||
|
|
||||||
|
Error: Max. length of the flight route exceeded !!=Fehler: Max. Flugstreckenlänge überschritten !!
|
||||||
|
@ -114,7 +114,11 @@ TA3 Booster=
|
|||||||
### button.lua ###
|
### button.lua ###
|
||||||
|
|
||||||
Access:=
|
Access:=
|
||||||
|
Button or switch=
|
||||||
|
Change the node name (infotext)=
|
||||||
Command to be sent=
|
Command to be sent=
|
||||||
|
Destination block number(s)=
|
||||||
|
Infotext=
|
||||||
TA3 Button/Switch=
|
TA3 Button/Switch=
|
||||||
TA4 Button/Switch=
|
TA4 Button/Switch=
|
||||||
|
|
||||||
@ -122,7 +126,11 @@ TA4 Button/Switch=
|
|||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
|
Access=
|
||||||
|
Button protection=
|
||||||
Command=
|
Command=
|
||||||
|
Number=
|
||||||
|
Type=
|
||||||
|
|
||||||
### button.lua ###
|
### button.lua ###
|
||||||
### cart_detector.lua ###
|
### cart_detector.lua ###
|
||||||
@ -154,14 +162,10 @@ TA4 2x Button=
|
|||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
Access=
|
|
||||||
Button protection=
|
|
||||||
Command to be sent (ignored for switches)=
|
Command to be sent (ignored for switches)=
|
||||||
Destination block number=
|
Destination block number=
|
||||||
Label for the button=
|
Label for the button=
|
||||||
Momentary button or on/off switch=
|
Momentary button or on/off switch=
|
||||||
Number=
|
|
||||||
Type=
|
|
||||||
|
|
||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
@ -446,7 +450,7 @@ Firebox=
|
|||||||
### fly_lib.lua ###
|
### fly_lib.lua ###
|
||||||
|
|
||||||
Destination position is protected=
|
Destination position is protected=
|
||||||
Error: Max. length of the flight route exceeded !!=
|
Error: Max. length of the flight route exceeded by @1 blocks !!=
|
||||||
No valid destination position=
|
No valid destination position=
|
||||||
No valid node at the start position=
|
No valid node at the start position=
|
||||||
Start position is protected=
|
Start position is protected=
|
||||||
@ -460,7 +464,6 @@ Error: Invalid path !!=
|
|||||||
|
|
||||||
Error: Recording is missing !!=
|
Error: Recording is missing !!=
|
||||||
Flight route (A to B)=
|
Flight route (A to B)=
|
||||||
Move=
|
|
||||||
See chat output=
|
See chat output=
|
||||||
TA5 Fly Controller=
|
TA5 Fly Controller=
|
||||||
Test=
|
Test=
|
||||||
@ -480,6 +483,7 @@ Store=
|
|||||||
Click on all blocks that shall be moved=
|
Click on all blocks that shall be moved=
|
||||||
Maximum Speed=
|
Maximum Speed=
|
||||||
Maximum speed for moving blocks=
|
Maximum speed for moving blocks=
|
||||||
|
Move=
|
||||||
Move A-B=
|
Move A-B=
|
||||||
Move B-A=
|
Move B-A=
|
||||||
Move block height=
|
Move block height=
|
||||||
@ -495,7 +499,6 @@ TA2 Flywheel=
|
|||||||
|
|
||||||
Area already loaded or max. number of Forceload Blocks reached!=
|
Area already loaded or max. number of Forceload Blocks reached!=
|
||||||
List of your Forceload Blocks:=
|
List of your Forceload Blocks:=
|
||||||
Priv missing=
|
|
||||||
Punch the block to make the area visible.=
|
Punch the block to make the area visible.=
|
||||||
Show all forceload blocks in a 64x64x64 range=
|
Show all forceload blocks in a 64x64x64 range=
|
||||||
Techage Forceload Block=
|
Techage Forceload Block=
|
||||||
@ -870,15 +873,27 @@ TA1 Pine Wood Board=
|
|||||||
|
|
||||||
TA4 Streetlamp Solar Cell=
|
TA4 Streetlamp Solar Cell=
|
||||||
|
|
||||||
|
### minichest.lua ###
|
||||||
|
|
||||||
|
Test Chest=
|
||||||
|
|
||||||
|
### minitank.lua ###
|
||||||
|
|
||||||
|
Test Mini Tank=
|
||||||
|
|
||||||
### movecontroller.lua ###
|
### movecontroller.lua ###
|
||||||
|
|
||||||
Error: Invalid distance !!=
|
Error: Invalid distance !!=
|
||||||
Handover to A=
|
Handover to A=
|
||||||
Handover to B=
|
Handover to B=
|
||||||
|
Move distance=
|
||||||
Move distance (A to B)=
|
Move distance (A to B)=
|
||||||
Number of the next movecontroller=
|
Number of the next movecontroller=
|
||||||
Number of the previous movecontroller=
|
Number of the previous movecontroller=
|
||||||
Object offset=
|
Object offset=
|
||||||
|
Operational mode=
|
||||||
|
Reset=
|
||||||
|
Switch to the remote controlled 'move xyz' mode=
|
||||||
TA4 Move Controller=
|
TA4 Move Controller=
|
||||||
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=
|
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=
|
||||||
|
|
||||||
@ -1010,6 +1025,8 @@ Allow to dig/place Techage power lines nearby power poles=
|
|||||||
|
|
||||||
### pump.lua ###
|
### pump.lua ###
|
||||||
|
|
||||||
|
Number of liquid units that are allowed to be pumped=
|
||||||
|
Number of units=
|
||||||
TA3 Pump=
|
TA3 Pump=
|
||||||
TA4 Pump=
|
TA4 Pump=
|
||||||
|
|
||||||
@ -1029,6 +1046,8 @@ no oil=
|
|||||||
|
|
||||||
### pusher.lua ###
|
### pusher.lua ###
|
||||||
|
|
||||||
|
Number of items=
|
||||||
|
Number of items that are allowed to be pushed=
|
||||||
Optionally configure@nthe pusher with one item=
|
Optionally configure@nthe pusher with one item=
|
||||||
Pusher=
|
Pusher=
|
||||||
|
|
||||||
@ -1083,6 +1102,8 @@ Biome=
|
|||||||
Node owner=
|
Node owner=
|
||||||
Position=
|
Position=
|
||||||
Position temperature=
|
Position temperature=
|
||||||
|
Pump connected to no/empty tank(s).=
|
||||||
|
Pump connected to tank(s) with: @1=
|
||||||
TechAge Info Tool (use @= read status info)=
|
TechAge Info Tool (use @= read status info)=
|
||||||
TechAge Repair Kit=
|
TechAge Repair Kit=
|
||||||
|
|
||||||
@ -1120,6 +1141,7 @@ stopped=
|
|||||||
### sequencer2.lua ###
|
### sequencer2.lua ###
|
||||||
|
|
||||||
- 'goto <num>' (jump to another line)@n=
|
- 'goto <num>' (jump to another line)@n=
|
||||||
|
- 'nop' (do nothing)@n=
|
||||||
- 'send <node num> <cmnd>' (techage command)@n=
|
- 'send <node num> <cmnd>' (techage command)@n=
|
||||||
- 'stop' (stop the execution)@n=
|
- 'stop' (stop the execution)@n=
|
||||||
- 1 corresponds to 100 ms@n=
|
- 1 corresponds to 100 ms@n=
|
||||||
@ -1152,7 +1174,7 @@ TA5 Fusion Reactor Shell=
|
|||||||
|
|
||||||
TA4 Wind Turbine Signal Lamp=
|
TA4 Wind Turbine Signal Lamp=
|
||||||
TechAge Signal Lamp=
|
TechAge Signal Lamp=
|
||||||
TechAge Signal Lamp (can be colored)=
|
TechAge Signal Lamp 2 =
|
||||||
|
|
||||||
### signallamp_2x.lua ###
|
### signallamp_2x.lua ###
|
||||||
|
|
||||||
|
@ -20,6 +20,22 @@ local NDEF = function(pos) return (minetest.registered_nodes[techage.get_node_lv
|
|||||||
local logic = techage.logic
|
local logic = techage.logic
|
||||||
|
|
||||||
local WRENCH_MENU = {
|
local WRENCH_MENU = {
|
||||||
|
{
|
||||||
|
type = "dropdown",
|
||||||
|
choices = "switch,on button,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s",
|
||||||
|
name = "type",
|
||||||
|
label = S("Type"),
|
||||||
|
tooltip = S("Button or switch"),
|
||||||
|
default = "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "numbers",
|
||||||
|
name = "numbers",
|
||||||
|
label = S("Number"),
|
||||||
|
tooltip = S("Destination block number(s)"),
|
||||||
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
name = "command",
|
name = "command",
|
||||||
@ -27,6 +43,21 @@ local WRENCH_MENU = {
|
|||||||
tooltip = S("Command to be sent"),
|
tooltip = S("Command to be sent"),
|
||||||
default = "on",
|
default = "on",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "dropdown",
|
||||||
|
choices = "private,protected,public",
|
||||||
|
name = "access",
|
||||||
|
label = S("Access"),
|
||||||
|
tooltip = S("Button protection"),
|
||||||
|
default = "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "ascii",
|
||||||
|
name = "decription",
|
||||||
|
label = S("Infotext"),
|
||||||
|
tooltip = S("Change the block name (infotext)"),
|
||||||
|
default = "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function switch_on(pos)
|
local function switch_on(pos)
|
||||||
@ -56,7 +87,8 @@ local function switch_off(pos, is_button)
|
|||||||
logic.swap_node(pos, "techage:ta4_button_off")
|
logic.swap_node(pos, "techage:ta4_button_off")
|
||||||
end
|
end
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
if not meta:contains("command") or meta:get_string("command") == "on" then
|
if meta:get_string("off_command") ~= "true" and
|
||||||
|
(not meta:contains("command") or meta:get_string("command") == "on") then
|
||||||
logic.send_off(pos, M(pos))
|
logic.send_off(pos, M(pos))
|
||||||
end
|
end
|
||||||
if not is_button then
|
if not is_button then
|
||||||
@ -74,22 +106,18 @@ local function formspec(meta)
|
|||||||
if idx == 0 then idx = 1 end
|
if idx == 0 then idx = 1 end
|
||||||
local access_idx = meta:get_string("public") == "true" and 3 or meta:get_string("protected") == "true" and 2 or 1
|
local access_idx = meta:get_string("public") == "true" and 3 or meta:get_string("protected") == "true" and 2 or 1
|
||||||
return "size[7.5,6]"..
|
return "size[7.5,6]"..
|
||||||
"dropdown[0.2,0;3;type;switch,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s;"..idx.."]"..
|
"dropdown[0.2,0;3;type;switch,on button,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s;"..idx.."]"..
|
||||||
"field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";"..numbers.."]" ..
|
"field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";"..numbers.."]" ..
|
||||||
"label[0.2,3;"..S("Access:").."]"..
|
"label[0.2,3;"..S("Access:").."]"..
|
||||||
"dropdown[3,3;4;access;private,protected,public;"..access_idx.."]"..
|
"dropdown[3,3;4;access;private,protected,public;"..access_idx.."]"..
|
||||||
"button_exit[2,4;3,1;exit;"..S("Save").."]"
|
"button_exit[2,4;3,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_receive_fields(pos, formname, fields, player)
|
local function store_fields_data(pos, fields)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
if not techage.check_numbers(fields.numbers, player:get_player_name()) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
meta:set_string("numbers", fields.numbers)
|
meta:set_string("numbers", fields.numbers)
|
||||||
|
meta:set_string("off_command", "")
|
||||||
|
|
||||||
if fields.access == "protected" then
|
if fields.access == "protected" then
|
||||||
meta:set_string("protected", "true")
|
meta:set_string("protected", "true")
|
||||||
meta:set_string("public", "")
|
meta:set_string("public", "")
|
||||||
@ -106,28 +134,46 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
if fields.type == "switch" then
|
if fields.type == "switch" then
|
||||||
meta:set_int("cycle_idx", 1)
|
meta:set_int("cycle_idx", 1)
|
||||||
cycle_time = 0
|
cycle_time = 0
|
||||||
elseif fields.type == "button 1s" then
|
elseif fields.type == "on button" then
|
||||||
meta:set_int("cycle_idx", 2)
|
meta:set_int("cycle_idx", 2)
|
||||||
|
meta:set_string("off_command", "true")
|
||||||
|
cycle_time = 1
|
||||||
|
elseif fields.type == "button 1s" then
|
||||||
|
meta:set_int("cycle_idx", 3)
|
||||||
cycle_time = 1
|
cycle_time = 1
|
||||||
elseif fields.type == "button 2s" then
|
elseif fields.type == "button 2s" then
|
||||||
meta:set_int("cycle_idx", 3)
|
meta:set_int("cycle_idx", 4)
|
||||||
cycle_time = 2
|
cycle_time = 2
|
||||||
elseif fields.type == "button 4s" then
|
elseif fields.type == "button 4s" then
|
||||||
meta:set_int("cycle_idx", 4)
|
meta:set_int("cycle_idx", 5)
|
||||||
cycle_time = 4
|
cycle_time = 4
|
||||||
elseif fields.type == "button 8s" then
|
elseif fields.type == "button 8s" then
|
||||||
meta:set_int("cycle_idx", 5)
|
meta:set_int("cycle_idx", 6)
|
||||||
cycle_time = 8
|
cycle_time = 8
|
||||||
elseif fields.type == "button 16s" then
|
elseif fields.type == "button 16s" then
|
||||||
meta:set_int("cycle_idx", 6)
|
meta:set_int("cycle_idx", 7)
|
||||||
cycle_time = 16
|
cycle_time = 16
|
||||||
elseif fields.type == "button 32s" then
|
elseif fields.type == "button 32s" then
|
||||||
meta:set_int("cycle_idx", 7)
|
meta:set_int("cycle_idx", 8)
|
||||||
cycle_time = 32
|
cycle_time = 32
|
||||||
end
|
end
|
||||||
if cycle_time ~= nil then
|
if cycle_time ~= nil then
|
||||||
meta:set_int("cycle_time", cycle_time)
|
meta:set_int("cycle_time", cycle_time)
|
||||||
end
|
end
|
||||||
|
meta:set_string("access", fields.access)
|
||||||
|
meta:set_string("type", fields.type)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_receive_fields(pos, formname, fields, player)
|
||||||
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not techage.check_numbers(fields.numbers, player:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
store_fields_data(pos, fields)
|
||||||
|
|
||||||
|
local meta = M(pos)
|
||||||
logic.infotext(meta, NDEF(pos).description)
|
logic.infotext(meta, NDEF(pos).description)
|
||||||
if fields.exit then
|
if fields.exit then
|
||||||
meta:set_string("formspec", nil)
|
meta:set_string("formspec", nil)
|
||||||
@ -137,6 +183,16 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function ta_after_formspec(pos, fields, playername)
|
||||||
|
store_fields_data(pos, fields)
|
||||||
|
local meta = M(pos)
|
||||||
|
if fields.decription ~= "" then
|
||||||
|
logic.infotext(meta, fields.decription)
|
||||||
|
else
|
||||||
|
logic.infotext(meta, NDEF(pos).description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function can_access(pos, player)
|
local function can_access(pos, player)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local public = meta:get_string("public") == "true"
|
local public = meta:get_string("public") == "true"
|
||||||
@ -269,6 +325,7 @@ minetest.register_node("techage:ta4_button_off", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
ta4_formspec = WRENCH_MENU,
|
ta4_formspec = WRENCH_MENU,
|
||||||
|
ta_after_formspec = ta_after_formspec,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
on_rightclick = on_rightclick_on,
|
on_rightclick = on_rightclick_on,
|
||||||
techage_set_numbers = techage_set_numbers,
|
techage_set_numbers = techage_set_numbers,
|
||||||
@ -305,6 +362,8 @@ minetest.register_node("techage:ta4_button_on", {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ta4_formspec = WRENCH_MENU,
|
||||||
|
ta_after_formspec = ta_after_formspec,
|
||||||
on_rightclick = on_rightclick_off,
|
on_rightclick = on_rightclick_off,
|
||||||
on_timer = switch_off,
|
on_timer = switch_off,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
@ -55,6 +55,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 1",
|
label = S("Number") .. " 1",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
@ -76,6 +77,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 2",
|
label = S("Number") .. " 2",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
|
@ -59,6 +59,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 1",
|
label = S("Number") .. " 1",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
@ -80,6 +81,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 2",
|
label = S("Number") .. " 2",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
@ -101,6 +103,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 3",
|
label = S("Number") .. " 3",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
@ -122,6 +125,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Number") .. " 4",
|
label = S("Number") .. " 4",
|
||||||
tooltip = S("Destination block number"),
|
tooltip = S("Destination block number"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "ascii",
|
type = "ascii",
|
||||||
|
@ -249,12 +249,13 @@ minetest.register_craft({
|
|||||||
|
|
||||||
techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, {
|
techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, {
|
||||||
on_push_item = function(pos, in_dir, stack)
|
on_push_item = function(pos, in_dir, stack)
|
||||||
if techage.safe_push_items(pos, in_dir, stack) then
|
local leftover = techage.safe_push_items(pos, in_dir, stack)
|
||||||
|
if leftover then
|
||||||
local inv = minetest.get_inventory({type = "node", pos = pos})
|
local inv = minetest.get_inventory({type = "node", pos = pos})
|
||||||
if not inv or inv:is_empty("cfg") or inv:contains_item("cfg", ItemStack(stack:get_name())) then
|
if not inv or inv:is_empty("cfg") or inv:contains_item("cfg", ItemStack(stack:get_name())) then
|
||||||
switch_on(pos)
|
switch_on(pos)
|
||||||
end
|
end
|
||||||
return true
|
return leftover
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
@ -263,11 +264,19 @@ techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, {
|
|||||||
|
|
||||||
techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, {
|
techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, {
|
||||||
on_push_item = function(pos, in_dir, stack)
|
on_push_item = function(pos, in_dir, stack)
|
||||||
if techage.safe_push_items(pos, in_dir, stack) then
|
local leftover = techage.safe_push_items(pos, in_dir, stack)
|
||||||
switch_on(pos)
|
if leftover then
|
||||||
local nvm = techage.get_nvm(pos)
|
local inv = minetest.get_inventory({type = "node", pos = pos})
|
||||||
nvm.counter = (nvm.counter or 0) + stack:get_count()
|
if not inv or inv:is_empty("cfg") or inv:contains_item("cfg", ItemStack(stack:get_name())) then
|
||||||
return true
|
switch_on(pos)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
if leftover == true then
|
||||||
|
nvm.counter = (nvm.counter or 0) + stack:get_count()
|
||||||
|
else
|
||||||
|
nvm.counter = (nvm.counter or 0) + stack:get_count() - leftover:get_count()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return leftover
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
@ -38,6 +38,27 @@ local HELP = S("Syntax:\n") ..
|
|||||||
" [30] send 1234 b2a\n" ..
|
" [30] send 1234 b2a\n" ..
|
||||||
" [60] goto 1 -- keep going"
|
" [60] goto 1 -- keep going"
|
||||||
|
|
||||||
|
local WRENCH_MENU = {
|
||||||
|
{
|
||||||
|
type = "dropdown",
|
||||||
|
choices = "100ms,200ms,500ms,1s,2s",
|
||||||
|
name = "cycletime",
|
||||||
|
label = S("Cycle time"),
|
||||||
|
tooltip = S("Timer cycle time (default: 100 ms)"),
|
||||||
|
default = "1",
|
||||||
|
values = {0.1, 0.2, 0.5, 1.0, 2.0}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function cycle_time(pos)
|
||||||
|
local mem = techage.get_mem(pos)
|
||||||
|
if not mem.cycletime then
|
||||||
|
mem.cycletime = tonumber(M(pos):get_string("cycletime")) or 0.1
|
||||||
|
end
|
||||||
|
return mem.cycletime
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function strsplit(text)
|
local function strsplit(text)
|
||||||
text = text:gsub("\r\n", "\n")
|
text = text:gsub("\r\n", "\n")
|
||||||
text = text:gsub("\r", "\n")
|
text = text:gsub("\r", "\n")
|
||||||
@ -169,12 +190,12 @@ local function formspec_help(meta)
|
|||||||
"background[0.1,0.3;9.8,8.0;techage_form_mask.png]"
|
"background[0.1,0.3;9.8,8.0;techage_form_mask.png]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function restart_timer(pos, time)
|
local function restart_timer(pos, ticks)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
if timer:is_started() then
|
if timer:is_started() then
|
||||||
timer:stop()
|
timer:stop()
|
||||||
end
|
end
|
||||||
timer:start(time / 10)
|
timer:start(ticks * cycle_time(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
@ -240,7 +261,8 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
meta:set_string("text", fields.text or "")
|
meta:set_string("text", fields.text or "")
|
||||||
mem.code = nil
|
mem.code = nil
|
||||||
mem.idx = nil
|
mem.idx = nil
|
||||||
minetest.get_node_timer(pos):start(0.5)
|
mem.cycletime = nil
|
||||||
|
restart_timer(pos, 1)
|
||||||
logic.infotext(meta, S("TA4 Sequencer"), S("running"))
|
logic.infotext(meta, S("TA4 Sequencer"), S("running"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -274,6 +296,7 @@ minetest.register_node("techage:ta4_sequencer", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = node_timer,
|
on_timer = node_timer,
|
||||||
|
ta4_formspec = WRENCH_MENU,
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy=2, cracky=2, crumbly=2},
|
groups = {choppy=2, cracky=2, crumbly=2},
|
||||||
@ -300,7 +323,7 @@ techage.register_node({"techage:ta4_sequencer"}, {
|
|||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
mem.idx = tonumber(payload or 1) or 1
|
mem.idx = tonumber(payload or 1) or 1
|
||||||
restart_timer(pos, 0.1)
|
restart_timer(pos, 1)
|
||||||
logic.infotext(M(pos), S("TA4 Sequencer"), S("running"))
|
logic.infotext(M(pos), S("TA4 Sequencer"), S("running"))
|
||||||
elseif topic == "stop" or topic == "off" then
|
elseif topic == "stop" or topic == "off" then
|
||||||
nvm.running = false
|
nvm.running = false
|
||||||
@ -319,7 +342,7 @@ techage.register_node({"techage:ta4_sequencer"}, {
|
|||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
mem.idx = tonumber(payload or 1) or 1
|
mem.idx = tonumber(payload or 1) or 1
|
||||||
restart_timer(pos, 0.1)
|
restart_timer(pos, 1)
|
||||||
logic.infotext(M(pos), S("TA4 Sequencer"), S("running"))
|
logic.infotext(M(pos), S("TA4 Sequencer"), S("running"))
|
||||||
return 0
|
return 0
|
||||||
elseif payload[1] == 0 then
|
elseif payload[1] == 0 then
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
AGPL v3
|
AGPL v3
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
Colored Signal Lamp (requires unifieddyes)
|
Colored Signal Lamps (with unifieddyes support)
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -20,127 +20,215 @@ local logic = techage.logic
|
|||||||
|
|
||||||
local COLORED = minetest.get_modpath("unifieddyes") and minetest.global_exists("unifieddyes")
|
local COLORED = minetest.get_modpath("unifieddyes") and minetest.global_exists("unifieddyes")
|
||||||
|
|
||||||
|
local LampsOff = {}
|
||||||
|
local LampsOn = {}
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node, player, color)
|
||||||
node.name = "techage:signal_lamp_on"
|
if player and minetest.is_protected(pos, player:get_player_name()) then
|
||||||
minetest.swap_node(pos, node)
|
return
|
||||||
|
end
|
||||||
|
color = tonumber(color) or node.param2
|
||||||
|
if LampsOff[node.name] then
|
||||||
|
node.name = LampsOff[node.name]
|
||||||
|
node.param2 = color
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
elseif LampsOn[node.name] and color ~= node.param2 then
|
||||||
|
node.param2 = color
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function switch_off(pos, node)
|
local function switch_off(pos, node, player)
|
||||||
node.name = "techage:signal_lamp_off"
|
if player and minetest.is_protected(pos, player:get_player_name()) then
|
||||||
minetest.swap_node(pos, node)
|
return
|
||||||
|
end
|
||||||
|
if LampsOn[node.name] then
|
||||||
|
node.name = LampsOn[node.name]
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:signal_lamp_off", {
|
local function register_signallamp(name, description, tiles_off, tiles_on, node_box)
|
||||||
description = S("TechAge Signal Lamp (can be colored)"),
|
LampsOff[name .. "_off"] = name .. "_on"
|
||||||
tiles = {"techage_signal_lamp.png^[colorize:#000000:100"},
|
LampsOn[name .. "_on"] = name .. "_off"
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
minetest.register_node(name .. "_off", {
|
||||||
|
description = description,
|
||||||
|
tiles = tiles_off,
|
||||||
|
drawtype = node_box and "nodebox",
|
||||||
|
node_box = node_box,
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
logic.after_place_node(pos, placer, name .. "_off", description)
|
||||||
|
logic.infotext(M(pos), description)
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
||||||
|
else
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
node.param2 = 35
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rightclick = switch_on,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
techage.remove_node(pos, oldnode, oldmetadata)
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_construct = COLORED and unifieddyes.on_construct or nil,
|
||||||
|
on_dig = COLORED and unifieddyes.on_dig or nil,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
--palette = "techage_palette256.png",
|
||||||
|
palette = COLORED and "unifieddyes_palette_extended.png" or "techage_palette256.png",
|
||||||
|
place_param2 = 240,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
groups = {choppy=2, cracky=1, ud_param2_colorable = 1},
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = name .. "_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(name .. "_on", {
|
||||||
|
description = description,
|
||||||
|
tiles = tiles_on,
|
||||||
|
drawtype = node_box and "nodebox",
|
||||||
|
node_box = node_box,
|
||||||
|
|
||||||
|
on_rightclick = switch_off,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
--palette = "techage_palette256.png",
|
||||||
|
palette = COLORED and "unifieddyes_palette_extended.png" or "techage_palette256.png",
|
||||||
|
groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
techage.remove_node(pos, oldnode, oldmetadata)
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_dig = COLORED and unifieddyes.on_dig or nil,
|
||||||
|
light_source = 10,
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = name .. "_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_node({name .. "_off", name .. "_on"}, {
|
||||||
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
|
if topic == "on" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_on(pos, node)
|
||||||
|
return true
|
||||||
|
elseif topic == "off" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_off(pos, node)
|
||||||
|
return true
|
||||||
|
elseif topic == "color" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_on(pos, node, nil, payload)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return "unsupported"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||||
|
if topic == 1 and payload[1] == 1 then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_on(pos, node)
|
||||||
|
return 0
|
||||||
|
elseif topic == 1 and payload[1] == 0 then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_off(pos, node)
|
||||||
|
return 0
|
||||||
|
elseif topic == 70 then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
switch_on(pos, node, nil, payload[1])
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("ta_color", {
|
||||||
|
description = minetest.formspec_escape(
|
||||||
|
"Output the color palette and the numbers for Lua/Beduino color commands"),
|
||||||
|
|
||||||
|
func = function(name, param)
|
||||||
|
local tbl = {}
|
||||||
|
if COLORED then
|
||||||
|
tbl[1] = "size[14,7]"
|
||||||
|
tbl[2] = "background[0,0;14,7;unifieddyes_palette_extended.png]"
|
||||||
|
for i = 0, 10 do
|
||||||
|
local y = i * 0.64
|
||||||
|
tbl[#tbl + 1] = "label[0," .. y .. ";" .. (i * 24 + 0) .. "]"
|
||||||
|
tbl[#tbl + 1] = "label[7," .. y .. ";" .. (i * 24 + 12) .. "]"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tbl[1] = "size[10,7.5]"
|
||||||
|
tbl[2] = "background[0,0;10,7.5;techage_palette256.png]"
|
||||||
|
for i = 0, 13 do
|
||||||
|
local y = i * 0.5
|
||||||
|
tbl[#tbl + 1] = "label[0," .. y .. ";" .. (i * 18 + 0) .. "]"
|
||||||
|
tbl[#tbl + 1] = "label[5," .. y .. ";" .. (i * 18 + 9) .. "]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.show_formspec(name, ";techage:color_form", table.concat(tbl, ""))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Register callback
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "techage:color_form" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
register_signallamp("techage:signal_lamp",
|
||||||
|
S("TechAge Signal Lamp"),
|
||||||
|
{"techage_signal_lamp.png^[colorize:#000000:80"},
|
||||||
|
{"techage_signal_lamp.png"},
|
||||||
|
{
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-6/16, -6/16, -6/16, 6/16, 6/16, 6/16},
|
{-6/16, -6/16, -6/16, 6/16, 6/16, 6/16},
|
||||||
{-4/16, -10/16, -4/16, 4/16, -6/16, 4/16},
|
{-4/16, -10/16, -4/16, 4/16, -6/16, 4/16},
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
|
)
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
register_signallamp("techage:signal_lamp2",
|
||||||
logic.after_place_node(pos, placer, "techage:signal_lamp_off", S("TechAge Signal Lamp"))
|
S("TechAge Signal Lamp 2 "),
|
||||||
logic.infotext(M(pos), S("TechAge Signal Lamp"))
|
{"techage_signallamp2.png^[colorize:#000000:80"},
|
||||||
if COLORED then
|
{"techage_signallamp2.png"}
|
||||||
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
)
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_rightclick = switch_on,
|
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
techage.remove_node(pos, oldnode, oldmetadata)
|
|
||||||
if COLORED then
|
|
||||||
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_construct = COLORED and unifieddyes.on_construct or nil,
|
|
||||||
on_dig = COLORED and unifieddyes.on_dig or nil,
|
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = COLORED and "unifieddyes_palette_extended.png" or 'techage_color16.png',
|
|
||||||
place_param2 = 241,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
groups = {choppy=2, cracky=1, ud_param2_colorable = 1},
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "techage:signal_lamp_off"
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("techage:signal_lamp_on", {
|
|
||||||
description = S("TechAge Signal Lamp"),
|
|
||||||
tiles = {"techage_signal_lamp.png"},
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-6/16, -6/16, -6/16, 6/16, 6/16, 6/16},
|
|
||||||
{-4/16, -10/16, -4/16, 4/16, -6/16, 4/16},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_rightclick = switch_off,
|
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "color",
|
|
||||||
palette = COLORED and "unifieddyes_palette_extended.png" or 'techage_color16.png',
|
|
||||||
groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
|
||||||
|
|
||||||
on_construct = COLORED and unifieddyes.on_construct or nil,
|
|
||||||
after_place_node = COLORED and unifieddyes.recolor_on_place or nil,
|
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
techage.remove_node(pos, oldnode, oldmetadata)
|
|
||||||
if COLORED then
|
|
||||||
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_dig = COLORED and unifieddyes.on_dig or nil,
|
|
||||||
light_source = 10,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "techage:signal_lamp_off"
|
|
||||||
})
|
|
||||||
|
|
||||||
techage.register_node({"techage:signal_lamp_off", "techage:signal_lamp_on"}, {
|
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
|
||||||
if topic == "on" then
|
|
||||||
local node = techage.get_node_lvm(pos)
|
|
||||||
switch_on(pos, node)
|
|
||||||
elseif topic == "off" then
|
|
||||||
local node = techage.get_node_lvm(pos)
|
|
||||||
switch_off(pos, node)
|
|
||||||
else
|
|
||||||
return "unsupported"
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
|
||||||
if topic == 1 and payload[1] == 1 then
|
|
||||||
local node = techage.get_node_lvm(pos)
|
|
||||||
switch_on(pos, node)
|
|
||||||
return 0
|
|
||||||
elseif topic == 1 and payload[1] == 0 then
|
|
||||||
local node = techage.get_node_lvm(pos)
|
|
||||||
switch_off(pos, node)
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "techage:signal_lamp_off",
|
output = "techage:signal_lamp_off",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "wool:white", ""},
|
{"", "wool:white", ""},
|
||||||
{"", "default:torch", ""},
|
{"", "default:torch", ""},
|
||||||
{"", "techage:vacuum_tube", ""},
|
{"", "techage:vacuum_tube", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:signal_lamp2_off",
|
||||||
|
recipe = {
|
||||||
|
{"", "default:glass", ""},
|
||||||
|
{"", "default:torch", ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -527,7 +527,7 @@ Dieser Status und weitere Informationen werden auch ausgegeben, wenn mit dem Sch
|
|||||||
### TA3 Taster/Schalter / Button/Switch
|
### TA3 Taster/Schalter / Button/Switch
|
||||||
|
|
||||||
Der Taster/Schalter sendet `on`/`off` Kommandos zu den Blöcken, die über die Nummern konfiguriert wurden.
|
Der Taster/Schalter sendet `on`/`off` Kommandos zu den Blöcken, die über die Nummern konfiguriert wurden.
|
||||||
Der Taster/Schalter kann als Taster (button) oder Schalter (switch) konfiguriert werden. Wird er als Taster konfiguriert, so kann die Zeit zwischen den `on` und `off` Kommandos eingestellt werden.
|
Der Taster/Schalter kann als Taster (button) oder Schalter (switch) konfiguriert werden. Wird er als Taster konfiguriert, so kann die Zeit zwischen den `on` und `off` Kommandos eingestellt werden. Mit der Betriebsart "on button" wird nur ein `on` und kein `off` Kommandos gesendet.
|
||||||
|
|
||||||
Über die Checkbox "public" kann eingestellt werden, ob den Taster von jedem (gesetzt), oder nur vom Besitzer selbst (nicht gesetzt) genutzt werden darf.
|
Über die Checkbox "public" kann eingestellt werden, ob den Taster von jedem (gesetzt), oder nur vom Besitzer selbst (nicht gesetzt) genutzt werden darf.
|
||||||
|
|
||||||
@ -631,7 +631,9 @@ Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden,
|
|||||||
### TechAge Signallampe / Signal Lamp
|
### TechAge Signallampe / Signal Lamp
|
||||||
|
|
||||||
Die Signallampe kann mit `on`/`off` Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und
|
Die Signallampe kann mit `on`/`off` Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und
|
||||||
kann mit der Spritzpistole aus der Mod "Unified Dyes" farbig gemacht werden.
|
kann mit der Spritzpistole aus der Mod "Unified Dyes" und über Lua/Beduino Kommandos eingefärbt werden.
|
||||||
|
|
||||||
|
Mit dem Chat-Kommando `/ta_color` wird die Farbpalette mit den Werten für die Lua/Beduino Kommandos angezeigt und mit `/ta_send color <num>` kann die Farbe geändert werden.
|
||||||
|
|
||||||
[ta3_signallamp|image]
|
[ta3_signallamp|image]
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ This status and other information is also output when the wrench is clicked on t
|
|||||||
|
|
||||||
### TA3 Button / Switch
|
### TA3 Button / Switch
|
||||||
The button/switch sends `on` / `off` commands to the blocks that have been configured via the numbers.
|
The button/switch sends `on` / `off` commands to the blocks that have been configured via the numbers.
|
||||||
The button/switch can be configured as a button or a switch. If it is configured as a button, the time between the `on` and `off` commands can be set.
|
The button/switch can be configured as a button or a switch. If it is configured as a button, the time between the `on` and `off` commands can be set. With the operating mode "on button" only an `on` and no `off` command is sent.
|
||||||
|
|
||||||
The checkbox "public" can be used to set whether the button can be used by everyone (set) or only by the owner himself (not set).
|
The checkbox "public" can be used to set whether the button can be used by everyone (set) or only by the owner himself (not set).
|
||||||
|
|
||||||
@ -629,8 +629,9 @@ In public mode, all players can use the preconfigured keys.
|
|||||||
|
|
||||||
### TechAge Signal Lamp
|
### TechAge Signal Lamp
|
||||||
|
|
||||||
The signal lamp can be switched on or off with the `on` / `off` command. This lamp does not need electricity and
|
The signal lamp can be switched on or off with the `on` / `off` command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes" and via Lua/Beduino commands.
|
||||||
can be colored with the airbrush tool of the mod Unified Dyes.
|
|
||||||
|
With the chat command `/ta_color` the color palette with the values for the Lua/Beduino commands is displayed and with `/ta_send color <num>` the color can be changed.
|
||||||
|
|
||||||
[ta3_signallamp|image]
|
[ta3_signallamp|image]
|
||||||
|
|
||||||
@ -826,6 +827,18 @@ The processing power is up to 8 times one item every 4 seconds.
|
|||||||
[ta3_injector|image]
|
[ta3_injector|image]
|
||||||
|
|
||||||
|
|
||||||
|
### TA3 Item Flow Limiter
|
||||||
|
|
||||||
|
The Flow Limiter limits the number of items that can be pushed through by using a slider. This allows the number of items that are put into an oven, for example, to be precisely adapted to the recipe.
|
||||||
|
|
||||||
|
The Flow Limiter must be configured via the menu and then started. If the configured number of items has been passed, the block switches off. The next time the Flow Limiter is switched on, it again transmits the configured number of items.
|
||||||
|
|
||||||
|
**Note: The Flow Limiter must be placed behind the pusher.**
|
||||||
|
|
||||||
|
The Flow Limiter can also be configured and started using a Lua or Beduino controller.
|
||||||
|
|
||||||
|
[ta3_item_flow_limiter_pas|image]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
@ -467,7 +467,7 @@ Das Terminal dient zur Ein-/Ausgabe für den Lua Controller.
|
|||||||
|
|
||||||
### TA4 Taster/Schalter / Button/Switch
|
### TA4 Taster/Schalter / Button/Switch
|
||||||
|
|
||||||
Beim TA4 Taster/Schalter hat sich nur das Aussehen geändert. Die Funktionalität ist gleich wie beim TA3 Taster/Schalter.
|
Beim TA4 Taster/Schalter hat sich nur das Aussehen geändert. Die Funktionalität ist gleich wie beim TA3 Taster/Schalter. Mit dem Schraubenschlüssel-Menü können die Daten aber nachträglich geändert werden.
|
||||||
|
|
||||||
[ta4_button|image]
|
[ta4_button|image]
|
||||||
|
|
||||||
@ -554,6 +554,8 @@ Der TA4 Sequenzer unterstützt folgende techage Kommandos:
|
|||||||
|
|
||||||
Das `goto` Kommando wird nur angenommen, wenn der Sequenzer gestoppt ist.
|
Das `goto` Kommando wird nur angenommen, wenn der Sequenzer gestoppt ist.
|
||||||
|
|
||||||
|
Über das Gabelschlüssel-Menü kann beim Sequenzer die Zykluszeit (normal: 100 ms) geändert werden.
|
||||||
|
|
||||||
[ta4_sequencer|image]
|
[ta4_sequencer|image]
|
||||||
|
|
||||||
|
|
||||||
@ -569,7 +571,7 @@ Da die bewegten Blöcke Spieler und Mobs mitnehmen können, die auf dem Block st
|
|||||||
Anleitung:
|
Anleitung:
|
||||||
|
|
||||||
- Controller setzen und die Blöcke, die bewegt werden sollen, über das Menü an-trainieren (Es können bis zu 16 Blöcke an-trainiert werden)
|
- Controller setzen und die Blöcke, die bewegt werden sollen, über das Menü an-trainieren (Es können bis zu 16 Blöcke an-trainiert werden)
|
||||||
- die "Flugstrecke" muss über eine x,y,z Angabe (relativ) eingegeben werden (die maximale Distanz beträgt 100 m)
|
- die "Flugstrecke" muss über eine x,y,z Angabe (relativ) eingegeben werden (die maximale Distanz (x+y+z) beträgt 200 m)
|
||||||
- mit den Menü-Tasten "Bewege A-B" sowie "Bewege B-A" kann die Bewegung getestet werden
|
- mit den Menü-Tasten "Bewege A-B" sowie "Bewege B-A" kann die Bewegung getestet werden
|
||||||
- man kann auch durch Wände oder andere Blöcke fliegen
|
- man kann auch durch Wände oder andere Blöcke fliegen
|
||||||
- auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle "unsichtbar" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht
|
- auch die Zielposition für die Blöcke kann belegt sein. Die Blöcke werden in diesem Falle "unsichtbar" gespeichert. Dies ist für Schiebetüren und ähnliches gedacht
|
||||||
@ -804,7 +806,13 @@ In einen TA4 Tank passen 2000 Einheiten oder 200 Fässer einer Flüssigkeit.
|
|||||||
|
|
||||||
Siehe TA3 Pumpe.
|
Siehe TA3 Pumpe.
|
||||||
|
|
||||||
Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. Zusätzlich unterstützt die Pumpe das Kommando `flowrate`. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.
|
Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden.
|
||||||
|
|
||||||
|
In der Betriebsart "Durchflussbegrenzer" kann die Anzahl der Einheiten, die von der Pumpe gepumpt werden, begrenzt werden. Die Betriebsart Durchflussbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden, indem im Menü die Anzahl an Einheiten konfiguriert wird. Sobald die konfigurierte Anzahl an Einheiten gepumpt wurden, schaltet sich die Pumpe ab. Wird die Pumpe wieder eingeschaltet, pumpt sie wieder die konfigurierte Anzahl an Einheiten und schaltet sich dann ab.
|
||||||
|
|
||||||
|
Der Durchflussbegrenzer kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.
|
||||||
|
|
||||||
|
Zusätzlich unterstützt die Pumpe das Kommando `flowrate`. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.
|
||||||
|
|
||||||
[ta4_pump|image]
|
[ta4_pump|image]
|
||||||
|
|
||||||
@ -840,14 +848,18 @@ Aber: TA4 Schieber und TA4 Verteiler erreichen ihre volle Leistungsfähigkeit nu
|
|||||||
Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen.
|
Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen.
|
||||||
Die Verarbeitungsleistung beträgt 12 Items alle 2 s, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s.
|
Die Verarbeitungsleistung beträgt 12 Items alle 2 s, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s.
|
||||||
|
|
||||||
Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:
|
In der Betriebsart "Durchlaufbegrenzer" kann die Anzahl der Items, die von dem Schieber bewegt werden, begrenzt werden. Die Betriebsart Durchlaufbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden, indem im Menü die Anzahl an Items konfiguriert wird. Sobald die konfigurierte Anzahl an Items bewegt wurden, schaltet sich der Schieber ab. Wird der Schieber wieder eingeschaltet, bewegt er wieder die konfigurierte Anzahl an Items und schaltet sich dann ab.
|
||||||
|
|
||||||
|
Der TA4 Schieber kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.
|
||||||
|
|
||||||
|
Hier die zusätzlichen Kommandos für den Lua Controller:
|
||||||
|
|
||||||
- `config` dient zur Konfiguration des Schiebers, analog zum manuellen Konfiguration über das Menü.
|
- `config` dient zur Konfiguration des Schiebers, analog zum manuellen Konfiguration über das Menü.
|
||||||
Beispiel: `$send_cmnd(1234, "config", "default:dirt")`
|
Beispiel: `$send_cmnd(1234, "config", "default:dirt")`
|
||||||
Mit `$send_cmnd(1234, "config", "")` wird die Konfiguration gelöscht
|
Mit `$send_cmnd(1234, "config", "")` wird die Konfiguration gelöscht
|
||||||
- `pull` dient zum Absetzen eines Auftrags an den Schieber:
|
- `limit` dient zum Setzen der Anzahl der Items für die Durchlaufbegrenzer Betriebsart:
|
||||||
Beispiel: `$send_cmnd(1234, "pull", "default:dirt 8")`
|
Beispiel: `$send_cmnd(1234, "init", 7)`
|
||||||
Als Nummer sind Werte von 1 bis 12 zulässig. Danach geht der Schieber wieder in den `stopped` Mode und sendet ein "off" Kommando zurück an den Sender des "pull" Kommandos.
|
|
||||||
|
|
||||||
[ta4_pusher|image]
|
[ta4_pusher|image]
|
||||||
|
|
||||||
@ -957,3 +969,8 @@ Die Verarbeitungsleistung beträgt ein Item alle 8 s. Der Block benötigt hierf
|
|||||||
|
|
||||||
[ta4_recycler|image]
|
[ta4_recycler|image]
|
||||||
|
|
||||||
|
### TA4 Item Durchlaufbegrenzer / Item Flow Limiter
|
||||||
|
|
||||||
|
Die Funktion entspricht der von TA3.
|
||||||
|
|
||||||
|
[ta4_item_flow_limiter_pas|image]
|
@ -459,7 +459,7 @@ The terminal is used for input / output for the Lua controller.
|
|||||||
|
|
||||||
### TA4 Button/Switch
|
### TA4 Button/Switch
|
||||||
|
|
||||||
Only the appearance of the TA4 button/switch has changed. The functionality is the same as with the TA3 button/switch.
|
Only the appearance of the TA4 button/switch has changed. The functionality is the same as with the TA3 button/switch. With the wrench menu, however, the data can be changed later.
|
||||||
|
|
||||||
[ta4_button|image]
|
[ta4_button|image]
|
||||||
|
|
||||||
@ -546,6 +546,8 @@ The TA4 sequencer supports the following techage commands:
|
|||||||
|
|
||||||
The `goto` command is only accepted when the sequencer is stopped.
|
The `goto` command is only accepted when the sequencer is stopped.
|
||||||
|
|
||||||
|
The cycle time (default: 100 ms) can be changed for the sequencer via the open-end wrench menu.
|
||||||
|
|
||||||
[ta4_sequencer|image]
|
[ta4_sequencer|image]
|
||||||
|
|
||||||
|
|
||||||
@ -560,7 +562,7 @@ Since the moving blocks can take players and mobs standing on the block with the
|
|||||||
Instructions:
|
Instructions:
|
||||||
|
|
||||||
- Set the controller and train the blocks to be moved via the menu (up to 16 blocks can be trained)
|
- Set the controller and train the blocks to be moved via the menu (up to 16 blocks can be trained)
|
||||||
- the "flight route" must be entered via an x, y, z specification (relative) (the maximum distance is 100 m)
|
- the "flight route" must be entered via an x, y, z specification (relative) (the maximum distance (x+y+z) is 200 m)
|
||||||
- The movement can be tested with the menu buttons "Move A-B" and "Move B-A"
|
- The movement can be tested with the menu buttons "Move A-B" and "Move B-A"
|
||||||
- you can also fly through walls or other blocks
|
- you can also fly through walls or other blocks
|
||||||
- The target position for the blocks can also be occupied. In this case, the blocks are saved "invisibly". This is intended for sliding doors and the like
|
- The target position for the blocks can also be occupied. In this case, the blocks are saved "invisibly". This is intended for sliding doors and the like
|
||||||
@ -796,7 +798,13 @@ A TA4 tank can hold 2000 units or 200 barrels of liquid.
|
|||||||
|
|
||||||
See TA3 pump.
|
See TA3 pump.
|
||||||
|
|
||||||
The TA4 pump pumps 8 units of liquid every two seconds. The pump also supports the `flowrate` command. This means that the total flow rate through the pump can be queried.
|
The TA4 pump pumps 8 units of liquid every two seconds.
|
||||||
|
|
||||||
|
In the "Flow limiter" mode, the number of units pumped by the pump can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of units in the menu. Once the configured number of units have been pumped, the pump will turn off. When the pump is turned on again, it will pump the configured number of units again and then turn off.
|
||||||
|
|
||||||
|
The flow limiter can also be configured and started using a Lua or Beduino controller.
|
||||||
|
|
||||||
|
The pump also supports the `flowrate` command. This allows the total flow rate through the pump to be queried.
|
||||||
|
|
||||||
[ta4_pump|image]
|
[ta4_pump|image]
|
||||||
|
|
||||||
@ -832,14 +840,17 @@ But: TA4 pushers and TA4 distributors only achieve their full performance when u
|
|||||||
The function basically corresponds to that of TA2 / TA3. In addition, a menu can be used to configure which objects should be taken from a TA4 chest and transported further.
|
The function basically corresponds to that of TA2 / TA3. In addition, a menu can be used to configure which objects should be taken from a TA4 chest and transported further.
|
||||||
The processing power is 12 items every 2 s, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s.
|
The processing power is 12 items every 2 s, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s.
|
||||||
|
|
||||||
The TA4 pusher has two additional commands for the Lua controller:
|
In the "flow limiter" mode, the number of items that are moved by the pusher can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of items in the menu. As soon as the configured number of items have been moved, the pusher switches off. If the pusher is switched on again, it moves the configured number of items again and then switches off.
|
||||||
|
|
||||||
|
The TA4 pusher can also be configured and started using a Lua or Beduino controller.
|
||||||
|
|
||||||
|
Here are the additional commands for the Lua controller:
|
||||||
|
|
||||||
- `config` is used to configure the pusher, analogous to manual configuration via the menu.
|
- `config` is used to configure the pusher, analogous to manual configuration via the menu.
|
||||||
Example: `$send_cmnd(1234, "config", "default: dirt")`
|
Example: `$send_cmnd(1234, "config", "default:dirt")`
|
||||||
With `$send_cmnd(1234, "config", "")` the configuration is deleted
|
With `$send_cmnd(1234, "config", "")` the configuration is deleted
|
||||||
- `pull` is used to send an order to the pusher:
|
- `limit` is used to set the number of items for the flow limiter mode:
|
||||||
Example: `$send_cmnd(1234, "pull", "default: dirt 8")`
|
Example: `$send_cmnd(1234, "init", 7)`
|
||||||
Values from 1 to 12 are permitted as numbers. Then the pusher goes back to `stopped` mode and sends an" off "command back to the transmitter of the" pull "command.
|
|
||||||
|
|
||||||
[ta4_pusher|image]
|
[ta4_pusher|image]
|
||||||
|
|
||||||
@ -949,3 +960,10 @@ The machine can disassemble pretty much any Techage and Hyperloop blocks. But no
|
|||||||
The processing power is one item every 8 s. The block requires 16 ku of electricity for this.
|
The processing power is one item every 8 s. The block requires 16 ku of electricity for this.
|
||||||
|
|
||||||
[ta4_recycler|image]
|
[ta4_recycler|image]
|
||||||
|
|
||||||
|
### TA4 Item Flow Limiter
|
||||||
|
|
||||||
|
The function corresponds to that of TA3.
|
||||||
|
|
||||||
|
[ta4_item_flow_limiter_pas|image]
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import pprint
|
import pprint
|
||||||
import mistune
|
import mistune # must be v0.8.4
|
||||||
|
|
||||||
def formspec_escape(text):
|
def formspec_escape(text):
|
||||||
text = text.replace("\\", "")
|
text = text.replace("\\", "")
|
||||||
|
@ -372,6 +372,8 @@ Please note, that this is not a technical distinction, only a logical.
|
|||||||
| "stacks" | Array with up to 4 Stores with the inventory content (see example) | Only for Sensor Chests |
|
| "stacks" | Array with up to 4 Stores with the inventory content (see example) | Only for Sensor Chests |
|
||||||
| "count" | number | Read the item counter of the TA4 Item Detector block |
|
| "count" | number | Read the item counter of the TA4 Item Detector block |
|
||||||
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). |
|
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). |
|
||||||
|
| "count" | number of items | Read the number of pushed items for a TA4 Pusher in "flow limiter" mode |
|
||||||
|
| "count" | number of units | Read the number of pumped liquid units for a TA4 Pump in "flow limiter" mode |
|
||||||
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
|
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
|
||||||
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |
|
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |
|
||||||
| "input" | \<index> | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
|
| "input" | \<index> | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
|
||||||
@ -395,7 +397,8 @@ Please note, that this is not a technical distinction, only a logical.
|
|||||||
| "config" | "\<slot> \<item list>" | Configure a Distributor filter slot, like: "red default:dirt dye:blue" |
|
| "config" | "\<slot> \<item list>" | Configure a Distributor filter slot, like: "red default:dirt dye:blue" |
|
||||||
| "text" | text string | Text to be used for the Sensor Chest menu |
|
| "text" | text string | Text to be used for the Sensor Chest menu |
|
||||||
| "reset" | nil | Reset the item counter of the TA4 Item Detector block |
|
| "reset" | nil | Reset the item counter of the TA4 Item Detector block |
|
||||||
| "pull" | item string | Start the TA4 pusher to pull/push items.<br /> Example: `default:dirt 8` |
|
| "limit" | number | Configure a TA4 Pusher with the number of items that are allowed to be pushed ("flow limiter" mode)<br />limit = 0 turns off the "flow limiter" mode |
|
||||||
|
| "limit" | number | Configure a TA4 Pump with the number of liquid units that are allowed to be pumped ("flow limiter" mode)<br />limit = 0 turns off the "flow limiter" mode |
|
||||||
| "config" | item string | Configure the TA4 pusher.<br />Example: `wool:blue` |
|
| "config" | item string | Configure the TA4 pusher.<br />Example: `wool:blue` |
|
||||||
| "exchange" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Exchange a block<br />*idx* is the inventory slot number (1..n) of/for the block to be exchanged |
|
| "exchange" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Exchange a block<br />*idx* is the inventory slot number (1..n) of/for the block to be exchanged |
|
||||||
| "set" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Set/add a block<br />*idx* is the inventory slot number (1..n) with the block to be set |
|
| "set" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Set/add a block<br />*idx* is the inventory slot number (1..n) with the block to be set |
|
||||||
@ -414,6 +417,7 @@ Please note, that this is not a technical distinction, only a logical.
|
|||||||
| "stop" | nil | Stop command for the TA4 Sequencer. |
|
| "stop" | nil | Stop command for the TA4 Sequencer. |
|
||||||
| "gain" | volume | Set volume of the sound block (`volume` is a value between 0 and 1.0) |
|
| "gain" | volume | Set volume of the sound block (`volume` is a value between 0 and 1.0) |
|
||||||
| "sound" | index | Select sound sample of the sound block |
|
| "sound" | index | Select sound sample of the sound block |
|
||||||
|
| "color" | \<color> | Set the color of the TechAge Signal Lamp and TechAge Signal Lamp 2 (color = 0..255) |
|
||||||
|
|
||||||
### Server and Terminal Functions
|
### Server and Terminal Functions
|
||||||
|
|
||||||
|
Binary file not shown.
@ -228,6 +228,7 @@
|
|||||||
- [TA4 Elektronikfabrik / Electronic Fab](./manual_ta4_DE.md#ta4-elektronikfabrik--electronic-fab)
|
- [TA4 Elektronikfabrik / Electronic Fab](./manual_ta4_DE.md#ta4-elektronikfabrik--electronic-fab)
|
||||||
- [TA4 Injektor / Injector](./manual_ta4_DE.md#ta4-injektor--injector)
|
- [TA4 Injektor / Injector](./manual_ta4_DE.md#ta4-injektor--injector)
|
||||||
- [TA4 Recycler](./manual_ta4_DE.md#ta4-recycler)
|
- [TA4 Recycler](./manual_ta4_DE.md#ta4-recycler)
|
||||||
|
- [TA4 Item Durchlaufbegrenzer / Item Flow Limiter](./manual_ta4_DE.md#ta4-item-durchlaufbegrenzer--item-flow-limiter)
|
||||||
- [TA5: Zukunft](./manual_ta5_DE.md#ta5:-zukunft)
|
- [TA5: Zukunft](./manual_ta5_DE.md#ta5:-zukunft)
|
||||||
- [Energiequellen](./manual_ta5_DE.md#energiequellen)
|
- [Energiequellen](./manual_ta5_DE.md#energiequellen)
|
||||||
- [TA5 Fusionsreaktor](./manual_ta5_DE.md#ta5-fusionsreaktor)
|
- [TA5 Fusionsreaktor](./manual_ta5_DE.md#ta5-fusionsreaktor)
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
- [TA3 Gravel Rinser](./manual_ta3_EN.md#ta3-gravel-rinser)
|
- [TA3 Gravel Rinser](./manual_ta3_EN.md#ta3-gravel-rinser)
|
||||||
- [TA3 Grinder](./manual_ta3_EN.md#ta3-grinder)
|
- [TA3 Grinder](./manual_ta3_EN.md#ta3-grinder)
|
||||||
- [TA3 Injector](./manual_ta3_EN.md#ta3-injector)
|
- [TA3 Injector](./manual_ta3_EN.md#ta3-injector)
|
||||||
|
- [TA3 Item Flow Limiter](./manual_ta3_EN.md#ta3-item-flow-limiter)
|
||||||
- [Tools](./manual_ta3_EN.md#tools)
|
- [Tools](./manual_ta3_EN.md#tools)
|
||||||
- [Techage Info Tool](./manual_ta3_EN.md#techage-info-tool)
|
- [Techage Info Tool](./manual_ta3_EN.md#techage-info-tool)
|
||||||
- [TechAge Programmer](./manual_ta3_EN.md#techage-programmer)
|
- [TechAge Programmer](./manual_ta3_EN.md#techage-programmer)
|
||||||
@ -228,6 +229,7 @@
|
|||||||
- [TA4 Electronic Fab](./manual_ta4_EN.md#ta4-electronic-fab)
|
- [TA4 Electronic Fab](./manual_ta4_EN.md#ta4-electronic-fab)
|
||||||
- [TA4 Injector](./manual_ta4_EN.md#ta4-injector)
|
- [TA4 Injector](./manual_ta4_EN.md#ta4-injector)
|
||||||
- [TA4 Recycler](./manual_ta4_EN.md#ta4-recycler)
|
- [TA4 Recycler](./manual_ta4_EN.md#ta4-recycler)
|
||||||
|
- [TA4 Item Flow Limiter](./manual_ta4_EN.md#ta4-item-flow-limiter)
|
||||||
- [TA5: Future](./manual_ta5_EN.md#ta5:-future)
|
- [TA5: Future](./manual_ta5_EN.md#ta5:-future)
|
||||||
- [Energy Sources](./manual_ta5_EN.md#energy-sources)
|
- [Energy Sources](./manual_ta5_EN.md#energy-sources)
|
||||||
- [TA5 Fusion Reactor](./manual_ta5_EN.md#ta5-fusion-reactor)
|
- [TA5 Fusion Reactor](./manual_ta5_EN.md#ta5-fusion-reactor)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name = techage
|
name = techage
|
||||||
depends = default,doors,flowers,tubelib2,networks,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua
|
depends = default,doors,flowers,tubelib2,networks,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua
|
||||||
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks,i3,creative,craftguide
|
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecons,digtron,bakedclay,moreblocks,i3,creative,craftguide
|
||||||
description = Techage, go through 5 tech ages in search of wealth and power!
|
description = Techage, go through 5 tech ages in search of wealth and power!
|
||||||
|
@ -46,7 +46,8 @@ local WRENCH_MENU = {
|
|||||||
|
|
||||||
local function formspec(nvm, meta)
|
local function formspec(nvm, meta)
|
||||||
local status = meta:get_string("status")
|
local status = meta:get_string("status")
|
||||||
local path = meta:contains("path") and meta:get_string("path") or "0,3,0"
|
local path = meta:contains("fs_path") and meta:get_string("fs_path") or
|
||||||
|
meta:contains("path") and meta:get_string("path") or "0,3,0"
|
||||||
return "size[8,6.7]" ..
|
return "size[8,6.7]" ..
|
||||||
"style_type[textarea;font=mono;textcolor=#FFFFFF;border=true]" ..
|
"style_type[textarea;font=mono;textcolor=#FFFFFF;border=true]" ..
|
||||||
"box[0,-0.1;7.2,0.5;#c6e8ff]" ..
|
"box[0,-0.1;7.2,0.5;#c6e8ff]" ..
|
||||||
@ -107,6 +108,7 @@ minetest.register_node("techage:ta5_flycontroller", {
|
|||||||
local pos_list = mark.get_poslist(name)
|
local pos_list = mark.get_poslist(name)
|
||||||
local _, err = fly.to_path(fields.path, MAX_DIST)
|
local _, err = fly.to_path(fields.path, MAX_DIST)
|
||||||
if not err then
|
if not err then
|
||||||
|
meta:set_string("fs_path", fields.path)
|
||||||
meta:set_string("path", fields.path)
|
meta:set_string("path", fields.path)
|
||||||
end
|
end
|
||||||
nvm.running = nil
|
nvm.running = nil
|
||||||
@ -120,8 +122,11 @@ minetest.register_node("techage:ta5_flycontroller", {
|
|||||||
local _, err = fly.to_path(fields.path, MAX_DIST)
|
local _, err = fly.to_path(fields.path, MAX_DIST)
|
||||||
if not err then
|
if not err then
|
||||||
meta:set_string("path", fields.path)
|
meta:set_string("path", fields.path)
|
||||||
|
meta:set_string("fs_path", fields.path)
|
||||||
meta:set_string("status", S("Stored"))
|
meta:set_string("status", S("Stored"))
|
||||||
else
|
else
|
||||||
|
meta:set_string("path", "0,0,0")
|
||||||
|
meta:set_string("fs_path", fields.path)
|
||||||
meta:set_string("status", err)
|
meta:set_string("status", err)
|
||||||
end
|
end
|
||||||
meta:set_string("formspec", formspec(nvm, meta))
|
meta:set_string("formspec", formspec(nvm, meta))
|
||||||
|
@ -22,7 +22,7 @@ local MP = minetest.get_modpath("techage")
|
|||||||
local fly = dofile(MP .. "/basis/fly_lib.lua")
|
local fly = dofile(MP .. "/basis/fly_lib.lua")
|
||||||
local mark = dofile(MP .. "/basis/mark_lib.lua")
|
local mark = dofile(MP .. "/basis/mark_lib.lua")
|
||||||
|
|
||||||
local MAX_DIST = 100
|
local MAX_DIST = 200
|
||||||
local MAX_BLOCKS = 16
|
local MAX_BLOCKS = 16
|
||||||
|
|
||||||
local WRENCH_MENU = {
|
local WRENCH_MENU = {
|
||||||
@ -40,6 +40,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Handover to B"),
|
label = S("Handover to B"),
|
||||||
tooltip = S("Number of the next movecontroller"),
|
tooltip = S("Number of the next movecontroller"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "number",
|
type = "number",
|
||||||
@ -47,6 +48,7 @@ local WRENCH_MENU = {
|
|||||||
label = S("Handover to A"),
|
label = S("Handover to A"),
|
||||||
tooltip = S("Number of the previous movecontroller"),
|
tooltip = S("Number of the previous movecontroller"),
|
||||||
default = "",
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "float",
|
type = "float",
|
||||||
@ -183,7 +185,7 @@ minetest.register_node("techage:ta4_movecontroller", {
|
|||||||
if fly.to_vector(fields.path or "", MAX_DIST) then
|
if fly.to_vector(fields.path or "", MAX_DIST) then
|
||||||
meta:set_string("path", fields.path)
|
meta:set_string("path", fields.path)
|
||||||
end
|
end
|
||||||
local line = fly.to_vector(meta:get_string("path"))
|
local line = fly.to_vector(meta:get_string("path"), MAX_DIST)
|
||||||
if line then
|
if line then
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
fly.move_to(pos, line)
|
fly.move_to(pos, line)
|
||||||
@ -235,12 +237,12 @@ techage.register_node({"techage:ta4_movecontroller"}, {
|
|||||||
nvm.moveBA = false
|
nvm.moveBA = false
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
return fly.move_to_other_pos(pos, true)
|
return fly.move_to_other_pos(pos, true)
|
||||||
elseif move_xyz and topic == "move" then
|
elseif not move_xyz and topic == "move" then
|
||||||
nvm.moveBA = nvm.moveBA == false
|
nvm.moveBA = nvm.moveBA == false
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
return fly.move_to_other_pos(pos, nvm.moveBA == false)
|
return fly.move_to_other_pos(pos, nvm.moveBA == false)
|
||||||
elseif move_xyz and topic == "move2" then
|
elseif move_xyz and topic == "move2" then
|
||||||
local line = fly.to_vector(payload)
|
local line = fly.to_vector(payload, MAX_DIST)
|
||||||
if line then
|
if line then
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
nvm.controller_mode = true
|
nvm.controller_mode = true
|
||||||
|
@ -20,7 +20,7 @@ local Cable = techage.ElectricCable
|
|||||||
local power = networks.power
|
local power = networks.power
|
||||||
|
|
||||||
local function can_dig(pos, digger)
|
local function can_dig(pos, digger)
|
||||||
if digger and digger:is_player() then
|
if digger and digger:is_player() then
|
||||||
if M(pos):get_string("owner") == digger:get_player_name() then
|
if M(pos):get_string("owner") == digger:get_player_name() then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ end
|
|||||||
local function add_chest_entity(pos, nvm)
|
local function add_chest_entity(pos, nvm)
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
local length
|
local length
|
||||||
|
|
||||||
if not nvm.capa or nvm.capa == 0 then
|
if not nvm.capa or nvm.capa == 0 then
|
||||||
length = (nvm.length or MAX_ROPE_LEN) * (1 - (nvm.load or 0))
|
length = (nvm.length or MAX_ROPE_LEN) * (1 - (nvm.load or 0))
|
||||||
else
|
else
|
||||||
|
@ -158,11 +158,14 @@ techage.register_node({"techage:ta5_tele_tube"}, {
|
|||||||
local rmt_nvm = techage.get_nvm(rmt_pos)
|
local rmt_nvm = techage.get_nvm(rmt_pos)
|
||||||
if techage.is_operational(rmt_nvm) then
|
if techage.is_operational(rmt_nvm) then
|
||||||
local tube_dir = M(rmt_pos):get_int("tube_dir")
|
local tube_dir = M(rmt_pos):get_int("tube_dir")
|
||||||
if techage.push_items(rmt_pos, tube_dir, stack) then
|
local leftover = techage.push_items(rmt_pos, tube_dir, stack)
|
||||||
|
-- Moved any items
|
||||||
|
if leftover then
|
||||||
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
State:keep_running(rmt_pos, rmt_nvm, COUNTDOWN_TICKS)
|
State:keep_running(rmt_pos, rmt_nvm, COUNTDOWN_TICKS)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
return leftover
|
||||||
else
|
else
|
||||||
State:blocked(pos, nvm, S("Remote block error"))
|
State:blocked(pos, nvm, S("Remote block error"))
|
||||||
end
|
end
|
||||||
|
40
techage/textures/generate.py
Executable file
40
techage/textures/generate.py
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Script to generate the palette PNG file.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022 Joachim Stolberg
|
||||||
|
# LGPLv2.1+
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
MainColors = [
|
||||||
|
0x000080, 0x008000, 0x800000, 0x008080, 0x808000, 0x800080,
|
||||||
|
0x0000FF, 0x00FF00, 0xFF0000, 0x00FFFF, 0xFFFF00, 0xFF00FF,
|
||||||
|
0x0080FF, 0x8000FF, 0x80FF00, 0x00FF80, 0xFF8000, 0xFF0080,
|
||||||
|
]
|
||||||
|
|
||||||
|
def generate():
|
||||||
|
img = Image.new("RGB", (18, 15), color='#000000')
|
||||||
|
|
||||||
|
# Main colors
|
||||||
|
for x in range(0,18):
|
||||||
|
img.putpixel((x, 0), MainColors[x])
|
||||||
|
|
||||||
|
# Grey scale
|
||||||
|
for x in range(0,18):
|
||||||
|
img.putpixel((x, 1), (x * 15, x * 15, x * 15))
|
||||||
|
|
||||||
|
# 216 colors palette
|
||||||
|
idx = 36
|
||||||
|
for r in range(0,6):
|
||||||
|
for g in range(0,6):
|
||||||
|
for b in range(0,6):
|
||||||
|
x = idx % 18
|
||||||
|
y = int(idx / 18)
|
||||||
|
img.putpixel((x, y), (r * 0x33, g * 0x33, b * 0x33))
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
img.save("techage_palette256.png", "PNG")
|
||||||
|
|
||||||
|
generate()
|
BIN
techage/textures/techage_palette256.png
Normal file
BIN
techage/textures/techage_palette256.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 B |
BIN
techage/textures/techage_signallamp2.png
Normal file
BIN
techage/textures/techage_signallamp2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 B |
@ -115,6 +115,16 @@ local function read_state(itemstack, user, pointed_thing)
|
|||||||
if owner ~= "" then
|
if owner ~= "" then
|
||||||
minetest.chat_send_player(user:get_player_name(), S("Node owner")..": "..owner.." ")
|
minetest.chat_send_player(user:get_player_name(), S("Node owner")..": "..owner.." ")
|
||||||
end
|
end
|
||||||
|
if ndef and ndef.networks and ndef.networks.pipe2 and ndef.networks.pipe2.ntype == "pump" then
|
||||||
|
local tbl = networks.liquid.get_liquids(pos, Pipe2)
|
||||||
|
if #tbl > 0 then
|
||||||
|
local names = table.concat(tbl, ", ")
|
||||||
|
minetest.chat_send_player(user:get_player_name(), S("Pump connected to tank(s) with: @1", names))
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(user:get_player_name(), S("Pump connected to no/empty tank(s)."))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(user:get_player_name(), S("Position")..": "..minetest.pos_to_string(pos).." ")
|
minetest.chat_send_player(user:get_player_name(), S("Position")..": "..minetest.pos_to_string(pos).." ")
|
||||||
itemstack:add_wear(65636/200)
|
itemstack:add_wear(65636/200)
|
||||||
return itemstack
|
return itemstack
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user