Add time & name commands to the TA4 button
This commit is contained in:
parent
df6a526a99
commit
7082e1ab0d
@ -56,7 +56,10 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
return 0
|
||||
end
|
||||
if listname == "src" then
|
||||
CRD(pos).State:start_if_standby(pos)
|
||||
local state = CRD(pos).State
|
||||
if state then
|
||||
state:start_if_standby(pos)
|
||||
end
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
|
@ -318,8 +318,7 @@ local function entity_to_node(pos, obj)
|
||||
local nvm = techage.get_nvm(self.base_pos)
|
||||
nvm.running = nil
|
||||
end
|
||||
minetest.after(0.2, obj.remove, obj)
|
||||
|
||||
minetest.after(0.1, obj.remove, obj)
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef1 = minetest.registered_nodes[name]
|
||||
local ndef2 = minetest.registered_nodes[node.name]
|
||||
@ -358,7 +357,7 @@ local function node_to_entity(start_pos)
|
||||
-- Block with other metadata
|
||||
node = minetest.get_node(start_pos)
|
||||
metadata = meta:to_table()
|
||||
minetest.after(0.2, minetest.remove_node, start_pos)
|
||||
minetest.after(0.1, minetest.remove_node, start_pos)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
@ -152,6 +152,9 @@ local function on_rightclick_on(pos, node, clicker)
|
||||
if fixed == "true" then
|
||||
if can_access(pos, clicker) then
|
||||
switch_on(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.clicker = clicker and clicker:get_player_name()
|
||||
mem.time = math.floor(minetest.get_us_time() / 100000)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -334,3 +337,31 @@ minetest.register_craft({
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
techage.register_node({
|
||||
"techage:ta4_button_off", "techage:ta4_button_on",
|
||||
}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "name" then
|
||||
local mem = techage.get_mem(pos)
|
||||
return mem.clicker or ""
|
||||
elseif topic == "time" then
|
||||
local mem = techage.get_mem(pos)
|
||||
return mem.time or 0
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
on_beduino_request_data = function(pos, src, topic, payload)
|
||||
if topic == 144 then -- Player Name
|
||||
local mem = techage.get_mem(pos)
|
||||
return 0, mem.clicker
|
||||
elseif topic == 149 then --time
|
||||
local mem = techage.get_mem(pos)
|
||||
return 0, {mem.time or 0}
|
||||
else
|
||||
return 2, ""
|
||||
end
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
@ -374,7 +374,9 @@ Please note, that this is not a technical distinction, only a logical.
|
||||
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). |
|
||||
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
|
||||
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |
|
||||
| "input" | `<index>` | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
|
||||
| "input" | \<index> | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
|
||||
| "name" | \<player name> | Player name of the TA3/TA4 Player Detector or TA4 Button |
|
||||
| "time" | number | Time in system ticks (norm. 100 ms) when the TA4 Button is clicked |
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user