get_pollution(position) | → double | Get the pollution for a given position. [...] |
Get the pollution for a given position. [...] | ||
can_place_entity{name=…, position=…, direction?=…, force?=…, build_check_type?=…, forced?=…, inner_name?=…} changed | → boolean | Check for collisions with terrain or other entities. |
Check for collisions with terrain or other entities. | ||
can_fast_replace{name=…, position=…, direction?=…, force?=…} changed | → boolean | If there exists an entity at the given location that can be fast-replaced with the given entity parameters. |
If there exists an entity at the given location that can be fast-replaced with the given entity parameters. | ||
find_entity(entity, position) changed | → LuaEntity? | Find an entity of the given name at the given position. [...] |
Find an entity of the given name at the given position. [...] | ||
find_entities(area?) | → array[LuaEntity] | Find entities in a given area. [...] |
Find entities in a given area. [...] | ||
find_entities_filtered(filter) changed | → array[LuaEntity] | Find all entities of the given type or name in the given area. [...] |
Find all entities of the given type or name in the given area. [...] | ||
find_tiles_filtered(filter) changed | → array[LuaTile] | Find all tiles of the given name in the given area. [...] |
Find all tiles of the given name in the given area. [...] | ||
count_entities_filtered(filter) changed | → uint | Count entities of given type or name in a given area. [...] |
Count entities of given type or name in a given area. [...] | ||
count_tiles_filtered(filter) changed | → uint | Count tiles of a given name in a given area. [...] |
Count tiles of a given name in a given area. [...] | ||
find_non_colliding_position(name, center, radius, precision, force_to_tile_center?) changed | → MapPosition? | Find a non-colliding position within a given radius. [...] |
Find a non-colliding position within a given radius. [...] | ||
find_non_colliding_position_in_box(name, search_space, precision, force_to_tile_center?) changed | → MapPosition? | Find a non-colliding position within a given rectangle. |
Find a non-colliding position within a given rectangle. | ||
spill_item_stack{position=…, stack=…, enable_looted?=…, force?=…, allow_belts?=…, max_radius?=…, use_start_position_on_failure?=…} changed | → array[LuaEntity] | Spill items on the ground centered at a given location. |
Spill items on the ground centered at a given location. | ||
find_enemy_units(center, radius, force?) changed | → array[LuaEntity] | Find enemy units (entities with type "unit") of a given force within an area. [...] |
Find enemy units (entities with type "unit") of a given force within an area. [...] | ||
find_units{area=…, force=…, condition=…} changed | → array[LuaEntity] | Find units (entities with type "unit") of a given force and force condition within a given area. [...] |
Find units (entities with type "unit") of a given force and force condition within a given area. [...] | ||
find_nearest_enemy{position=…, max_distance=…, force?=…} changed | → LuaEntity? | Find the enemy military target (military entity) closest to the given position. |
Find the enemy military target (military entity) closest to the given position. | ||
find_nearest_enemy_entity_with_owner{position=…, max_distance=…, force?=…} changed | → LuaEntity | Find the enemy entity-with-owner closest to the given position. |
Find the enemy entity-with-owner closest to the given position. | ||
set_multi_command{command=…, unit_count=…, force?=…, unit_search_distance?=…} changed | → uint | Give a command to multiple units. [...] |
Give a command to multiple units. [...] | ||
create_entity{name=…, position=…, direction?=…, quality?=…, force?=…, target?=…, source?=…, cause?=…, snap_to_grid?=…, fast_replace?=…, item_index?=…, player?=…, character?=…, spill?=…, raise_built?=…, create_build_effect_smoke?=…, spawn_decorations?=…, move_stuck_players?=…, item?=…, preserve_ghosts_and_corpses?=…} changed | → LuaEntity? | Create an entity on this surface. |
Create an entity on this surface. | ||
create_trivial_smoke{name=…, position=…} changed | ||
create_particle{name=…, position=…, movement=…, height=…, vertical_speed=…, frame_speed=…} changed | Creates a particle at the given location | |
Creates a particle at the given location | ||
create_unit_group{position=…, force?=…} changed | → LuaCommandable | Create a new unit group at a given position. |
Create a new unit group at a given position. | ||
build_enemy_base(position, unit_count, force?) changed | Send a group to build a new base. [...] | |
Send a group to build a new base. [...] | ||
get_tile(x, y) | → LuaTile | Get the tile at a given position. [...] |
Get the tile at a given position. [...] | ||
set_tiles(tiles, correct_tiles?, remove_colliding_entities?, remove_colliding_decoratives?, raise_event?, player?, undo_index?) changed | Set tiles at specified locations. [...] | |
Set tiles at specified locations. [...] | ||
pollute(source, amount, prototype?) changed | Spawn pollution at the given position. | |
Spawn pollution at the given position. | ||
get_chunks() | → LuaChunkIterator | Get an iterator going over every chunk on this surface. |
Get an iterator going over every chunk on this surface. | ||
is_chunk_generated(position) | → boolean | Is a given chunk generated? |
Is a given chunk generated? | ||
request_to_generate_chunks(position, radius?) | Request that the game's map generator generate chunks at the given position for the given radius on this surface. [...] | |
Request that the game's map generator generate chunks at the given position for the given radius on this surface. [...] | ||
force_generate_chunk_requests() | Blocks and generates all chunks that have been requested using all available threads. | |
Blocks and generates all chunks that have been requested using all available threads. | ||
set_chunk_generated_status(position, status) | Set generated status of a chunk. [...] | |
Set generated status of a chunk. [...] | ||
find_logistic_network_by_position(position, force) changed | → LuaLogisticNetwork? | Find the logistic network that covers a given position. |
Find the logistic network that covers a given position. | ||
find_closest_logistic_network_by_position(position, force) changed | → LuaLogisticNetwork? | Find the logistic network with a cell closest to a given position. |
Find the logistic network with a cell closest to a given position. | ||
find_logistic_networks_by_construction_area(position, force) changed | → array[LuaLogisticNetwork] | Finds all of the logistics networks whose construction area intersects with the given position. |
Finds all of the logistics networks whose construction area intersects with the given position. | ||
deconstruct_area{area=…, force=…, player?=…, skip_fog_of_war?=…, item?=…, super_forced?=…} changed | Place a deconstruction request. | |
Place a deconstruction request. | ||
cancel_deconstruct_area{area=…, force=…, player?=…, skip_fog_of_war?=…, item?=…, item_index?=…, super_forced?=…} changed | Cancel a deconstruction order. | |
Cancel a deconstruction order. | ||
upgrade_area{area=…, force=…, player?=…, skip_fog_of_war?=…, item=…} changed | Place an upgrade request. | |
Place an upgrade request. | ||
cancel_upgrade_area{area=…, force=…, player?=…, skip_fog_of_war?=…, item=…} changed | Cancel a upgrade order. | |
Cancel a upgrade order. | ||
get_hidden_tile(position) | → string? | The hidden tile name. |
The hidden tile name. | ||
get_double_hidden_tile(position) new | → string | The double hidden tile name or |
The double hidden tile name or | ||
set_hidden_tile(position, tile?) changed | Set the hidden tile for the specified position. [...] | |
Set the hidden tile for the specified position. [...] | ||
set_double_hidden_tile(position, tile?) new | Set double hidden tile for the specified position. [...] | |
Set double hidden tile for the specified position. [...] | ||
get_connected_tiles(position, tiles, include_diagonal?, area?) changed | → array[TilePosition] | Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position. [...] |
Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position. [...] | ||
delete_chunk(position) | ||
regenerate_entity(entities?, chunks?) | Regenerate autoplacement of some entities on this surface. [...] | |
Regenerate autoplacement of some entities on this surface. [...] | ||
regenerate_decorative(decoratives?, chunks?) | Regenerate autoplacement of some decoratives on this surface. [...] | |
Regenerate autoplacement of some decoratives on this surface. [...] | ||
print(message, print_settings?) changed | Print text to the chat console of all players on this surface. [...] | |
Print text to the chat console of all players on this surface. [...] | ||
destroy_decoratives{area?=…, position?=…, name?=…, collision_mask?=…, from_layer?=…, to_layer?=…, exclude_soft?=…, limit?=…, invert?=…} changed | Removes all decoratives from the given area. [...] | |
Removes all decoratives from the given area. [...] | ||
create_decoratives{check_collision?=…, decoratives=…} | Adds the given decoratives to the surface. [...] | |
Adds the given decoratives to the surface. [...] | ||
find_decoratives_filtered{area?=…, position?=…, name?=…, collision_mask?=…, from_layer?=…, to_layer?=…, exclude_soft?=…, limit?=…, invert?=…} changed | → array[DecorativeResult] | Find decoratives of a given name in a given area. [...] |
Find decoratives of a given name in a given area. [...] | ||
clear_pollution() | Clears all pollution on this surface. | |
Clears all pollution on this surface. | ||
play_sound{path=…, position?=…, volume_modifier?=…, override_sound_type?=…} | Play a sound for every player on this surface. [...] | |
Play a sound for every player on this surface. [...] | ||
get_resource_counts() | → dictionary[string → uint] | Gets the resource amount of all resources on this surface |
Gets the resource amount of all resources on this surface | ||
get_random_chunk() | → ChunkPosition | Gets a random generated chunk position or 0,0 if no chunks have been generated on this surface. |
Gets a random generated chunk position or 0,0 if no chunks have been generated on this surface. | ||
clone_area{source_area=…, destination_area=…, destination_surface?=…, destination_force?=…, clone_tiles?=…, clone_entities?=…, clone_decoratives?=…, clear_destination_entities?=…, clear_destination_decoratives?=…, expand_map?=…, create_build_effect_smoke?=…} changed | Clones the given area. [...] | |
Clones the given area. [...] | ||
clone_brush{source_offset=…, destination_offset=…, source_positions=…, destination_surface?=…, destination_force?=…, clone_tiles?=…, clone_entities?=…, clone_decoratives?=…, clear_destination_entities?=…, clear_destination_decoratives?=…, expand_map?=…, manual_collision_mode?=…, create_build_effect_smoke?=…} | Clones the given area. [...] | |
Clones the given area. [...] | ||
clone_entities{entities=…, destination_offset=…, destination_surface?=…, destination_force?=…, snap_to_grid?=…, create_build_effect_smoke?=…} changed | Clones the given entities. [...] | |
Clones the given entities. [...] | ||
clear(ignore_characters?) | Clears this surface deleting all entities and chunks on it. | |
Clears this surface deleting all entities and chunks on it. | ||
request_path{bounding_box=…, collision_mask=…, start=…, goal=…, force=…, radius?=…, pathfind_flags?=…, can_open_gates?=…, path_resolution_modifier?=…, max_gap_size?=…, max_attack_distance?=…, entity_to_ignore?=…} changed | → uint | Generates a path with the specified constraints (as an array of PathfinderWaypoints) using the unit pathfinding algorithm. [...] |
Generates a path with the specified constraints (as an array of PathfinderWaypoints) using the unit pathfinding algorithm. [...] | ||
get_script_areas(name?) | → array[ScriptArea] | Gets the script areas that match the given name or if no name is given all areas are returned. |
Gets the script areas that match the given name or if no name is given all areas are returned. | ||
get_script_area(key?) | → ScriptArea? | Gets the first script area by name or id. |
Gets the first script area by name or id. | ||
edit_script_area(id, area) | Sets the given script area to the new values. | |
Sets the given script area to the new values. | ||
add_script_area(area) | → uint | Adds the given script area. |
Adds the given script area. | ||
remove_script_area(id) | → boolean | Removes the given script area. |
Removes the given script area. | ||
get_script_positions(name?) | → array[ScriptPosition] | Gets the script positions that match the given name or if no name is given all positions are returned. |
Gets the script positions that match the given name or if no name is given all positions are returned. | ||
get_script_position(key?) | → ScriptPosition? | Gets the first script position by name or id. |
Gets the first script position by name or id. | ||
edit_script_position(id, position) changed | Sets the given script position to the new values. | |
Sets the given script position to the new values. | ||
add_script_position(position) changed | → uint | Adds the given script position. |
Adds the given script position. | ||
remove_script_position(id) | → boolean | Removes the given script position. |
Removes the given script position. | ||
get_map_exchange_string() | → string | Gets the map exchange string for the current map generation settings of this surface. |
Gets the map exchange string for the current map generation settings of this surface. | ||
get_starting_area_radius() | → double | Gets the starting area radius of this surface. |
Gets the starting area radius of this surface. | ||
get_closest(position, entities) | → LuaEntity? | Gets the closest entity in the list to this position. |
Gets the closest entity in the list to this position. | ||
get_total_pollution() | → double | Gets the total amount of pollution on the surface by iterating over all the chunks containing pollution. |
Gets the total amount of pollution on the surface by iterating over all the chunks containing pollution. | ||
entity_prototype_collides(prototype, position, use_map_generation_bounding_box, direction?) changed | → boolean | Whether the given entity prototype collides at the given position and direction. |
Whether the given entity prototype collides at the given position and direction. | ||
decorative_prototype_collides(prototype, position) changed | → boolean | Whether the given decorative prototype collides at the given position and direction. |
Whether the given decorative prototype collides at the given position and direction. | ||
calculate_tile_properties(property_names, positions) | → dictionary[string → array[double]] | Calculate values for a list of tile properties at a list of positions. [...] |
Calculate values for a list of tile properties at a list of positions. [...] | ||
get_entities_with_force(position, force) changed | → array[LuaEntity] | Returns all the military targets (entities with force) on this chunk for the given force. |
Returns all the military targets (entities with force) on this chunk for the given force. | ||
build_checkerboard(area) | Sets the given area to the checkerboard lab tiles. | |
Sets the given area to the checkerboard lab tiles. | ||
get_property(property) new | → double | Gets the value of surface property on this surface. |
Gets the value of surface property on this surface. | ||
set_property(property, value) new | Sets the value of surface property on this surface. | |
Sets the value of surface property on this surface. | ||
create_global_electric_network() new | Creates a global electric network for this surface, if one doesn't exist already. | |
Creates a global electric network for this surface, if one doesn't exist already. | ||
destroy_global_electric_network() new | Destroys the global electric network for this surface, if it exists. | |
Destroys the global electric network for this surface, if it exists. | ||
execute_lightning{name=…, position=…} new | Creates lightning. [...] | |
Creates lightning. [...] | ||
clear_hidden_tiles() new | Completely removes hidden and double hidden tiles data on this surface. | |
Completely removes hidden and double hidden tiles data on this surface. | ||
name | :: RW string | The name of this surface. [...] |
The name of this surface. [...] | ||
index | :: R uint | This surface's index in LuaGameScript::surfaces (unique ID). [...] |
This surface's index in LuaGameScript::surfaces (unique ID). [...] | ||
map_gen_settings | :: RW MapGenSettings | The generation settings for this surface. [...] |
The generation settings for this surface. [...] | ||
generate_with_lab_tiles | :: RW boolean | When set to true, new chunks will be generated with lab tiles, instead of using the surface's map generation settings. |
When set to true, new chunks will be generated with lab tiles, instead of using the surface's map generation settings. | ||
always_day | :: RW boolean | When set to true, the sun will always shine. |
When set to true, the sun will always shine. | ||
daytime | :: RW double | Current time of day, as a number in range |
Current time of day, as a number in range | ||
darkness | :: R float | Amount of darkness at the current time, as a number in range |
Amount of darkness at the current time, as a number in range | ||
wind_speed | :: RW double | Current wind speed in tiles per tick. |
Current wind speed in tiles per tick. | ||
wind_orientation | :: RW RealOrientation | Current wind direction. |
Current wind direction. | ||
wind_orientation_change | :: RW double | Change in wind orientation per tick. |
Change in wind orientation per tick. | ||
peaceful_mode | :: RW boolean | Is peaceful mode enabled on this surface? |
Is peaceful mode enabled on this surface? | ||
no_enemies_mode new | :: RW boolean | Is no-enemies mode enabled on this surface? |
Is no-enemies mode enabled on this surface? | ||
freeze_daytime | :: RW boolean | True if daytime is currently frozen. |
True if daytime is currently frozen. | ||
ticks_per_day | :: RW uint | The number of ticks per day for this surface. |
The number of ticks per day for this surface. | ||
dusk | :: RW double | The daytime when dusk starts. |
The daytime when dusk starts. | ||
dawn | :: RW double | The daytime when dawn starts. |
The daytime when dawn starts. | ||
evening | :: RW double | The daytime when evening starts. |
The daytime when evening starts. | ||
morning | :: RW double | The daytime when morning starts. |
The daytime when morning starts. | ||
solar_power_multiplier | :: RW double | The multiplier of solar power on this surface. [...] |
The multiplier of solar power on this surface. [...] | ||
min_brightness | :: RW double | The minimal brightness during the night. [...] |
The minimal brightness during the night. [...] | ||
brightness_visual_weights | :: RW ColorModifier | Defines how surface daytime brightness influences each color channel of the current color lookup table (LUT). [...] |
Defines how surface daytime brightness influences each color channel of the current color lookup table (LUT). [...] | ||
show_clouds | :: RW boolean | If clouds are shown on this surface. [...] |
If clouds are shown on this surface. [...] | ||
has_global_electric_network new | :: R boolean | Whether this surface currently has a global electric network. |
Whether this surface currently has a global electric network. | ||
platform new | :: R LuaSpacePlatform? | |
planet new | :: R LuaPlanet? | The planet associated with this surface, if there is one. [...] |
The planet associated with this surface, if there is one. [...] | ||
deletable new | :: R boolean | If this surface can be deleted. |
If this surface can be deleted. | ||
global_effect new | :: RW ModuleEffects? | Surface-wide effects applied to entities with effect receivers. [...] |
Surface-wide effects applied to entities with effect receivers. [...] | ||
pollutant_type new | :: R LuaAirbornePollutantPrototype? | The type of pollutant enabled on the surface, or |
The type of pollutant enabled on the surface, or | ||
localised_name new | :: RW LocalisedString? | Localised name of this surface. [...] |
Localised name of this surface. [...] | ||
valid | :: R boolean | Is this object valid? [...] |
Is this object valid? [...] | ||
object_name | :: R string | The class name of this object. [...] |
The class name of this object. [...] |
position | :: MapPosition | The position to poll the chunk's pollution |
The position to poll the chunk's pollution |
game.surfaces[1].get_pollution({1,2})
name | :: string | Name of the entity prototype to check. |
Name of the entity prototype to check. | ||
position | :: MapPosition | Where the entity would be placed. |
Where the entity would be placed. | ||
direction | :: defines.direction? | Direction of the placed entity. Defaults to |
Direction of the placed entity. Defaults to | ||
force | :: ForceID? | The force that would place the entity. Defaults to the |
The force that would place the entity. Defaults to the | ||
build_check_type | :: defines.build_check_type? | Which type of check should be carried out. Defaults to |
Which type of check should be carried out. Defaults to | ||
forced | :: boolean? | If |
If | ||
inner_name | :: string? | The prototype name of the entity contained in the ghost. Only used if |
The prototype name of the entity contained in the ghost. Only used if |
name | :: string | Name of the entity to check. |
Name of the entity to check. | ||
position | :: MapPosition | Where the entity would be placed. |
Where the entity would be placed. | ||
direction | :: defines.direction? | Direction the entity would be placed. Defaults to |
Direction the entity would be placed. Defaults to | ||
force | :: ForceID? | The force that would place the entity. Defaults to the |
The force that would place the entity. Defaults to the |
entity | :: EntityWithQualityID | Name of the entity to look for. |
Name of the entity to look for. | ||
position | :: MapPosition | Coordinates to look at. |
Coordinates to look at. |
→ LuaEntity? |
|
game.player.selected.surface.find_entity('filter-inserter', {0,0})
area | :: BoundingBox? |
-- Will evaluate to a list of all entities within given area.
game.surfaces["nauvis"].find_entities({{-10, -10}, {10, 10}})
filter | :: EntitySearchFilters |
game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, type = "resource"} -- gets all resources in the rectangle
game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, name = "iron-ore"} -- gets all iron ores in the rectangle
game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, name = {"iron-ore", "copper-ore"}} -- gets all iron ore and copper ore in the rectangle
game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, force = "player"} -- gets player owned entities in the rectangle
game.surfaces[1].find_entities_filtered{area = {{-10, -10}, {10, 10}}, limit = 5} -- gets the first 5 entities in the rectangle
game.surfaces[1].find_entities_filtered{position = {0, 0}, radius = 10} -- gets all entities within 10 tiles of the position [0,0].
name | :: EntityID | Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.) |
Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.) | ||
center | :: MapPosition | Center of the search area. |
Center of the search area. | ||
radius | :: double | Max distance from |
Max distance from | ||
precision | :: double | The step length from the given position as it searches, in tiles. Minimum value is |
The step length from the given position as it searches, in tiles. Minimum value is | ||
force_to_tile_center | :: boolean? | Will only check tile centers. This can be useful when your intent is to place a building at the resulting position, as they must generally be placed at tile centers. Defaults to |
Will only check tile centers. This can be useful when your intent is to place a building at the resulting position, as they must generally be placed at tile centers. Defaults to |
→ MapPosition? | The non-colliding position. May be |
name | :: EntityID | Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.) |
Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.) | ||
search_space | :: BoundingBox | The rectangle to search inside. |
The rectangle to search inside. | ||
precision | :: double | The step length from the given position as it searches, in tiles. Minimum value is 0.01. |
The step length from the given position as it searches, in tiles. Minimum value is 0.01. | ||
force_to_tile_center | :: boolean? | Will only check tile centers. This can be useful when your intent is to place a building at the resulting position, as they must generally be placed at tile centers. Defaults to |
Will only check tile centers. This can be useful when your intent is to place a building at the resulting position, as they must generally be placed at tile centers. Defaults to |
→ MapPosition? | The non-colliding position. May be |
position | :: MapPosition | Center of the spillage |
Center of the spillage | ||
stack | :: ItemStackIdentification | Stack of items to spill |
Stack of items to spill | ||
enable_looted | :: boolean? | When true, each created item will be flagged with the LuaEntity::to_be_looted flag. Defaults to |
When true, each created item will be flagged with the LuaEntity::to_be_looted flag. Defaults to | ||
force | :: ForceID? | When provided (and not |
When provided (and not | ||
allow_belts | :: boolean? | Whether items can be spilled onto belts. Defaults to |
Whether items can be spilled onto belts. Defaults to | ||
max_radius | :: double? | Max radius from the specified |
Max radius from the specified | ||
use_start_position_on_failure | :: boolean? | Allow spilling items at |
Allow spilling items at |
→ array[LuaEntity] | The created item-on-ground entities. |
center | :: MapPosition | Center of the search area |
Center of the search area | ||
radius | :: double | Radius of the circular search area |
Radius of the circular search area | ||
force | :: ForceID? | Force to find enemies of. If not given, uses the player force. |
Force to find enemies of. If not given, uses the player force. |
-- Find all units who would be interested to attack the player, within 100-tile area.
local enemies = game.player.surface.find_enemy_units(game.player.position, 100)
area | :: BoundingBox | Box to find units within. |
Box to find units within. | ||
force | :: ForceID | Force performing the search. |
Force performing the search. | ||
condition | :: ForceCondition | Only forces which meet the condition will be included in the search. |
Only forces which meet the condition will be included in the search. |
-- Find friendly units to "player" force
local friendly_units = game.player.surface.find_units({area = {{-10, -10},{10, 10}}, force = "player", condition = "friend")
-- Find units of "player" force
local units = game.player.surface.find_units({area = {{-10, -10},{10, 10}}, force = "player", condition = "same"})
position | :: MapPosition | Center of the search area. |
Center of the search area. | ||
max_distance | :: double | Radius of the circular search area. |
Radius of the circular search area. | ||
force | :: ForceID? | The force the result will be an enemy of. Uses the player force if not specified. |
The force the result will be an enemy of. Uses the player force if not specified. |
→ LuaEntity? | The nearest enemy military target or |
position | :: MapPosition | Center of the search area. |
Center of the search area. | ||
max_distance | :: double | Radius of the circular search area. |
Radius of the circular search area. | ||
force | :: ForceID? | The force the result will be an enemy of. Uses the player force if not specified. |
The force the result will be an enemy of. Uses the player force if not specified. |
→ LuaEntity | The nearest enemy entity-with-owner or |
command | :: Command | |
unit_count | :: uint | Number of units to give the command to. |
Number of units to give the command to. | ||
force | :: ForceID? | Force of the units this command is to be given to. If not specified, uses the enemy force. |
Force of the units this command is to be given to. If not specified, uses the enemy force. | ||
unit_search_distance | :: uint? | Radius to search for units. The search area is centered on the destination of the command. If not specified uses default value of 150. |
Radius to search for units. The search area is centered on the destination of the command. If not specified uses default value of 150. |
→ uint | Number of units actually sent. May be less than |
name | :: EntityID | The entity prototype name to create. |
The entity prototype name to create. | ||
position | :: MapPosition | Where to create the entity. |
Where to create the entity. | ||
direction | :: defines.direction? | Desired orientation of the entity after creation. |
Desired orientation of the entity after creation. | ||
quality | :: QualityID? | Quality of the entity to be created. Defaults to |
Quality of the entity to be created. Defaults to | ||
force | :: ForceID? | Force of the entity, default is enemy. |
Force of the entity, default is enemy. | ||
target | :: LuaEntity or MapPosition? | Entity with health for the new entity to target. |
Entity with health for the new entity to target. | ||
source | :: LuaEntity or MapPosition? | Source entity. Used for beams, projectiles, and highlight-boxes. |
Source entity. Used for beams, projectiles, and highlight-boxes. | ||
cause | :: LuaEntity or ForceID? | Cause entity / force. The entity or force that triggered the chain of events that led to this entity being created. Used for beams, projectiles, stickers, etc. so that the damage receiver can know which entity or force to retaliate against. |
Cause entity / force. The entity or force that triggered the chain of events that led to this entity being created. Used for beams, projectiles, stickers, etc. so that the damage receiver can know which entity or force to retaliate against. | ||
snap_to_grid | :: boolean? | If false the exact position given is used to instead of snapping to the normal entity grid. This only applies if the entity normally snaps to the grid. |
If false the exact position given is used to instead of snapping to the normal entity grid. This only applies if the entity normally snaps to the grid. | ||
fast_replace | :: boolean? | If true, building will attempt to simulate fast-replace building. Defaults to |
If true, building will attempt to simulate fast-replace building. Defaults to | ||
item_index | :: uint? | The index of the undo item to add this action to. An index of |
The index of the undo item to add this action to. An index of | ||
player | :: PlayerIdentification? | If given set the last_user to this player. If fast_replace is true simulate fast replace using this player. Also the player whose undo queue this action should be added to. |
If given set the last_user to this player. If fast_replace is true simulate fast replace using this player. Also the player whose undo queue this action should be added to. | ||
character | :: LuaEntity? | If fast_replace is true simulate fast replace using this character. |
If fast_replace is true simulate fast replace using this character. | ||
spill | :: boolean? | If false while fast_replace is true and player is nil any items from fast-replacing will be deleted instead of dropped on the ground. Defaults to |
If false while fast_replace is true and player is nil any items from fast-replacing will be deleted instead of dropped on the ground. Defaults to | ||
raise_built | :: boolean? | If true; defines.events.script_raised_built will be fired on successful entity creation. Defaults to |
If true; defines.events.script_raised_built will be fired on successful entity creation. Defaults to | ||
create_build_effect_smoke | :: boolean? | If false, the building effect smoke will not be shown around the new entity. Defaults to |
If false, the building effect smoke will not be shown around the new entity. Defaults to | ||
spawn_decorations | :: boolean? | If true, entity types that have spawn_decoration property will apply triggers defined in the property. Defaults to |
If true, entity types that have spawn_decoration property will apply triggers defined in the property. Defaults to | ||
move_stuck_players | :: boolean? | If true, any characters that are in the way of the entity are teleported out of the way. |
If true, any characters that are in the way of the entity are teleported out of the way. | ||
item | :: LuaItemStack? | If provided, the entity will attempt to pull stored values from this item (for example; creating a spidertron from a previously named and mined spidertron) |
If provided, the entity will attempt to pull stored values from this item (for example; creating a spidertron from a previously named and mined spidertron) | ||
preserve_ghosts_and_corpses | :: boolean? | If true, colliding ghosts and corpses will not be removed by the creation of some entity types. Defaults to |
If true, colliding ghosts and corpses will not be removed by the creation of some entity types. Defaults to |
Other attributes may be specified depending on the type of entity:
assembling-machine
recipe | :: string? |
beam
target_position | :: MapPosition? | Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined). |
Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined). | ||
source_position | :: MapPosition? | Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined). |
Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined). | ||
max_length | :: uint? | If set, beam will be destroyed when distance between source and target is greater than this value. |
If set, beam will be destroyed when distance between source and target is greater than this value. | ||
duration | :: uint? | If set, beam will be destroyed after this value of ticks. |
If set, beam will be destroyed after this value of ticks. | ||
source_offset | :: Vector? | Source position will be offset by this value when rendering the beam. |
Source position will be offset by this value when rendering the beam. |
stream
target_position | :: MapPosition? | Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined). |
Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined). | ||
source_position | :: MapPosition? | Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined). |
Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined). |
container
bar | :: uint? | Inventory index where the red limiting bar should be set. |
Inventory index where the red limiting bar should be set. |
cliff
cliff_orientation | :: CliffOrientation? | If not specified, |
If not specified, |
entity-ghost
inner_name | :: string | The prototype name of the entity contained in the ghost. |
The prototype name of the entity contained in the ghost. | ||
tags | :: Tags? | The LuaEntity::tags associated with this entity ghost. |
The LuaEntity::tags associated with this entity ghost. |
tile-ghost
inner_name | :: string | The prototype name of the tile contained in the ghost. |
The prototype name of the tile contained in the ghost. |
fire
initial_ground_flame_count | :: uint8? | With how many small flames should the fire on ground be created. Defaults to the initial flame count of the prototype. |
With how many small flames should the fire on ground be created. Defaults to the initial flame count of the prototype. |
plant
tick_grown | :: uint? | The tick the plant will be fully grown. If not specified, the plants normal growth time is used. |
The tick the plant will be fully grown. If not specified, the plants normal growth time is used. |
inserter
conditions | :: InserterCircuitConditions | |
filters | :: array[InventoryFilter] |
item-entity
stack | :: SimpleItemStack | The stack of items to create. |
The stack of items to create. |
item-request-proxy
target | :: LuaEntity | The target items are to be delivered to. |
The target items are to be delivered to. | ||
modules | :: array[BlueprintInsertPlan] | The stacks of items to be delivered to target entity from logistic network. |
The stacks of items to be delivered to target entity from logistic network. | ||
removal_plan | :: array[BlueprintInsertPlan]? | Specification of items to be removed from the target entity by the logistic network. |
Specification of items to be removed from the target entity by the logistic network. |
rolling-stock
orientation | :: RealOrientation? | The orientation of this rolling stock. |
The orientation of this rolling stock. | ||
color | :: Color? | The color of this rolling stock, if it supports colors. |
The color of this rolling stock, if it supports colors. |
locomotive
snap_to_train_stop | :: boolean? | Whether the locomotive should snap to an adjacent train stop. Defaults to true. |
Whether the locomotive should snap to an adjacent train stop. Defaults to true. |
logistic-container
request_filters | :: array[InventoryFilter]? |
particle
artillery-flare
projectile
artillery-projectile
speed | :: double? | Defaults to 1. |
Defaults to 1. |
resource
amount | :: uint | |
enable_tree_removal | :: boolean? | If colliding trees are removed normally for this resource entity based off the prototype tree removal values. Default is true. |
If colliding trees are removed normally for this resource entity based off the prototype tree removal values. Default is true. | ||
enable_cliff_removal | :: boolean? | If colliding cliffs are removed. Default is true. |
If colliding cliffs are removed. Default is true. | ||
snap_to_tile_center | :: boolean? | If true, the resource entity will be placed to center of a tile as map generator would place it, otherwise standard non-resource grid alignment rules will apply. Default is true. |
If true, the resource entity will be placed to center of a tile as map generator would place it, otherwise standard non-resource grid alignment rules will apply. Default is true. |
underground-belt
type | :: "output" or "input" ? | Defaults to |
Defaults to |
loader
type | :: "output" or "input" ? | Defaults to |
Defaults to | ||
filters | :: array[InventoryFilter]? |
loader-1x1
type | :: "output" or "input" ? | Defaults to |
Defaults to | ||
filters | :: array[InventoryFilter]? |
programmable-speaker
parameters | :: ProgrammableSpeakerParameters? | |
alert_parameters | :: ProgrammableSpeakerAlertParameters? |
character-corpse
highlight-box
bounding_box | :: BoundingBox? | The bounding box defining the highlight box using absolute map coordinates. If specified, the general |
The bounding box defining the highlight box using absolute map coordinates. If specified, the general | ||
box_type | :: CursorBoxRenderType? | Specifies the graphical appearance (color) of the highlight box. Defaults to |
Specifies the graphical appearance (color) of the highlight box. Defaults to | ||
render_player_index | :: uint? | The player to render the highlight box for. If not provided, it will be rendered for all players. |
The player to render the highlight box for. If not provided, it will be rendered for all players. | ||
blink_interval | :: uint? | The blink interval for this highlight box. Makes it be shown every |
The blink interval for this highlight box. Makes it be shown every | ||
time_to_live | :: uint? | The amount of time in ticks that the highlight box will exist for. Defaults to existing forever. |
The amount of time in ticks that the highlight box will exist for. Defaults to existing forever. |
speech-bubble
text | :: LocalisedString | |
lifetime | :: uint? |
simple-entity-with-owner
render_player_index | :: uint? |
simple-entity-with-force
render_player_index | :: uint? |
electric-pole
auto_connect | :: boolean? | True by default. If set to false, created electric pole will not auto connect to neighbour electric poles. |
True by default. If set to false, created electric pole will not auto connect to neighbour electric poles. |
lamp
color | :: Color? | Defaults to white. |
Defaults to white. | ||
always_on | :: boolean? | Defaults to false. |
Defaults to false. |
rail-signal
rail_layer | :: defines.rail_layer? | Defaults to defines.rail_layer.ground. |
Defaults to defines.rail_layer.ground. |
rail-chain-signal
rail_layer | :: defines.rail_layer? | Defaults to defines.rail_layer.ground. |
Defaults to defines.rail_layer.ground. |
→ LuaEntity? | The created entity or |
script_raised_built? instantly | Raised if the |
local asm = game.surfaces[1].create_entity{name = "assembling-machine-1", position = {15, 3}, force = game.forces.player, recipe = "iron-stick"}
-- Creates a filter inserter with circuit conditions and a filter
game.surfaces[1].create_entity{
name = "filter-inserter", position = {20, 15}, force = game.player.force,
conditions =
{
red = {name = "wood", count = 3, operator = ">"},
green = {name = "iron-ore", count = 1, operator = "<"},
logistics = {name = "wood", count = 3, operator = "="}
},
filters = {{index = 1, name = "iron-ore"}}
}
-- Creates a requester chest already set to request 128 iron plates.
game.surfaces[1].create_entity{
name = "requester-chest", position = {game.player.position.x+3, game.player.position.y},
force = game.player.force, request_filters = {{index = 1, name = "iron-plate", count = 128}}
}
game.surfaces[1].create_entity{name = "big-biter", position = {15, 3}, force = game.forces.player} -- Friendly biter
game.surfaces[1].create_entity{name = "medium-biter", position = {15, 3}, force = game.forces.enemy} -- Enemy biter
-- Creates a basic inserter at the player's location facing north
game.surfaces[1].create_entity{name = "inserter", position = game.player.position, direction = defines.direction.north}
name | :: TrivialSmokeID | The smoke prototype name to create. |
The smoke prototype name to create. | ||
position | :: MapPosition | Where to create the smoke. |
Where to create the smoke. |
name | :: ParticleID | The particle name. |
The particle name. | ||
position | :: MapPosition | Where to create the particle. |
Where to create the particle. | ||
movement | :: Vector | |
height | :: float | |
vertical_speed | :: float | |
frame_speed | :: float |
position | :: MapPosition | Initial position of the new unit group. |
Initial position of the new unit group. | ||
force | :: ForceID? | Force of the new unit group. Defaults to |
Force of the new unit group. Defaults to |
on_unit_group_created instantly |
position | :: MapPosition | Location of the new base. |
Location of the new base. | ||
unit_count | :: uint | Number of biters to send for the base-building task. |
Number of biters to send for the base-building task. | ||
force | :: ForceID? | Force the new base will belong to. Defaults to enemy. |
Force the new base will belong to. Defaults to enemy. |
tiles | :: array[Tile] | |
correct_tiles | :: boolean? | If |
If | ||
remove_colliding_entities | :: boolean or "abort_on_collision" ? | Defaults to |
Defaults to | ||
remove_colliding_decoratives | :: boolean? | Defaults to |
Defaults to | ||
raise_event | :: boolean? | Defaults to |
Defaults to | ||
player | :: PlayerIdentification? | The player whose undo queue to add these actions to. |
The player whose undo queue to add these actions to. | ||
undo_index | :: uint? | The index of the undo item to add this action to. An index of |
The index of the undo item to add this action to. An index of |
script_raised_set_tiles? instantly | Raised if the |
source | :: MapPosition | Where to spawn the pollution. |
Where to spawn the pollution. | ||
amount | :: double | How much pollution to add. |
How much pollution to add. | ||
prototype | :: EntityID? | The entity prototype to attribute the pollution change to in statistics. If not defined, the pollution change will not show up in statistics. |
The entity prototype to attribute the pollution change to in statistics. If not defined, the pollution change will not show up in statistics. |
position | :: MapPosition | Where to generate the new chunks. |
Where to generate the new chunks. | ||
radius | :: uint? | The chunk radius from |
The chunk radius from |
position | :: ChunkPosition | The chunk's position. |
The chunk's position. | ||
status | :: defines.chunk_generated_status | The chunk's new status. |
The chunk's new status. |
position | :: MapPosition | |
force | :: ForceID | Force the logistic network should belong to. |
Force the logistic network should belong to. |
→ LuaLogisticNetwork? | The found network or |
position | :: MapPosition | |
force | :: ForceID | Force the logistic network should belong to. |
Force the logistic network should belong to. |
→ LuaLogisticNetwork? | The found network or |
position | :: MapPosition | |
force | :: ForceID | Force the logistic networks should belong to. |
Force the logistic networks should belong to. |
area | :: BoundingBox | The area to mark for deconstruction. |
The area to mark for deconstruction. | ||
force | :: ForceID | The force whose bots should perform the deconstruction. |
The force whose bots should perform the deconstruction. | ||
player | :: PlayerIdentification? | The player to set the last_user to if any. |
The player to set the last_user to if any. | ||
skip_fog_of_war | :: boolean? | If chunks covered by fog-of-war are skipped. Defaults to |
If chunks covered by fog-of-war are skipped. Defaults to | ||
item | :: LuaItemStack? | The deconstruction item to use if any. |
The deconstruction item to use if any. | ||
super_forced | :: boolean? | If the deconstruction is super-forced. Defaults to |
If the deconstruction is super-forced. Defaults to |
on_marked_for_deconstruction? instantly | Raised for every entity that has been successfully marked for deconstruction. |
area | :: BoundingBox | The area to cancel deconstruction orders in. |
The area to cancel deconstruction orders in. | ||
force | :: ForceID | The force whose deconstruction orders to cancel. |
The force whose deconstruction orders to cancel. | ||
player | :: PlayerIdentification? | The player to set the last_user to, if any. Also the player whose undo queue this action should be added to. |
The player to set the last_user to, if any. Also the player whose undo queue this action should be added to. | ||
skip_fog_of_war | :: boolean? | If chunks covered by fog-of-war are skipped. Defaults to |
If chunks covered by fog-of-war are skipped. Defaults to | ||
item | :: LuaItemStack? | The deconstruction item to use if any. |
The deconstruction item to use if any. | ||
item_index | :: uint? | The index of the undo item to add this action to. An index of |
The index of the undo item to add this action to. An index of | ||
super_forced | :: boolean? | If the cancel deconstruction is super-forced. Defaults to |
If the cancel deconstruction is super-forced. Defaults to |
on_cancelled_deconstruction? instantly | Raised for every entity whose deconstruction has been successfully cancelled. |
area | :: BoundingBox | The area to mark for upgrade. |
The area to mark for upgrade. | ||
force | :: ForceID | The force whose bots should perform the upgrade. |
The force whose bots should perform the upgrade. | ||
player | :: PlayerIdentification? | The player to set the last_user to if any. |
The player to set the last_user to if any. | ||
skip_fog_of_war | :: boolean? | If chunks covered by fog-of-war are skipped. |
If chunks covered by fog-of-war are skipped. | ||
item | :: LuaItemStack | The upgrade item to use. |
The upgrade item to use. |
on_marked_for_upgrade? instantly | Raised for every entity that has been successfully marked for upgrade. |
area | :: BoundingBox | The area to cancel upgrade orders in. |
The area to cancel upgrade orders in. | ||
force | :: ForceID | The force whose upgrade orders to cancel. |
The force whose upgrade orders to cancel. | ||
player | :: PlayerIdentification? | The player to set the last_user to if any. |
The player to set the last_user to if any. | ||
skip_fog_of_war | :: boolean? | If chunks covered by fog-of-war are skipped. |
If chunks covered by fog-of-war are skipped. | ||
item | :: LuaItemStack | The upgrade item to use. |
The upgrade item to use. |
on_cancelled_upgrade? instantly | Raised for every entity whose upgrade has been successfully cancelled. |
position | :: TilePosition | The tile position to start at. |
The tile position to start at. | ||
tiles | :: array[TileID] | The tiles to search for. |
The tiles to search for. | ||
include_diagonal | :: boolean? | Include tiles that are connected diagonally. |
Include tiles that are connected diagonally. | ||
area | :: BoundingBox? | The area to find connected tiles in. If provided the start position must be in this area. |
The area to find connected tiles in. If provided the start position must be in this area. |
→ array[TilePosition] | The resulting set of tiles. |
position | :: ChunkPosition | The chunk position to delete |
The chunk position to delete |
on_pre_chunk_deleted future_tick | |
on_chunk_deleted future_tick |
entities | :: string or array[string]? | Prototype names of entity or entities to autoplace. When |
Prototype names of entity or entities to autoplace. When | ||
chunks | :: array[ChunkPosition]? | The chunk positions to regenerate the entities on. If not given all chunks are regenerated. Note chunks with status < entities are ignored. |
The chunk positions to regenerate the entities on. If not given all chunks are regenerated. Note chunks with status < entities are ignored. |
decoratives | :: string or array[string]? | Prototype names of decorative or decoratives to autoplace. When |
Prototype names of decorative or decoratives to autoplace. When | ||
chunks | :: array[ChunkPosition]? | The chunk positions to regenerate the decoratives on. If not given all chunks are regenerated. Note chunks with status < entities are ignored. |
The chunk positions to regenerate the decoratives on. If not given all chunks are regenerated. Note chunks with status < entities are ignored. |
area | :: BoundingBox? | |
position | :: TilePosition? | |
name | :: DecorativeID or array[DecorativeID]? | |
collision_mask | :: CollisionLayerID or array[CollisionLayerID] or dictionary[CollisionLayerID → true ]? | |
from_layer | :: string? | |
to_layer | :: string? | |
exclude_soft | :: boolean? | Soft decoratives can be drawn over rails. |
Soft decoratives can be drawn over rails. | ||
limit | :: uint? | |
invert | :: boolean? | If the filters should be inverted. |
If the filters should be inverted. |
check_collision | :: boolean? | If collision should be checked against entities/tiles. |
If collision should be checked against entities/tiles. | ||
decoratives | :: array[Decorative] |
area | :: BoundingBox? | |
position | :: TilePosition? | |
name | :: DecorativeID or array[DecorativeID]? | |
collision_mask | :: CollisionLayerID or array[CollisionLayerID] or dictionary[CollisionLayerID → true ]? | |
from_layer | :: string? | |
to_layer | :: string? | |
exclude_soft | :: boolean? | Soft decoratives can be drawn over rails. |
Soft decoratives can be drawn over rails. | ||
limit | :: uint? | |
invert | :: boolean? | If the filters should be inverted. |
If the filters should be inverted. |
game.surfaces[1].find_decoratives_filtered{area = {{-10, -10}, {10, 10}}, name = "sand-decal"} -- gets all sand-decals in the rectangle
game.surfaces[1].find_decoratives_filtered{area = {{-10, -10}, {10, 10}}, limit = 5} -- gets the first 5 decoratives in the rectangle
path | :: SoundPath | The sound to play. |
The sound to play. | ||
position | :: MapPosition? | Where the sound should be played. If not given, it's played at the current position of each player. |
Where the sound should be played. If not given, it's played at the current position of each player. | ||
volume_modifier | :: double? | The volume of the sound to play. Must be between 0 and 1 inclusive. |
The volume of the sound to play. Must be between 0 and 1 inclusive. | ||
override_sound_type | :: SoundType? | The volume mixer to play the sound through. Defaults to the default mixer for the given sound type. |
The volume mixer to play the sound through. Defaults to the default mixer for the given sound type. |
source_area | :: BoundingBox | |
destination_area | :: BoundingBox | |
destination_surface | :: SurfaceIdentification? | |
destination_force | :: ForceID? | |
clone_tiles | :: boolean? | If tiles should be cloned |
If tiles should be cloned | ||
clone_entities | :: boolean? | If entities should be cloned |
If entities should be cloned | ||
clone_decoratives | :: boolean? | If decoratives should be cloned |
If decoratives should be cloned | ||
clear_destination_entities | :: boolean? | If the destination entities should be cleared |
If the destination entities should be cleared | ||
clear_destination_decoratives | :: boolean? | If the destination decoratives should be cleared |
If the destination decoratives should be cleared | ||
expand_map | :: boolean? | If the destination surface should be expanded when destination_area is outside current bounds. Defaults to |
If the destination surface should be expanded when destination_area is outside current bounds. Defaults to | ||
create_build_effect_smoke | :: boolean? | If true, the building effect smoke will be shown around the new entities. Defaults to |
If true, the building effect smoke will be shown around the new entities. Defaults to |
on_entity_cloned instantly | Raised for every entity that was cloned. |
on_area_cloned instantly | Raised after the individual |
source_offset | :: TilePosition | |
destination_offset | :: TilePosition | |
source_positions | :: array[TilePosition] | |
destination_surface | :: SurfaceIdentification? | |
destination_force | :: LuaForce or string? | |
clone_tiles | :: boolean? | If tiles should be cloned |
If tiles should be cloned | ||
clone_entities | :: boolean? | If entities should be cloned |
If entities should be cloned | ||
clone_decoratives | :: boolean? | If decoratives should be cloned |
If decoratives should be cloned | ||
clear_destination_entities | :: boolean? | If the destination entities should be cleared |
If the destination entities should be cleared | ||
clear_destination_decoratives | :: boolean? | If the destination decoratives should be cleared |
If the destination decoratives should be cleared | ||
expand_map | :: boolean? | If the destination surface should be expanded when destination_area is outside current bounds. Defaults to |
If the destination surface should be expanded when destination_area is outside current bounds. Defaults to | ||
manual_collision_mode | :: boolean? | If manual-style collision checks should be done. |
If manual-style collision checks should be done. | ||
create_build_effect_smoke | :: boolean? | If true, the building effect smoke will be shown around the new entities. |
If true, the building effect smoke will be shown around the new entities. |
entities | :: array[LuaEntity] | |
destination_offset | :: Vector | |
destination_surface | :: SurfaceIdentification? | |
destination_force | :: ForceID? | |
snap_to_grid | :: boolean? | |
create_build_effect_smoke | :: boolean? | If true, the building effect smoke will be shown around the new entities. |
If true, the building effect smoke will be shown around the new entities. |
on_entity_cloned instantly | Raised for every entity that was cloned. |
ignore_characters | :: boolean? | Whether characters on this surface that are connected to or associated with players should be ignored (not destroyed). Defaults to |
Whether characters on this surface that are connected to or associated with players should be ignored (not destroyed). Defaults to |
on_pre_surface_cleared future_tick | |
on_surface_cleared future_tick |
bounding_box | :: BoundingBox | The dimensions of the object that's supposed to travel the path. |
The dimensions of the object that's supposed to travel the path. | ||
collision_mask | :: CollisionMask | The collision mask the |
The collision mask the | ||
start | :: MapPosition | The position from which to start pathfinding. |
The position from which to start pathfinding. | ||
goal | :: MapPosition | The position to find a path to. |
The position to find a path to. | ||
force | :: ForceID | The force for which to generate the path, determining which gates can be opened for example. |
The force for which to generate the path, determining which gates can be opened for example. | ||
radius | :: double? | How close the pathfinder needs to get to its |
How close the pathfinder needs to get to its | ||
pathfind_flags | :: PathfinderFlags? | Flags that affect pathfinder behavior. |
Flags that affect pathfinder behavior. | ||
can_open_gates | :: boolean? | Whether the path request can open gates. Defaults to |
Whether the path request can open gates. Defaults to | ||
path_resolution_modifier | :: int? | Defines how coarse the pathfinder's grid is, where smaller values mean a coarser grid. Defaults to |
Defines how coarse the pathfinder's grid is, where smaller values mean a coarser grid. Defaults to | ||
max_gap_size | :: int? | Defines the maximum allowed distance between path waypoints. 0 means that paths must be contiguous (as they are for biters). Values greater than 0 will produce paths with "gaps" that are suitable for spiders. Allowed values are from |
Defines the maximum allowed distance between path waypoints. 0 means that paths must be contiguous (as they are for biters). Values greater than 0 will produce paths with "gaps" that are suitable for spiders. Allowed values are from | ||
max_attack_distance | :: double? | Defines the maximum allowed distance between the last traversable path waypoint and an obstacle entity to be destroyed. Only used when finding a discontiguous path, i.e. when |
Defines the maximum allowed distance between the last traversable path waypoint and an obstacle entity to be destroyed. Only used when finding a discontiguous path, i.e. when | ||
entity_to_ignore | :: LuaEntity? | Makes the pathfinder ignore collisions with this entity if it is given. |
Makes the pathfinder ignore collisions with this entity if it is given. |
→ uint | A unique handle to identify this call when on_script_path_request_finished fires. |
on_script_path_request_finished future_tick |
position | :: MapPosition | |
entities | :: array[LuaEntity] | The Entities to check. |
The Entities to check. |
prototype | :: EntityID | The entity prototype to check. |
The entity prototype to check. | ||
position | :: MapPosition | The position to check. |
The position to check. | ||
use_map_generation_bounding_box | :: boolean | If the map generation bounding box should be used instead of the collision bounding box. |
If the map generation bounding box should be used instead of the collision bounding box. | ||
direction | :: defines.direction? |
prototype | :: DecorativeID | The decorative prototype to check. |
The decorative prototype to check. | ||
position | :: MapPosition | The position to check. |
The position to check. |
property_names | :: array[string] | Names of properties ( |
Names of properties ( | ||
positions | :: array[MapPosition] | Positions for which to calculate property values. |
Positions for which to calculate property values. |
position | :: ChunkPosition | The chunk's position. |
The chunk's position. | ||
force | :: ForceID | Entities of this force will be returned. |
Entities of this force will be returned. |
property | :: SurfacePropertyID | Property to read. |
Property to read. |
→ double | Value of the property. |
property | :: SurfacePropertyID | Property to change. |
Property to change. | ||
value | :: double | The wanted value of the property. |
The wanted value of the property. |
-- Makes night on the surface pitch black, LuaSurface::min_brightness is set to default value 0.15.
game.surfaces[1].brightness_visual_weights = { 1 / 0.85, 1 / 0.85, 1 / 0.85 }