flower command and sign added

This commit is contained in:
Joachim Stolberg 2020-03-27 18:29:40 +01:00
parent 0dcfa3de18
commit 773ac542df
10 changed files with 235 additions and 38 deletions

View File

@ -90,6 +90,7 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
pickup_items <slot> - pickup items (in a 3x3 field)
drop_items <num> <slot> - drop items
harvest - harvest a 3x3 field (farming)
cutting - cut a 3x3 flower field
sow_seed <slot> - a 3x3 field sowing / planting
plant_sapling <slot> - plant a sapling in front of the robot
pattern - save the blocks behind the shield (up to 5x3x3) as template
@ -97,7 +98,7 @@ For all Inventory commands applies: If the inventory stack specified by <slot> i
punch_cart - Punch a rail cart to start it
### License
Copyright (C) 2019 Joachim Stolberg
Copyright (C) 2019-2020 Joachim Stolberg
Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt
@ -121,4 +122,5 @@ optional: farming redo, node_io, doc, techage, minecart
- 2019-08-09 v0.12 * bug fixes
- 2019-08-14 v0.13 * Signs Bot Chest recipe added, Minecart signs added
- 2020-01-02 v1.00 * bot inventory filter added, documentation enhanced
- 2020-03-27 v1.01 * flower command and sign added

View File

@ -218,6 +218,7 @@ function signs_bot.stop_robot(base_pos, mem)
if minetest.global_exists("techage") then
minetest.get_node_timer(base_pos):start(4)
mem.charging = true
mem.power_available = false
else
minetest.get_node_timer(base_pos):stop()
mem.charging = false

123
cmd_flowers.lua Normal file
View File

@ -0,0 +1,123 @@
--[[
Signs Bot
=========
Copyright (C) 2019-2020 Joachim Stolberg
GPL v3
See LICENSE.txt for more information
Bot flower cutting command
]]--
-- for lazy programmers
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
-- Load support for intllib.
local MP = minetest.get_modpath("signs_bot")
local I,_ = dofile(MP.."/intllib.lua")
local lib = signs_bot.lib
local bot_inv_put_item = signs_bot.bot_inv_put_item
local bot_inv_take_item = signs_bot.bot_inv_take_item
local Flowers = {}
function signs_bot.register_flower(name)
Flowers[name] = true
end
minetest.after(1, function()
for name,_ in pairs(minetest.registered_decorations) do
if type(name) == "string" then
local mod = string.split(name, ":")[1]
if mod == "flowers" then
signs_bot.register_flower(name)
end
end
end
end)
local function soil_availabe(pos)
local node = minetest.get_node_or_nil(pos)
if node.name == "air" then
node = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
if node and minetest.get_item_group(node.name, "soil") >= 1 then
return true
end
end
return false
end
local function harvesting(base_pos, mem)
local pos = mem.pos_tbl and mem.pos_tbl[mem.steps]
mem.steps = (mem.steps or 1) + 1
if pos and lib.not_protected(base_pos, pos) then
local node = minetest.get_node_or_nil(pos)
if Flowers[node.name] then
minetest.remove_node(pos)
bot_inv_put_item(base_pos, 0, ItemStack(node.name))
end
end
end
signs_bot.register_botcommand("cutting", {
mod = "farming",
params = "",
description = I("Cutting flowers\nin front of the robot\non a 3x3 field."),
cmnd = function(base_pos, mem)
if not mem.steps then
mem.pos_tbl = signs_bot.lib.gen_position_table(mem.robot_pos, mem.robot_param2, 3, 3, 0)
mem.steps = 1
end
mem.pos_tbl = mem.pos_tbl or {}
harvesting(base_pos, mem)
if mem.steps > #mem.pos_tbl then
mem.steps = nil
return lib.DONE
end
return lib.BUSY
end,
})
local CMD = [[dig_sign 1
move
cutting
backward
place_sign 1
turn_around]]
signs_bot.register_sign({
name = "flowers",
description = I('Sign "flowers"'),
commands = CMD,
image = "signs_bot_sign_flowers.png",
})
minetest.register_craft({
output = "signs_bot:flowers 2",
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:black", "default:stick", "dye:yellow"},
{"dye:red", "", ""}
}
})
if minetest.get_modpath("doc") then
doc.add_entry("signs_bot", "flowers", {
name = I("Sign 'flowers'"),
data = {
item = "signs_bot:flowers",
text = table.concat({
I("Used to cut flowers on a 3x3 field."),
I("Place the sign in front of the field."),
I("When finished, the bot turns."),
}, "\n")
},
})
end

View File

@ -30,6 +30,7 @@ dofile(MP.."/cmd_place.lua")
dofile(MP.."/cmd_sign.lua")
dofile(MP.."/cmd_pattern.lua")
dofile(MP.."/cmd_farming.lua")
dofile(MP.."/cmd_flowers.lua")
dofile(MP.."/signal.lua")
dofile(MP.."/extender.lua")

View File

@ -1,4 +1,4 @@
#!/bin/bash
../intllib/tools/xgettext.sh ./basis.lua ./bot_flap.lua ./bot_sensor.lua ./cart_sensor.lua ./changer.lua ./chest.lua ./cmd_farming.lua ./cmd_item.lua ./cmd_move.lua ./cmd_pattern.lua ./cmd_place.lua ./cmd_sign.lua ./commands.lua ./crop_sensor.lua ./doc.lua ./duplicator.lua ./extender.lua ./init.lua ./lib.lua ./node_sensor.lua ./nodes.lua ./robot.lua ./signal.lua ./signs.lua ./tool.lua ./timer.lua ./delayer.lua ./logic_and.lua
../intllib/tools/xgettext.sh ./basis.lua ./bot_flap.lua ./bot_sensor.lua ./cart_sensor.lua ./changer.lua ./chest.lua ./cmd_farming.lua ./cmd_flowers.lua ./cmd_item.lua ./cmd_move.lua ./cmd_pattern.lua ./cmd_place.lua ./cmd_sign.lua ./commands.lua ./crop_sensor.lua ./doc.lua ./duplicator.lua ./extender.lua ./init.lua ./lib.lua ./node_sensor.lua ./nodes.lua ./robot.lua ./signal.lua ./signs.lua ./tool.lua ./timer.lua ./delayer.lua ./logic_and.lua

Binary file not shown.

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-02 16:00+0100\n"
"PO-Revision-Date: 2020-02-21 22:08+0100\n"
"POT-Creation-Date: 2020-03-27 18:20+0100\n"
"PO-Revision-Date: 2020-03-27 18:24+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
@ -44,7 +44,7 @@ msgstr "Vorbelegungen"
#: basis.lua
msgid "Back"
msgstr "zurück"
msgstr "Zurück"
#: basis.lua
msgid "Robot Box "
@ -66,6 +66,10 @@ msgstr "gestoppt"
msgid "Signs Bot Box"
msgstr "Signs Bot Box"
#: basis.lua
msgid "no power"
msgstr "kein Strom"
#: basis.lua
msgid "The Box is the housing of the bot."
msgstr "Die Box ist das Gehäuse des Roboters."
@ -284,7 +288,7 @@ msgstr "Zeichen 'Farming'"
msgid "Used to harvest and seed a 3x3 field."
msgstr "Benötigt um ein 3x3 Feld zu ernten und wieder zu sähen."
#: cmd_farming.lua
#: cmd_farming.lua cmd_flowers.lua
msgid "Place the sign in front of the field."
msgstr "Platziere das Zeichen vor das Feld."
@ -294,10 +298,32 @@ msgstr ""
"Das Saatgut, dass gesät werden soll, muss sich an der 1. Position im "
"Inventar befinden."
#: cmd_farming.lua
#: cmd_farming.lua cmd_flowers.lua
msgid "When finished, the bot turns."
msgstr "Der Roboter dreht um, wenn er fertig ist."
#: cmd_flowers.lua
msgid ""
"Cutting flowers\n"
"in front of the robot\n"
"on a 3x3 field."
msgstr ""
"Schneide Blumen\n"
"in einem 3x3 großem Feld\n"
"vor dem Roboter."
#: cmd_flowers.lua
msgid "Sign \"flowers\""
msgstr "Zeichen \"Blumen\""
#: cmd_flowers.lua
msgid "Sign 'flowers'"
msgstr "Zeichen 'Blumen'"
#: cmd_flowers.lua
msgid "Used to cut flowers on a 3x3 field."
msgstr "Benötigt um ein 3x3 Blumenfeld zu ernten."
#: cmd_item.lua
msgid ""
"Take <num> items from a chest like node\n"
@ -1129,7 +1155,7 @@ msgid ""
"the bot inventory "
msgstr ""
"Wurde beim Kommando kein Slot oder Slot 0 angegeben (Fall A), werden "
"nacheinander alle"
"nacheinander alle "
#: doc.lua
msgid ""
@ -1145,7 +1171,7 @@ msgid ""
"the item, "
msgstr ""
"In beiden Fällen gilt: Ist der Slot vorkonfiguriert und passt das Item dazu, "
"oder ist der Slot"
"oder ist der Slot "
#: doc.lua
msgid ""
@ -1153,7 +1179,7 @@ msgid ""
"the item type "
msgstr ""
"nicht konfiguriert und leer, oder mit dem Item-Typ (das hinzu gefügt werden "
"soll) nur"
"soll) nur "
#: doc.lua
msgid "(which should be added), then the items are added."
@ -1287,7 +1313,7 @@ msgstr "Zeichen Kopierer"
#: duplicator.lua
msgid "Sign \"user\""
msgstr "\"Benutzer\" Zeichen"
msgstr "Zeichen \"Benutzer\""
#: duplicator.lua
msgid "Sign \"blank\""

