v0.08 * recipe bug fixes and prepared for techage

This commit is contained in:
Joachim Stolberg 2019-05-22 18:29:22 +02:00
parent f8b1fe0d97
commit 8aa96abfbd
11 changed files with 105 additions and 16 deletions

View File

@ -110,3 +110,4 @@ optional: farming redo
- 2019-04-14 v0.05 * timer added, user signs added, bug fixes
- 2019-04-15 v0.06 * nodes remove bugfix, punch_cart command added, cart sensor added
- 2019-04-18 v0.07 * node_io is now optional, support for MTG chests and furnace added
- 2019-05-22 v0.08 * recipe bug fixes and prepared for techage

View File

@ -24,18 +24,21 @@ local I,_ = dofile(MP.."/intllib.lua")
local lib = signs_bot.lib
local CYCLE_TIME = 1
local MAX_CAPA = 100
local function formspec(pos, mem)
mem.running = mem.running or false
local cmnd = mem.running and "stop;"..I("Off") or "start;"..I("On")
local bot = not mem.running and "image[0.5,1;1,1;signs_bot_bot_inv.png]" or ""
local bot = not mem.running and "image[0.6,1;1,1;signs_bot_bot_inv.png]" or ""
local current_capa = mem.capa or 95
return "size[9,7.6]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[2.1,0;"..I("Signs").."]label[5.3,0;"..I("Other items").."]"..
"image[0.5,1;1,1;signs_bot_form_mask.png]"..
"image[0.6,1;1,1;signs_bot_form_mask.png]"..
bot..
signs_bot.formspec_battery_capa(MAX_CAPA, current_capa)..
"label[2.1,0.5;1]label[3.1,0.5;2]label[4.1,0.5;3]"..
"list[context;sign;1.8,1;3,2;]"..
"label[2.1,3;4]label[3.1,3;5]label[4.1,3;6]"..
@ -244,12 +247,52 @@ minetest.register_node("signs_bot:box", {
})
minetest.register_craft({
output = "signs_bot:box",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"basic_materials:motor", "default:mese_crystal", "basic_materials:gear_steel"},
{"default:tin_ingot", "", "default:tin_ingot"}
}
})
if minetest.global_exists("techage") then
minetest.register_craft({
output = "signs_bot:box",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"basic_materials:motor", "techage:wlanchip", "basic_materials:gear_steel"},
{"default:tin_ingot", "", "default:tin_ingot"}
}
})
else
minetest.register_craft({
output = "signs_bot:box",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"basic_materials:motor", "default:mese_crystal", "basic_materials:gear_steel"},
{"default:tin_ingot", "", "default:tin_ingot"}
}
})
end
if minetest.global_exists("techage") then
techage.register_node("signs_bot:box", {}, {
on_pull_item = function(pos, in_dir, num)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return techage.get_items(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,
on_recv_message = function(pos, topic, payload)
if topic == "state" then
local meta = minetest.get_meta(pos)
return techage.get_inv_state(meta, "main")
else
return "unsupported"
end
end,
})
end

View File

@ -347,6 +347,6 @@ minetest.register_craft({
recipe = {
{"group:wood", "default:stick", "group:wood"},
{"dye:yellow", "default:stick", "dye:yellow"},
{"", "", ""}
{"", "dye:black", ""}
}
})

View File

@ -42,6 +42,7 @@ dofile(MP.."/crop_sensor.lua")
dofile(MP.."/cart_sensor.lua")
dofile(MP.."/chest.lua")
dofile(MP.."/legacy.lua")
dofile(MP.."/techage.lua")
dofile(MP.."/timer.lua")
dofile(MP.."/tool.lua")

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-15 20:53+0200\n"
"PO-Revision-Date: 2019-04-15 20:56+0200\n"
"PO-Revision-Date: 2019-05-22 15:05+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
@ -187,13 +187,13 @@ msgstr ""
msgid "Move the robot upwards"
msgstr ""
"Bewege den Roboter\n"
"nach unten"
"nach oben"
#: cmd_move.lua
msgid "Move the robot down"
msgstr ""
"Bewege den Roboter\n"
"nach oben."
"nach unten."
#: cmd_move.lua
msgid ""

View File

@ -1,4 +1,4 @@
name=signs_bot
depends = default,farming,basic_materials,tubelib2
optional_depends = node_io
optional_depends = node_io,techage
description = A robot controlled by signs

44
techage.lua Normal file
View File

@ -0,0 +1,44 @@
if minetest.global_exists("techage") then
signs_bot.register_inventory({"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4"}, {
allow_inventory_put = function(pos, stack, player_name)
return not minetest.is_protected(pos, player_name)
end,
allow_inventory_take = function(pos, stack, player_name)
return not minetest.is_protected(pos, player_name)
end,
put = {
listname = "main",
},
take = {
listname = "main",
},
})
signs_bot.register_inventory({"techage:meltingpot", "techage:meltingpot_active"}, {
allow_inventory_put = function(pos, stack, player_name)
return not minetest.is_protected(pos, player_name)
end,
allow_inventory_take = function(pos, stack, player_name)
return not minetest.is_protected(pos, player_name)
end,
put = {
listname = "src",
},
take = {
listname = "dst",
},
})
local function percent_value(max_val, curr_val)
return math.min(math.ceil(((curr_val or 0) * 100.0) / (max_val or 1.0)), 100)
end
function signs_bot.formspec_battery_capa(max_capa, current_capa)
local percent = percent_value(max_capa, current_capa)
return "image[0.1,1;0.5,1;signs_bot_form_level_bg.png^[lowpart:"..
percent..":signs_bot_form_level_fg.png]"
end
else
function signs_bot.formspec_battery_capa(max_capa, current_capa)
return ""
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

View File

@ -165,7 +165,7 @@ minetest.register_craft({
output = "signs_bot:timer",
recipe = {
{"", "", ""},
{"dye:black", "group:stone", "dye:yellow"},
{"dye:yellow", "group:stone", "dye:black"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}
}
})