Best way to know if entity can be connected to a circuit?
Posted: Fri May 26, 2017 3:02 pm
I'm doing the following. Is it a good way to see if some random entity can get a green or red wire?
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).
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).