built on 17/08/2022 14:28:55

This commit is contained in:
Joachim Stolberg 2022-08-17 14:28:55 +02:00
parent c29afcf14f
commit 641e79e084
7 changed files with 18 additions and 11 deletions

View File

@ -282,6 +282,9 @@ local tubing = {
return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload) return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload)
end end
end, end,
on_beduino_request_data = function(pos, src, topic, payload)
return CRD(pos).State:on_beduino_request_data(pos, topic, payload)
end,
} }
local node_name_ta2, node_name_ta3, node_name_ta4 = local node_name_ta2, node_name_ta3, node_name_ta4 =

View File

@ -230,6 +230,7 @@ function techage.add_node(pos, name, is_ta2)
local key = minetest.hash_node_position(pos) local key = minetest.hash_node_position(pos)
local num = NumbersToBeRecycled[key] local num = NumbersToBeRecycled[key]
if num then if num then
NodeInfoCache[num] = nil
backend.set_nodepos(num, pos) backend.set_nodepos(num, pos)
NumbersToBeRecycled[key] = nil NumbersToBeRecycled[key] = nil
return num return num

View File

@ -82,7 +82,7 @@ minetest.register_entity(":techage:region_cube", {
initial_properties = { initial_properties = {
visual = "upright_sprite", visual = "upright_sprite",
textures = {"techage_cube_mark.png"}, textures = {"techage_cube_mark.png"},
use_texture_alpha = techage.BLEND, use_texture_alpha = true,
physical = false, physical = false,
glow = 12, glow = 12,
}, },

View File

@ -70,7 +70,7 @@ minetest.register_entity(":techage:position_cube", {
"techage_cube_mark.png", "techage_cube_mark.png",
"techage_cube_mark.png", "techage_cube_mark.png",
}, },
use_texture_alpha = techage.BLEND, use_texture_alpha = true,
physical = false, physical = false,
visual_size = {x = 1.1, y = 1.1}, visual_size = {x = 1.1, y = 1.1},
collisionbox = {-0.55,-0.55,-0.55, 0.55,0.55,0.55}, collisionbox = {-0.55,-0.55,-0.55, 0.55,0.55,0.55},

View File

@ -62,6 +62,8 @@ local P = minetest.string_to_pos
local M = minetest.get_meta local M = minetest.get_meta
local N = techage.get_node_lvm local N = techage.get_node_lvm
local MAX_CYCLE_TIME = 20
-- --
-- TechAge machine states -- TechAge machine states
-- --
@ -282,6 +284,7 @@ function NodeStates:start(pos, nvm)
if self.quick_start and state == STOPPED then if self.quick_start and state == STOPPED then
self.quick_start(pos, 0) self.quick_start(pos, 0)
end end
self:trigger_state(pos, nvm)
return true return true
end end
return false return false
@ -468,7 +471,7 @@ function NodeStates:on_receive_message(pos, topic, payload)
if node.name == "ignore" then -- unloaded node? if node.name == "ignore" then -- unloaded node?
return "unloaded" return "unloaded"
elseif nvm.techage_state == RUNNING then elseif nvm.techage_state == RUNNING then
local ttl = (nvm.last_active or 0) + 2 * (self.cycle_time or 0) local ttl = (nvm.last_active or 0) + MAX_CYCLE_TIME
if ttl < minetest.get_gametime() then if ttl < minetest.get_gametime() then
return "inactive" return "inactive"
end end
@ -506,7 +509,7 @@ function NodeStates:on_beduino_request_data(pos, topic, payload)
if node.name == "ignore" then -- unloaded node? if node.name == "ignore" then -- unloaded node?
return 0, {techage.UNLOADED} return 0, {techage.UNLOADED}
elseif nvm.techage_state == RUNNING then elseif nvm.techage_state == RUNNING then
local ttl = (nvm.last_active or 0) + 2 * (self.cycle_time or 0) local ttl = (nvm.last_active or 0) + MAX_CYCLE_TIME
if ttl < minetest.get_gametime() then if ttl < minetest.get_gametime() then
return 0, {techage.INACTIVE} return 0, {techage.INACTIVE}
end end

View File

@ -97,9 +97,9 @@ local function formspec_help(meta, manual)
"tableoptions[opendepth=1]".. "tableoptions[opendepth=1]"..
"table[0.1,0;9,5;page;"..table.concat(aTitel, ",")..";"..idx.."]".. "table[0.1,0;9,5;page;"..table.concat(aTitel, ",")..";"..idx.."]"..
bttn.. bttn..
"box[0,5.75;10.775,4.45;#000000]"..
"style_type[textarea;textcolor=#FFFFFF]".. "style_type[textarea;textcolor=#FFFFFF]"..
"textarea[0.3,5.7;11,5.3;;"..(aText[idx] or "")..";]".. "textarea[0.3,5.7;11,5.3;;"..(aText[idx] or "")..";]"
"box[0,5.75;10.775,4.45;#000000]"
end end
local function formspec_plan(meta, manual) local function formspec_plan(meta, manual)

View File

@ -153,7 +153,7 @@ techage.icta_register_condition("input", {
return env.input[data.number] return env.input[data.number]
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value) or 0, data.operand) return techage.compare(val, data.value or "invalid", data.operand)
end end
return condition, result return condition, result
end, end,
@ -196,7 +196,7 @@ techage.icta_register_condition("state", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value) or 0, data.operand) return techage.compare(val, data.value or "invalid", data.operand)
end end
return condition, result return condition, result
end, end,
@ -408,7 +408,7 @@ techage.icta_register_condition("chest", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value) or 0, data.operand) return techage.compare(val, data.value or "invalid", data.operand)
end end
return condition, result return condition, result
end, end,
@ -449,7 +449,7 @@ techage.icta_register_condition("signaltower", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value) or 0, data.operand) return techage.compare(val, data.value or "invalid", data.operand)
end end
return condition, result return condition, result
end, end,
@ -919,7 +919,7 @@ techage.icta_register_condition("get_filter", {
return techage.send_single(environ.number, data.number, "port", data.color) return techage.send_single(environ.number, data.number, "port", data.color)
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value) or 0, data.operand) return techage.compare(val, data.value or "invalid", data.operand)
end end
return condition, result return condition, result
end, end,