built on 03/09/2021 19:32:06
@ -47,6 +47,13 @@ ta4_jetpack requires the modpack 3d_armor. 3d_armor is itself a modpack and can'
|
||||
### History
|
||||
|
||||
|
||||
#### 2021-09-03
|
||||
|
||||
Updated Mods:
|
||||
- techage
|
||||
- minecart
|
||||
|
||||
|
||||
#### 2021-08-19
|
||||
|
||||
Changed Mods:
|
||||
|
@ -77,7 +77,8 @@ Introduction
|
||||
'<num>' is the cart number, or get a list of carts with /mycart
|
||||
11. Drop items into the Minecart and punch the cart to start it, or "sneak+click" the
|
||||
Minecart to get cart and items back
|
||||
|
||||
12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.
|
||||
13. To retrieve lost carts, use the chat command: /stopcart <num>
|
||||
|
||||
Hopper
|
||||
------
|
||||
@ -150,3 +151,4 @@ History
|
||||
2020-11-12 V1.10 Make carts more robust against server lag
|
||||
2021-04-10 V2.00 Complete revision to make carts robust against server load/lag,
|
||||
Speed limit signs and cart terminal added
|
||||
2021-09-02 V2.01 Chat command /stopcart added
|
@ -35,12 +35,16 @@ local function remote_station_name(pos)
|
||||
if route and route.dest_pos then
|
||||
return M(route.dest_pos):get_string("name")
|
||||
end
|
||||
return "none"
|
||||
end
|
||||
|
||||
local function on_punch(pos, node, puncher)
|
||||
local name = M(pos):get_string("name")
|
||||
M(pos):set_string("infotext", name..": "..S("connected to").." "..remote_station_name(pos))
|
||||
local dest = remote_station_name(pos)
|
||||
if dest then
|
||||
M(pos):set_string("infotext", name .. ": " .. S("connected to") .. " " .. dest)
|
||||
else
|
||||
M(pos):set_string("infotext", name .. ": " .. S("Not connected!"))
|
||||
end
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
|
||||
@ -127,7 +131,12 @@ minetest.register_node("minecart:buffer", {
|
||||
M(pos):set_string("name", fields.name)
|
||||
M(pos):set_int("time", tonumber(fields.time) or 0)
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
M(pos):set_string("infotext", fields.name.." "..S("connected to").." "..remote_station_name(pos))
|
||||
local dest = remote_station_name(pos)
|
||||
if dest then
|
||||
M(pos):set_string("infotext", fields.name .. ": " .. S("connected to") .. " " .. dest)
|
||||
else
|
||||
M(pos):set_string("infotext", fields.name .. ": " .. S("Not connected!"))
|
||||
end
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end
|
||||
end,
|
||||
|
@ -35,6 +35,7 @@ local summary_doc = table.concat({
|
||||
S("10. Check the cart state via the chat command: /mycart <num>\n '<num>' is the cart number"),
|
||||
S("11. Drop items into the Minecart and punch the cart to start it."),
|
||||
S("12. Dig the cart with 'sneak+click' (as usual). The items will be drop down."),
|
||||
S("13. To retrieve lost carts, use the chat command: /stopcart <num>"),
|
||||
}, "\n")
|
||||
|
||||
local cart_doc = S("Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back")
|
||||
|
@ -13,7 +13,7 @@
|
||||
minecart = {}
|
||||
|
||||
-- Version for compatibility checks, see readme.md/history
|
||||
minecart.version = 2.00
|
||||
minecart.version = 2.01
|
||||
|
||||
minecart.hopper_enabled = minetest.settings:get_bool("minecart_hopper_enabled") ~= false
|
||||
minecart.teleport_enabled = minetest.settings:get_bool("minecart_teleport_enabled") == true
|
||||
|
@ -2,6 +2,7 @@
|
||||
Station name=Stationsname
|
||||
Waiting time/sec=Wartezeit/s
|
||||
connected to=verbunden mit
|
||||
Not connected!=Nicht verbunden!
|
||||
Summary=Zusammenfassung
|
||||
1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.=1. Baue eine Schienenstrecke mit zwei Enden. Kreuzungen sind zulässig, solange jede Route ihre eigenen Start- und Endpunkte hat.
|
||||
2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).=2. Platziere einen Prellbock an beide Schienenenden (Prellböcke sind zwingend notwendig, sie speichern die Routen- und Zeit-Informationen).
|
||||
@ -12,9 +13,10 @@ Summary=Zusammenfassung
|
||||
7. Optional: Configure the Minecart waiting time in both buffers. The Minecart will then start automatically after the configured time.=7. Optional: Konfiguriere die Wagenwartezeit in beiden Prellböcken. Der Wagen startet dann nach dieser Zeit automatisch.
|
||||
8. Optional: Protect your rail network with the Protection Landmarks (one Landmark at least every 16 nodes/meters).=8. Optional: Schütze deine Schienen mit Hilfe der Meilensteine (ein Meilenstein mindestens alle 16 Blöcke).
|
||||
9. Place a Minecart in front of the buffer and check whether it starts after the configured time.=9. Platziere einen Wagen direkt vor einem Prellbock und prüfe, ob er nach der konfigurierten Zeit startet.
|
||||
10. Check the cart state via the chat command: /mycart <num>@n '<num>' is the cart number=Prüfe den Status des Wagen mit dem Chat Kommando: /mycart <num>@n <num> ist die Wagennummer
|
||||
10. Check the cart state via the chat command: /mycart <num>@n '<num>' is the cart number=10. Prüfe den Status des Wagen mit dem Chat Kommando: /mycart <num>@n <num> ist die Wagennummer
|
||||
11. Drop items into the Minecart and punch the cart to start it.=11: Lege Gegenstände in ein Wagen (Taste Q) und starte dann den Wagen durch Anklicken.
|
||||
12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.=10. Klicke mit gedrückter Shift-Taste auf den Wagen, um diesen zu entfernen. Die Gegenstände fallen dann zu Boden.
|
||||
12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.=12. Klicke mit gedrückter Shift-Taste auf den Wagen, um diesen zu entfernen. Die Gegenstände fallen dann zu Boden.
|
||||
13. To retrieve lost carts, use the chat command: /stopcart <num>=13. Um verirrte Waren zurückzuholen, verwende den Chat-Befehl: /stopcart <num>
|
||||
Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back=Primär für den Transport von Gegenständen genutzt. Du kannst Gegenstände in ein Cart legen (Taste Q) und dann den Wagen durch Anklicken starten. Klicke mit gedrückter Shift-Taste auf den Wagen, um Cart und Gegenstände zurückzuerhalten
|
||||
Used as buffer on both rail ends. Needed to be able to record the cart routes=Preckblöcke müssen an beiden Schienenenden platziert sein, so dass Aufzeichnungen der Strecke gemacht werden können.
|
||||
Protect your rails with the Landmarks (one Landmark at least every 16 blocks near the rail)=Schütze deine Schienen mit Hilfe der Meilensteine (ein Meilenstein mindestens alle 16 Blöcke der Strecke entlang)
|
||||
@ -32,6 +34,10 @@ Cart Pusher=Wagen Anschieber
|
||||
Minecart (Sneak+Click to pick up)=Minecart (Shift+Klick zum Entfernen des Carts)
|
||||
Output cart state and position, or a list of carts, if no cart number is given.=Gibt Status und Position des Wagens, oder eine Liste aller Wagen aus, wenn keine Wagennummer angegeben ist.
|
||||
List of carts=Liste aller Wagen
|
||||
Stop amd return a missing/running cart.=Stoppe und hole einen vermissten Wagen zurück.
|
||||
Cart=Wagen
|
||||
stopped=gestoppt
|
||||
is not existing!=existiert nicht!
|
||||
Enter cart number=Gebe Cart Nummer ein
|
||||
Save=Speichern
|
||||
[minecart] Area is protected!=[minecart] Bereich ist geschützt!
|
||||
@ -52,8 +58,3 @@ Speed "4"=Tempo "4"
|
||||
No speed limit=Keine Geschwindigkeitsbegrenzung
|
||||
Cart List=Cart Liste
|
||||
Cart Terminal=Cart Terminal
|
||||
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Used to push a cart if the cart does not stop directly at a buffer. Block has to be placed below the rail.=Wird verwendet, um einen Wagen anzuschieben, wenn der Wagen nicht direkt an einem Puffer anhält. Der Block muss unter der Schiene platziert werden.
|
||||
|
@ -2,6 +2,7 @@
|
||||
Station name=
|
||||
Waiting time/sec=
|
||||
connected to=
|
||||
Not connected!=
|
||||
Summary=
|
||||
1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.=
|
||||
2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).=
|
||||
@ -15,6 +16,7 @@ Summary=
|
||||
10. Check the cart state via the chat command: /mycart <num>@n '<num>' is the cart number=
|
||||
11. Drop items into the Minecart and punch the cart to start it.=
|
||||
12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.=
|
||||
13. To retrieve lost carts, use the chat command: /stopcart <num>=
|
||||
Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back=
|
||||
Used as buffer on both rail ends. Needed to be able to record the cart routes=
|
||||
Protect your rails with the Landmarks (one Landmark at least every 16 blocks near the rail)=
|
||||
@ -32,6 +34,10 @@ Cart Pusher=
|
||||
Minecart (Sneak+Click to pick up)=
|
||||
Output cart state and position, or a list of carts, if no cart number is given.=
|
||||
List of carts=
|
||||
Stop amd return a missing/running cart.=
|
||||
Cart=
|
||||
stopped=
|
||||
is not existing!=
|
||||
Enter cart number=
|
||||
Save=
|
||||
[minecart] Area is protected!=
|
||||
|
@ -243,6 +243,33 @@ minetest.register_chatcommand("mycart", {
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("stopcart", {
|
||||
params = "<cart-num>",
|
||||
description = S("Stop amd return a missing/running cart."),
|
||||
func = function(owner, param)
|
||||
local userID = tonumber(param)
|
||||
local player_pos = minetest.get_player_by_name(owner):get_pos()
|
||||
if userID then
|
||||
local data = minecart.get_cart_monitoring_data(owner, userID)
|
||||
if data then
|
||||
if data.objID and data.objID ~= 0 then
|
||||
local entity = minetest.luaentities[data.objID]
|
||||
if entity then -- cart entity running
|
||||
minecart.entity_to_node(player_pos, entity)
|
||||
end
|
||||
else
|
||||
local pos = data.last_pos or data.pos
|
||||
local cargo, owner, userID = minecart.remove_nodecart(pos)
|
||||
minecart.add_nodecart(player_pos, data.node_name, 0, cargo, owner, userID)
|
||||
end
|
||||
return true, S("Cart") .. " " .. userID .. " " .. S("stopped")
|
||||
else
|
||||
return false, S("Cart") .. " " .. userID .. " " .. S("is not existing!")
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
function minecart.cmnd_cart_state(name, userID)
|
||||
local state, loc = get_cart_state_and_loc(name, userID, {x=0, y=0, z=0})
|
||||
return state
|
||||
|
@ -82,6 +82,7 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
|
||||
dig_right <slot> <lvl> - remove block on the right
|
||||
dig_below <slot> - dig block under the robot
|
||||
dig_above <slot> - dig block above the robot
|
||||
rotate_item <lvl> <steps> - rotate a block in front of the robot
|
||||
place_sign <slot> - set sign
|
||||
place_sign_behind <slot> - put a sign behind the bot
|
||||
dig_sign <slot> - remove the sign
|
||||
@ -96,7 +97,14 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
|
||||
pattern - save the blocks behind the shield (up to 5x3x3) as template
|
||||
copy <size> - make a copy of "pattern". Size is e.g. 3x3 (see ingame help)
|
||||
punch_cart - Punch a rail cart to start it
|
||||
add_compost <slot> - Put 2 leaves into the compost barrel
|
||||
take_compost <slot> - Take a compost item from the barrel
|
||||
print <text> - Output chat message for debug purposes
|
||||
take_water <slot> - Take water with empty bucket
|
||||
fill_cauldron <slot> - Fill the xdecor cauldron for a soup
|
||||
take_soup <slot> - Take boiling soup into empty bowl from cauldron
|
||||
flame_on - Make fire
|
||||
flame_off - Put out the fire
|
||||
|
||||
#### Flow control commands
|
||||
|
||||
@ -141,13 +149,14 @@ Or alternatively with the function at the end:
|
||||
return -- end of 'foo'. Jump back
|
||||
|
||||
### License
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2021 Michal 'Micu' Cieslakiewicz (soup commands)
|
||||
Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt
|
||||
|
||||
|
||||
### Dependencies
|
||||
default, farming, basic_materials, tubelib2
|
||||
optional: farming redo, node_io, doc, techage, minecart
|
||||
optional: farming redo, node_io, doc, techage, minecart, xdecor, compost
|
||||
|
||||
|
||||
### History
|
||||
@ -173,4 +182,5 @@ optional: farming redo, node_io, doc, techage, minecart
|
||||
- 2021-03-14 v1.06 * Switch translation from intllib to minetest.translator
|
||||
- 2021-04-24 v1.07 * Adapted to minecart v2.0
|
||||
- 2021-05-04 v1.08 * Add print command, improve error msg
|
||||
- 2021-08-22 v1.09 * Add soup commands and signs, add aspen sign
|
||||
|
||||
|
323
signs_bot/cmd_soup.lua
Normal file
@ -0,0 +1,323 @@
|
||||
--[[
|
||||
|
||||
Signs Bot
|
||||
=========
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2021 Michal 'Micu' Cieslakiewicz
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Bot soup cooking commands
|
||||
|
||||
Allows bot to use pot (xdecor:cauldron) to cook a vegetable soup
|
||||
|
||||
]]--
|
||||
|
||||
if not minetest.global_exists("bucket") or not minetest.global_exists("fire")
|
||||
or not minetest.global_exists("xdecor") then return end
|
||||
|
||||
local M = minetest.get_meta
|
||||
|
||||
-- Load support for I18n.
|
||||
local S = signs_bot.S
|
||||
|
||||
local lib = signs_bot.lib
|
||||
|
||||
local bucket_empty, bucket_water = ItemStack("bucket:bucket_empty 1"), ItemStack("bucket:bucket_water 1")
|
||||
local bowl_empty_farming, bowl_empty_xdecor = ItemStack("farming:bowl 1"), ItemStack("xdecor:bowl 1")
|
||||
local bowl_soup = ItemStack("xdecor:bowl_soup 1")
|
||||
|
||||
local function find_item_slot(base_pos, item)
|
||||
local inv = M(base_pos):get_inventory()
|
||||
local s = nil
|
||||
for i = 1, 8 do
|
||||
local t = inv:get_stack("main", i)
|
||||
if t and t:get_name() == item:get_name() then
|
||||
s = i
|
||||
break
|
||||
end
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
signs_bot.register_botcommand("take_water", {
|
||||
mod = "soup",
|
||||
params = "<slot>",
|
||||
num_param = 1,
|
||||
description = S("Take water into empty bucket when standing on a shore\n(use specified slot number or 0 for auto selection)"),
|
||||
check = function(slot)
|
||||
slot = tonumber(slot)
|
||||
return slot and slot >= 0 and slot <= 8
|
||||
end,
|
||||
cmnd = function(base_pos, mem, slot)
|
||||
slot = tonumber(slot)
|
||||
local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 })
|
||||
pos.y = pos.y - 1
|
||||
if not lib.not_protected(base_pos, pos) then
|
||||
return signs_bot.ERROR, S("Error: Position protected")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or node.name ~= "default:water_source" then
|
||||
return signs_bot.ERROR, S("Error: No still water around")
|
||||
end
|
||||
local itemslot = slot
|
||||
if slot == 0 then
|
||||
itemslot = find_item_slot(base_pos, bucket_empty)
|
||||
if not itemslot then
|
||||
return signs_bot.ERROR, S("Error: No empty bucket in inventory")
|
||||
end
|
||||
end
|
||||
local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1)
|
||||
if not item or item:is_empty() or item:get_name() ~= bucket_empty:get_name() then
|
||||
return signs_bot.ERROR, S("Error: No empty bucket in inventory slot " .. itemslot)
|
||||
end
|
||||
item = signs_bot.bot_inv_put_item(base_pos, slot, bucket_water)
|
||||
if item:is_empty() then
|
||||
minetest.remove_node(pos)
|
||||
else
|
||||
signs_bot.bot_inv_put_item(base_pos, itemslot, bucket_empty)
|
||||
return signs_bot.ERROR, S("Error: No inventory space for full bucket")
|
||||
end
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
||||
signs_bot.register_botcommand("fill_cauldron", {
|
||||
mod = "soup",
|
||||
params = "<slot>",
|
||||
num_param = 1,
|
||||
description = S("Pour water from bucket to empty cauldron in front of a robot\n(use specified slot number or 0 for auto selection)"),
|
||||
check = function(slot)
|
||||
slot = tonumber(slot)
|
||||
return slot and slot >= 0 and slot <= 8
|
||||
end,
|
||||
cmnd = function(base_pos, mem, slot)
|
||||
slot = tonumber(slot)
|
||||
local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 })
|
||||
if not lib.not_protected(base_pos, pos) then
|
||||
return signs_bot.ERROR, S("Error: Position protected")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or node.name ~= "xdecor:cauldron_empty" then
|
||||
return signs_bot.ERROR, S("Error: No empty cauldron in front of a robot")
|
||||
end
|
||||
local itemslot = slot
|
||||
if slot == 0 then
|
||||
itemslot = find_item_slot(base_pos, bucket_water)
|
||||
if not itemslot then
|
||||
return signs_bot.ERROR, S("Error: No full bucket in inventory")
|
||||
end
|
||||
end
|
||||
local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1)
|
||||
if not item or item:is_empty() or item:get_name() ~= bucket_water:get_name() then
|
||||
return signs_bot.ERROR, S("Error: No full bucket in inventory slot " .. itemslot)
|
||||
end
|
||||
item = signs_bot.bot_inv_put_item(base_pos, slot, bucket_empty)
|
||||
if item:is_empty() then
|
||||
minetest.set_node(pos, { name = "xdecor:cauldron_idle", param2 = node.param2 })
|
||||
else
|
||||
signs_bot.bot_inv_put_item(base_pos, itemslot, bucket_water)
|
||||
return signs_bot.ERROR, S("Error: No inventory space for empty bucket")
|
||||
end
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
||||
signs_bot.register_botcommand("flame_on", {
|
||||
mod = "soup",
|
||||
params = "",
|
||||
num_param = 0,
|
||||
description = S("Set fire under cauldron (requires flammable material)\n(command is ignored when fire is already burning)"),
|
||||
cmnd = function(base_pos, mem)
|
||||
local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 })
|
||||
local fire_pos = { x = pos.x, y = pos.y - 1, z = pos.z }
|
||||
local fuel_pos = { x = pos.x, y = pos.y - 2, z = pos.z }
|
||||
if not (lib.not_protected(base_pos, pos) and lib.not_protected(base_pos, fire_pos)
|
||||
and lib.not_protected(base_pos, fuel_pos)) then
|
||||
return signs_bot.ERROR, S("Error: Position protected")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or not node.name:find("xdecor:cauldron") then
|
||||
return signs_bot.ERROR, S("Error: No cauldron in front of a robot")
|
||||
end
|
||||
local fire_node = minetest.get_node_or_nil(fire_pos)
|
||||
if fire_node and fire_node.name:match("fire:[%w_]*flame") then
|
||||
return signs_bot.DONE
|
||||
elseif not fire_node or fire_node.name ~= "air" then
|
||||
return signs_bot.ERROR, S("Error: No space for fire under cauldron")
|
||||
end
|
||||
local fuel_node = minetest.get_node_or_nil(fuel_pos)
|
||||
if fuel_node and minetest.registered_nodes[fuel_node.name].on_ignite then
|
||||
minetest.registered_nodes[fuel_node.name].on_ignite(fuel_pos)
|
||||
elseif fuel_node and minetest.get_item_group(fuel_node.name, "flammable") >= 1 then
|
||||
minetest.set_node(fire_pos, { name = "fire:basic_flame" })
|
||||
else
|
||||
return signs_bot.ERROR, S("Error: No flammable material under cauldron")
|
||||
end
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
||||
signs_bot.register_botcommand("flame_off", {
|
||||
mod = "soup",
|
||||
params = "",
|
||||
num_param = 0,
|
||||
description = S("Put out (extinguish) fire under cauldron\n(command is ignored when there is no fire)"),
|
||||
cmnd = function(base_pos, mem)
|
||||
local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 })
|
||||
local fire_pos = { x = pos.x, y = pos.y - 1, z = pos.z }
|
||||
if not (lib.not_protected(base_pos, pos) and lib.not_protected(base_pos, fire_pos)) then
|
||||
return signs_bot.ERROR, S("Error: Position protected")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or not node.name:find("xdecor:cauldron") then
|
||||
return signs_bot.ERROR, S("Error: No cauldron in front of a robot")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(fire_pos)
|
||||
if node and node.name:match("fire:[%w_]*flame") then
|
||||
minetest.remove_node(fire_pos)
|
||||
end
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
||||
signs_bot.register_botcommand("take_soup", {
|
||||
mod = "soup",
|
||||
params = "<slot>",
|
||||
num_param = 1,
|
||||
description = S("Take boiling soup into empty bowl from cauldron\nin front of a robot\n(use specified slot number or 0 for auto selection)"),
|
||||
check = function(slot)
|
||||
slot = tonumber(slot)
|
||||
return slot and slot >= 0 and slot <= 8
|
||||
end,
|
||||
cmnd = function(base_pos, mem, slot)
|
||||
slot = tonumber(slot)
|
||||
local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 })
|
||||
if not lib.not_protected(base_pos, pos) then
|
||||
return signs_bot.ERROR, S("Error: Position protected")
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or node.name ~= "xdecor:cauldron_soup" then
|
||||
return signs_bot.ERROR, S("Error: No cauldron with a soup in front of a robot")
|
||||
end
|
||||
local itemslot = slot
|
||||
if slot == 0 then
|
||||
itemslot = find_item_slot(base_pos, bowl_empty_xdecor) or find_item_slot(base_pos, bowl_empty_farming)
|
||||
if not itemslot then
|
||||
return signs_bot.ERROR, S("Error: No empty bowl in inventory")
|
||||
end
|
||||
end
|
||||
local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1)
|
||||
if not item or item:is_empty() or (item:get_name() ~= bowl_empty_farming:get_name()
|
||||
and item:get_name() ~= bowl_empty_xdecor:get_name()) then
|
||||
return signs_bot.ERROR, S("Error: No empty bowl in inventory slot " .. itemslot)
|
||||
end
|
||||
local item_full = signs_bot.bot_inv_put_item(base_pos, slot, bowl_soup)
|
||||
if item_full:is_empty() then
|
||||
minetest.set_node(pos, { name = "xdecor:cauldron_empty", param2 = node.param2 })
|
||||
else
|
||||
signs_bot.bot_inv_put_item(base_pos, itemslot, item)
|
||||
return signs_bot.ERROR, S("Error: No inventory space for full bowl")
|
||||
end
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
||||
local CMD_WATER = [[
|
||||
dig_sign 1
|
||||
move
|
||||
take_water 1
|
||||
backward
|
||||
place_sign 1
|
||||
turn_around
|
||||
]]
|
||||
|
||||
local CMD_SOUP = [[
|
||||
dig_sign 1
|
||||
move 2
|
||||
fill_cauldron 1
|
||||
flame_on
|
||||
pause 11
|
||||
move_up
|
||||
drop_items 1 2
|
||||
drop_items 1 3
|
||||
move_down
|
||||
pause 6
|
||||
take_soup 4
|
||||
flame_off
|
||||
backward
|
||||
backward
|
||||
place_sign 1
|
||||
turn_around
|
||||
]]
|
||||
|
||||
signs_bot.register_sign({
|
||||
name = "water",
|
||||
description = S('Sign "take water"'),
|
||||
commands = CMD_WATER,
|
||||
image = "signs_bot_sign_water.png",
|
||||
})
|
||||
|
||||
|
||||
signs_bot.register_sign({
|
||||
name = "soup",
|
||||
description = S('Sign "cook soup"'),
|
||||
commands = CMD_SOUP,
|
||||
image = "signs_bot_sign_soup.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "signs_bot:water",
|
||||
recipe = {
|
||||
{"group:wood", "bucket:bucket_empty", "group:wood"},
|
||||
{"dye:black", "default:stick", "dye:yellow"},
|
||||
{"dye:blue", "", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "signs_bot:soup",
|
||||
recipe = {
|
||||
{"group:wood", "xdecor:bowl", "group:wood"},
|
||||
{"dye:black", "default:stick", "dye:yellow"},
|
||||
{"dye:orange", "", ""}
|
||||
}
|
||||
})
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
doc.add_entry("signs_bot", "water", {
|
||||
name = S("Sign 'take water'"),
|
||||
data = {
|
||||
item = "signs_bot:water",
|
||||
text = table.concat({
|
||||
S("Used to take water into bucket."),
|
||||
S("Place the sign on a shore, in front of the still water pool."),
|
||||
S("Items in slots:"),
|
||||
S(" 1 - empty bucket"),
|
||||
S("The result is one bucket with water in selected inventory slot."),
|
||||
S("When finished, the bot turns around."),
|
||||
}, "\n")
|
||||
},
|
||||
})
|
||||
doc.add_entry("signs_bot", "soup", {
|
||||
name = S("Sign 'cook soup'"),
|
||||
data = {
|
||||
item = "signs_bot:soup",
|
||||
text = table.concat({
|
||||
S("Used to cook a vegetable soup in cauldron."),
|
||||
S("Cauldon should be empty and located above flammable material."),
|
||||
S("Place the sign in front of the cauldron with one field space,"),
|
||||
S("to prevent wooden sign from catching fire."),
|
||||
S("Items in slots:"),
|
||||
S(" 1 - water bucket"),
|
||||
S(" 2 - vegetable #1 (i.e. tomato)"),
|
||||
S(" 3 - vegetable #2 (i.e. carrot)"),
|
||||
S(" 4 - empty bowl (from farming or xdecor mods)"),
|
||||
S("The result is one bowl with vegetable soup in selected inventory slot."),
|
||||
S("When finished, the bot turns around."),
|
||||
}, "\n")
|
||||
},
|
||||
})
|
||||
end
|
98
signs_bot/cmd_trees.lua
Normal file
@ -0,0 +1,98 @@
|
||||
--[[
|
||||
|
||||
Signs Bot
|
||||
=========
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Bot tree cutting signs
|
||||
]]--
|
||||
|
||||
-- Load support for I18n.
|
||||
local S = signs_bot.S
|
||||
|
||||
local CMNDS = [[-- Harvest pine/aspen trunks v1.0
|
||||
|
||||
-- Take dirt and saplings from chest
|
||||
dig_sign 1
|
||||
move 1
|
||||
turn_right
|
||||
take_item 99 0
|
||||
take_item 99 0
|
||||
|
||||
-- Goto trunk
|
||||
turn_left
|
||||
dig_front 0 0
|
||||
move 1
|
||||
|
||||
-- Climb up
|
||||
repeat 10
|
||||
dig_above 0
|
||||
move_up
|
||||
place_below 1
|
||||
end
|
||||
|
||||
-- Climb down
|
||||
repeat 10
|
||||
dig_below 1
|
||||
move_down
|
||||
end
|
||||
|
||||
-- Pickup saplings
|
||||
repeat 4
|
||||
pickup_items 2
|
||||
turn_left
|
||||
end
|
||||
|
||||
-- Return dirt and saplings to chest
|
||||
backward
|
||||
plant_sapling 2
|
||||
turn_right
|
||||
add_item 99 1
|
||||
add_item 99 2
|
||||
|
||||
-- Finish
|
||||
turn_left
|
||||
backward
|
||||
place_sign 1
|
||||
turn_around]]
|
||||
|
||||
local HELP = table.concat({
|
||||
S("Used to harvest an aspen or pine tree trunk"),
|
||||
S("- Place the sign in front of the tree."),
|
||||
S("- Place a chest to the right of the sign."),
|
||||
S("- Put a dirt stack (10 items min.) into the chest."),
|
||||
S("- Preconfigure slot 1 of the bot inventory with dirt"),
|
||||
S("- Preconfigure slot 2 of the bot inventory with saplings"),
|
||||
}, "\n")
|
||||
|
||||
|
||||
signs_bot.register_signXL({
|
||||
name = "aspen",
|
||||
description = S('Sign "aspen"'),
|
||||
help_text = HELP,
|
||||
commands = CMNDS,
|
||||
image = "signs_bot_sign_aspen.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "signs_bot:aspen 2",
|
||||
recipe = {
|
||||
{"group:wood", "default:stick", "group:wood"},
|
||||
{"dye:black", "default:stick", "dye:yellow"},
|
||||
{"dye:grey", "default:aspen_sapling", ""}
|
||||
}
|
||||
})
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
doc.add_entry("signs_bot", "aspen", {
|
||||
name = S("Sign 'aspen'"),
|
||||
data = {
|
||||
item = "signs_bot:aspen",
|
||||
text = HELP .. "\n",
|
||||
},
|
||||
})
|
||||
end
|
@ -63,38 +63,44 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
local function get_template_data(stack)
|
||||
local name = stack:get_name()
|
||||
local data = stack:get_meta():to_table().fields
|
||||
|
||||
if name == "default:sign_user" or name == "signs_bot:sign_cmnd" then
|
||||
return data.description, data.cmnd
|
||||
end
|
||||
if name == "default:book_written" then
|
||||
return data.title, data.text
|
||||
end
|
||||
end
|
||||
|
||||
local function get_dest_item(stack)
|
||||
local name = stack:get_name()
|
||||
if name == "signs_bot:sign_blank" or name == "signs_bot:sign_user" then
|
||||
return ItemStack("signs_bot:sign_user")
|
||||
end
|
||||
if name == "signs_bot:sign_cmnd" then
|
||||
return ItemStack("signs_bot:sign_cmnd")
|
||||
end
|
||||
end
|
||||
|
||||
local function move_to_output(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local inp_stack = inv:get_stack("inp", 1)
|
||||
local temp_stack = inv:get_stack("temp", 1)
|
||||
local outp_stack = inv:get_stack("outp", 1)
|
||||
local dest_item = get_dest_item(inp_stack)
|
||||
local descr, cmnd = get_template_data(temp_stack)
|
||||
|
||||
if (inp_stack:get_name() == "signs_bot:sign_blank"
|
||||
or inp_stack:get_name() == "signs_bot:sign_user")
|
||||
and temp_stack:get_name() == "signs_bot:sign_cmnd"
|
||||
and outp_stack:get_name() == "" then
|
||||
local stack = ItemStack("signs_bot:sign_user")
|
||||
stack:set_count(inp_stack:get_count())
|
||||
local meta = stack:get_meta()
|
||||
local temp_meta = temp_stack:get_meta()
|
||||
meta:set_string("cmnd", temp_meta:get_string("cmnd"))
|
||||
meta:set_string("description", temp_meta:get_string("description"))
|
||||
if dest_item and descr then
|
||||
dest_item:set_count(inp_stack:get_count())
|
||||
local meta = dest_item:get_meta()
|
||||
meta:set_string("description", descr)
|
||||
meta:set_string("cmnd", cmnd)
|
||||
inp_stack:clear()
|
||||
inv:set_stack("inp", 1, inp_stack)
|
||||
inv:set_stack("outp", 1, stack)
|
||||
elseif (inp_stack:get_name() == "signs_bot:sign_blank"
|
||||
or inp_stack:get_name() == "signs_bot:sign_user")
|
||||
and temp_stack:get_name() == "default:book_written"
|
||||
and outp_stack:get_name() == "" then
|
||||
local stack = ItemStack("signs_bot:sign_user")
|
||||
stack:set_count(inp_stack:get_count())
|
||||
local meta = stack:get_meta()
|
||||
local temp_data = temp_stack:get_meta():to_table().fields
|
||||
meta:set_string("cmnd", temp_data.text)
|
||||
meta:set_string("description", temp_data.title)
|
||||
inp_stack:clear()
|
||||
inv:set_stack("inp", 1, inp_stack)
|
||||
inv:set_stack("outp", 1, stack)
|
||||
inv:set_stack("outp", 1, dest_item)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
signs_bot = {}
|
||||
|
||||
-- Version for compatibility checks, see readme.md/history
|
||||
signs_bot.version = 1.08
|
||||
signs_bot.version = 1.09
|
||||
|
||||
-- Test for MT 5.4 new string mode
|
||||
signs_bot.CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
|
||||
@ -52,6 +52,8 @@ dofile(MP.."/cmd_sign.lua")
|
||||
dofile(MP.."/cmd_pattern.lua")
|
||||
dofile(MP.."/cmd_farming.lua")
|
||||
dofile(MP.."/cmd_flowers.lua")
|
||||
dofile(MP.."/cmd_soup.lua")
|
||||
dofile(MP.."/cmd_trees.lua")
|
||||
|
||||
dofile(MP.."/signal.lua")
|
||||
dofile(MP.."/extender.lua")
|
||||
|
@ -5,7 +5,6 @@
|
||||
### basis.lua ###
|
||||
|
||||
running=läuft
|
||||
charging=aufladen
|
||||
stopped=gestoppt
|
||||
Off=Aus
|
||||
On=An
|
||||
@ -15,7 +14,6 @@ Config=Konfig.
|
||||
Preassign slots items=Vorbelegungen
|
||||
Back=Zurück
|
||||
Robot Box=Roboterbox
|
||||
no power=kein Strom
|
||||
Signs Bot Box=Roboter Box
|
||||
The Box is the housing of the bot.=Die Box ist das Gehäuse des Roboters.
|
||||
Place the box and start the bot by means of the 'On' button.=Platziere die Box und starte den Roboter über den "An" Button.
|
||||
@ -43,6 +41,11 @@ 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 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: Connected with=Wagen Sensor: Verbunden mit
|
||||
@ -51,11 +54,6 @@ 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 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 ###
|
||||
|
||||
Signs:=Zeichen:
|
||||
@ -87,12 +85,6 @@ 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.
|
||||
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_farming.lua ###
|
||||
### cmd_flowers.lua ###
|
||||
|
||||
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.
|
||||
|
||||
### 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.
|
||||
@ -100,6 +92,12 @@ 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 ###
|
||||
|
||||
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.
|
||||
|
||||
### 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
|
||||
@ -139,7 +137,6 @@ Use the pattern sign to mark the pattern.=Benutze das Vorlage-Zeichen und die Vo
|
||||
|
||||
### cmd_place.lua ###
|
||||
|
||||
Error: Position protected=Fehler: Position geschützt
|
||||
Place a block in front of the robot@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=Setze einen Block vor den Roboter.@n<slot> ist die Position im@neigenen Inventar (1--8).@nFür <lvl> ist zulässig: -1 0 +1
|
||||
Place a block on the left side@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=Setze einen Block links vorne.@n<slot> ist die Position im@neigenen Inventar (1--8).@nFür <lvl> ist zulässig: -1 0 +1
|
||||
Place a block on the right side@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=Setze einen Block rechts vorne.@n<slot> ist die Position im@neigenen Inventar (1--8).@nFür <lvl> ist zulässig: -1 0 +1
|
||||
@ -179,6 +176,64 @@ The 'command' sign can be programmed by the player.=Das 'Kommando' Zeichen kann
|
||||
Place the sign in front of you and use the node menu to program your sequence of bot commands.=Platziere das Zeichen vor dir und nutze das Zeichen-Menü, um die Kommando-Sequenz zu programmieren.
|
||||
The menu has an edit field for your commands and a help page with all available commands.=Das Menü hat ein Eingabefeld für deine Kommandos und eine Hilfeseite zu allen Kommandos.
|
||||
|
||||
### cmd_soup.lua ###
|
||||
|
||||
Take water into empty bucket when standing on a shore@n(use specified slot number or 0 for auto selection)=Schöpfe Wasser mit einen leeren Eimer.@nDer Bot muss dazu am Wasser stehen. (verwende die Slot-Nummer@ndes Eimers oder 0 für eine automatische Auswahl)
|
||||
Error: No still water around=Fehler: Kein stilles Wasser in der Nähe
|
||||
Error: No empty bucket in inventory=Fehler: Kein leerer Eimer im Inventar
|
||||
Error: No empty bucket in inventory slot =Fehler: Kein leerer Eimer in der Inventar Position
|
||||
Error: No inventory space for full bucket=Fehler: Kein freier Inventarplatz für den vollen Eimer
|
||||
Pour water from bucket to empty cauldron in front of a robot@n(use specified slot number or 0 for auto selection)=Gieße das Wasser aus dem Eimer in einen leeren Kessel (xdecor) vor dem Roboter@n(verwende die Slot-Nummer des Eimers oder 0 für eine automatische Auswahl)
|
||||
Error: No empty cauldron in front of a robot=Fehler: Kein leerer Kessel vor dem Roboter
|
||||
Error: No full bucket in inventory=Fehler: Kein voller Eimer im Inventar
|
||||
Error: No full bucket in inventory slot =Fehler: Kein voller Eimer an der Inventarposition
|
||||
Error: No inventory space for empty bucket=Fehler: Kein Platz im Inventar für den leeren Eimer
|
||||
Set fire under cauldron (requires flammable material)@n(command is ignored when fire is already burning)=Mache Feuer unter dem Kessel (benötigt brennbares Material)@n(Befehl wird ignoriert, wenn Feuer bereits brennt)
|
||||
Error: No cauldron in front of a robot=Fehler: Kein Kessel vor dem Roboter
|
||||
Error: No space for fire under cauldron=Fehler: Kein Platz für das Feuer unter dem Kessel
|
||||
Error: No flammable material under cauldron=Fehler: Kein brennbares Material unter dem Kessel
|
||||
Put out (extinguish) fire under cauldron@n(command is ignored when there is no fire)=Das Feuer löschen unter dem Kessel@n(Befehl wird ignoriert, wenn kein Feuer vorhanden ist)
|
||||
Take boiling soup into empty bowl from cauldron@nin front of a robot@n(use specified slot number or 0 for auto selection)=Die kochende Suppe aus im Kessel in eine leere Schüssel tun.@n(verwende die Slot-Nummer der Schüssel oder 0 für eine automatische Auswahl)
|
||||
Error: No cauldron with a soup in front of a robot=Fehler: Kein Kessel mit Suppe vor dem Roboter
|
||||
Error: No empty bowl in inventory=Fehler: Keine leere Schüssel im Inventar
|
||||
Error: No empty bowl in inventory slot =Fehler: Keine leere Schüssel in der angegebenen Inventarposition
|
||||
Error: No inventory space for full bowl=Fehler: Kein Platz im Inventar für die Schüssel
|
||||
Sign "take water"=Zeichen "Schöpfe Wasser"
|
||||
Sign "cook soup"=Zeichen "Koche Suppe"
|
||||
Sign 'take water'=Zeichen 'Schöpfe Wasser'
|
||||
Used to take water into bucket.=Wird verwendet, um Wasser in den Eimer zu schöpfen.
|
||||
Place the sign on a shore, in front of the still water pool.=Platziere das Schild am Ufer des Wassers
|
||||
Items in slots:=Gegenstände im Inventar:
|
||||
1 - empty bucket= 1 - leerer Eimer
|
||||
The result is one bucket with water in selected inventory slot.=Das Ergebnis ist ein Eimer mit Wasser an der ausgewählten Inventarposition.
|
||||
When finished, the bot turns around.=Wenn er fertig ist, dreht sich der Bot um.
|
||||
Sign 'cook soup'=Zeichen 'Koche Suppe'
|
||||
Used to cook a vegetable soup in cauldron.=Wird verwendet, um eine vegetarische Suppe im Kessel zu kochen.
|
||||
Cauldon should be empty and located above flammable material.=Der Kessel sollte leer sein und sich über brennbarem Material befinden.
|
||||
Place the sign in front of the cauldron with one field space,=Platziere das Schild vor dem Kessel mit einem Feld Abstand,
|
||||
to prevent wooden sign from catching fire.=um zu verhindern, dass das Holzschild Feuer fängt.
|
||||
1 - water bucket= 2 - Wassereimer
|
||||
2 - vegetable #1 (i.e. tomato)= 2 - Gemüse #1 (bspw. Tomate)
|
||||
3 - vegetable #2 (i.e. carrot)= 3 - Gemüse #2 (bspw. Zwiebel)
|
||||
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.
|
||||
|
||||
### cmd_soup.lua ###
|
||||
### cmd_place.lua ###
|
||||
|
||||
Error: Position protected=Fehler: Position geschützt
|
||||
|
||||
### cmd_trees.lua ###
|
||||
|
||||
Used to harvest an aspen or pine tree trunk=Wird verwendet, um einen Espen- oder Kiefernstamm zu ernten
|
||||
- Place the sign in front of the tree.=- Setze das Zeichen vor den Baum.
|
||||
- Place a chest to the right of the sign.=- Setze eine Kiste rechts neben das Zeichen.
|
||||
- Put a dirt stack (10 items min.) into the chest.=- Lege einen Stapel (>10) Erde (dirt) in die Kiste.
|
||||
- Preconfigure slot 1 of the bot inventory with dirt=Pos. 1 des Bot-Inventars mit Erde (dirt) vorkonfigurieren
|
||||
- Preconfigure slot 2 of the bot inventory with saplings=Pos. 2 des Bot-Inventars mit einem Setzling vorkonfigurieren
|
||||
Sign "aspen"=Zeichen "Espe"
|
||||
Sign 'aspen'=Zeichen 'Espe'
|
||||
|
||||
### commands.lua ###
|
||||
|
||||
commands:=Kommandos:
|
||||
@ -345,6 +400,11 @@ inputs=Eingängen
|
||||
Signal AND=Signal UND
|
||||
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: Connected with =Block Sensor: Verbunden mit
|
||||
@ -363,6 +423,8 @@ The sensor has an active side (red) that must point to the observed area.=Der Se
|
||||
|
||||
### signs.lua ###
|
||||
|
||||
Instructions:=Anweisungen:
|
||||
Code=Code
|
||||
Sign "turn right"=Zeichen "rechts drehen"
|
||||
Sign "turn left"=Zeichen "links drehen"
|
||||
Sign "take item"=Zeichen "Nehme Gegenstand"
|
||||
@ -382,11 +444,17 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t
|
||||
|
||||
### techage.lua ###
|
||||
|
||||
no power=kein Strom
|
||||
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)
|
||||
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
|
||||
|
||||
### techage.lua ###
|
||||
### basis.lua ###
|
||||
|
||||
charging=aufladen
|
||||
|
||||
### timer.lua ###
|
||||
|
||||
Bot Timer=Roboter Timer
|
||||
@ -400,14 +468,6 @@ Can be programmed with a time in seconds, e.g. to start the bot cyclically.=Kann
|
||||
|
||||
Start=Start
|
||||
|
||||
### timer.lua ###
|
||||
### logic_and.lua ###
|
||||
|
||||
Connected with=Verbunden mit
|
||||
|
||||
### tool.lua ###
|
||||
|
||||
Sensor Connection Tool=Sensor Verbindungswerkzeug
|
||||
|
||||
|
||||
##### not used anymore #####
|
||||
|
@ -5,7 +5,6 @@
|
||||
### basis.lua ###
|
||||
|
||||
running=
|
||||
charging=
|
||||
stopped=
|
||||
Off=
|
||||
On=
|
||||
@ -15,7 +14,6 @@ Config=
|
||||
Preassign slots items=
|
||||
Back=
|
||||
Robot Box=
|
||||
no power=
|
||||
Signs Bot Box=
|
||||
The Box is the housing of the bot.=
|
||||
Place the box and start the bot by means of the 'On' button.=
|
||||
@ -43,6 +41,11 @@ Bot Sensor: Not connected=
|
||||
The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=
|
||||
The sensor direction does not care.=
|
||||
|
||||
### bot_sensor.lua ###
|
||||
### cart_sensor.lua ###
|
||||
|
||||
the sensor range is one node/meter.=
|
||||
|
||||
### cart_sensor.lua ###
|
||||
|
||||
Cart Sensor: Connected with=
|
||||
@ -51,11 +54,6 @@ Cart Sensor: Not connected=
|
||||
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.=
|
||||
|
||||
### cart_sensor.lua ###
|
||||
### bot_sensor.lua ###
|
||||
|
||||
the sensor range is one node/meter.=
|
||||
|
||||
### changer.lua ###
|
||||
|
||||
Signs:=
|
||||
@ -87,12 +85,6 @@ Sign 'farming'=
|
||||
Used to harvest and seed a 3x3 field.=
|
||||
The seed to be placed has to be in the first inventory slot of the bot.=
|
||||
|
||||
### cmd_farming.lua ###
|
||||
### cmd_flowers.lua ###
|
||||
|
||||
Place the sign in front of the field.=
|
||||
When finished, the bot turns.=
|
||||
|
||||
### cmd_flowers.lua ###
|
||||
|
||||
Cutting flowers, leaves and tree blocks@nin front of the robot@non a 3x3 field.=
|
||||
@ -100,6 +92,12 @@ Sign "flowers"=
|
||||
Sign 'flowers'=
|
||||
Used to cut flowers on a 3x3 field.=
|
||||
|
||||
### cmd_flowers.lua ###
|
||||
### cmd_farming.lua ###
|
||||
|
||||
Place the sign in front of the field.=
|
||||
When finished, the bot turns.=
|
||||
|
||||
### 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=
|
||||
@ -139,7 +137,6 @@ Use the pattern sign to mark the pattern.=
|
||||
|
||||
### cmd_place.lua ###
|
||||
|
||||
Error: Position protected=
|
||||
Place a block in front of the robot@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=
|
||||
Place a block on the left side@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=
|
||||
Place a block on the right side@n<slot> is the inventory slot (1..8)@n<lvl> is one of: -1 0 +1=
|
||||
@ -179,6 +176,64 @@ The 'command' sign can be programmed by the player.=
|
||||
Place the sign in front of you and use the node menu to program your sequence of bot commands.=
|
||||
The menu has an edit field for your commands and a help page with all available commands.=
|
||||
|
||||
### cmd_soup.lua ###
|
||||
|
||||
Take water into empty bucket when standing on a shore@n(use specified slot number or 0 for auto selection)=
|
||||
Error: No still water around=
|
||||
Error: No empty bucket in inventory=
|
||||
Error: No empty bucket in inventory slot =
|
||||
Error: No inventory space for full bucket=
|
||||
Pour water from bucket to empty cauldron in front of a robot@n(use specified slot number or 0 for auto selection)=
|
||||
Error: No empty cauldron in front of a robot=
|
||||
Error: No full bucket in inventory=
|
||||
Error: No full bucket in inventory slot =
|
||||
Error: No inventory space for empty bucket=
|
||||
Set fire under cauldron (requires flammable material)@n(command is ignored when fire is already burning)=
|
||||
Error: No cauldron in front of a robot=
|
||||
Error: No space for fire under cauldron=
|
||||
Error: No flammable material under cauldron=
|
||||
Put out (extinguish) fire under cauldron@n(command is ignored when there is no fire)=
|
||||
Take boiling soup into empty bowl from cauldron@nin front of a robot@n(use specified slot number or 0 for auto selection)=
|
||||
Error: No cauldron with a soup in front of a robot=
|
||||
Error: No empty bowl in inventory=
|
||||
Error: No empty bowl in inventory slot =
|
||||
Error: No inventory space for full bowl=
|
||||
Sign "take water"=
|
||||
Sign "cook soup"=
|
||||
Sign 'take water'=
|
||||
Used to take water into bucket.=
|
||||
Place the sign on a shore, in front of the still water pool.=
|
||||
Items in slots:=
|
||||
1 - empty bucket=
|
||||
The result is one bucket with water in selected inventory slot.=
|
||||
When finished, the bot turns around.=
|
||||
Sign 'cook soup'=
|
||||
Used to cook a vegetable soup in cauldron.=
|
||||
Cauldon should be empty and located above flammable material.=
|
||||
Place the sign in front of the cauldron with one field space,=
|
||||
to prevent wooden sign from catching fire.=
|
||||
1 - water bucket=
|
||||
2 - vegetable #1 (i.e. tomato)=
|
||||
3 - vegetable #2 (i.e. carrot)=
|
||||
4 - empty bowl (from farming or xdecor mods)=
|
||||
The result is one bowl with vegetable soup in selected inventory slot.=
|
||||
|
||||
### cmd_soup.lua ###
|
||||
### cmd_place.lua ###
|
||||
|
||||
Error: Position protected=
|
||||
|
||||
### cmd_trees.lua ###
|
||||
|
||||
Used to harvest an aspen or pine tree trunk=
|
||||
- Place the sign in front of the tree.=
|
||||
- Place a chest to the right of the sign.=
|
||||
- Put a dirt stack (10 items min.) into the chest.=
|
||||
- Preconfigure slot 1 of the bot inventory with dirt=
|
||||
- Preconfigure slot 2 of the bot inventory with saplings=
|
||||
Sign "aspen"=
|
||||
Sign 'aspen'=
|
||||
|
||||
### commands.lua ###
|
||||
|
||||
commands:=
|
||||
@ -345,6 +400,11 @@ inputs=
|
||||
Signal AND=
|
||||
Signal is sent, if all input signals are received.=
|
||||
|
||||
### logic_and.lua ###
|
||||
### timer.lua ###
|
||||
|
||||
Connected with=
|
||||
|
||||
### node_sensor.lua ###
|
||||
|
||||
Node Sensor: Connected with =
|
||||
@ -363,6 +423,8 @@ The sensor has an active side (red) that must point to the observed area.=
|
||||
|
||||
### signs.lua ###
|
||||
|
||||
Instructions:=
|
||||
Code=
|
||||
Sign "turn right"=
|
||||
Sign "turn left"=
|
||||
Sign "take item"=
|
||||
@ -382,11 +444,17 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t
|
||||
|
||||
### techage.lua ###
|
||||
|
||||
no power=
|
||||
Ignite the techage charcoal lighter=
|
||||
Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=
|
||||
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=
|
||||
|
||||
### techage.lua ###
|
||||
### basis.lua ###
|
||||
|
||||
charging=
|
||||
|
||||
### timer.lua ###
|
||||
|
||||
Bot Timer=
|
||||
@ -400,11 +468,6 @@ Can be programmed with a time in seconds, e.g. to start the bot cyclically.=
|
||||
|
||||
Start=
|
||||
|
||||
### timer.lua ###
|
||||
### logic_and.lua ###
|
||||
|
||||
Connected with=
|
||||
|
||||
### tool.lua ###
|
||||
|
||||
Sensor Connection Tool=
|
||||
|
@ -1,4 +1,4 @@
|
||||
name=signs_bot
|
||||
depends = default,farming,basic_materials,tubelib2
|
||||
optional_depends = node_io,techage,doc,minecart
|
||||
description = A robot controlled by signs
|
||||
optional_depends = node_io,techage,doc,minecart,bucket,fire,xdecor
|
||||
description = A robot controlled by signs
|
||||
|
@ -24,6 +24,18 @@ local function formspec(cmnd)
|
||||
"label[0.2,0;"..cmnd.."]"
|
||||
end
|
||||
|
||||
local function formspecXL(help_text, bot_cmnds)
|
||||
help_text = help_text or "no help"
|
||||
bot_cmnds = minetest.formspec_escape(bot_cmnds)
|
||||
return "size[9,8]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"label[0,0;" .. S("Instructions:") .. "]" ..
|
||||
"label[0.2,0.6;" .. help_text .. "]" ..
|
||||
"textarea[0.3,4.0;9,4.9;code;" .. S("Code") .. ":;" .. bot_cmnds .. "]"
|
||||
end
|
||||
|
||||
local function register_sign(def)
|
||||
minetest.register_node("signs_bot:"..def.name, {
|
||||
description = def.description,
|
||||
@ -61,7 +73,45 @@ local function register_sign(def)
|
||||
})
|
||||
end
|
||||
|
||||
local function register_signXL(def)
|
||||
minetest.register_node("signs_bot:"..def.name, {
|
||||
description = def.description,
|
||||
inventory_image = def.image,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -1/16, -8/16, -1/16, 1/16, 4/16, 1/16},
|
||||
{ -6/16, -5/16, -2/16, 6/16, 3/16, -1/16},
|
||||
},
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png^"..def.image,
|
||||
},
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("signs_bot_cmnd", def.commands)
|
||||
meta:set_string("formspec", formspecXL(def.help_text, def.commands))
|
||||
meta:set_string("infotext", def.description)
|
||||
end,
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype = "light",
|
||||
use_texture_alpha = signs_bot.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, sign_bot_sign = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
signs_bot.register_sign = register_sign
|
||||
signs_bot.register_signXL = register_signXL
|
||||
|
||||
|
||||
|
||||
|
@ -167,9 +167,9 @@ send_cmnd 3465 pull*default:dirt*2]]),
|
||||
command = command:gsub("*", " ")
|
||||
address = tostring(tonumber(address))
|
||||
local meta = minetest.get_meta(base_pos)
|
||||
local number = meta:get_int("number") or 0
|
||||
local number = tostring(meta:get_int("number") or 0)
|
||||
local topic, payload = unpack(string.split(command, " ", false, 1))
|
||||
techage.send_multi(number, address, topic, payload)
|
||||
techage.send_single(number, address, topic, payload)
|
||||
return signs_bot.DONE
|
||||
end,
|
||||
})
|
||||
|
@ -1,16 +0,0 @@
|
||||
import os, fnmatch
|
||||
|
||||
|
||||
print ">>> Convert"
|
||||
for filename in os.listdir("./"):
|
||||
if fnmatch.fnmatch(filename, "*.png"):
|
||||
print(filename)
|
||||
os.system("pngquant --skip-if-larger --quality=8-32 --output ./%s.new ./%s" % (filename, filename))
|
||||
|
||||
print "\n>>> Copy"
|
||||
for filename in os.listdir("./"):
|
||||
if fnmatch.fnmatch(filename, "*.new"):
|
||||
print(filename)
|
||||
os.remove("./" + filename[:-4])
|
||||
os.rename("./" + filename, "./" + filename[:-4])
|
||||
|
2
signs_bot/textures/shrink.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
pngquant --skip-if-larger --quality=80 --strip *.png --ext .png --force
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 602 B After Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 897 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 388 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 113 B |
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 188 B |
BIN
signs_bot/textures/signs_bot_sign_aspen.png
Normal file
After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 197 B |
BIN
signs_bot/textures/signs_bot_sign_soup.png
Normal file
After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 174 B |
BIN
signs_bot/textures/signs_bot_sign_water.png
Normal file
After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 865 B After Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 179 B |
@ -102,7 +102,7 @@ for _, size in ipairs(SIZES) do
|
||||
physical = false,
|
||||
collide_with_objects = false,
|
||||
pointable = false,
|
||||
static_save = false,
|
||||
static_save = true,
|
||||
visual_size = {x = size, y = 0.05, z = 0.05},
|
||||
glow = 14,
|
||||
shaded = true,
|
||||
|
@ -130,6 +130,9 @@ end
|
||||
|
||||
local function check_TES_integrity(pos, nvm)
|
||||
nvm.ticks = (nvm.ticks or 0) + 1
|
||||
if (nvm.ticks % 5) == 0 then -- every 10 saec
|
||||
glowing(pos, nvm, (nvm.capa or 0) / (nvm.capa_max or 1) > 0.8)
|
||||
end
|
||||
if (nvm.ticks % 30) == 0 then -- every minute
|
||||
return heatexchanger1_cmnd(pos, "volume")
|
||||
end
|
||||
|
@ -87,8 +87,19 @@ local function check_num(pos, num, player_name)
|
||||
end
|
||||
end
|
||||
|
||||
local function debug(mem, text)
|
||||
mem.debug = mem.debug or {}
|
||||
if #mem.debug > 20 then
|
||||
table.remove(mem.debug, 1)
|
||||
end
|
||||
local s = string.format("%.3f", techage.SystemTime) .. " s: " .. text
|
||||
table.insert(mem.debug, s)
|
||||
end
|
||||
|
||||
local function send(pos, num, val)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
debug(mem, "(outp) " .. num .. " = " .. val)
|
||||
|
||||
if num == "me" then
|
||||
nvm.outp_tbl = nvm.outp_tbl or {}
|
||||
@ -242,7 +253,7 @@ local function formspec(pos, meta)
|
||||
local inputs, outputs = data(nvm)
|
||||
local bt = nvm.blocking_time or 1
|
||||
return "size[10,8.2]" ..
|
||||
"tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help")..";1;;true]" ..
|
||||
"tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";1;;true]" ..
|
||||
"container[0.4,0.1]" ..
|
||||
rules(meta) ..
|
||||
"container_end[]" ..
|
||||
@ -263,10 +274,20 @@ end
|
||||
|
||||
local function formspec_help()
|
||||
return "size[10,8.2]" ..
|
||||
"tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help")..";2;;true]" ..
|
||||
"tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";2;;true]" ..
|
||||
"textarea[0.3,0.3;9.9,8.5;;;"..minetest.formspec_escape(HELP).."]"
|
||||
end
|
||||
|
||||
local function formspec_debug(mem)
|
||||
mem.debug = mem.debug or {}
|
||||
local s = table.concat(mem.debug, "\n")
|
||||
return "size[10,8.2]" ..
|
||||
"tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";3;;true]" ..
|
||||
"textarea[0.3,0.3;9.9,8.5;;;"..minetest.formspec_escape(s).."]" ..
|
||||
"button[1.5,7.5;3,1;update2;" .. S("Update") .. "]" ..
|
||||
"button[5.6,7.5;3,1;clear;" .. S("Clear") .. "]"
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta3_logic2", {
|
||||
description = S("TA3 Logic Block"),
|
||||
tiles = {
|
||||
@ -302,10 +323,20 @@ minetest.register_node("techage:ta3_logic2", {
|
||||
nvm.blocking_time = tonumber(fields.bt) or 0.1
|
||||
nvm.inp_tbl = {me = "off"}
|
||||
nvm.outp_tbl = {}
|
||||
elseif fields.update2 then
|
||||
local mem = techage.get_mem(pos)
|
||||
meta:set_string("formspec", formspec_debug(mem))
|
||||
elseif fields.clear then
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.debug = {}
|
||||
meta:set_string("formspec", formspec_debug(mem))
|
||||
end
|
||||
|
||||
if fields.tab == "2" then
|
||||
meta:set_string("formspec", formspec_help())
|
||||
elseif fields.tab == "3" then
|
||||
local mem = techage.get_mem(pos)
|
||||
meta:set_string("formspec", formspec_debug(mem))
|
||||
else
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
@ -361,10 +392,13 @@ techage.register_node({"techage:ta3_logic2"}, {
|
||||
|
||||
if src ~= nvm.own_num then
|
||||
if topic == "on" then
|
||||
debug(mem, "(inp) " .. src .. " = on")
|
||||
nvm.inp_tbl[src] = "on"
|
||||
elseif topic == "off" then
|
||||
debug(mem, "(inp) " .. src .. " = off")
|
||||
nvm.inp_tbl[src] = "off"
|
||||
else
|
||||
debug(mem, "(inp) invalid command")
|
||||
return "unsupported"
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ local function join_to_string(tbl)
|
||||
end
|
||||
|
||||
local function reset_programmer(itemstack, user, pointed_thing)
|
||||
user:set_attribute("techage_prog_numbers", nil)
|
||||
user:get_meta():set_string("techage_prog_numbers", nil)
|
||||
minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] programmer reset"))
|
||||
return itemstack
|
||||
end
|
||||
@ -35,9 +35,9 @@ local function read_number(itemstack, user, pointed_thing)
|
||||
if pos then
|
||||
local number = techage.get_node_number(pos)
|
||||
if number then
|
||||
local numbers = minetest.deserialize(user:get_attribute("techage_prog_numbers")) or {}
|
||||
local numbers = minetest.deserialize(user:get_meta():get_string("techage_prog_numbers")) or {}
|
||||
techage.add_to_set(numbers, number)
|
||||
user:set_attribute("techage_prog_numbers", minetest.serialize(numbers))
|
||||
user:get_meta():set_string("techage_prog_numbers", minetest.serialize(numbers))
|
||||
minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] number").." "..number.." read")
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] Unknown node on").." "..minetest.pos_to_string(pos))
|
||||
@ -52,8 +52,8 @@ local function program_numbers(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.under
|
||||
if pos then
|
||||
local meta = M(pos)
|
||||
local numbers = minetest.deserialize(placer:get_attribute("techage_prog_numbers")) or {}
|
||||
placer:set_attribute("techage_prog_numbers", nil)
|
||||
local numbers = minetest.deserialize(placer:get_meta():get_string("techage_prog_numbers")) or {}
|
||||
placer:get_meta():set_string("techage_prog_numbers", nil)
|
||||
local player_name = placer:get_player_name()
|
||||
if meta and meta:get_string("owner") ~= player_name then
|
||||
minetest.chat_send_player(player_name, S("[TechAge Programmer] foreign or unknown node!"))
|
||||
|