View File

@ -3,13 +3,12 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: doc.lua
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-02 15:59+0100\n"
"PO-Revision-Date: 2019-10-10 22:40+0200\n"
"POT-Creation-Date: 2020-03-27 18:17+0100\n"
"PO-Revision-Date: 2020-03-27 18:19+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
@ -41,7 +40,7 @@ msgstr "Konfig."
#: basis.lua
msgid "Preassign slots items"
msgstr "Vorbelegte Inventar Gegenstände"
msgstr "Vorbelegungen"
#: basis.lua
msgid "Back"
@ -57,7 +56,7 @@ msgstr "läuft"
#: basis.lua
msgid "charging"
msgstr ""
msgstr "aufladen"
#: basis.lua
msgid "stopped"
@ -67,6 +66,10 @@ msgstr "gestoppt"
msgid "Signs Bot Box"
msgstr "Signs Bot Box"
#: basis.lua
msgid "no power"
msgstr "kein Strom"
#: basis.lua
msgid "The Box is the housing of the bot."
msgstr "Die Box ist das Gehäuse des Roboters."
@ -490,9 +493,8 @@ msgid "Use the pattern sign to mark the pattern."
msgstr "Benutze das Vorlage-Zeichen und die Vorlage zu markieren."
#: cmd_place.lua
#, fuzzy
msgid "Error: Position protected"
msgstr "Fehler: Die Position ist geschützt"
msgstr "Fehler: Position geschützt"
#: cmd_place.lua
msgid ""
@ -547,9 +549,8 @@ msgstr ""
"eigenen Inventar (1--8)."
#: cmd_place.lua
#, fuzzy
msgid "Error: No free inventory space"
msgstr "Fehler: Zeichen Inventar ist leer"
msgstr "Fehler: Kein freier Inventarplatz"
#: cmd_place.lua
msgid ""
@ -1087,118 +1088,138 @@ msgid ""
"The following applies to all commands that are used to place items in the "
"bot inventory, like:"
msgstr ""
"Das folgende gilt für alle Kommandos, um Items in das Roboter Inventar zu "
"legen, wie:"
#: doc.lua
msgid "- take_item <num> <slot>"
msgstr ""
msgstr "- take_item <num> <slot>"
#: doc.lua
msgid "- pickup_items <slot>"
msgstr ""
msgstr "- pickup_items <slot>"
#: doc.lua
#, fuzzy
msgid "- trash_sign <slot>"
msgstr "Vorbelegte Inventar Gegenstände"
msgstr "- trash_sign <slot>"
#: doc.lua
msgid "- harvest <slot>"
msgstr ""
msgstr "- harvest <slot>"
#: doc.lua
msgid "- dig_front <slot> <lvl>"
msgstr ""
msgstr "- dig_front <slot> <lvl>"
#: doc.lua
msgid "- dig_left <slot> <lvl>"
msgstr ""
msgstr "- dig_left <slot> <lvl>"
#: doc.lua
msgid "- dig_right <slot> <lvl>"
msgstr ""
msgstr "- dig_right <slot> <lvl>"
#: doc.lua
msgid "- dig_below <slot> <lvl>"
msgstr ""
msgstr "- dig_below <slot> <lvl>"
#: doc.lua
msgid "- dig_above <slot> <lvl>"
msgstr ""
msgstr "- dig_above <slot> <lvl>"
#: doc.lua
msgid ""
"If no slot or slot 0 was specified with the command (case A), all 8 slots of "
"the bot inventory "
msgstr ""
"Wurde beim Kommando kein Slot oder Slot 0 angegeben (Fall A), werden "
"nacheinander alle"
#: doc.lua
msgid ""
"are checked one after the other. If a slot was specified (case B), only this "
"slot is checked."
msgstr ""
"8 Slots des Bot Inventars geprüft, Wurde ein Slot angegeben (Fall B), wird "
"nur dieser geprüft."
#: doc.lua
msgid ""
"In both cases the following applies: If the slot is preconfigured and fits "
"the item, "
msgstr ""
"In beiden Fällen gilt: Ist der Slot vorkonfiguriert und passt das Item dazu, "
"oder ist der Slot"
#: doc.lua
msgid ""
"or if the slot is not configured and empty, or is only partially filled with "
"the item type "
msgstr ""
"nicht konfiguriert und leer, oder mit dem Item-Typ (das hinzu gefügt werden "
"soll) nur"
#: doc.lua
msgid "(which should be added), then the items are added."
msgstr ""
msgstr "teilweise gefüllt, dann werden die Items hinzugefügt."
#: doc.lua
msgid ""
"If not all items can be added, the remaining slots will be tried out in case "
"A."
msgstr ""
"Können nicht alle Items hinzugefügt werden, werden im Falle A die restlichen "
"Slots weiter durchprobiert."
#: doc.lua
msgid "Anything that could not be added to your own inventory goes back."
msgstr ""
msgstr "Was nicht dem eigenen Inventar hinzugefügt werden konnte, geht zurück."
#: doc.lua
msgid ""
"The following applies to all commands that are used to take items from the "
"bot inventory, like:"
msgstr ""
"Das folgende gilt für alle Kommandos, um Items aus dem Roboter Inventar zu "
"nehmen, wie:"
#: doc.lua
msgid "- add_item <num> <slot>"
msgstr ""
msgstr "- add_item <num> <slot>"
#: doc.lua
msgid ""
"It doesn't matter whether a slot is configured or not. The bot takes the "
"first stack that "
msgstr ""
"Hier ist es egal, ob ein Slot konfiguriert ist, oder nicht. Der Bot nimmt "
"den ersten Stack, den "
#: doc.lua
msgid "it can find from its own inventory and tries to use it."
msgstr ""
"er finden kann, aus dem eigenen Inventar und versucht diesen zu nutzen."
#: doc.lua
msgid ""
"If a slot is specified, it only takes this, if no slot has been specified, "
"it checks all of "
msgstr ""
"Ist ein Slot angegeben, nimmt er nur diesen, wurde kein Slot angegeben, "
"prüft er alle "
#: doc.lua
msgid ""
"them one after the other, starting from slot 1 until it finds something."
msgstr ""
"nacheinander, von Slot 1 beginnend, bis er etwas findet. Ist die gefundene "
"Anzahl kleiner als "
#: doc.lua
msgid ""
"If the number found is smaller than requested, he tries to take the rest out "
"of any slot."
msgstr ""
msgstr "gefordert, versucht er den Rest aus irgend einem Slot zu nehmen."
#: doc.lua
msgid "Signs Bot"
@ -1226,7 +1247,7 @@ msgstr "Verbinde Sensor mit Aktor"
#: doc.lua
msgid "Bot inventory behavior"
msgstr ""
msgstr "Verhalten beim Roboter Inventar"
#: duplicator.lua
msgid "Input:"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-02 16:00+0100\n"
"POT-Creation-Date: 2020-03-27 18:20+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -65,6 +65,10 @@ msgstr ""
msgid "Signs Bot Box"
msgstr ""
#: basis.lua
msgid "no power"
msgstr ""
#: basis.lua
msgid "The Box is the housing of the bot."
msgstr ""
@ -256,7 +260,7 @@ msgstr ""
msgid "Used to harvest and seed a 3x3 field."
msgstr ""
#: cmd_farming.lua
#: cmd_farming.lua cmd_flowers.lua
msgid "Place the sign in front of the field."
msgstr ""
@ -264,10 +268,29 @@ msgstr ""
msgid "The seed to be placed has to be in the first inventory slot of the bot."
msgstr ""
#: cmd_farming.lua
#: cmd_farming.lua cmd_flowers.lua
msgid "When finished, the bot turns."
msgstr ""
#: cmd_flowers.lua
msgid ""
"Cutting flowers\n"
"in front of the robot\n"
"on a 3x3 field."
msgstr ""
#: cmd_flowers.lua
msgid "Sign \"flowers\""
msgstr ""
#: cmd_flowers.lua
msgid "Sign 'flowers'"
msgstr ""
#: cmd_flowers.lua
msgid "Used to cut flowers on a 3x3 field."
msgstr ""
#: cmd_item.lua
msgid ""
"Take <num> items from a chest like node\n"

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B