pub struct LuaElectricNetwork;Expand description
A LuaElectricNetwork represents a group of LuaElectricSubNetworks that are directly or indirectly connected to each other through implicit connections (closed power switches, surface connections) and during next electric network update will transfer electricity from producers and consumers.
Electric networks can be merged together when a power switch is closed and can be split into multiple networks when power switch opens. Similarly turning on or off a global network may merge or split electric networks in a way that follows the expected electricity flows - two sub networks that are not directly or indirectly connected will be put into separate electric networks.
The electric network is what performs electric flow between entities. It does not track connected entities as that’s the responsibility of the electric sub network.
Implementations§
Source§impl LuaElectricNetwork
impl LuaElectricNetwork
Sourcepub fn flow_last_tick(&self) -> LuaElectricNetworkFlowLastTick
pub fn flow_last_tick(&self) -> LuaElectricNetworkFlowLastTick
Energy amounts of satisfaction percents related to latest electric network update.
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 statistics(&self) -> LuaFlowStatistics
pub fn statistics(&self) -> LuaFlowStatistics
Statistics for this electric network.
If the electric network becomes invalid, the flow statistics obtained from it will also become invalid.
pub fn sub_networks(&self) -> Vec<LuaElectricSubNetwork>
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: LuaElectricNetworkGetAccumulatorsEnergyParams,
) -> EnergyAndCapacityPair
pub fn get_accumulators_energy( &self, params: LuaElectricNetworkGetAccumulatorsEnergyParams, ) -> EnergyAndCapacityPair
Gets total energy stored inside of accumulators that are part of any electric sub network covered by this electric network.
Sourcepub fn set_accumulators_energy(
&self,
params: LuaElectricNetworkSetAccumulatorsEnergyParams,
)
pub fn set_accumulators_energy( &self, params: LuaElectricNetworkSetAccumulatorsEnergyParams, )
Changes energy stored inside of accumulators that are part of any electric sub network covered by this electric network.
Trait Implementations§
Source§impl Clone for LuaElectricNetwork
impl Clone for LuaElectricNetwork
Source§fn clone(&self) -> LuaElectricNetwork
fn clone(&self) -> LuaElectricNetwork
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more