pub struct LuaElectricSubNetwork;Expand description
A LuaElectricSubNetwork represents an electricity supply group.
When a supply group is related to electric poles, it spans over all poles that are connected with real (non ghost) wires and connects entities with an electric energy source in range of those poles.
When a supply group is related to a global electric network, it connects entities with an electric energy source on the same surface.
Implicit connections (when a power switch is closed, or when an electric pole is built on a surface with global network) do not cause supply groups to merge since they are not copper wire connections. Those connections will cause sub networks to have the same parent electric network causing electricity to be allowed to flow freely between multiple sub networks (electricity produced inside of one sub network that is connected through a power switch to a second sub network will be able to flow into a consumer connected to the second sub network).
The electric sub network keeps track of connected entities. It does not perform electricity flow as that’s the responsibility of the electric network.
Implementations§
Source§impl LuaElectricSubNetwork
impl LuaElectricSubNetwork
Sourcepub fn neighbours(&self) -> Vec<LuaElectricSubNetwork>
pub fn neighbours(&self) -> Vec<LuaElectricSubNetwork>
List of sub networks that are directly connected to this sub network through power switches or because they span over electric poles placed on a surface with global network (all poles on a surface with global network are implicitly connected to global network making their networks neighbour of a global network).
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 parent_network(&self) -> LuaElectricNetwork
pub fn parent_network(&self) -> LuaElectricNetwork
Parent network to this sub network.
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 get_accumulators_energy(
&self,
params: LuaElectricSubNetworkGetAccumulatorsEnergyParams,
) -> EnergyAndCapacityPair
pub fn get_accumulators_energy( &self, params: LuaElectricSubNetworkGetAccumulatorsEnergyParams, ) -> EnergyAndCapacityPair
Gets total energy stored inside of accumulators connected to the electric sub network.
Sourcepub fn set_accumulators_energy(
&self,
params: LuaElectricSubNetworkSetAccumulatorsEnergyParams,
)
pub fn set_accumulators_energy( &self, params: LuaElectricSubNetworkSetAccumulatorsEnergyParams, )
Changes energy stored inside of accumulators connected to the electric sub network.
Trait Implementations§
Source§impl Clone for LuaElectricSubNetwork
impl Clone for LuaElectricSubNetwork
Source§fn clone(&self) -> LuaElectricSubNetwork
fn clone(&self) -> LuaElectricSubNetwork
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more