pub struct LuaEntity;Expand description
The primary interface for interacting with entities through the Lua API. Entities are everything that exists on the map except for tiles (see LuaTile).
Most functions on LuaEntity also work when the entity is contained in a ghost.
Implementations§
Source§impl LuaEntity
impl LuaEntity
Sourcepub fn build_distance(&self) -> u32
pub fn build_distance(&self) -> u32
The build distance of this character or max uint when not a character or player connected to a character.
Sourcepub fn cargo_pod(&self) -> LuaEntity
pub fn cargo_pod(&self) -> LuaEntity
The cargo pod the player is currently sitting in or the cargo pod attached to this rocket silo.
Sourcepub fn character_additional_mining_categories(&self) -> Vec<&str>
pub fn character_additional_mining_categories(&self) -> Vec<&str>
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_build_distance_bonus(&self) -> u32
pub fn character_build_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_crafting_speed_modifier(&self) -> f64
pub fn character_crafting_speed_modifier(&self) -> f64
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_health_bonus(&self) -> f32
pub fn character_health_bonus(&self) -> f32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_inventory_slots_bonus(&self) -> u32
pub fn character_inventory_slots_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_item_drop_distance_bonus(&self) -> u32
pub fn character_item_drop_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_item_pickup_distance_bonus(&self) -> u32
pub fn character_item_pickup_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_loot_pickup_distance_bonus(&self) -> u32
pub fn character_loot_pickup_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_maximum_following_robot_count_bonus(&self) -> u32
pub fn character_maximum_following_robot_count_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_mining_progress(&self) -> f64
pub fn character_mining_progress(&self) -> f64
The current mining progress between 0 and 1 of this character, or 0 if they aren’t mining.
Sourcepub fn character_mining_speed_modifier(&self) -> f64
pub fn character_mining_speed_modifier(&self) -> f64
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_reach_distance_bonus(&self) -> u32
pub fn character_reach_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_resource_reach_distance_bonus(&self) -> u32
pub fn character_resource_reach_distance_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_running_speed(&self) -> f64
pub fn character_running_speed(&self) -> f64
The current movement speed of this character, including effects from exoskeletons, tiles, stickers and shooting.
Sourcepub fn character_running_speed_modifier(&self) -> f64
pub fn character_running_speed_modifier(&self) -> f64
Modifies the running speed of this character by the given value as a percentage. Setting the running modifier to 0.5 makes the character run 50% faster. The minimum value of -1 reduces the movement speed by 100%, resulting in a speed of 0.
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn character_trash_slot_count_bonus(&self) -> u32
pub fn character_trash_slot_count_bonus(&self) -> u32
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn cheat_mode(&self) -> bool
pub fn cheat_mode(&self) -> bool
When true hand crafting is free and instant.
Sourcepub fn crafting_queue(&self) -> Vec<CraftingQueueItem>
pub fn crafting_queue(&self) -> Vec<CraftingQueueItem>
The current crafting queue items.
Sourcepub fn crafting_queue_progress(&self) -> f64
pub fn crafting_queue_progress(&self) -> f64
The crafting queue progress in the range [0-1]. 0 when no recipe is being crafted.
Sourcepub fn crafting_queue_size(&self) -> u32
pub fn crafting_queue_size(&self) -> u32
Size of the crafting queue.
Sourcepub fn cursor_ghost(&self) -> ItemIDAndQualityIDPair
pub fn cursor_ghost(&self) -> ItemIDAndQualityIDPair
The ghost prototype in the player’s cursor.
Items in the cursor stack will take priority over the cursor ghost.
Sourcepub fn cursor_record(&self) -> LuaRecord
pub fn cursor_record(&self) -> LuaRecord
The blueprint record in the player’s cursor.
Sourcepub fn cursor_stack(&self) -> LuaItemStack
pub fn cursor_stack(&self) -> LuaItemStack
The player’s cursor stack. nil if the player controller is a spectator.
Sourcepub fn driving(&self) -> bool
pub fn driving(&self) -> bool
true if the player is in a vehicle. Writing to this attribute puts the player in or out of a vehicle.
Sourcepub fn drop_item_distance(&self) -> u32
pub fn drop_item_distance(&self) -> u32
The item drop distance of this character or max uint when not a character or player connected to a character.
Sourcepub fn flight_height(&self) -> f64
pub fn flight_height(&self) -> f64
The current flight height for this player or character entity.
When called on an entity, only valid if this entity is a character.
Sourcepub fn following_robots(&self) -> Vec<LuaEntity>
pub fn following_robots(&self) -> Vec<LuaEntity>
The current combat robots following the character.
When called on a LuaPlayer, it must be associated with a character (see LuaPlayer::character).
Sourcepub fn force_index(&self) -> u32
pub fn force_index(&self) -> u32
Unique index (ID) associated with the force of this entity.
Sourcepub fn is_flying(&self) -> bool
pub fn is_flying(&self) -> bool
If this player or character entity is flying.
When called on an entity, only valid if this entity is a character.
Sourcepub fn item_pickup_distance(&self) -> f64
pub fn item_pickup_distance(&self) -> f64
The item pickup distance of this character or max double when not a character or player connected to a character.
Sourcepub fn loot_pickup_distance(&self) -> f64
pub fn loot_pickup_distance(&self) -> f64
The loot pickup distance of this character or max double when not a character or player connected to a character.
Sourcepub fn mining_progress(&self) -> f64
pub fn mining_progress(&self) -> f64
For characters and players the number is between 0 and 1.
For mining drills the number is with the range [0, mining_target.prototype.mineable_properties.mining_time].
For all other types the number is 0.
Sourcepub fn mining_state(&self) -> LuaControlMiningState
pub fn mining_state(&self) -> LuaControlMiningState
Current mining state. Will error if written to with a controller_type other than character, god, or editor.
When the player isn’t mining tiles the player will mine whatever entity is currently selected. See LuaControl::selected and LuaControl::update_selected_entity.
Sourcepub fn opened(&self) -> LuaAny
pub fn opened(&self) -> LuaAny
The GUI the player currently has open.
This is the GUI that will asked to close (by firing the on_gui_closed event) when the Esc or E keys are pressed. If this attribute is non-nil, then writing nil or a new GUI to it will ask the existing GUI to close.
Write supports any of the types. Read will return the entity, equipment, equipment-grid, player, element, inventory, item or nil.
pub fn opened_gui_type(&self) -> &str
Sourcepub fn picking_state(&self) -> bool
pub fn picking_state(&self) -> bool
Current item-picking state.
Sourcepub fn position(&self) -> MapPosition
pub fn position(&self) -> MapPosition
The current position of the entity.
Sourcepub fn reach_distance(&self) -> u32
pub fn reach_distance(&self) -> u32
The reach distance of this character or max uint when not a character or player connected to a character.
Sourcepub fn render_position(&self) -> MapPosition
pub fn render_position(&self) -> MapPosition
The current render position of the entity.
Sourcepub fn repair_state(&self) -> LuaControlRepairState
pub fn repair_state(&self) -> LuaControlRepairState
Current repair state.
Sourcepub fn resource_reach_distance(&self) -> f64
pub fn resource_reach_distance(&self) -> f64
The resource reach distance of this character or max double when not a character or player connected to a character.
Sourcepub fn riding_state(&self) -> RidingState
pub fn riding_state(&self) -> RidingState
Current riding state of this car, or of the car this player is riding in.
Sourcepub fn selected(&self) -> LuaEntity
pub fn selected(&self) -> LuaEntity
The currently selected entity. Assigning an entity will select it if is selectable, otherwise the selection is cleared.
Sourcepub fn shooting_state(&self) -> LuaControlShootingState
pub fn shooting_state(&self) -> LuaControlShootingState
Current shooting state.
Sourcepub fn surface(&self) -> LuaSurface
pub fn surface(&self) -> LuaSurface
The surface this entity is currently on.
Sourcepub fn surface_index(&self) -> u32
pub fn surface_index(&self) -> u32
Unique index (ID) associated with the surface this entity is currently on.
Sourcepub fn walking_state(&self) -> LuaControlWalkingState
pub fn walking_state(&self) -> LuaControlWalkingState
Current walking state of the player, or the spider-vehicle the character is driving.
pub fn absorbed_pollution(&self) -> f64
Sourcepub fn active(&self) -> bool
pub fn active(&self) -> bool
A deactivated entity will stop all of its operations (car will stop moving, inserters will stop working, fish will stop moving, etc).
Reading from this returns false if the entity is deactivated in at least one of the following ways: by script, by circuit network, by recipe, by freezing, or by being marked for deconstruction.
If this entity is not considered updatable then this always returns false.
Sourcepub fn ai_settings(&self) -> LuaAISettings
pub fn ai_settings(&self) -> LuaAISettings
The AI settings of this unit.
pub fn alert_parameters(&self) -> ProgrammableSpeakerAlertParameters
Sourcepub fn allow_dispatching_robots(&self) -> bool
pub fn allow_dispatching_robots(&self) -> bool
Whether this entity’s personal roboports are allowed to dispatch robots.
Sourcepub fn artillery_auto_targeting(&self) -> bool
pub fn artillery_auto_targeting(&self) -> bool
If this artillery auto-targets enemies.
Sourcepub fn associated_player(&self) -> LuaPlayer
pub fn associated_player(&self) -> LuaPlayer
The player this character is associated with, if any. Set to nil to clear.
The player will be automatically disassociated when a controller is set on the character. Also, all characters associated to a player will be logged off when the player logs off in multiplayer.
A character associated with a player is not directly controlled by any player.
Sourcepub fn attached_cargo_pod(&self) -> LuaEntity
pub fn attached_cargo_pod(&self) -> LuaEntity
The cargo pod attached to this rocket silo rocket if any.
Sourcepub fn autopilot_destination(&self) -> MapPosition
pub fn autopilot_destination(&self) -> MapPosition
Destination of this spidertron’s autopilot, if any. Writing nil clears all destinations.
Sourcepub fn autopilot_destinations(&self) -> Vec<MapPosition>
pub fn autopilot_destinations(&self) -> Vec<MapPosition>
The queued destination positions of spidertron’s autopilot.
Sourcepub fn autopilot_patrol_size(&self) -> u32
pub fn autopilot_patrol_size(&self) -> u32
When there are this many waypoints left the spider vehicle will start patrolling along them.
Setting this to 0 will disable patrolling.
Sourcepub fn backer_name(&self) -> &str
pub fn backer_name(&self) -> &str
The backer name assigned to this entity. Entities that support backer names are labs, locomotives, radars, roboports, and train stops. nil if this entity doesn’t support backer names.
While train stops get the name of a backer when placed down, players can rename them if they want to. In this case, backer_name returns the player-given name of the entity.
pub fn base_damage_modifiers(&self) -> TriggerModifierData
Sourcepub fn beacons_count(&self) -> u32
pub fn beacons_count(&self) -> u32
Number of beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
Sourcepub fn belt_neighbours(&self) -> LuaEntityBeltNeighbours
pub fn belt_neighbours(&self) -> LuaEntityBeltNeighbours
The belt connectable neighbours of this belt connectable entity. Only entities that input to or are outputs of this entity. Does not contain the other end of an underground belt, see LuaEntity::underground_belt_neighbour for that.
Sourcepub fn belt_shape(&self) -> LuaEntityBeltShape
pub fn belt_shape(&self) -> LuaEntityBeltShape
Gives what is the current shape of a transport-belt.
Sourcepub fn belt_to_ground_type(&self) -> BeltConnectionType
pub fn belt_to_ground_type(&self) -> BeltConnectionType
Whether this underground belt goes into or out of the ground.
pub fn bonus_damage_modifiers(&self) -> TriggerModifierData
Sourcepub fn bonus_mining_progress(&self) -> f64
pub fn bonus_mining_progress(&self) -> f64
The bonus mining progress for this mining drill. Read yields a number in range [0, mining_target.prototype.mineable_properties.mining_time]. nil if this isn’t a mining drill.
Sourcepub fn bonus_progress(&self) -> f64
pub fn bonus_progress(&self) -> f64
The current productivity bonus progress, as a number in range [0, 1].
Sourcepub fn bounding_box(&self) -> BoundingBox
pub fn bounding_box(&self) -> BoundingBox
LuaEntityPrototype::collision_box around entity’s given position and respecting the current entity orientation.
Sourcepub fn cargo_bay_connection_owner(&self) -> LuaEntity
pub fn cargo_bay_connection_owner(&self) -> LuaEntity
The space platform hub or cargo landing pad this cargo bay is connected to if any.
Sourcepub fn cargo_hatches(&self) -> Vec<LuaCargoHatch>
pub fn cargo_hatches(&self) -> Vec<LuaCargoHatch>
The cargo hatches owned by this entity if any.
Sourcepub fn cargo_pod_destination(&self) -> CargoDestination
pub fn cargo_pod_destination(&self) -> CargoDestination
The destination of this cargo pod entity.
Use force_finish_ascending if you want it to only descend from orbit.
Sourcepub fn cargo_pod_origin(&self) -> LuaEntity
pub fn cargo_pod_origin(&self) -> LuaEntity
The origin of this cargo pod entity. (Must be a silo, hub or pad)
Sourcepub fn cargo_pod_state(&self) -> LuaEntityCargoPodState
pub fn cargo_pod_state(&self) -> LuaEntityCargoPodState
The state of this cargo pod entity.
Sourcepub fn chain_signal_state(&self) -> &str
pub fn chain_signal_state(&self) -> &str
The state of this chain signal.
Sourcepub fn character_corpse_death_cause(&self) -> &str
pub fn character_corpse_death_cause(&self) -> &str
The reason this character corpse character died. "" if there is no reason.
Sourcepub fn character_corpse_player_index(&self) -> u32
pub fn character_corpse_player_index(&self) -> u32
The player index associated with this character corpse.
The index is not guaranteed to be valid so it should always be checked first if a player with that index actually exists.
Sourcepub fn character_corpse_tick_of_death(&self) -> u32
pub fn character_corpse_tick_of_death(&self) -> u32
The tick this character corpse died at.
Sourcepub fn cliff_neighbours(&self) -> LuaEntityCliffNeighbours
pub fn cliff_neighbours(&self) -> LuaEntityCliffNeighbours
Table of cliff neighbours.
Sourcepub fn cliff_orientation(&self) -> CliffOrientation
pub fn cliff_orientation(&self) -> CliffOrientation
The orientation of this cliff.
Sourcepub fn color(&self) -> Color
pub fn color(&self) -> Color
The color of this character, rolling stock, corpse, character corpse, train stop, simple-entity-with-owner, car, spider-vehicle, or lamp. nil if this entity doesn’t use custom colors.
Car color is overridden by the color of the current driver/passenger, if there is one.
Sourcepub fn combat_robot_owner(&self) -> LuaEntity
pub fn combat_robot_owner(&self) -> LuaEntity
The owner of this combat robot, if any.
Sourcepub fn combinator_description(&self) -> &str
pub fn combinator_description(&self) -> &str
The description on this combinator.
Sourcepub fn commandable(&self) -> LuaCommandable
pub fn commandable(&self) -> LuaCommandable
Returns a LuaCommandable for this entity or nil if entity is not commandable. Units and SpiderUnits are commandable.
Sourcepub fn connected_rail(&self) -> LuaEntity
pub fn connected_rail(&self) -> LuaEntity
The rail entity this train stop is connected to, if any.
Sourcepub fn connected_rail_direction(&self) -> &str
pub fn connected_rail_direction(&self) -> &str
Rail direction to which this train stop is binding. This returns a value even when no rails are present.
Sourcepub fn consumption_bonus(&self) -> f64
pub fn consumption_bonus(&self) -> f64
The consumption bonus of this entity.
Sourcepub fn consumption_modifier(&self) -> f32
pub fn consumption_modifier(&self) -> f32
Multiplies the energy consumption.
Sourcepub fn copy_color_from_train_stop(&self) -> bool
pub fn copy_color_from_train_stop(&self) -> bool
If this rolling stock has ‘copy color from train stop’ enabled.
Sourcepub fn corpse_expires(&self) -> bool
pub fn corpse_expires(&self) -> bool
Whether this corpse will ever fade away.
Sourcepub fn corpse_immune_to_entity_placement(&self) -> bool
pub fn corpse_immune_to_entity_placement(&self) -> bool
If true, corpse won’t be destroyed when entities are placed over it. If false, whether corpse will be removed or not depends on value of CorpsePrototype::remove_on_entity_placement.
Sourcepub fn crafting_progress(&self) -> f32
pub fn crafting_progress(&self) -> f32
The current crafting progress, as a number in range [0, 1].
Sourcepub fn crafting_speed(&self) -> f64
pub fn crafting_speed(&self) -> f64
The current crafting speed, including speed bonuses from modules and beacons.
Sourcepub fn crane_destination(&self) -> MapPosition
pub fn crane_destination(&self) -> MapPosition
Destination of the crane of this entity. Throws when trying to set the destination out of range.
Sourcepub fn crane_destination_3d(&self) -> Vector3D
pub fn crane_destination_3d(&self) -> Vector3D
Destination of the crane of this entity in 3D. Throws when trying to set the destination out of range.
Sourcepub fn crane_end_position_3d(&self) -> Vector3D
pub fn crane_end_position_3d(&self) -> Vector3D
Returns current position in 3D for the end of the crane of this entity.
Sourcepub fn crane_grappler_destination(&self) -> LuaAny
pub fn crane_grappler_destination(&self) -> LuaAny
Will set destination for the grappler of crane of this entity. The crane grappler will start moving to reach the destination, but the rest of the arm will remain stationary. Throws when trying to set the destination out of range.
Sourcepub fn crane_grappler_destination_3d(&self) -> LuaAny
pub fn crane_grappler_destination_3d(&self) -> LuaAny
Will set destination in 3D for the grappler of crane of this entity. The crane grappler will start moving to reach the destination, but the rest of the arm will remain stationary. Throws when trying to set the destination out of range.
Sourcepub fn created_by_corpse(&self) -> LuaEntity
pub fn created_by_corpse(&self) -> LuaEntity
The corpse that caused this entity ghost to be created, if any.
Sourcepub fn custom_status(&self) -> CustomEntityStatus
pub fn custom_status(&self) -> CustomEntityStatus
A custom status for this entity that will be displayed in the GUI.
Sourcepub fn damage_dealt(&self) -> f64
pub fn damage_dealt(&self) -> f64
The damage dealt by this turret, artillery turret, or artillery wagon.
Sourcepub fn destructible(&self) -> bool
pub fn destructible(&self) -> bool
If set to false, this entity can’t be damaged and won’t be attacked automatically. It can however still be mined.
Entities that are indestructible naturally (they have no health, like smoke, resource etc) can’t be set to be destructible.
Sourcepub fn disabled_by_control_behavior(&self) -> bool
pub fn disabled_by_control_behavior(&self) -> bool
If the updatable entity is disabled by control behavior.
Always returns false if this entity is not considered updatable.
Sourcepub fn disabled_by_recipe(&self) -> bool
pub fn disabled_by_recipe(&self) -> bool
If the assembling machine is disabled by recipe, e.g. due to AssemblingMachinePrototype::disabled_when_recipe_not_researched.
Always returns false if this entity is not considered updatable.
Sourcepub fn disabled_by_script(&self) -> bool
pub fn disabled_by_script(&self) -> bool
If the updatable entity is disabled by script.
Note: Some entities (Corpse, FireFlame, Roboport, RollingStock, dying entities) need to remain active and will ignore writes.
If this entity is not considered updatable then this always returns false and writes will be ignored.
pub fn display_panel_always_show(&self) -> bool
Sourcepub fn display_panel_icon(&self) -> SignalID
pub fn display_panel_icon(&self) -> SignalID
Icon visible on the display panel. Can be written only when it is not set by control behavior.
pub fn display_panel_show_in_chart(&self) -> bool
Sourcepub fn display_panel_text(&self) -> &str
pub fn display_panel_text(&self) -> &str
Text visible on the display panel. Can be written only when it is not set by control behavior.
Sourcepub fn draw_data(&self) -> RollingStockDrawData
pub fn draw_data(&self) -> RollingStockDrawData
Gives a draw data of the given entity if it supports such data.
Sourcepub fn driver_is_gunner(&self) -> bool
pub fn driver_is_gunner(&self) -> bool
Whether the driver of this car or spidertron is the gunner. If false, the passenger is the gunner. nil if this is neither a car or a spidertron.
Sourcepub fn drop_position(&self) -> MapPosition
pub fn drop_position(&self) -> MapPosition
Position where the entity puts its stuff.
Mining drills and crafting machines can’t have their drop position changed; inserters must have allow_custom_vectors set to true on their prototype to allow changing the drop position.
Meaningful only for entities that put stuff somewhere, such as mining drills, crafting machines with a drop target or inserters.
Sourcepub fn drop_target(&self) -> LuaEntity
pub fn drop_target(&self) -> LuaEntity
The entity this entity is putting its items to. If there are multiple possible entities at the drop-off point, writing to this attribute allows a mod to choose which one to drop off items to. The entity needs to collide with the tile box under the drop-off position. nil if there is no entity to put items to, or if this is not an entity that puts items somewhere.
Sourcepub fn effective_speed(&self) -> f32
pub fn effective_speed(&self) -> f32
The current speed of this unit in tiles per tick, taking into account any walking speed modifier given by the tile the unit is standing on. nil if this is not a unit.
Sourcepub fn effectivity_modifier(&self) -> f32
pub fn effectivity_modifier(&self) -> f32
Multiplies the acceleration the car can create for one unit of energy. Defaults to 1.
Sourcepub fn effects(&self) -> ModuleEffects
pub fn effects(&self) -> ModuleEffects
The effects being applied to this entity, if any. For beacons, this is the effect the beacon is broadcasting.
Sourcepub fn electric_buffer_size(&self) -> f64
pub fn electric_buffer_size(&self) -> f64
The buffer size for the electric energy source. nil if the entity doesn’t have an electric energy source.
Write access is limited to the ElectricEnergyInterface type.
Sourcepub fn electric_drain(&self) -> f64
pub fn electric_drain(&self) -> f64
The electric drain for the electric energy source. nil if the entity doesn’t have an electric energy source.
Sourcepub fn electric_emissions_per_joule(&self) -> HashMap<String, f64>
pub fn electric_emissions_per_joule(&self) -> HashMap<String, f64>
The table of emissions of this energy source in pollution/Joule, indexed by pollutant type. nil if the entity doesn’t have an electric energy source. Multiplying values in the returned table by energy consumption in Watt gives pollution/second.
Sourcepub fn electric_interface_mode(&self) -> &str
pub fn electric_interface_mode(&self) -> &str
Mode this ElectricEnergyInterface is in. Mode changes how the interface interacts with electric network: if its an electric producer, consumer and what priority it has.
Sourcepub fn electric_network(&self) -> LuaElectricSubNetwork
pub fn electric_network(&self) -> LuaElectricSubNetwork
Electric network this entity is connected to.
This can be used with electric poles, in which case the network will be the same as the one obtained from copper wire connector.
If this entity has an electric energy source, only a primary network will be provided. To also get other networks for entities in range of multiple networks, use LuaEntity::electric_networks instead.
Sourcepub fn electric_network_id(&self) -> u32
pub fn electric_network_id(&self) -> u32
Returns the id of the electric network that this entity is connected to, if any.
Sourcepub fn electric_network_statistics(&self) -> LuaFlowStatistics
pub fn electric_network_statistics(&self) -> LuaFlowStatistics
The electric network statistics for this electric pole.
If this electric pole becomes invalid, the flow statistics obtained from it will also become invalid. If this electric pole becomes part of a different electric network, the flow statistics will be for the new electric network this pole is part of.
Sourcepub fn electric_networks(&self) -> Vec<LuaElectricSubNetwork>
pub fn electric_networks(&self) -> Vec<LuaElectricSubNetwork>
Electric networks this entity with an electric energy source is connected to.
No array is given if this entity has no electric energy source.
Empty array will be given if this entity is not in range of any networks.
Compared to LuaEntity::electric_network, this does not work with electric poles since they do not have an electric energy source and as such can only belong to one network at a time.
Sourcepub fn enable_logistics_while_moving(&self) -> bool
pub fn enable_logistics_while_moving(&self) -> bool
Whether equipment grid logistics are enabled while this vehicle is moving.
Sourcepub fn energy(&self) -> f64
pub fn energy(&self) -> f64
Energy stored in the entity’s energy buffer (energy stored in electrical devices etc.). Always 0 for entities that don’t have the concept of energy stored inside.
Sourcepub fn energy_generated_last_tick(&self) -> f64
pub fn energy_generated_last_tick(&self) -> f64
How much energy this generator generated in the last tick.
Sourcepub fn entity_label(&self) -> &str
pub fn entity_label(&self) -> &str
The label on this spider-vehicle entity, if any. nil if this is not a spider-vehicle.
Sourcepub fn filter_slot_count(&self) -> u32
pub fn filter_slot_count(&self) -> u32
The number of filter slots this inserter, loader, mining drill, asteroid collector or logistic storage container has. 0 if not one of those entities.
Sourcepub fn fluidbox_neighbours(&self) -> Vec<Vec<LuaEntity>>
pub fn fluidbox_neighbours(&self) -> Vec<Vec<LuaEntity>>
A list of neighbours connected to fluidboxes of this entity. Neighbours are grouped by index of fluid box of this entity to which they are connected. For more detailed informations please use LuaEntity::get_fluid_box_neighbours.
Sourcepub fn fluids_count(&self) -> u32
pub fn fluids_count(&self) -> u32
Returns count of fluid storages. This includes fluid storages provided by fluidboxes but also covers other fluid storages like fluid turret’s internal buffer and fluid wagon’s fluid.
Sourcepub fn follow_offset(&self) -> Vector
pub fn follow_offset(&self) -> Vector
The follow offset of this spidertron, if any entity is being followed. This is randomized each time the follow entity is set.
Sourcepub fn follow_target(&self) -> LuaEntity
pub fn follow_target(&self) -> LuaEntity
The follow target of this spidertron, if any.
Sourcepub fn friction_modifier(&self) -> f32
pub fn friction_modifier(&self) -> f32
Multiplies the car friction rate.
Sourcepub fn frozen(&self) -> bool
pub fn frozen(&self) -> bool
Whether the freezable entity is currently frozen.
Always returns false if this entity is not considered freezable.
pub fn ghost_localised_description(&self) -> &str
Sourcepub fn ghost_localised_name(&self) -> &str
pub fn ghost_localised_name(&self) -> &str
Localised name of the entity or tile contained in this ghost.
Sourcepub fn ghost_name(&self) -> &str
pub fn ghost_name(&self) -> &str
Name of the entity or tile contained in this ghost.
Sourcepub fn ghost_prototype(&self) -> LuaAny
pub fn ghost_prototype(&self) -> LuaAny
The prototype of the entity or tile contained in this ghost.
Sourcepub fn ghost_type(&self) -> &str
pub fn ghost_type(&self) -> &str
The prototype type of the entity or tile contained in this ghost.
Sourcepub fn ghost_unit_number(&self) -> u64
pub fn ghost_unit_number(&self) -> u64
The unit_number of the entity contained in this ghost. It is the same as the unit number of the EntityWithOwnerPrototype that was destroyed to create this ghost. If it was created by other means, or if the inner entity does not support unit numbers, this property is nil.
Sourcepub fn graphics_variation(&self) -> u8
pub fn graphics_variation(&self) -> u8
The graphics variation for this entity. nil if this entity doesn’t use graphics variations.
Sourcepub fn grid(&self) -> LuaEquipmentGrid
pub fn grid(&self) -> LuaEquipmentGrid
This entity’s equipment grid, if any.
Sourcepub fn health(&self) -> f32
pub fn health(&self) -> f32
The current health of the entity, if any. Health is automatically clamped to be between 0 and max health (inclusive). Entities with a health of 0 can not be attacked.
To get the maximum possible health of this entity, see LuaEntity::max_health.
Sourcepub fn heat_neighbours(&self) -> Vec<LuaEntity>
pub fn heat_neighbours(&self) -> Vec<LuaEntity>
The entities connected to this entities heat buffer.
Sourcepub fn held_stack(&self) -> LuaItemStack
pub fn held_stack(&self) -> LuaItemStack
The item stack currently held in an inserter’s hand.
Sourcepub fn held_stack_position(&self) -> MapPosition
pub fn held_stack_position(&self) -> MapPosition
Current position of the inserter’s “hand”.
Sourcepub fn highlight_box_blink_interval(&self) -> u32
pub fn highlight_box_blink_interval(&self) -> u32
The blink interval of this highlight box entity. 0 indicates no blink.
Sourcepub fn highlight_box_type(&self) -> CursorBoxRenderType
pub fn highlight_box_type(&self) -> CursorBoxRenderType
The highlight box type of this highlight box entity.
Sourcepub fn ignore_unprioritised_targets(&self) -> bool
pub fn ignore_unprioritised_targets(&self) -> bool
Whether this turret shoots at targets that are not on its priority list.
Sourcepub fn infinity_container_filters(&self) -> Vec<InfinityInventoryFilter>
pub fn infinity_container_filters(&self) -> Vec<InfinityInventoryFilter>
The filters for this infinity container.
Sourcepub fn initial_amount(&self) -> u32
pub fn initial_amount(&self) -> u32
Count of initial resource units contained. nil if this is not an infinite resource.
If this is not an infinite resource, writing will produce an error.
Sourcepub fn input_flow_limit(&self) -> f64
pub fn input_flow_limit(&self) -> f64
Max amount of energy this ElectricEnergyInterface will take from electric network in one tick.
Sourcepub fn insert_plan(&self) -> Vec<BlueprintInsertPlan>
pub fn insert_plan(&self) -> Vec<BlueprintInsertPlan>
The insert plan for this ghost or item request proxy.
Sourcepub fn inserter_filter_mode(&self) -> LuaEntityInserterFilterMode
pub fn inserter_filter_mode(&self) -> LuaEntityInserterFilterMode
The filter mode for this filter inserter. nil if this inserter doesn’t use filters.
Sourcepub fn inserter_spoil_priority(&self) -> SpoilPriority
pub fn inserter_spoil_priority(&self) -> SpoilPriority
The spoil priority for this inserter.
Sourcepub fn inserter_stack_size_override(&self) -> u32
pub fn inserter_stack_size_override(&self) -> u32
Sets the stack size limit on this inserter.
Set to 0 to reset.
Sourcepub fn inserter_target_pickup_count(&self) -> u32
pub fn inserter_target_pickup_count(&self) -> u32
Returns the current target pickup count of the inserter.
This considers the circuit network, manual override and the inserter stack size limit based on technology.
Sourcepub fn is_entity_with_health(&self) -> bool
pub fn is_entity_with_health(&self) -> bool
If this entity is EntityWithHealth
Sourcepub fn is_entity_with_owner(&self) -> bool
pub fn is_entity_with_owner(&self) -> bool
If this entity is EntityWithOwner
Sourcepub fn is_freezable(&self) -> bool
pub fn is_freezable(&self) -> bool
Whether the entity is freezable and considered a FreezableEntity.
Sourcepub fn is_headed_to_trains_front(&self) -> bool
pub fn is_headed_to_trains_front(&self) -> bool
If the rolling stock is facing train’s front.
Sourcepub fn is_military_target(&self) -> bool
pub fn is_military_target(&self) -> bool
Whether this entity is a MilitaryTarget. Can be written to if LuaEntityPrototype::allow_run_time_change_of_is_military_target returns true.
Sourcepub fn is_updatable(&self) -> bool
pub fn is_updatable(&self) -> bool
Whether the entity is updatable and considered an UpdatableEntity.
Sourcepub fn item_request_proxy(&self) -> LuaEntity
pub fn item_request_proxy(&self) -> LuaEntity
The first found item request proxy targeting this entity.
Sourcepub fn item_requests(&self) -> Vec<ItemWithQualityCount>
pub fn item_requests(&self) -> Vec<ItemWithQualityCount>
Items this ghost will request when revived or items this item request proxy is requesting.
Sourcepub fn kills(&self) -> u32
pub fn kills(&self) -> u32
The number of units killed by this turret, artillery turret, or artillery wagon.
Sourcepub fn last_user(&self) -> LuaPlayer
pub fn last_user(&self) -> LuaPlayer
The last player that changed any setting on this entity. This includes building the entity, changing its color, or configuring its circuit network. nil if the last user is not part of the save anymore.
Sourcepub fn linked_belt_neighbour(&self) -> LuaEntity
pub fn linked_belt_neighbour(&self) -> LuaEntity
Neighbour to which this linked belt is connected to, if any.
May return entity ghost which contains linked belt to which connection is made.
Sourcepub fn linked_belt_type(&self) -> BeltConnectionType
pub fn linked_belt_type(&self) -> BeltConnectionType
Type of linked belt. Changing type will also flip direction so the belt is out of the same side.
Can only be changed when linked belt is disconnected (has no neighbour set).
Sourcepub fn loader_belt_stack_size_override(&self) -> u8
pub fn loader_belt_stack_size_override(&self) -> u8
The belt stack size override for this loader. Set to 0 to disable. Writing this value requires LoaderPrototype::adjustable_belt_stack_size to be true.
Sourcepub fn loader_container(&self) -> LuaEntity
pub fn loader_container(&self) -> LuaEntity
The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.
Sourcepub fn loader_filter_mode(&self) -> PrototypeFilterMode
pub fn loader_filter_mode(&self) -> PrototypeFilterMode
The filter mode for this loader. nil if this loader does not support filters.
Sourcepub fn loader_type(&self) -> BeltConnectionType
pub fn loader_type(&self) -> BeltConnectionType
Whether this loader gets items from or puts item into a container.
pub fn localised_description(&self) -> &str
Sourcepub fn localised_name(&self) -> &str
pub fn localised_name(&self) -> &str
Localised name of the entity.
Sourcepub fn logistic_cell(&self) -> LuaLogisticCell
pub fn logistic_cell(&self) -> LuaLogisticCell
The logistic cell this entity is a part of. Will be nil if this entity is not a part of any logistic cell.
Sourcepub fn logistic_network(&self) -> LuaLogisticNetwork
pub fn logistic_network(&self) -> LuaLogisticNetwork
The logistic network this entity is a part of, or nil if this entity is not a part of any logistic network.
Sourcepub fn max_health(&self) -> f32
pub fn max_health(&self) -> f32
Max health of this entity.
Sourcepub fn minable(&self) -> bool
pub fn minable(&self) -> bool
Not minable entities can still be destroyed.
Tells if entity reports as being minable right now. This takes into account minable_flag and entity specific conditions (for example rail under rolling stocks is not minable, vehicle with passenger is not minable).
Sourcepub fn minable_flag(&self) -> bool
pub fn minable_flag(&self) -> bool
Script controlled flag that allows entity to be mined.
Sourcepub fn mining_area(&self) -> BoundingBox
pub fn mining_area(&self) -> BoundingBox
Area in which this mining drill looks for resources to mine.
Sourcepub fn mining_drill_filter_mode(&self) -> LuaEntityInserterFilterMode
pub fn mining_drill_filter_mode(&self) -> LuaEntityInserterFilterMode
The filter mode for this mining drill. nil if this mining drill doesn’t have filters.
Sourcepub fn mining_target(&self) -> LuaEntity
pub fn mining_target(&self) -> LuaEntity
The mining target, if any.
Sourcepub fn mirroring(&self) -> bool
pub fn mirroring(&self) -> bool
Whether the entity is currently mirrored. This state is referred to as flipped elsewhere, such as on the on_player_flipped_entity event.
If an entity is mirrored, it is flipped over the axis that is pointing in the entity’s direction. For example if a mirrored entity is facing north, everything that was defined to be facing east in the prototype now faces west.
Sourcepub fn name_tag(&self) -> &str
pub fn name_tag(&self) -> &str
Name tag of this entity. Returns nil if entity has no name tag. When name tag is already used by other entity, the name will be removed from the other entity. Entity name tags can also be set in the entity “extra settings” GUI in the map editor.
Sourcepub fn neighbour_bonus(&self) -> f64
pub fn neighbour_bonus(&self) -> f64
The current total neighbour bonus of this reactor.
Sourcepub fn neighbour_connectable_connections(
&self,
) -> Vec<NeighbourConnectableConnection>
pub fn neighbour_connectable_connections( &self, ) -> Vec<NeighbourConnectableConnection>
Connections of a neighbour connectable entity. Includes connections that aren’t currently connected to another entity.
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 operable(&self) -> bool
pub fn operable(&self) -> bool
Player can’t open gui of this entity and he can’t quick insert/input stuff in to the entity when it is not operable.
Sourcepub fn orientation(&self) -> LuaAny
pub fn orientation(&self) -> LuaAny
The smooth orientation of this entity. For turrets this is the orientation of the weapon.
Sourcepub fn output_flow_limit(&self) -> f64
pub fn output_flow_limit(&self) -> f64
Max amount of energy this ElectricEnergyInterface will provide to electric network in one tick.
Sourcepub fn override_logistic_mode(&self) -> &str
pub fn override_logistic_mode(&self) -> &str
The override logistic mode being used by this infinity container if it is overridden.
Sourcepub fn owned_plants(&self) -> Vec<LuaEntity>
pub fn owned_plants(&self) -> Vec<LuaEntity>
Plants registered by this agricultural tower. One plant can be registered in multiple agricultural towers.
pub fn parameters(&self) -> ProgrammableSpeakerParameters
Sourcepub fn pickup_from_left_lane(&self) -> bool
pub fn pickup_from_left_lane(&self) -> bool
For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the left lane.
Sourcepub fn pickup_from_right_lane(&self) -> bool
pub fn pickup_from_right_lane(&self) -> bool
For inserters taking items from transport belt connectables, this determines whether the inserter is allowed to take items from the right lane.
Sourcepub fn pickup_position(&self) -> MapPosition
pub fn pickup_position(&self) -> MapPosition
Where the inserter will pick up items from.
Inserters must have allow_custom_vectors set to true on their prototype to allow changing the pickup position.
Sourcepub fn pickup_target(&self) -> LuaEntity
pub fn pickup_target(&self) -> LuaEntity
The entity this inserter will attempt to pick up items from. If there are multiple possible entities at the pick-up point, writing to this attribute allows a mod to choose which one to pick up items from. The entity needs to collide with the tile box under the pick-up position. nil if there is no entity to pull items from.
Sourcepub fn pollution_bonus(&self) -> f64
pub fn pollution_bonus(&self) -> f64
The pollution bonus of this entity.
Sourcepub fn power_production(&self) -> f64
pub fn power_production(&self) -> f64
The power production specific to the ElectricEnergyInterface entity type.
Sourcepub fn power_switch_state(&self) -> bool
pub fn power_switch_state(&self) -> bool
The state of this power switch.
Sourcepub fn power_usage(&self) -> f64
pub fn power_usage(&self) -> f64
The power usage specific to the ElectricEnergyInterface entity type.
Sourcepub fn previous_recipe(&self) -> RecipeIDAndQualityIDPair
pub fn previous_recipe(&self) -> RecipeIDAndQualityIDPair
The previous recipe this furnace was using, if any.
Sourcepub fn priority_targets(&self) -> Vec<LuaEntityPrototype>
pub fn priority_targets(&self) -> Vec<LuaEntityPrototype>
The priority targets for this turret (if any).
Sourcepub fn procession_tick(&self) -> u32
pub fn procession_tick(&self) -> u32
how far into the current procession the cargo pod is.
Sourcepub fn productivity_bonus(&self) -> f64
pub fn productivity_bonus(&self) -> f64
The productivity bonus of this entity.
This includes force based bonuses as well as beacon/module bonuses.
Sourcepub fn products_finished(&self) -> u32
pub fn products_finished(&self) -> u32
The number of products this machine finished crafting in its lifetime.
Sourcepub fn prototype(&self) -> LuaEntityPrototype
pub fn prototype(&self) -> LuaEntityPrototype
The entity prototype of this entity.
Sourcepub fn proxy_target(&self) -> LuaEntity
pub fn proxy_target(&self) -> LuaEntity
The target entity for this item-request-proxy, if any.
Sourcepub fn proxy_target_entity(&self) -> LuaEntity
pub fn proxy_target_entity(&self) -> LuaEntity
Entity of which inventory is exposed by this ProxyContainer
Sourcepub fn proxy_target_inventory(&self) -> &str
pub fn proxy_target_inventory(&self) -> &str
Inventory index of the inventory that is exposed by this ProxyContainer
Sourcepub fn pump_input_rail_targets(&self) -> Vec<LuaEntity>
pub fn pump_input_rail_targets(&self) -> Vec<LuaEntity>
The rail targets of this pump’s input
Sourcepub fn pump_output_rail_targets(&self) -> Vec<LuaEntity>
pub fn pump_output_rail_targets(&self) -> Vec<LuaEntity>
The rail targets of this pump’s output
Sourcepub fn pumped_last_tick(&self) -> f64
pub fn pumped_last_tick(&self) -> f64
The amount of fluid moved by this offshore pump or normal pump in the last tick.
Sourcepub fn quality(&self) -> LuaQualityPrototype
pub fn quality(&self) -> LuaQualityPrototype
The quality of this entity.
Not all entities support quality and will give the “normal” quality back if they don’t.
Sourcepub fn radar_scan_progress(&self) -> f32
pub fn radar_scan_progress(&self) -> f32
The current radar scan progress, as a number in range [0, 1].
Sourcepub fn rail_layer(&self) -> &str
pub fn rail_layer(&self) -> &str
Gets rail layer of a given signal
Sourcepub fn rail_length(&self) -> f64
pub fn rail_length(&self) -> f64
Length of this rail piece.
Sourcepub fn recipe_locked(&self) -> bool
pub fn recipe_locked(&self) -> bool
When locked; the recipe in this assembling machine can’t be changed by the player.
Sourcepub fn relative_turret_orientation(&self) -> LuaAny
pub fn relative_turret_orientation(&self) -> LuaAny
The relative orientation of the vehicle turret, artillery turret, artillery wagon. nil if this entity isn’t a vehicle with a vehicle turret or artillery turret/wagon.
Writing does nothing if the vehicle doesn’t have a turret.
For the turret orientation of non-artillery turrets, use LuaEntity::orientation.
Sourcepub fn removal_plan(&self) -> Vec<BlueprintInsertPlan>
pub fn removal_plan(&self) -> Vec<BlueprintInsertPlan>
The removal plan for this item request proxy.
Sourcepub fn remove_unfiltered_items(&self) -> bool
pub fn remove_unfiltered_items(&self) -> bool
Whether items not included in this infinity container filters should be removed from the container.
Sourcepub fn render_player(&self) -> LuaPlayer
pub fn render_player(&self) -> LuaPlayer
The player that this simple-entity-with-owner, simple-entity-with-force, or highlight-box is visible to. nil when this entity is rendered for all players.
Sourcepub fn render_to_forces(&self) -> Vec<LuaForce>
pub fn render_to_forces(&self) -> Vec<LuaForce>
The forces that this simple-entity-with-owner or simple-entity-with-force is visible to. nil or an empty array when this entity is rendered for all forces.
Sourcepub fn request_from_buffers(&self) -> bool
pub fn request_from_buffers(&self) -> bool
Whether this requester chest is set to also request from buffer chests.
Useable only on entities that have requester slots.
Sourcepub fn result_quality(&self) -> LuaQualityPrototype
pub fn result_quality(&self) -> LuaQualityPrototype
The quality produced when this crafting machine finishes crafting. nil when crafting is not in progress.
Note: Writing nil is not allowed.
Sourcepub fn robot_order_queue(&self) -> Vec<WorkerRobotOrder>
pub fn robot_order_queue(&self) -> Vec<WorkerRobotOrder>
Get the current queue of robot orders.
Sourcepub fn rocket(&self) -> LuaEntity
pub fn rocket(&self) -> LuaEntity
The rocket silo rocket this cargo pod is attached to, or rocket silo rocket attached to this rocket silo - if any.
Sourcepub fn rocket_parts(&self) -> u32
pub fn rocket_parts(&self) -> u32
Number of rocket parts in this rocket silo.
Sourcepub fn rocket_silo_status(&self) -> &str
pub fn rocket_silo_status(&self) -> &str
The status of this rocket silo entity.
Sourcepub fn rotatable(&self) -> bool
pub fn rotatable(&self) -> bool
When entity is not to be rotatable (inserter, transport belt etc), it can’t be rotated by player using the R key.
Entities that are not rotatable naturally (like chest or furnace) can’t be set to be rotatable.
Sourcepub fn saved_request_filters(&self) -> SavedLogisticFilters
pub fn saved_request_filters(&self) -> SavedLogisticFilters
The saved logistic requests if they exist.
They exist when the infinity container was switched away from having the option to set logistic requests, for example by changing the logistic mode away from requester or buffer.
Sourcepub fn saved_request_from_buffers(&self) -> bool
pub fn saved_request_from_buffers(&self) -> bool
The saved request from buffers value if one exists.
The value exists when the infinity container was switched away from having the request from buffers option, for example by changing the logistic mode away from requester.
Sourcepub fn saved_set_requests(&self) -> bool
pub fn saved_set_requests(&self) -> bool
The saved set requests value if one exists.
The value exists when the infinity container was switched away from having the set requests option, for example by changing the logistic mode away from requester or buffer.
Sourcepub fn saved_storage_filters(&self) -> SavedLogisticFilters
pub fn saved_storage_filters(&self) -> SavedLogisticFilters
The saved storage filters if they exist.
They exist when the infinity container was switched away from having the option to set storage filters, for example by changing the logistic mode away from storage.
Sourcepub fn script_reservations_count(&self) -> u32
pub fn script_reservations_count(&self) -> u32
Amount of train stop reservations taken by script.
Sourcepub fn secondary_bounding_box(&self) -> BoundingBox
pub fn secondary_bounding_box(&self) -> BoundingBox
The secondary bounding box of this entity or nil if it doesn’t have one. This only exists for curved rails, and is automatically determined by the game.
Sourcepub fn secondary_selection_box(&self) -> BoundingBox
pub fn secondary_selection_box(&self) -> BoundingBox
The secondary selection box of this entity or nil if it doesn’t have one. This only exists for curved rails, and is automatically determined by the game.
Sourcepub fn segmented_unit(&self) -> LuaSegmentedUnit
pub fn segmented_unit(&self) -> LuaSegmentedUnit
The segmented unit object that the segment entity is a part of.
Sourcepub fn selected_gun_index(&self) -> u32
pub fn selected_gun_index(&self) -> u32
Index of the currently selected weapon slot of this character, car, or spidertron. nil if this entity doesn’t have guns.
Sourcepub fn selection_box(&self) -> BoundingBox
pub fn selection_box(&self) -> BoundingBox
LuaEntityPrototype::selection_box around entity’s given position and respecting the current entity orientation.
Sourcepub fn send_to_orbit_automatically(&self) -> bool
pub fn send_to_orbit_automatically(&self) -> bool
Whether this rocket silo is set to send items to orbit automatically. Only relevant if there is an item prototype with launch products with automated send_to_orbit_mode, such as the satellite in vanilla (without Space Age mod).
Sourcepub fn shooting_target(&self) -> LuaEntity
pub fn shooting_target(&self) -> LuaEntity
The shooting target for this turret, if any. Can’t be set to nil via script.
Sourcepub fn signal_state(&self) -> &str
pub fn signal_state(&self) -> &str
The state of this rail signal.
pub fn spawn_shift(&self) -> f64
pub fn spawning_cooldown(&self) -> f64
Sourcepub fn speed(&self) -> f32
pub fn speed(&self) -> f32
The current speed if this is a car, rolling stock, projectile or spidertron, or the maximum speed if this is a unit. The speed is in tiles per tick. nil if this is not a car, rolling stock, unit, projectile or spidertron.
Only the speed of units, cars, and projectiles are writable.
Sourcepub fn speed_bonus(&self) -> f64
pub fn speed_bonus(&self) -> f64
The speed bonus of this entity.
This includes force based bonuses as well as beacon/module bonuses.
Sourcepub fn splitter_filter(&self) -> ItemFilter
pub fn splitter_filter(&self) -> ItemFilter
The filter for this splitter, if any is set.
Sourcepub fn splitter_input_priority(&self) -> SplitterPriority
pub fn splitter_input_priority(&self) -> SplitterPriority
The input priority for this splitter.
Sourcepub fn splitter_output_priority(&self) -> SplitterPriority
pub fn splitter_output_priority(&self) -> SplitterPriority
The output priority for this splitter.
pub fn stack(&self) -> LuaItemStack
Sourcepub fn status(&self) -> &str
pub fn status(&self) -> &str
The status of this entity, if any.
This is always the actual status of the entity, even if LuaEntity::custom_status is set.
Sourcepub fn sticked_to(&self) -> LuaEntity
pub fn sticked_to(&self) -> LuaEntity
The entity this sticker is sticked to.
Sourcepub fn sticker_vehicle_modifiers(&self) -> LuaEntityStickerVehicleModifiers
pub fn sticker_vehicle_modifiers(&self) -> LuaEntityStickerVehicleModifiers
The vehicle modifiers applied to this entity through the attached stickers.
Sourcepub fn storage_filter(&self) -> ItemIDAndQualityIDPair
pub fn storage_filter(&self) -> ItemIDAndQualityIDPair
The storage filter for this logistic storage container.
Useable only on logistic containers with the "storage" logistic_mode.
Sourcepub fn supports_direction(&self) -> bool
pub fn supports_direction(&self) -> bool
Whether the entity has direction. When it is false for this entity, it will always return north direction when asked for.
The tags associated with this entity ghost. nil if this is not an entity ghost or when the ghost has no tags.
Sourcepub fn temperature(&self) -> f64
pub fn temperature(&self) -> f64
The temperature of this entity’s heat energy source. nil if this entity does not use a heat energy source.
Sourcepub fn tick_grown(&self) -> u32
pub fn tick_grown(&self) -> u32
The tick when this plant is fully grown.
Sourcepub fn tick_of_last_attack(&self) -> u32
pub fn tick_of_last_attack(&self) -> u32
The last tick this character entity was attacked.
Sourcepub fn tick_of_last_damage(&self) -> u32
pub fn tick_of_last_damage(&self) -> u32
The last tick this character entity was damaged.
Sourcepub fn tile_height(&self) -> u32
pub fn tile_height(&self) -> u32
Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). Uses the current direction of the entity.
Sourcepub fn tile_width(&self) -> u32
pub fn tile_width(&self) -> u32
Specifies the tiling size of the entity, is used to decide, if the center should be in the center of the tile (odd tile size dimension) or on the tile border (even tile size dimension). Uses the current direction of the entity.
Sourcepub fn time_to_live(&self) -> u64
pub fn time_to_live(&self) -> u64
The ticks left before a combat robot, highlight box, smoke, or sticker entity is destroyed.
Sourcepub fn time_to_next_effect(&self) -> u32
pub fn time_to_next_effect(&self) -> u32
The ticks until the next trigger effect of this smoke-with-trigger.
Sourcepub fn timeout(&self) -> u32
pub fn timeout(&self) -> u32
The timeout that’s left on this landmine in ticks. It describes the time between the landmine being placed and it being armed.
Sourcepub fn to_be_looted(&self) -> bool
pub fn to_be_looted(&self) -> bool
Will this item entity be picked up automatically when the player walks over it?
Sourcepub fn torso_orientation(&self) -> LuaAny
pub fn torso_orientation(&self) -> LuaAny
The torso orientation of this spider vehicle.
Sourcepub fn train(&self) -> LuaTrain
pub fn train(&self) -> LuaTrain
The train this rolling stock belongs to, if any. nil if this is not a rolling stock.
Sourcepub fn train_reservations_count(&self) -> u32
pub fn train_reservations_count(&self) -> u32
Amount of train stop reservations taken by trains.
Sourcepub fn train_stop_priority(&self) -> u8
pub fn train_stop_priority(&self) -> u8
Priority of this train stop.
Sourcepub fn trains_count(&self) -> u32
pub fn trains_count(&self) -> u32
Amount of trains related to this particular train stop. Includes train stopped at this train stop (until it finds a path to next target) and trains having this train stop as goal or waypoint.
Train may be included multiple times when braking distance covers this train stop multiple times.
Value may be read even when train stop has no control behavior.
This value is equal to LuaEntity::train_reservations_count + LuaEntity::script_reservations_count.
Sourcepub fn trains_in_block(&self) -> u32
pub fn trains_in_block(&self) -> u32
The number of trains in this rail block for this rail entity.
Sourcepub fn trains_limit(&self) -> u32
pub fn trains_limit(&self) -> u32
Amount of trains above which no new trains will be sent to this train stop. Writing nil will disable the limit (will set a maximum possible value).
When a train stop has a control behavior with wire connected and set_trains_limit enabled, this value will be overwritten by it.
Sourcepub fn transitional_request_target(&self) -> LuaSpacePlatform
pub fn transitional_request_target(&self) -> LuaSpacePlatform
The space platform in orbit this rocket silo is automatically requesting items for.
Sourcepub fn tree_color_index(&self) -> u8
pub fn tree_color_index(&self) -> u8
Index of the tree color.
Sourcepub fn tree_color_index_max(&self) -> u8
pub fn tree_color_index_max(&self) -> u8
Maximum index of the tree colors.
Sourcepub fn tree_gray_stage_index(&self) -> u8
pub fn tree_gray_stage_index(&self) -> u8
Index of the tree gray stage
Sourcepub fn tree_gray_stage_index_max(&self) -> u8
pub fn tree_gray_stage_index_max(&self) -> u8
Maximum index of the tree gray stages.
Sourcepub fn tree_stage_index(&self) -> u8
pub fn tree_stage_index(&self) -> u8
Index of the tree stage.
Sourcepub fn tree_stage_index_max(&self) -> u8
pub fn tree_stage_index_max(&self) -> u8
Maximum index of the tree stages.
Sourcepub fn underground_belt_neighbour(&self) -> LuaEntity
pub fn underground_belt_neighbour(&self) -> LuaEntity
Neighbour underground belt connected to this underground belt through underground lines.
Sourcepub fn unit_number(&self) -> u64
pub fn unit_number(&self) -> u64
A unique number identifying this entity for the lifetime of the save. These are allocated sequentially, and not re-used (until overflow).
Only entities inheriting from EntityWithOwnerPrototype, as well as ItemRequestProxyPrototype and EntityGhostPrototype are assigned a unit number. Returns nil otherwise.
Sourcepub fn use_filters(&self) -> bool
pub fn use_filters(&self) -> bool
If set to ‘true’, this inserter will use filtering logic.
This has no effect if the prototype does not support filters.
Sourcepub fn use_transitional_requests(&self) -> bool
pub fn use_transitional_requests(&self) -> bool
When true, the rocket silo will automatically request items for space platforms in orbit.
Setting the value will have no effect when the silo doesn’t support logistics.
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 valve_threshold_override(&self) -> f32
pub fn valve_threshold_override(&self) -> f32
The threshold override of this valve, or nil if an override is not defined.
If no override is defined, the threshold is taken from LuaEntityPrototype::valve_threshold.
Sourcepub fn vehicle_automatic_targeting_parameters(
&self,
) -> VehicleAutomaticTargetingParameters
pub fn vehicle_automatic_targeting_parameters( &self, ) -> VehicleAutomaticTargetingParameters
Read when this spidertron auto-targets enemies
Sourcepub fn wall_neighbours(&self) -> LuaEntityWallNeighbours
pub fn wall_neighbours(&self) -> LuaEntityWallNeighbours
Table of wall-connectable neighbours.
Sourcepub fn begin_crafting(&self, params: LuaControlBeginCraftingParams) -> u32
pub fn begin_crafting(&self, params: LuaControlBeginCraftingParams) -> u32
Begins crafting the given count of the given recipe.
Sourcepub fn can_insert(&self, items: LuaAny) -> bool
pub fn can_insert(&self, items: LuaAny) -> bool
Can at least some items be inserted?
Sourcepub fn can_place_entity(&self, params: LuaControlCanPlaceEntityParams) -> bool
pub fn can_place_entity(&self, params: LuaControlCanPlaceEntityParams) -> bool
Checks if this character or player can build the given entity at the given location on the surface the character or player is on.
Sourcepub fn can_reach_entity(&self, entity: LuaEntity) -> bool
pub fn can_reach_entity(&self, entity: LuaEntity) -> bool
Can a given entity be opened or accessed?
Sourcepub fn cancel_crafting(&self, params: LuaControlCancelCraftingParams)
pub fn cancel_crafting(&self, params: LuaControlCancelCraftingParams)
Cancels the given amount of crafts at the given crafting queue position. If this causes any later crafts that depend on the cancelled one to have insufficient ingredients, those crafts will also be cancelled.
Sourcepub fn clear_gui_arrow(&self)
pub fn clear_gui_arrow(&self)
Removes the arrow created by set_gui_arrow.
Sourcepub fn clear_items_inside(&self)
pub fn clear_items_inside(&self)
Remove all items from this entity.
Sourcepub fn clear_selected_entity(&self)
pub fn clear_selected_entity(&self)
Unselect any selected entity.
Sourcepub fn close_factoriopedia_gui(&self)
pub fn close_factoriopedia_gui(&self)
Closes the Factoriopedia GUI if it’s open.
Sourcepub fn disable_flashlight(&self)
pub fn disable_flashlight(&self)
Disable the flashlight.
Applied per controller. Only supported by defines.controllers.character and defines.controllers.remote.
Sourcepub fn enable_flashlight(&self)
pub fn enable_flashlight(&self)
Enable the flashlight.
Applied per controller. Only supported by defines.controllers.character and defines.controllers.remote.
Sourcepub fn get_craftable_count(&self, recipe: LuaAny) -> u32
pub fn get_craftable_count(&self, recipe: LuaAny) -> u32
Gets the count of the given recipe that can be crafted.
Sourcepub fn get_inventory(&self, inventory: &str) -> Option<LuaInventory>
pub fn get_inventory(&self, inventory: &str) -> Option<LuaInventory>
Get an inventory belonging to this entity. This can be either the “main” inventory or some auxiliary one, like the module slots or logistic trash slots.
A given defines.inventory is only meaningful for the corresponding LuaObject type. EG: get_inventory(defines.inventory.character_main) is only meaningful if ‘this’ is a player character. You may get a value back but if the type of ‘this’ isn’t the type referred to by the defines.inventory it’s almost guaranteed to not be the inventory asked for.
Sourcepub fn get_inventory_name(&self, inventory: &str) -> Option<&str>
pub fn get_inventory_name(&self, inventory: &str) -> Option<&str>
Get name of inventory. Names match keys of defines.inventory.
Sourcepub fn get_item_count(&self, item: Option<ItemFilter>) -> u32
pub fn get_item_count(&self, item: Option<ItemFilter>) -> u32
Get the number of all or some items in this entity.
Sourcepub fn get_main_inventory(&self) -> Option<LuaInventory>
pub fn get_main_inventory(&self) -> Option<LuaInventory>
Gets the main inventory for this character or player if this is a character or player.
Sourcepub fn get_max_inventory_index(&self) -> &str
pub fn get_max_inventory_index(&self) -> &str
The highest index of all inventories this entity can use. Allows iteration over all of them if desired.
Sourcepub fn get_requester_point(&self) -> Option<LuaLogisticPoint>
pub fn get_requester_point(&self) -> Option<LuaLogisticPoint>
Gets the requester logistic point for this entity if it has one.
Sourcepub fn has_items_inside(&self) -> bool
pub fn has_items_inside(&self) -> bool
Does this entity have any item inside it?
Sourcepub fn insert(&self, items: LuaAny) -> u32
pub fn insert(&self, items: LuaAny) -> u32
Insert items into this entity. This works the same way as inserters or shift-clicking: the “best” inventory is chosen automatically.
Sourcepub fn is_cursor_blueprint(&self) -> bool
pub fn is_cursor_blueprint(&self) -> bool
Returns whether the player is holding a blueprint. This takes both blueprint items as well as blueprint records from the blueprint library into account.
Note that both this method refers to the currently selected blueprint, which means that a blueprint book with a selected blueprint will return the information as well.
Sourcepub fn is_cursor_empty(&self) -> bool
pub fn is_cursor_empty(&self) -> bool
Returns whether the player is holding something in the cursor. Takes into account items from the blueprint library, as well as items and ghost cursor.
Sourcepub fn is_flashlight_enabled(&self) -> bool
pub fn is_flashlight_enabled(&self) -> bool
Is the flashlight enabled for the current controller. Only supported by defines.controllers.character and defines.controllers.remote.
Sourcepub fn is_player(&self) -> bool
pub fn is_player(&self) -> bool
When true control adapter is a LuaPlayer object, false for entities including characters with players.
Sourcepub fn mine_entity(&self, entity: LuaEntity, force: Option<bool>) -> bool
pub fn mine_entity(&self, entity: LuaEntity, force: Option<bool>) -> bool
Mines the given entity as if this player (or character) mined it.
Sourcepub fn mine_tile(&self, tile: LuaTile) -> bool
pub fn mine_tile(&self, tile: LuaTile) -> bool
Mines the given tile as if this player (or character) mined it.
Sourcepub fn open_factoriopedia_gui(&self, prototype: Option<LuaAny>)
pub fn open_factoriopedia_gui(&self, prototype: Option<LuaAny>)
Open the Factoriopedia GUI and select a given entry, if any valid ID is given.
Sourcepub fn open_technology_gui(&self, technology: Option<LuaAny>)
pub fn open_technology_gui(&self, technology: Option<LuaAny>)
Open the technology GUI and select a given technology.
Sourcepub fn remove_item(&self, items: LuaAny) -> u32
pub fn remove_item(&self, items: LuaAny) -> u32
Remove items from this entity.
Sourcepub fn set_driving(&self, driving: bool, force: Option<bool>)
pub fn set_driving(&self, driving: bool, force: Option<bool>)
Sets if this character or player is driving. Returns if the player or character is still driving.
Sourcepub fn set_gui_arrow(&self, params: LuaControlSetGuiArrowParams)
pub fn set_gui_arrow(&self, params: LuaControlSetGuiArrowParams)
Create an arrow which points at this entity. This is used in the tutorial. For examples, see control.lua in the campaign missions.
Sourcepub fn teleport(
&self,
build_check_type: Option<&str>,
position: MapPosition,
raise_teleported: Option<bool>,
snap_to_grid: Option<bool>,
surface: Option<LuaAny>,
) -> bool
pub fn teleport( &self, build_check_type: Option<&str>, position: MapPosition, raise_teleported: Option<bool>, snap_to_grid: Option<bool>, surface: Option<LuaAny>, ) -> bool
Teleport the entity to a given position, possibly on another surface.
Some entities may not be teleported. For instance, transport belts won’t allow teleportation and this method will always return false when used on any such entity.
You can also pass 1 or 2 numbers as the parameters and they will be used as relative teleport coordinates 'teleport(0, 1)' to move the entity 1 tile positive y. 'teleport(4)' to move the entity 4 tiles to the positive x.
script_raised_teleported will not be raised if teleporting a player with no character.
Sourcepub fn update_selected_entity(&self, position: MapPosition)
pub fn update_selected_entity(&self, position: MapPosition)
Select an entity, as if by hovering the mouse above it.
Sourcepub fn add_autopilot_destination(
&self,
attempt_patrol: Option<bool>,
position: MapPosition,
)
pub fn add_autopilot_destination( &self, attempt_patrol: Option<bool>, position: MapPosition, )
Adds the given position to this spidertron’s autopilot’s queue of destinations.
Sourcepub fn add_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
pub fn add_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
Adds the given fluid to the entity’s given fluid storage if possible.
If the current fluid conflicts or the current filter conflicts the fluid may not be added.
Sourcepub fn add_fluid_box_linked_connection(
&self,
other_entity: LuaEntity,
other_linked_connection_id: u32,
this_linked_connection_id: u32,
)
pub fn add_fluid_box_linked_connection( &self, other_entity: LuaEntity, other_linked_connection_id: u32, this_linked_connection_id: u32, )
Registers a linked fluidbox connection between this entity and other entity. Because entity may have multiple fluidboxes, each with multiple connections that could be linked, a unique value for this and other linked_connection_id may need to be given.
It may happen a linked fluidbox connection is not established immediately due to crafting machines being possible to not have certain fluidboxes exposed at a given point in time, but once they appear (due to recipe changes that would use them) they will be linked. Linked connections are persisted as (this_entity, this_linked_connection_id, other_entity, other_linked_connection_id) so if a pipe connection definition’s value of linked_connection_id changes existing connections may not restore correct connections.
Every fluidbox connection that was defined in prototypes as connection_type==“linked” may be linked to at most 1 other fluidbox. When trying to connect already used connection, previous connection will be removed.
Linked connections cannot go to the same entity even if they would be part of other fluidbox.
Sourcepub fn add_fluid_segment_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
pub fn add_fluid_segment_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
Adds the given fluid to the given storage’s fluid segment if possible.
Sourcepub fn add_market_item(&self, offer: Offer)
pub fn add_market_item(&self, offer: Offer)
Offer a thing on the market.
Sourcepub fn apply_upgrade(&self) -> (Option<LuaEntity>, Option<LuaEntity>)
pub fn apply_upgrade(&self) -> (Option<LuaEntity>, Option<LuaEntity>)
Upgrades this entity in place if it’s marked to be upgraded.
Sourcepub fn can_be_destroyed(&self) -> bool
pub fn can_be_destroyed(&self) -> bool
Whether the entity can be destroyed
Sourcepub fn can_set_inventory_filter(
&self,
filter: ItemFilter,
index: u32,
inventory_index: &str,
) -> bool
pub fn can_set_inventory_filter( &self, filter: ItemFilter, index: u32, inventory_index: &str, ) -> bool
The same as LuaInventory::can_set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn can_shoot(&self, position: MapPosition, target: LuaEntity) -> bool
pub fn can_shoot(&self, position: MapPosition, target: LuaEntity) -> bool
Whether this character can shoot the given entity or position.
Sourcepub fn can_wires_reach(&self, entity: LuaEntity) -> bool
pub fn can_wires_reach(&self, entity: LuaEntity) -> bool
Can wires reach between these entities.
Sourcepub fn cancel_deconstruction(&self, force: LuaAny, player: Option<LuaAny>)
pub fn cancel_deconstruction(&self, force: LuaAny, player: Option<LuaAny>)
Cancels deconstruction if it is scheduled, does nothing otherwise.
Sourcepub fn cancel_upgrade(&self, force: LuaAny, player: Option<LuaAny>) -> bool
pub fn cancel_upgrade(&self, force: LuaAny, player: Option<LuaAny>) -> bool
Cancels upgrade if it is scheduled, does nothing otherwise.
Sourcepub fn clear_fluid(&self, index: LuaAny) -> Option<Fluid>
pub fn clear_fluid(&self, index: LuaAny) -> Option<Fluid>
Removes all fluid from the entity’s given fluid storage if possible.
Sourcepub fn clear_fluid_inside(&self)
pub fn clear_fluid_inside(&self)
Remove all fluids from this entity and connected fluid segments.
Sourcepub fn clear_fluid_segment_fluid(&self, index: LuaAny) -> Option<Fluid>
pub fn clear_fluid_segment_fluid(&self, index: LuaAny) -> Option<Fluid>
Clears the given fluid storage’s fluid segment.
Sourcepub fn clear_fluids(&self) -> Vec<Fluid>
pub fn clear_fluids(&self) -> Vec<Fluid>
Clears all fluids in this entity but will not clear fluids in any fluid segments fluidboxes may be part of.
Sourcepub fn clear_market_items(&self)
pub fn clear_market_items(&self)
Removes all offers from a market.
pub fn clear_stored_durability(&self)
Sourcepub fn clear_tooltip_field(&self, id: u32)
pub fn clear_tooltip_field(&self, id: u32)
Removes selected runtime tooltip field.
Sourcepub fn clear_tooltip_fields(&self)
pub fn clear_tooltip_fields(&self)
Removes all runtime tooltip fields attached to this entity.
Sourcepub fn clone(&self, params: LuaEntityCloneParams) -> Option<LuaEntity>
pub fn clone(&self, params: LuaEntityCloneParams) -> Option<LuaEntity>
Clones this entity.
Sourcepub fn connect_linked_belts(&self, neighbour: Option<LuaEntity>)
pub fn connect_linked_belts(&self, neighbour: Option<LuaEntity>)
Connects current linked belt with another one.
Neighbours have to be of different type. If given linked belt is connected to something else it will be disconnected first. If provided neighbour is connected to something else it will also be disconnected first. Automatically updates neighbour to be connected back to this one.
Sourcepub fn connect_rolling_stock(&self, direction: &str) -> bool
pub fn connect_rolling_stock(&self, direction: &str) -> bool
Connects the rolling stock in the given direction.
Sourcepub fn copy_settings(
&self,
by_player: Option<LuaAny>,
entity: LuaEntity,
) -> Vec<ItemWithQualityCount>
pub fn copy_settings( &self, by_player: Option<LuaAny>, entity: LuaEntity, ) -> Vec<ItemWithQualityCount>
Copies settings from the given entity onto this entity.
Sourcepub fn create_build_effect_smoke(&self)
pub fn create_build_effect_smoke(&self)
Creates the same smoke that is created when you place a building by hand.
You can play the building sound to go with it by using LuaSurface::play_sound, eg: entity.surface.play_sound{path="entity-build/"..entity.prototype.name, position=entity.position}
Sourcepub fn create_cargo_pod(
&self,
params: LuaEntityCreateCargoPodParams,
) -> Option<LuaEntity>
pub fn create_cargo_pod( &self, params: LuaEntityCreateCargoPodParams, ) -> Option<LuaEntity>
Creates a cargo pod if possible.
Cargo pod will be created with invalid destination type. Setting cargo_pod_destination will cause it to launch.
Sourcepub fn damage(
&self,
cause: Option<LuaEntity>,
damage: f32,
force: LuaAny,
source: Option<LuaEntity>,
type: Option<LuaAny>,
) -> f32
pub fn damage( &self, cause: Option<LuaEntity>, damage: f32, force: LuaAny, source: Option<LuaEntity>, type: Option<LuaAny>, ) -> f32
Damages the entity.
Sourcepub fn destroy(&self, params: LuaEntityDestroyParams) -> bool
pub fn destroy(&self, params: LuaEntityDestroyParams) -> bool
Destroys the entity.
Not all entities can be destroyed - things such as rails under trains cannot be destroyed until the train is moved or destroyed.
Sourcepub fn die(&self, cause: Option<LuaEntity>, force: Option<LuaAny>) -> bool
pub fn die(&self, cause: Option<LuaEntity>, force: Option<LuaAny>) -> bool
Immediately kills the entity. Does nothing if the entity doesn’t have health.
Unlike LuaEntity::destroy, die will trigger the on_entity_died event and the entity will produce a corpse and drop loot if it has any.
Sourcepub fn disconnect_linked_belts(&self)
pub fn disconnect_linked_belts(&self)
Disconnects linked belt from its neighbour.
Sourcepub fn disconnect_rolling_stock(&self, direction: &str) -> bool
pub fn disconnect_rolling_stock(&self, direction: &str) -> bool
Tries to disconnect this rolling stock in the given direction.
Sourcepub fn extract_fluid(&self, params: LuaEntityExtractFluidParams) -> LuaAny
pub fn extract_fluid(&self, params: LuaEntityExtractFluidParams) -> LuaAny
Remove fluid from this entity.
If temperature is given only fluid matching that exact temperature is removed. If minimum and maximum is given fluid within that range is removed.
Sourcepub fn flip(&self, params: LuaEntityFlipParams) -> bool
pub fn flip(&self, params: LuaEntityFlipParams) -> bool
Flips this entity
Sourcepub fn force_finish_ascending(&self)
pub fn force_finish_ascending(&self)
Take an ascending cargo pod and safely make it skip all animation and immediately switch surface.
Sourcepub fn force_finish_descending(&self)
pub fn force_finish_descending(&self)
Take a descending cargo pod and safely make it arrive and deposit cargo.
Sourcepub fn get_beacon_effect_receivers(&self) -> Vec<LuaEntity>
pub fn get_beacon_effect_receivers(&self) -> Vec<LuaEntity>
Returns a table with all entities affected by this beacon
Sourcepub fn get_beacons(&self) -> Option<Vec<LuaEntity>>
pub fn get_beacons(&self) -> Option<Vec<LuaEntity>>
Returns a table with all beacons affecting this effect receiver. Can only be used when the entity has an effect receiver (AssemblingMachine, Furnace, Lab, MiningDrills)
Sourcepub fn get_beam_source(&self) -> Option<BeamTarget>
pub fn get_beam_source(&self) -> Option<BeamTarget>
Get the source of this beam.
Sourcepub fn get_beam_target(&self) -> Option<BeamTarget>
pub fn get_beam_target(&self) -> Option<BeamTarget>
Get the target of this beam.
Sourcepub fn get_burnt_result_inventory(&self) -> Option<LuaInventory>
pub fn get_burnt_result_inventory(&self) -> Option<LuaInventory>
The burnt result inventory for this entity or nil if this entity doesn’t have a burnt result inventory.
Sourcepub fn get_cargo_bays(&self) -> Vec<LuaEntity>
pub fn get_cargo_bays(&self) -> Vec<LuaEntity>
Gets the cargo bays connected to this cargo landing pad or space platform hub.
Sourcepub fn get_child_signals(&self) -> Vec<LuaEntity>
pub fn get_child_signals(&self) -> Vec<LuaEntity>
Returns all child signals. Child signals can be either RailSignal or RailChainSignal. Child signals are signals which are checked by this signal to determine a chain state.
pub fn get_circuit_network( &self, wire_connector_id: &str, ) -> Option<LuaCircuitNetwork>
pub fn get_connected_rail( &self, params: LuaEntityGetConnectedRailParams, ) -> (Option<LuaEntity>, Option<&str>, Option<&str>)
Sourcepub fn get_connected_rails(&self) -> Vec<LuaEntity>
pub fn get_connected_rails(&self) -> Vec<LuaEntity>
Get the rails that this signal is connected to.
Sourcepub fn get_connected_rolling_stock(
&self,
direction: &str,
) -> (Option<LuaEntity>, Option<&str>)
pub fn get_connected_rolling_stock( &self, direction: &str, ) -> (Option<LuaEntity>, Option<&str>)
Gets rolling stock connected to the given end of this stock.
Sourcepub fn get_control_behavior(&self) -> Option<LuaControlBehavior>
pub fn get_control_behavior(&self) -> Option<LuaControlBehavior>
Gets the control behavior of the entity (if any).
Sourcepub fn get_damage_to_be_taken(&self) -> Option<f32>
pub fn get_damage_to_be_taken(&self) -> Option<f32>
Returns the amount of damage to be taken by this entity.
Sourcepub fn get_driver(&self) -> Option<LuaAny>
pub fn get_driver(&self) -> Option<LuaAny>
Gets the driver of this vehicle if any.
Sourcepub fn get_electric_input_flow_limit(
&self,
quality: Option<LuaAny>,
) -> Option<f64>
pub fn get_electric_input_flow_limit( &self, quality: Option<LuaAny>, ) -> Option<f64>
The input flow limit for the electric energy source. nil if the entity doesn’t have an electric energy source.
Sourcepub fn get_electric_output_flow_limit(
&self,
quality: Option<LuaAny>,
) -> Option<f64>
pub fn get_electric_output_flow_limit( &self, quality: Option<LuaAny>, ) -> Option<f64>
The output flow limit for the electric energy source. nil if the entity doesn’t have an electric energy source.
Sourcepub fn get_filter(&self, slot_index: u32) -> Option<LuaAny>
pub fn get_filter(&self, slot_index: u32) -> Option<LuaAny>
Get the filter for a slot in an inserter, loader, mining drill, asteroid collector, or logistic storage container. The entity must allow filters.
Sourcepub fn get_fluid(&self, index: LuaAny) -> Option<Fluid>
pub fn get_fluid(&self, index: LuaAny) -> Option<Fluid>
Gets the fluid in the entity’s given fluid storage if one exists.
Sourcepub fn get_fluid_box_linked_connection(
&self,
this_linked_connection_id: u32,
) -> (Option<LuaEntity>, Option<u32>)
pub fn get_fluid_box_linked_connection( &self, this_linked_connection_id: u32, ) -> (Option<LuaEntity>, Option<u32>)
Returns other end of a linked fluidbox connection.
Sourcepub fn get_fluid_box_linked_connections(&self) -> Vec<FluidBoxConnectionRecord>
pub fn get_fluid_box_linked_connections(&self) -> Vec<FluidBoxConnectionRecord>
Returns list of all linked fluidbox connections registered for this entity.
Sourcepub fn get_fluid_box_neighbours(
&self,
index: LuaAny,
) -> Option<Vec<FluidBoxNeighbourRecord>>
pub fn get_fluid_box_neighbours( &self, index: LuaAny, ) -> Option<Vec<FluidBoxNeighbourRecord>>
The entities the given fluidbox is connected to.
Sourcepub fn get_fluid_box_pipe_connections(
&self,
index: LuaAny,
) -> Option<Vec<PipeConnection>>
pub fn get_fluid_box_pipe_connections( &self, index: LuaAny, ) -> Option<Vec<PipeConnection>>
Get the given connections and associated data of the fluidbox.
Sourcepub fn get_fluid_box_prototype(&self, index: LuaAny) -> Option<LuaAny>
pub fn get_fluid_box_prototype(&self, index: LuaAny) -> Option<LuaAny>
The prototype of the entity’s given fluid storage if one exists. If this is used on a fluidbox of a crafting machine which due to recipe was created by merging multiple prototypes, a table of prototypes that were merged will be returned instead For storages on entities that have fluid storage but no prototype for those storages (fluid wagons, and fluid turrets) this returns nil.
Sourcepub fn get_fluid_capacity(&self, index: LuaAny) -> LuaAny
pub fn get_fluid_capacity(&self, index: LuaAny) -> LuaAny
Gets the maximum capacity of the entity’s given fluid storage.
Sourcepub fn get_fluid_contents(&self) -> HashMap<String, LuaAny>
pub fn get_fluid_contents(&self) -> HashMap<String, LuaAny>
Get amounts of all fluids in this entity.
If information about fluid temperatures is required, LuaEntity::get_fluid should be used instead.
Sourcepub fn get_fluid_count(&self, fluid: Option<&str>) -> LuaAny
pub fn get_fluid_count(&self, fluid: Option<&str>) -> LuaAny
Get the amount of all or some fluid in this entity.
If information about fluid temperatures is required, LuaEntity::get_fluid should be used instead.
Sourcepub fn get_fluid_filter(&self, index: LuaAny) -> Option<FluidFilter>
pub fn get_fluid_filter(&self, index: LuaAny) -> Option<FluidFilter>
Get a fluidbox filter, such as the filter of a pump.
Sourcepub fn get_fluid_segment_capacity(&self, index: LuaAny) -> LuaAny
pub fn get_fluid_segment_capacity(&self, index: LuaAny) -> LuaAny
Gets the maximum capacity of the given fluid storage’s segment.
Sourcepub fn get_fluid_segment_extent_bounding_box(
&self,
index: LuaAny,
) -> BoundingBox
pub fn get_fluid_segment_extent_bounding_box( &self, index: LuaAny, ) -> BoundingBox
Gets the current extent bounding box of of the given fluid storage’s segment.
Sourcepub fn get_fluid_segment_filter(&self, index: LuaAny) -> Option<FluidFilter>
pub fn get_fluid_segment_filter(&self, index: LuaAny) -> Option<FluidFilter>
Gets the filter of the given fluid storage’s segment. The filter is based on the filters set on the fluidboxes of the segment, so it can’t be set directly on the segment.
Sourcepub fn get_fluid_segment_fluid(&self, index: LuaAny) -> Option<Fluid>
pub fn get_fluid_segment_fluid(&self, index: LuaAny) -> Option<Fluid>
The fluid within the given storage’s fluid segment.
pub fn get_fluid_segment_id(&self, index: LuaAny) -> u32
Sourcepub fn get_fluid_source_fluid(&self) -> Option<&str>
pub fn get_fluid_source_fluid(&self) -> Option<&str>
Checks what is expected fluid to be produced from the offshore pump’s source tile. It accounts for visible tile, hidden tile and double hidden tile. It ignores currently set fluid box filter.
Sourcepub fn get_fluid_source_tile(&self) -> TilePosition
pub fn get_fluid_source_tile(&self) -> TilePosition
Gives TilePosition of a tile which this offshore pump uses to check what fluid should be produced.
Sourcepub fn get_fuel_inventory(&self) -> Option<LuaInventory>
pub fn get_fuel_inventory(&self) -> Option<LuaInventory>
The fuel inventory for this entity or nil if this entity doesn’t have a fuel inventory.
Sourcepub fn get_health_ratio(&self) -> Option<f32>
pub fn get_health_ratio(&self) -> Option<f32>
The health ratio of this entity between 1 and 0 (for full health and no health respectively).
Sourcepub fn get_heat_setting(&self) -> HeatSetting
pub fn get_heat_setting(&self) -> HeatSetting
Gets the heat setting for this heat interface.
Sourcepub fn get_inbound_signals(&self) -> Vec<LuaEntity>
pub fn get_inbound_signals(&self) -> Vec<LuaEntity>
Returns all signals guarding entrance to a rail block this rail belongs to.
Sourcepub fn get_infinity_container_filter(
&self,
index: u32,
) -> Option<InfinityInventoryFilter>
pub fn get_infinity_container_filter( &self, index: u32, ) -> Option<InfinityInventoryFilter>
Gets the filter for this infinity container at the given index, or nil if the filter index doesn’t exist or is empty.
Sourcepub fn get_infinity_pipe_filter(&self) -> Option<InfinityPipeFilter>
pub fn get_infinity_pipe_filter(&self) -> Option<InfinityPipeFilter>
Gets the filter for this infinity pipe, or nil if the filter is empty.
Sourcepub fn get_inventory_bar(&self, inventory_index: &str) -> u32
pub fn get_inventory_bar(&self, inventory_index: &str) -> u32
The same as LuaInventory::get_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn get_inventory_filter(
&self,
index: u32,
inventory_index: &str,
) -> Option<ItemFilter>
pub fn get_inventory_filter( &self, index: u32, inventory_index: &str, ) -> Option<ItemFilter>
The same as LuaInventory::get_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn get_inventory_size_override(&self, inventory_index: &str) -> Option<u16>
pub fn get_inventory_size_override(&self, inventory_index: &str) -> Option<u16>
Gets the inventory size override of the selected inventory if size override was set using set_inventory_size_override.
Sourcepub fn get_item_insert_specification(
&self,
mirrored: Option<bool>,
position: MapPosition,
) -> (u32, f32)
pub fn get_item_insert_specification( &self, mirrored: Option<bool>, position: MapPosition, ) -> (u32, f32)
Get an item insert specification onto a belt connectable: for a given map position provides into which line at what position item should be inserted to be closest to the provided position.
Sourcepub fn get_line_item_position(&self, index: &str, position: f32) -> MapPosition
pub fn get_line_item_position(&self, index: &str, position: f32) -> MapPosition
Get a map position related to a position on a transport line.
Sourcepub fn get_logistic_point(&self, index: Option<&str>) -> Option<LuaAny>
pub fn get_logistic_point(&self, index: Option<&str>) -> Option<LuaAny>
Gets all the LuaLogisticPoints that this entity owns. Optionally returns only the point specified by the index parameter.
Sourcepub fn get_logistic_sections(&self) -> Option<LuaLogisticSections>
pub fn get_logistic_sections(&self) -> Option<LuaLogisticSections>
Gives logistic sections of this entity if it uses logistic sections.
Sourcepub fn get_market_items(&self) -> Vec<Offer>
pub fn get_market_items(&self) -> Vec<Offer>
Get all offers in a market as an array.
Sourcepub fn get_max_transport_line_index(&self) -> &str
pub fn get_max_transport_line_index(&self) -> &str
Get the maximum transport line index of a belt or belt connectable entity.
Sourcepub fn get_module_inventory(&self) -> Option<LuaInventory>
pub fn get_module_inventory(&self) -> Option<LuaInventory>
Inventory for storing modules of this entity; nil if this entity has no module inventory.
Sourcepub fn get_movement(&self) -> Vector
pub fn get_movement(&self) -> Vector
Gets the combined movement vector (direction and speed) of this combat robot or asteroid. The entity moves by this vector each tick.
Note that for combat robots this does not include the constant drift in the direction they are facing.
Sourcepub fn get_or_create_control_behavior(&self) -> Option<LuaControlBehavior>
pub fn get_or_create_control_behavior(&self) -> Option<LuaControlBehavior>
Gets (and or creates if needed) the control behavior of the entity.
Sourcepub fn get_outbound_signals(&self) -> Vec<LuaEntity>
pub fn get_outbound_signals(&self) -> Vec<LuaEntity>
Returns all signals guarding exit from a rail block this rail belongs to.
Sourcepub fn get_output_inventory(&self) -> Option<LuaInventory>
pub fn get_output_inventory(&self) -> Option<LuaInventory>
Gets the entity’s output inventory if it has one.
Sourcepub fn get_parent_signals(&self) -> Vec<LuaEntity>
pub fn get_parent_signals(&self) -> Vec<LuaEntity>
Returns all parent signals. Parent signals are always RailChainSignal. Parent signals are those signals that are checking state of this signal to determine their own chain state.
Sourcepub fn get_passenger(&self) -> Option<LuaAny>
pub fn get_passenger(&self) -> Option<LuaAny>
Gets the passenger of this car, spidertron, or cargo pod if any.
This differs over LuaEntity::get_driver in that for cars, the passenger can’t drive the car.
Sourcepub fn get_priority_target(&self, index: u32) -> Option<LuaEntityPrototype>
pub fn get_priority_target(&self, index: u32) -> Option<LuaEntityPrototype>
Get the entity ID at the specified position in the turret’s priority list.
Sourcepub fn get_radius(&self) -> f64
pub fn get_radius(&self) -> f64
The radius of this entity. The radius is defined as half the distance between the top left corner and bottom right corner of the collision box.
Sourcepub fn get_rail_end(&self, direction: &str) -> LuaRailEnd
pub fn get_rail_end(&self, direction: &str) -> LuaRailEnd
Gets a LuaRailEnd object for specified end of this rail
Sourcepub fn get_rail_segment_end(&self, direction: &str) -> (LuaEntity, &str)
pub fn get_rail_segment_end(&self, direction: &str) -> (LuaEntity, &str)
Get the rail at the end of the rail segment this rail is in.
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_rail_segment_length(&self) -> f64
pub fn get_rail_segment_length(&self) -> f64
Get the length of the rail segment this rail is in.
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_rail_segment_overlaps(&self) -> Vec<LuaEntity>
pub fn get_rail_segment_overlaps(&self) -> Vec<LuaEntity>
Get a rail from each rail segment that overlaps with this rail’s rail segment.
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_rail_segment_rails(&self, direction: &str) -> Vec<LuaEntity>
pub fn get_rail_segment_rails(&self, direction: &str) -> Vec<LuaEntity>
Get all rails of a rail segment this rail is in
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_rail_segment_signal(
&self,
direction: &str,
in_else_out: bool,
) -> Option<LuaEntity>
pub fn get_rail_segment_signal( &self, direction: &str, in_else_out: bool, ) -> Option<LuaEntity>
Get the rail signal at the start/end of the rail segment this rail is in.
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_rail_segment_stop(&self, direction: &str) -> Option<LuaEntity>
pub fn get_rail_segment_stop(&self, direction: &str) -> Option<LuaEntity>
Get train stop at the start/end of the rail segment this rail is in.
A rail segment is a continuous section of rail with no branches, signals, nor train stops.
Sourcepub fn get_recipe(&self) -> (Option<LuaRecipe>, Option<LuaQualityPrototype>)
pub fn get_recipe(&self) -> (Option<LuaRecipe>, Option<LuaQualityPrototype>)
Current recipe being assembled by this machine, if any.
Sourcepub fn get_signal(
&self,
extra_wire_connector_id: Option<&str>,
signal: SignalID,
wire_connector_id: &str,
) -> i32
pub fn get_signal( &self, extra_wire_connector_id: Option<&str>, signal: SignalID, wire_connector_id: &str, ) -> i32
Read a single signal from the selected wire connector
Sourcepub fn get_signals(
&self,
extra_wire_connector_id: Option<&str>,
wire_connector_id: &str,
) -> Option<Vec<Signal>>
pub fn get_signals( &self, extra_wire_connector_id: Option<&str>, wire_connector_id: &str, ) -> Option<Vec<Signal>>
Read all signals from the selected wire connector.
Sourcepub fn get_spider_legs(&self) -> Vec<LuaEntity>
pub fn get_spider_legs(&self) -> Vec<LuaEntity>
Gets legs of given SpiderVehicle.
Sourcepub fn get_stopped_train(&self) -> Option<LuaTrain>
pub fn get_stopped_train(&self) -> Option<LuaTrain>
The train currently stopped at this train stop, if any.
pub fn get_stored_durability(&self, item: LuaAny) -> LabStoredDurability
Sourcepub fn get_tooltip_field(&self, id: u32) -> Option<RuntimeTooltipField>
pub fn get_tooltip_field(&self, id: u32) -> Option<RuntimeTooltipField>
Gets selected runtime tooltip field.
Sourcepub fn get_tooltip_fields(&self) -> Vec<RuntimeTooltipField>
pub fn get_tooltip_fields(&self) -> Vec<RuntimeTooltipField>
Gets all runtime tooltip fields attached to this entity.
Sourcepub fn get_train_stop_trains(&self) -> Vec<LuaTrain>
pub fn get_train_stop_trains(&self) -> Vec<LuaTrain>
The trains scheduled to stop at this train stop.
Sourcepub fn get_transport_line(&self, index: &str) -> LuaTransportLine
pub fn get_transport_line(&self, index: &str) -> LuaTransportLine
Get a transport line of a belt or belt connectable entity.
Sourcepub fn get_upgrade_target(
&self,
) -> (Option<LuaEntityPrototype>, Option<LuaQualityPrototype>)
pub fn get_upgrade_target( &self, ) -> (Option<LuaEntityPrototype>, Option<LuaQualityPrototype>)
Returns the new entity prototype and its quality.
Sourcepub fn get_wire_connector(
&self,
or_create: bool,
wire_connector_id: &str,
) -> Option<LuaWireConnector>
pub fn get_wire_connector( &self, or_create: bool, wire_connector_id: &str, ) -> Option<LuaWireConnector>
Gets a single wire connector of this entity, if any.
Sourcepub fn get_wire_connectors(
&self,
or_create: bool,
) -> HashMap<String, Box<LuaWireConnector>>
pub fn get_wire_connectors( &self, or_create: bool, ) -> HashMap<String, Box<LuaWireConnector>>
Gets all wire connectors of this entity
Sourcepub fn ghost_has_flag(&self, flag: EntityPrototypeFlag) -> bool
pub fn ghost_has_flag(&self, flag: EntityPrototypeFlag) -> bool
Same as LuaEntity::has_flag, but targets the inner entity on a entity ghost.
Sourcepub fn has_flag(&self, flag: EntityPrototypeFlag) -> bool
pub fn has_flag(&self, flag: EntityPrototypeFlag) -> bool
Test whether this entity’s prototype has a certain flag set.
entity.has_flag(f) is a shortcut for entity.prototype.has_flag(f).
Sourcepub fn has_fluid_segment(&self, index: LuaAny) -> bool
pub fn has_fluid_segment(&self, index: LuaAny) -> bool
Whether the given fluid storage has a fluid segment.
Sourcepub fn insert_fluid(&self, fluid: Fluid) -> LuaAny
pub fn insert_fluid(&self, fluid: Fluid) -> LuaAny
Insert fluid into this entity. Fluidbox is chosen automatically.
Sourcepub fn inventory_supports_bar(&self, inventory_index: &str) -> bool
pub fn inventory_supports_bar(&self, inventory_index: &str) -> bool
The same as LuaInventory::supports_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn inventory_supports_filters(&self, inventory_index: &str) -> bool
pub fn inventory_supports_filters(&self, inventory_index: &str) -> bool
The same as LuaInventory::supports_filters but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
pub fn is_closed(&self) -> bool
pub fn is_closing(&self) -> bool
Sourcepub fn is_connected_to_electric_network(&self) -> bool
pub fn is_connected_to_electric_network(&self) -> bool
Returns true if this entity produces or consumes electricity and is connected to an electric network that has at least one entity that can produce power.
Sourcepub fn is_crafting(&self) -> bool
pub fn is_crafting(&self) -> bool
Returns whether a craft is currently in process. It does not indicate whether progress is currently being made, but whether a crafting process has been started in this machine.
Sourcepub fn is_inventory_filtered(&self, inventory_index: &str) -> bool
pub fn is_inventory_filtered(&self, inventory_index: &str) -> bool
The same as LuaInventory::is_filtered but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
pub fn is_opened(&self) -> bool
pub fn is_opening(&self) -> bool
Sourcepub fn is_rail_in_same_rail_block_as(&self, other_rail: LuaEntity) -> bool
pub fn is_rail_in_same_rail_block_as(&self, other_rail: LuaEntity) -> bool
Checks if this rail and other rail both belong to the same rail block.
Sourcepub fn is_rail_in_same_rail_segment_as(&self, other_rail: LuaEntity) -> bool
pub fn is_rail_in_same_rail_segment_as(&self, other_rail: LuaEntity) -> bool
Checks if this rail and other rail both belong to the same rail segment.
Sourcepub fn is_registered_for_construction(&self) -> bool
pub fn is_registered_for_construction(&self) -> bool
Is this entity or tile ghost or item request proxy registered for construction? If false, it means a construction robot has been dispatched to build the entity, or it is not an entity that can be constructed.
Sourcepub fn is_registered_for_deconstruction(&self, force: LuaAny) -> bool
pub fn is_registered_for_deconstruction(&self, force: LuaAny) -> bool
Is this entity registered for deconstruction with this force? If false, it means a construction robot has been dispatched to deconstruct it, or it is not marked for deconstruction. The complexity is effectively O(1) - it depends on the number of objects targeting this entity which should be small enough.
Sourcepub fn is_registered_for_repair(&self) -> bool
pub fn is_registered_for_repair(&self) -> bool
Is this entity registered for repair? If false, it means a construction robot has been dispatched to repair it, or it is not damaged. This is worst-case O(N) complexity where N is the current number of things in the repair queue.
Sourcepub fn is_registered_for_upgrade(&self) -> bool
pub fn is_registered_for_upgrade(&self) -> bool
Is this entity registered for upgrade? If false, it means a construction robot has been dispatched to upgrade it, or it is not marked for upgrade. This is worst-case O(N) complexity where N is the current number of things in the upgrade queue.
pub fn launch_rocket( &self, character: Option<LuaEntity>, destination: Option<CargoDestination>, ) -> bool
Sourcepub fn mine(&self, params: LuaEntityMineParams) -> bool
pub fn mine(&self, params: LuaEntityMineParams) -> bool
Mines this entity.
‘Standard’ operation is to keep calling LuaEntity.mine with an inventory until all items are transferred and the items dealt with.
The result of mining the entity (the item(s) it produces when mined) will be dropped on the ground if they don’t fit into the provided inventory. If no inventory is provided, the items will be destroyed.
Sourcepub fn order_deconstruction(
&self,
force: LuaAny,
player: Option<LuaAny>,
undo_index: Option<u32>,
) -> bool
pub fn order_deconstruction( &self, force: LuaAny, player: Option<LuaAny>, undo_index: Option<u32>, ) -> bool
Sets the entity to be deconstructed by construction robots.
Sourcepub fn order_upgrade(&self, params: LuaEntityOrderUpgradeParams) -> bool
pub fn order_upgrade(&self, params: LuaEntityOrderUpgradeParams) -> bool
Sets the entity to be upgraded by construction robots.
Sourcepub fn play_note(
&self,
instrument: u32,
note: u32,
stop_playing_sounds: Option<bool>,
) -> bool
pub fn play_note( &self, instrument: u32, note: u32, stop_playing_sounds: Option<bool>, ) -> bool
Plays a note with the given instrument and note.
Sourcepub fn register_tree(&self, tree: LuaEntity) -> bool
pub fn register_tree(&self, tree: LuaEntity) -> bool
Registers the given tree in this agricultural tower.
If the tree is not within range of the tower it will not be registered.
If the tree is already registered with a tower it will not be registered.
Sourcepub fn release_from_spawner(&self)
pub fn release_from_spawner(&self)
Release the unit from the spawner which spawned it. This allows the spawner to continue spawning additional units.
Sourcepub fn remove_fluid(&self, amount: LuaAny, index: LuaAny) -> Option<Fluid>
pub fn remove_fluid(&self, amount: LuaAny, index: LuaAny) -> Option<Fluid>
Removes the given fluid amount from the entity’s given fluid storage if possible.
Sourcepub fn remove_fluid_box_linked_connection(&self, this_linked_connection_id: u32)
pub fn remove_fluid_box_linked_connection(&self, this_linked_connection_id: u32)
Removes linked fluidbox connection record. If connected, other end will be also removed.
Sourcepub fn remove_fluid_segment_fluid(
&self,
amount: LuaAny,
index: LuaAny,
) -> Option<Fluid>
pub fn remove_fluid_segment_fluid( &self, amount: LuaAny, index: LuaAny, ) -> Option<Fluid>
Removes the given fluid amount from the given storage’s fluid segment if possible.
Sourcepub fn remove_market_item(&self, offer: u32) -> bool
pub fn remove_market_item(&self, offer: u32) -> bool
Remove an offer from a market.
The other offers are moved down to fill the gap created by removing the offer, which decrements the overall size of the offer array.
pub fn request_to_close(&self, force: LuaAny)
pub fn request_to_open(&self, extra_time: Option<u32>, force: LuaAny)
Sourcepub fn revive(
&self,
params: LuaEntityReviveParams,
) -> (Option<Vec<ItemWithQualityCount>>, Option<LuaEntity>, Option<LuaEntity>)
pub fn revive( &self, params: LuaEntityReviveParams, ) -> (Option<Vec<ItemWithQualityCount>>, Option<LuaEntity>, Option<LuaEntity>)
Revive a ghost, which turns it from a ghost into a real entity or tile.
Sourcepub fn rotate(&self, params: LuaEntityRotateParams) -> bool
pub fn rotate(&self, params: LuaEntityRotateParams) -> bool
Rotates this entity as if the player rotated it.
Sourcepub fn set_beam_source(&self, source: LuaAny)
pub fn set_beam_source(&self, source: LuaAny)
Set the source of this beam.
Sourcepub fn set_beam_target(&self, target: LuaAny)
pub fn set_beam_target(&self, target: LuaAny)
Set the target of this beam.
Sourcepub fn set_driver(&self, driver: LuaAny)
pub fn set_driver(&self, driver: LuaAny)
Sets the driver of this vehicle.
This differs from LuaEntity::set_passenger in that the passenger can’t drive the vehicle.
Sourcepub fn set_filter(&self, filter: Option<LuaAny>, index: u32)
pub fn set_filter(&self, filter: Option<LuaAny>, index: u32)
Set the filter for a slot in an inserter (ItemFilter), loader (ItemFilter), mining drill (EntityID), asteroid collector (AsteroidChunkID) or logistic storage container (ItemWithQualityID). The entity must allow filters.
Sourcepub fn set_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
pub fn set_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
Sets the fluid in the entity’s given fluid storage to the provided fluid if possible.
Fluid filters may block setting the fluid, or less fluid may be set if it’s more than the maximum capacity.
Sourcepub fn set_fluid_filter(
&self,
filter: Option<FluidFilter>,
index: LuaAny,
) -> bool
pub fn set_fluid_filter( &self, filter: Option<FluidFilter>, index: LuaAny, ) -> bool
Set a fluidbox filter, such as the filter of a pump.
Some entities cannot have their fluidbox filter set, notably fluid wagons and crafting machines.
Sourcepub fn set_fluid_segment_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
pub fn set_fluid_segment_fluid(&self, fluid: Fluid, index: LuaAny) -> LuaAny
Sets the fluid within the given storage’s fluid segment.
Sourcepub fn set_heat_setting(&self, filter: HeatSetting)
pub fn set_heat_setting(&self, filter: HeatSetting)
Sets the heat setting for this heat interface.
Sourcepub fn set_infinity_container_filter(
&self,
filter: Option<InfinityInventoryFilter>,
index: u32,
)
pub fn set_infinity_container_filter( &self, filter: Option<InfinityInventoryFilter>, index: u32, )
Sets the filter for this infinity container at the given index.
Sourcepub fn set_infinity_pipe_filter(&self, filter: Option<InfinityPipeFilter>)
pub fn set_infinity_pipe_filter(&self, filter: Option<InfinityPipeFilter>)
Sets the filter for this infinity pipe.
Sourcepub fn set_inventory_bar(&self, bar: Option<u32>, inventory_index: &str)
pub fn set_inventory_bar(&self, bar: Option<u32>, inventory_index: &str)
The same as LuaInventory::set_bar but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn set_inventory_filter(
&self,
filter: Option<ItemFilter>,
index: u32,
inventory_index: &str,
) -> bool
pub fn set_inventory_filter( &self, filter: Option<ItemFilter>, index: u32, inventory_index: &str, ) -> bool
The same as LuaInventory::set_filter but also works for ghosts where the inventory is not available through LuaControl::get_inventory.
Sourcepub fn set_inventory_size_override(
&self,
inventory_index: &str,
overflow: Option<LuaInventory>,
size_override: Option<u16>,
)
pub fn set_inventory_size_override( &self, inventory_index: &str, overflow: Option<LuaInventory>, size_override: Option<u16>, )
Sets inventory size override. When set, supported entity will ignore inventory size from prototype and will instead keep inventory size equal to the override. Setting nil will restore default inventory size.
Sourcepub fn set_movement(&self, direction: Vector, speed: f64)
pub fn set_movement(&self, direction: Vector, speed: f64)
Sets the movement direction and movement speed for this combat robot or asteroid.
Note that for combat robots this does not affect the constant drift in the direction they are facing.
Sourcepub fn set_passenger(&self, passenger: LuaAny)
pub fn set_passenger(&self, passenger: LuaAny)
Sets the passenger of this car, spidertron, or cargo pod.
This differs from LuaEntity::get_driver in that the passenger can’t drive the car.
Sourcepub fn set_priority_target(&self, entity_id: Option<LuaAny>, index: u32)
pub fn set_priority_target(&self, entity_id: Option<LuaAny>, index: u32)
Set the entity ID name at the specified position in the turret’s priority list.
Sourcepub fn set_recipe(
&self,
quality: Option<LuaAny>,
recipe: Option<LuaAny>,
) -> Vec<ItemWithQualityCount>
pub fn set_recipe( &self, quality: Option<LuaAny>, recipe: Option<LuaAny>, ) -> Vec<ItemWithQualityCount>
Sets the given recipe in this assembly machine.
pub fn set_stored_durability( &self, durability: LabStoredDurability, item: LuaAny, )
Sourcepub fn set_tooltip_field(&self, field: RuntimeTooltipField) -> u32
pub fn set_tooltip_field(&self, field: RuntimeTooltipField) -> u32
Adds or changes runtime tooltip field. If id is not given a new one will be allocated in a way that makes it unique within this entity. If a value is given that is already used, existing line will be updated.
Sourcepub fn silent_revive(
&self,
params: LuaEntitySilentReviveParams,
) -> (Vec<ItemWithQualityCount>, Option<LuaEntity>, Option<LuaEntity>)
pub fn silent_revive( &self, params: LuaEntitySilentReviveParams, ) -> (Vec<ItemWithQualityCount>, Option<LuaEntity>, Option<LuaEntity>)
Revives a ghost silently, so the revival makes no sound and no smoke is created.
Sourcepub fn spawn_decorations(&self)
pub fn spawn_decorations(&self)
Triggers spawn_decoration actions defined in the entity prototype or does nothing if entity is not “turret” or “unit-spawner”.
Sourcepub fn start_fading_out(&self)
pub fn start_fading_out(&self)
Only works if the entity is a speech-bubble, with an “effect” defined in its wrapper_flow_style. Starts animating the opacity of the speech bubble towards zero, and destroys the entity when it hits zero.
Sourcepub fn stop_spider(&self)
pub fn stop_spider(&self)
Sets the speed of the given SpiderVehicle to zero. Notably does not clear its autopilot_destination, which it will continue moving towards if set.
Sourcepub fn supports_backer_name(&self) -> bool
pub fn supports_backer_name(&self) -> bool
Whether this entity supports a backer name.
Sourcepub fn to_be_deconstructed(&self) -> bool
pub fn to_be_deconstructed(&self) -> bool
Is this entity marked for deconstruction?
Sourcepub fn to_be_upgraded(&self) -> bool
pub fn to_be_upgraded(&self) -> bool
Is this entity marked for upgrade?
Sourcepub fn toggle_equipment_movement_bonus(&self)
pub fn toggle_equipment_movement_bonus(&self)
Toggle this entity’s equipment movement bonus. Does nothing if the entity does not have an equipment grid.
This property can also be read and written on the equipment grid of this entity.
Sourcepub fn update_connections(&self)
pub fn update_connections(&self)
Reconnect loader, beacon, cliff and mining drill connections to entities that might have been teleported out or in by the script. The game doesn’t do this automatically as we don’t want to lose performance by checking this in normal games.