pub struct LuaWireConnector;Expand description
A wire connector of a given entity. Allows to find wires, add or remove wires and do some basic operations specific to those connectors.
Implementations§
Source§impl LuaWireConnector
impl LuaWireConnector
Sourcepub fn connection_count(&self) -> u32
pub fn connection_count(&self) -> u32
Amount of wires going out of this connector. It includes all wires (ghost wires and real wires).
Sourcepub fn connections(&self) -> Vec<WireConnection>
pub fn connections(&self) -> Vec<WireConnection>
All wire connectors this connector is connected to. It includes all wires (ghost wires and real wires).
Sourcepub fn electric_network(&self) -> LuaElectricSubNetwork
pub fn electric_network(&self) -> LuaElectricSubNetwork
The electric sub network this copper wire connector provides.
No value will be provided if this is not a copper wire connector. May be nil in case of a copper wire connector when it belongs to a ghost or its from a power switch when there are no real wires connecting it to other entities.
Sourcepub fn is_ghost(&self) -> bool
pub fn is_ghost(&self) -> bool
If this connector is owned by an entity inside of a ghost. If any of 2 ends of a wire attaches to a ghost connector, then a wire is considered to be a ghost.
Sourcepub fn network_id(&self) -> u32
pub fn network_id(&self) -> u32
Index of a CircuitNetwork or ElectricSubNetwork which is going through this wire connector. Returns 0 if there is no network associated with this wire connector right now. CircuitNetwork indexes are independent of indexes of ElectricSubNetwork so they may collide with each other.
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn owner(&self) -> LuaEntity
pub fn owner(&self) -> LuaEntity
The entity this wire connector belongs to. May return entity ghost instead if this wire connector belongs to inner entity.
Sourcepub fn real_connection_count(&self) -> u32
pub fn real_connection_count(&self) -> u32
Amount of real wires going out of this connector. It only includes wires for which both wire connectors are real (not ghosts).
Sourcepub fn real_connections(&self) -> Vec<WireConnection>
pub fn real_connections(&self) -> Vec<WireConnection>
All wire connectors this connector is connected to with real wires. It only includes wires that are between two non-ghost entities.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Sourcepub fn wire_connector_id(&self) -> &str
pub fn wire_connector_id(&self) -> &str
Identifier of this connector in the entity this connector belongs to.
Sourcepub fn can_wire_reach(&self, other_connector: LuaAny) -> bool
pub fn can_wire_reach(&self, other_connector: LuaAny) -> bool
Checks if a wire can reach from this connector to the other connector.
Sourcepub fn connect_to(
&self,
origin: Option<&str>,
reach_check: Option<bool>,
target: LuaWireConnector,
) -> bool
pub fn connect_to( &self, origin: Option<&str>, reach_check: Option<bool>, target: LuaWireConnector, ) -> bool
Connects this connector to other wire connector.
Sourcepub fn disconnect_all(&self, origin: Option<&str>) -> bool
pub fn disconnect_all(&self, origin: Option<&str>) -> bool
Removes all wires going out of this wire connector.
Sourcepub fn disconnect_from(
&self,
origin: Option<&str>,
target: LuaWireConnector,
) -> bool
pub fn disconnect_from( &self, origin: Option<&str>, target: LuaWireConnector, ) -> bool
Disconnects this connector from other wire connector.
Sourcepub fn have_common_neighbour(
&self,
ignore_ghost_neighbours: Option<bool>,
other_connector: LuaWireConnector,
) -> bool
pub fn have_common_neighbour( &self, ignore_ghost_neighbours: Option<bool>, other_connector: LuaWireConnector, ) -> bool
Checks if this and other wire connector have a common neighbour.
Sourcepub fn is_connected_to(
&self,
origin: Option<&str>,
target: LuaWireConnector,
) -> bool
pub fn is_connected_to( &self, origin: Option<&str>, target: LuaWireConnector, ) -> bool
Checks if this connector has any wire going to the other connector.
Trait Implementations§
Source§impl Clone for LuaWireConnector
impl Clone for LuaWireConnector
Source§fn clone(&self) -> LuaWireConnector
fn clone(&self) -> LuaWireConnector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more