LuaATC PCNaming: Allow naming active components using the tool
This commit is contained in:
parent
75025b13ca
commit
35d5106a21
|
@ -150,7 +150,7 @@ local static_env = {
|
||||||
--interrupts are handled per node, position unknown. (same goes for digilines)
|
--interrupts are handled per node, position unknown. (same goes for digilines)
|
||||||
--however external interrupts can be set here.
|
--however external interrupts can be set here.
|
||||||
interrupt_pos = function(parpos, imesg)
|
interrupt_pos = function(parpos, imesg)
|
||||||
local pos=atlatc.pcnaming.resolve_pos(parpos)
|
local pos=atlatc.pcnaming.resolve_pos(parpos, "interrupt_pos")
|
||||||
atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg})
|
atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg})
|
||||||
end,
|
end,
|
||||||
-- sends an atc command to train regardless of where it is in the world
|
-- sends an atc command to train regardless of where it is in the world
|
||||||
|
|
|
@ -44,7 +44,12 @@ minetest.register_craftitem("advtrains_luaautomation:pcnaming",{
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local node = advtrains.ndb.get_node(pos)
|
local node = advtrains.ndb.get_node(pos)
|
||||||
if node.name and (minetest.get_item_group(node.name, "advtrains_signal")>0 or advtrains.is_passive(pos)) then
|
local ndef = minetest.registered_nodes[node.name]
|
||||||
|
if node.name and (
|
||||||
|
minetest.get_item_group(node.name, "advtrains_signal")>0 --is IL signal
|
||||||
|
or advtrains.is_passive(pos) -- is passive component
|
||||||
|
or (ndef and ndef.luaautomation) -- is active component
|
||||||
|
) then
|
||||||
--look if this one already has a name
|
--look if this one already has a name
|
||||||
local pn=""
|
local pn=""
|
||||||
for name, npos in pairs(atlatc.pcnaming.name_map) do
|
for name, npos in pairs(atlatc.pcnaming.name_map) do
|
||||||
|
|
Loading…
Reference in New Issue