Best way to know if entity can be connected to a circuit?

Place to get help with not working mods / modding interface.
Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Best way to know if entity can be connected to a circuit?

Post by Theanderblast »

I'm doing the following. Is it a good way to see if some random entity can get a green or red wire?

Code: Select all

    
connectable = 
   (some_entity.prototype.max_circuit_wire_distance ~= nil and 
    some_entity.prototype.max_circuit_wire_distance ~= 0) or 
    (some_entity.prototype.max_wire_distance ~= nil and 
     some_entity.prototype.max_wire_distance ~= 0) 
    if connectable then
(etc.)

The reason I'm checking both wire distances is that type="electric-pole" objects seem to have max_circuit_wire_distance == 0, (which seems odd to me).
Post Reply

Return to “Modding help”