minor quarry und distibutor bugfixes, quarry depth cmnd added, TA1 stone hammer added

This commit is contained in:
Joachim Stolberg 2020-06-04 18:56:10 +02:00
parent 218fd9fba5
commit 2d1afbe0d0
9 changed files with 91 additions and 14 deletions

View File

@ -264,7 +264,7 @@ local function distributing(pos, inv, crd, nvm)
end
end
if num_pushed == 0 then
if sum_num_pushed == 0 then
crd.State:blocked(pos, nvm)
else
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)

View File

@ -189,6 +189,8 @@ local function quarry_task(pos, crd, nvm)
pos1.y = y_curr
pos2.y = y_curr
nvm.level = y_first - y_curr
if minetest.is_area_protected(pos1, pos2, owner, 5) then
crd.State:fault(pos, nvm, S("area is protected"))
return
@ -215,7 +217,6 @@ local function quarry_task(pos, crd, nvm)
end
techage.unmark_position(owner)
end
nvm.level = nvm.level + 1
end
crd.State:stop(pos, nvm, S("finished"))
end
@ -348,7 +349,12 @@ local tubing = {
end
end,
on_recv_message = function(pos, src, topic, payload)
return CRD(pos).State:on_receive_message(pos, topic, payload)
if topic == "depth" then
local nvm = techage.get_nvm(pos)
return nvm.level or 0
else
return CRD(pos).State:on_receive_message(pos, topic, payload)
end
end,
on_node_load = function(pos, node)
local nvm = techage.get_nvm(pos)

View File

@ -277,7 +277,7 @@ end
function NodeStates:standby(pos, nvm, err_string)
local state = nvm.techage_state or STOPPED
if state == RUNNING then
if state == RUNNING or state == BLOCKED then
nvm.techage_state = STANDBY
if self.node_name_passive then
swap_node(pos, self.node_name_passive)

View File

@ -210,3 +210,9 @@ minetest.register_craft({
},
})
minetest.register_craft({
type = "shapeless",
output = "techage:construction_board_EN",
recipe = {"techage:construction_board"},
})

View File

@ -185,7 +185,7 @@ techage.icta_register_condition("state", {
{
type = "label",
name = "lbl",
label = "Read the state from a TA3/TA4 machine.\n",
label = "Read the state of a TA3/TA4 machine.\n",
},
},
button = function(data, environ) -- default button label
@ -222,7 +222,7 @@ techage.icta_register_condition("fuel", {
{
type = "label",
name = "lbl",
label = "Read and evaluate the fuel value\nfrom a fuel consuming block.",
label = "Read and evaluate the fuel value\nof a fuel consuming block.",
},
},
button = function(data, environ)
@ -259,7 +259,7 @@ techage.icta_register_condition("load", {
{
type = "label",
name = "lbl",
label = "Read and evaluate the load (0..100)\nfrom a tank/storage block.",
label = "Read and evaluate the load (0..100)\nof a tank/storage block.",
},
},
button = function(data, environ)
@ -271,6 +271,43 @@ techage.icta_register_condition("load", {
end,
})
techage.icta_register_condition("depth", {
title = "read quarry depth",
formspec = {
{
type = "number",
name = "number",
label = "quarry number",
default = "",
},
{
type = "textlist",
name = "operand",
label = "",
choices = "greater,less",
default = "greater",
},
{
type = "digits",
name = "value",
label = "than",
default = ""
},
{
type = "label",
name = "lbl",
label = "Read and evaluate the current\ndepth of a quarry block.",
},
},
button = function(data, environ)
return 'depth('..techage.fmt_number(data.number)..","..data.operand..' '..data.value..')'
end,
code = function(data, environ)
return send_single_string(environ, data.number, "depth"),
techage.operand(data.operand)..tonumber(data.value)
end,
})
techage.icta_register_condition("delivered", {
title = "read delivered power",
formspec = {
@ -296,7 +333,7 @@ techage.icta_register_condition("delivered", {
{
type = "label",
name = "lbl",
label = "Read and evaluate the delivered\npower from a generator block.\nPower consuming blocks like accus\ncould also provide a negative value.",
label = "Read and evaluate the delivered\npower of a generator block.\nPower consuming blocks like accus\ncould also provide a negative value.",
},
},
button = function(data, environ)
@ -371,7 +408,7 @@ techage.icta_register_condition("signaltower", {
{
type = "label",
name = "lbl",
label = "Read the color state\nfrom a Signal Tower.",
label = "Read the color state\nof a Signal Tower.",
},
},
button = function(data, environ) -- default button label
@ -602,7 +639,7 @@ techage.icta_register_condition("playerdetector", {
{
type = "label",
name = "lbl",
label = "Read and check the name\nfrom a Player Detector.\nUse a '*' character for all player names.\n Use a '-' character for no player.",
label = "Read and check the name\nof a Player Detector.\nUse a '*' character for all player names.\n Use a '-' character for no player.",
},
},

BIN
images/melting_furnace.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -48,6 +48,25 @@ local function handler(player_name, node, itemstack, digparams)
end
end
minetest.register_tool("techage:hammer_stone", {
description = S("TA1 Stone Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_stone.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=6.00, [2]=2.5, [3]=1.2}, uses=30, maxlevel=2},
},
damage_groups = {fleshy=4},
},
sound = {breaks = "default_tool_breaks"},
after_use = function(itemstack, user, node, digparams)
minetest.after(0.01, handler, user:get_player_name(), node)
itemstack:add_wear(digparams.wear)
return itemstack
end,
})
minetest.register_tool("techage:hammer_bronze", {
description = S("TA1 Bronze Hammer (smash stone to gravel)"),
inventory_image = "techage_tool_hammer_bronze.png",
@ -153,6 +172,14 @@ if minetest.global_exists("wielded_light") then
})
end
minetest.register_craft({
output = "techage:hammer_stone 2",
recipe = {
{"default:cobble", "group:stick", "default:cobble"},
{"default:cobble", "group:stick", "default:cobble"},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "techage:hammer_bronze 2",
recipe = {

View File

@ -352,12 +352,13 @@ In addition to Lua standard function the Lua Controller provides the following f
| ident | returned data | comment |
| ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines |
| "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines |
| "state" | one of: "red", "amber", "green", "off" | Signal Tower state |
| "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest |
| "fuel" | number | fuel value from fuel consuming block |
| "load" | number | Read the load value in percent (0..100) from a tank/storage block, an accu block, of from the Signs Bot Box. |
| "delivered" | number | Read the current delivered power value from a generator block. A power consuming block (accu) provides a negative value |
| "fuel" | number | fuel value of a fuel consuming block |
| "depth" | number | Read the current depth value of a quarry block (1..80) |
| "load" | number | Read the load value in percent (0..100) of a tank/storage block, an accu block, of of the Signs Bot Box. |
| "delivered" | number | Read the current delivered power value of a generator block. A power consuming block (accu) provides a negative value |
| "action" | player-name, action-string | 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 |

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB