Files
project-cybersyn/.vscode/factorio/runtime-api-LuaSurface.lua
Monica Moniot 30fe2946e6 updated api
2022-12-01 19:04:58 -05:00

1725 lines
93 KiB
Lua

---@meta
---@diagnostic disable
--$Factorio 1.1.72
--$Overlay 5
--$Section LuaSurface
-- This file is automatically generated. Edits will be overwritten.
---A "domain" of the world. Surfaces can only be created and deleted through the API. Surfaces are uniquely identified by their name. Every game contains at least the surface "nauvis".
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html)
---@class LuaSurface:LuaObject
---[RW]
---When set to true, the sun will always shine.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.always_day)
---@field always_day boolean
---[RW]
---Defines how surface daytime brightness influences each color channel of the current color lookup table (LUT).
---
---The LUT is multiplied by `((1 - weight) + brightness * weight)` and result is clamped to range [0, 1].
---
---Default is `{0, 0, 0}`, which means no influence.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.brightness_visual_weights)
---
---### Example
---Makes night on the surface pitch black, assuming [LuaSurface::min_brightness](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.min_brightness) being set to default value `0.15`.
---```
---game.surfaces[1].brightness_visual_weights = { 1 / 0.85, 1 / 0.85, 1 / 0.85 }
---```
---@field brightness_visual_weights ColorModifier
---[R]
---Amount of darkness at the current time, as a number in range [0, 1].
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.darkness)
---@field darkness float
---[RW]
---The daytime when dawn starts.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.dawn)
---@field dawn double
---[RW]
---Current time of day, as a number in range [0, 1).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.daytime)
---@field daytime double
---[RW]
---The daytime when dusk starts.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.dusk)
---@field dusk double
---[RW]
---The daytime when evening starts.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.evening)
---@field evening double
---[RW]
---True if daytime is currently frozen.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.freeze_daytime)
---@field freeze_daytime boolean
---[RW]
---When set to true, new chunks will be generated with lab tiles, instead of using the surface's map generation settings.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.generate_with_lab_tiles)
---@field generate_with_lab_tiles boolean
---[R]
---Unique ID associated with this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.index)
---@field index uint
---[RW]
---The generation settings for this surface. These can be modified to after surface generation, but note that this will not retroactively update the surface. To manually adjust it, [LuaSurface::regenerate_entity](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.regenerate_entity), [LuaSurface::regenerate_decorative](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.regenerate_decorative) and [LuaSurface::delete_chunk](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.delete_chunk) can be used.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.map_gen_settings)
---@field map_gen_settings MapGenSettings
---[RW]
---The minimal brightness during the night. Default is `0.15`. The value has an effect on the game simalution only, it doesn't have any effect on rendering.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.min_brightness)
---@field min_brightness double
---[RW]
---The daytime when morning starts.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.morning)
---@field morning double
---[RW]
---The name of this surface. Names are unique among surfaces.
---
---**Note:** the default surface can't be renamed.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.name)
---@field name string
---[R]
---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.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.object_name)
---@field object_name string
---[RW]
---Is peaceful mode enabled on this surface?
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.peaceful_mode)
---@field peaceful_mode boolean
---[RW]
---If clouds are shown on this surface.
---
---**Note:** If false, clouds are never shown. If true the player must also have clouds enabled in graphics settings for them to be shown.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.show_clouds)
---@field show_clouds boolean
---[RW]
---The multiplier of solar power on this surface. Cannot be less than 0.
---
---**Note:** Solar equipment is still limited to its maximum power output.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.solar_power_multiplier)
---@field solar_power_multiplier double
---[RW]
---The number of ticks per day for this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.ticks_per_day)
---@field ticks_per_day uint
---[R]
---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.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.valid)
---@field valid boolean
---[RW]
---Current wind direction.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.wind_orientation)
---@field wind_orientation RealOrientation
---[RW]
---Change in wind orientation per tick.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.wind_orientation_change)
---@field wind_orientation_change double
---[RW]
---Current wind speed.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.wind_speed)
---@field wind_speed double
local LuaSurface={
---Adds the given script area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.add_script_area)
---@param area ScriptArea
---@return uint@The id of the created area.
add_script_area=function(area)end,
---Adds the given script position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.add_script_position)
---@param area ScriptPosition
---@return uint@The id of the created position.
add_script_position=function(area)end,
---Sets the given area to the checkerboard lab tiles.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.build_checkerboard)
---@param area BoundingBox@The tile area.
build_checkerboard=function(area)end,
---Send a group to build a new base.
---
---**Note:** The specified force must be AI-controlled; i.e. `force.ai_controllable` must be `true`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.build_enemy_base)
---@param position MapPosition@Location of the new base.
---@param unit_count uint@Number of biters to send for the base-building task.
---@param force ForceIdentification?@Force the new base will belong to. Defaults to enemy.
build_enemy_base=function(position,unit_count,force)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.calculate_tile_properties)
---@param property_names string[]@Names of properties (e.g. "elevation") to calculate
---@param positions MapPosition[]@Positions for which to calculate property values
---@return {[string]: double[]}@Table of property value lists, keyed by property name
calculate_tile_properties=function(property_names,positions)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@class LuaSurface.can_fast_replace_param
---Name of the entity to check.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@field name string
---Where the entity would be placed.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@field position MapPosition
---Direction the entity would be placed. Defaults to `north`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@field direction? defines.direction
---The force that would place the entity. Defaults to the `"neutral"` force.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@field force? ForceIdentification
---If there exists an entity at the given location that can be fast-replaced with the given entity parameters.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_fast_replace)
---@param param LuaSurface.can_fast_replace_param
---@return boolean
can_fast_replace=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@class LuaSurface.can_place_entity_param
---Name of the entity prototype to check.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field name string
---Where the entity would be placed.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field position MapPosition
---Direction of the placed entity. Defaults to `north`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field direction? defines.direction
---The force that would place the entity. Defaults to the `"neutral"` force.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field force? ForceIdentification
---Which type of check should be carried out. Defaults to `ghost_revive`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field build_check_type? defines.build_check_type
---If `true`, entities that can be marked for deconstruction are ignored. Only used if `build_check_type` is either `manual_ghost`, `script_ghost` or `blueprint_ghost`. Defaults to `false`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field forced? boolean
---The prototype name of the entity contained in the ghost. Only used if `name` is `entity-ghost`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@field inner_name? string
---Check for collisions with terrain or other entities.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.can_place_entity)
---@param param LuaSurface.can_place_entity_param
---@return boolean
can_place_entity=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@class LuaSurface.cancel_deconstruct_area_param
---The area to cancel deconstruction orders in.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@field area BoundingBox
---The force whose deconstruction orders to cancel.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@field force ForceIdentification
---The player to set the last_user to if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@field player? PlayerIdentification
---If chunks covered by fog-of-war are skipped.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@field skip_fog_of_war? boolean
---The deconstruction item to use if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@field item? LuaItemStack
---Cancel a deconstruction order.
---
---**Events:**
--- * May raise [on_cancelled_deconstruction](https://lua-api.factorio.com/latest/events.html#on_cancelled_deconstruction) instantly.
---Raised for every entity whose deconstruction has been successfully cancelled.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_deconstruct_area)
---@param param LuaSurface.cancel_deconstruct_area_param
cancel_deconstruct_area=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@class LuaSurface.cancel_upgrade_area_param
---The area to cancel upgrade orders in.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@field area BoundingBox
---The force whose upgrade orders to cancel.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@field force ForceIdentification
---The player to set the last_user to if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@field player? PlayerIdentification
---If chunks covered by fog-of-war are skipped.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@field skip_fog_of_war? boolean
---The upgrade item to use if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@field item? LuaItemStack
---Cancel a upgrade order.
---
---**Events:**
--- * May raise [on_cancelled_upgrade](https://lua-api.factorio.com/latest/events.html#on_cancelled_upgrade) instantly.
---Raised for every entity whose upgrade has been successfully cancelled.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.cancel_upgrade_area)
---@param param LuaSurface.cancel_upgrade_area_param
cancel_upgrade_area=function(param)end,
---Clears this surface deleting all entities and chunks on it.
---
---**Events:**
--- * Will raise [on_pre_surface_cleared](https://lua-api.factorio.com/latest/events.html#on_pre_surface_cleared) in a future tick.
---
--- * Will raise [on_surface_cleared](https://lua-api.factorio.com/latest/events.html#on_surface_cleared) in a future tick.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clear)
---@param ignore_characters boolean?@Whether characters on this surface that are connected to or associated with players should be ignored (not destroyed).
clear=function(ignore_characters)end,
---Clears all pollution on this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clear_pollution)
clear_pollution=function()end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@class LuaSurface.clone_area_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field source_area BoundingBox
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field destination_area BoundingBox
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field destination_surface? SurfaceIdentification
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field destination_force? LuaForce|string
---If tiles should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field clone_tiles? boolean
---If entities should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field clone_entities? boolean
---If decoratives should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field clone_decoratives? boolean
---If the destination entities should be cleared
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field clear_destination_entities? boolean
---If the destination decoratives should be cleared
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field clear_destination_decoratives? boolean
---If the destination surface should be expanded when destination_area is outside current bounds. Default false.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field expand_map? boolean
---If true, the building effect smoke will be shown around the new entities.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@field create_build_effect_smoke? boolean
---Clones the given area.
---
---**Note:** Entities are cloned in an order such that they can always be created, eg rails before trains.
---
---**Events:**
--- * Will raise [on_area_cloned](https://lua-api.factorio.com/latest/events.html#on_area_cloned) instantly.
---Raised after the individual `on_entity_cloned` events.
---
--- * Will raise [on_entity_cloned](https://lua-api.factorio.com/latest/events.html#on_entity_cloned) instantly.
---Raised for every entity that was cloned.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_area)
---@param param LuaSurface.clone_area_param
clone_area=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@class LuaSurface.clone_brush_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field source_offset TilePosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field destination_offset TilePosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field source_positions TilePosition[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field destination_surface? SurfaceIdentification
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field destination_force? LuaForce|string
---If tiles should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field clone_tiles? boolean
---If entities should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field clone_entities? boolean
---If decoratives should be cloned
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field clone_decoratives? boolean
---If the destination entities should be cleared
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field clear_destination_entities? boolean
---If the destination decoratives should be cleared
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field clear_destination_decoratives? boolean
---If the destination surface should be expanded when destination_area is outside current bounds. Default false.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field expand_map? boolean
---If manual-style collision checks should be done.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field manual_collision_mode? boolean
---If true, the building effect smoke will be shown around the new entities.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@field create_build_effect_smoke? boolean
---Clones the given area.
---
---**Note:** [defines.events.on_entity_cloned](https://lua-api.factorio.com/latest/defines.html#defines.events.on_entity_cloned) is raised for each entity, and then [defines.events.on_area_cloned](https://lua-api.factorio.com/latest/defines.html#defines.events.on_area_cloned) is raised.
---
---**Note:** Entities are cloned in an order such that they can always be created, eg rails before trains.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_brush)
---@param param LuaSurface.clone_brush_param
clone_brush=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@class LuaSurface.clone_entities_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field entities LuaEntity[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field destination_offset Vector
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field destination_surface? SurfaceIdentification
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field destination_force? ForceIdentification
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field snap_to_grid? boolean
---If true, the building effect smoke will be shown around the new entities.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@field create_build_effect_smoke? boolean
---Clones the given entities.
---
---**Note:** Entities are cloned in an order such that they can always be created, eg rails before trains.
---
---**Events:**
--- * Will raise [on_entity_cloned](https://lua-api.factorio.com/latest/events.html#on_entity_cloned) instantly.
---Raised for every entity that was cloned.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.clone_entities)
---@param param LuaSurface.clone_entities_param
clone_entities=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@class LuaSurface.count_entities_filtered_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field area? BoundingBox
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field position? MapPosition
---If given with position, will count all entities within the radius of the position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field radius? double
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field type? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field ghost_name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field ghost_type? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field direction? defines.direction|defines.direction[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field force? ForceIdentification|ForceIdentification[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field to_be_deconstructed? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field to_be_upgraded? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field limit? uint
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field is_military_target? boolean
---Whether the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@field invert? boolean
---Count entities of given type or name in a given area. Works just like [LuaSurface::find_entities_filtered](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered), except this only returns the count. As it doesn't construct all the wrapper objects, this is more efficient if one is only interested in the number of entities.
---
---If no `area` or `position` are given, the entire surface is searched. If `position` is given, this returns the entities colliding with that position (i.e the given position is within the entity's collision box). If `position` and `radius` are given, this returns entities in the radius of the position. If `area` is specified, this returns entities colliding with that area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_entities_filtered)
---@param param LuaSurface.count_entities_filtered_param
---@return uint
count_entities_filtered=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@class LuaSurface.count_tiles_filtered_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field area? BoundingBox
---Ignored if not given with radius.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field position? MapPosition
---If given with position, will return all entities within the radius of the position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field radius? double
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field force? ForceIdentification|ForceIdentification[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field limit? uint
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field has_hidden_tile? boolean
---Can be further filtered by supplying a `force` filter.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field has_tile_ghost? boolean
---Can be further filtered by supplying a `force` filter.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field to_be_deconstructed? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---If the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@field invert? boolean
---Count tiles of a given name in a given area. Works just like [LuaSurface::find_tiles_filtered](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered), except this only returns the count. As it doesn't construct all the wrapper objects, this is more efficient if one is only interested in the number of tiles.
---
---If no `area` or `position` and `radius` is given, the entire surface is searched. If `position` and `radius` are given, only tiles within the radius of the position are included.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.count_tiles_filtered)
---@param param LuaSurface.count_tiles_filtered_param
---@return uint
count_tiles_filtered=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_decoratives)
---@class LuaSurface.create_decoratives_param
---If collision should be checked against entities/tiles.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_decoratives)
---@field check_collision? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_decoratives)
---@field decoratives Decorative[]
---Adds the given decoratives to the surface.
---
---**Note:** This will merge decoratives of the same type that already exist effectively increasing the "amount" field.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_decoratives)
---@param param LuaSurface.create_decoratives_param
create_decoratives=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@class LuaSurface.create_entity_param
---The entity prototype name to create.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field name string
---Where to create the entity.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field position MapPosition
---Desired orientation of the entity after creation.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field direction? defines.direction
---Force of the entity, default is enemy.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field force? ForceIdentification
---Entity with health for the new entity to target.
---
---Applies to **"item-request-proxy"**: (required)
---The target items are to be delivered to.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field target? LuaEntity|MapPosition
---Source entity. Used for beams and highlight-boxes.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field source? LuaEntity|MapPosition
---If true, building will attempt to simulate fast-replace building.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field fast_replace? boolean
---If given set the last_user to this player. If fast_replace is true simulate fast replace using this player.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field player? PlayerIdentification
---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.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field spill? boolean
---If true; [defines.events.script_raised_built](https://lua-api.factorio.com/latest/defines.html#defines.events.script_raised_built) will be fired on successful entity creation.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field raise_built? boolean
---If false, the building effect smoke will not be shown around the new entity.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field create_build_effect_smoke? boolean
---If true, entity types that have spawn_decorations property will apply triggers defined in the property.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field spawn_decorations? boolean
---If true, any characters that are in the way of the entity are teleported out of the way.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field move_stuck_players? boolean
---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)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field item? LuaItemStack
---Applies to **"assembling-machine"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field recipe? string
---Applies to **"beam"**: (optional)
---Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined).
---
---Applies to **"stream"**: (optional)
---Absolute target position that can be used instead of target entity (entity has precedence if both entity and position are defined).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field target_position? MapPosition
---Applies to **"beam"**: (optional)
---Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined).
---
---Applies to **"stream"**: (optional)
---Absolute source position that can be used instead of source entity (entity has precedence if both entity and position are defined).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field source_position? MapPosition
---Applies to **"beam"**: (optional)
---If set, beam will be destroyed when distance between source and target is greater than this value.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field max_length? uint
---Applies to **"beam"**: (optional)
---If set, beam will be destroyed after this value of ticks.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field duration? uint
---Applies to **"beam"**: (optional)
---Source position will be offset by this value when rendering the beam.
---
---Applies to **"stream"**: (optional)
---Source position will be offset by this value when rendering the stream.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field source_offset? Vector
---Applies to **"container"**: (optional)
---Inventory index where the red limiting bar should be set.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field bar? uint
---Applies to **"cliff"**: (optional)
---If not specified, `direction` will be used instead.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field cliff_orientation? CliffOrientation
---Applies to **"flying-text"**: (required)
---The string to show.
---
---Applies to **"speech-bubble"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field text LocalisedString
---Applies to **"flying-text"**: (optional)
---Color of the displayed text.
---
---Applies to **"rolling-stock"**: (optional)
---The color of this rolling stock, if it supports colors.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field color? Color
---Applies to **"flying-text"**: (optional)
---
---Applies to **"highlight-box"**: (optional)
---The player to render the highlight box for. If not provided, it will be rendered for all players.
---
---Applies to **"simple-entity-with-owner"**: (optional)
---
---Applies to **"simple-entity-with-force"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field render_player_index? uint
---Applies to **"entity-ghost"**: (required)
---The prototype name of the entity contained in the ghost.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field inner_name string
---Applies to **"entity-ghost"**: (optional)
---If `false` the ghost entity will not expire. Default is `false`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field expires? boolean
---Applies to **"fire"**: (optional)
---With how many small flames should the fire on ground be created. Defaults to the initial flame count of the prototype.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field initial_ground_flame_count? uint8
---Applies to **"inserter"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field conditions InserterCircuitConditions
---Applies to **"inserter"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field filters InventoryFilter[]
---Applies to **"item-entity"**: (required)
---The stack of items to create.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field stack SimpleItemStack
---Applies to **"item-request-proxy"**: (required)
---The stacks of items to be delivered to target entity from logistic network.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field modules {[string]: uint}
---Applies to **"rolling-stock"**: (optional)
---The orientation of this rolling stock.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field orientation? RealOrientation
---Applies to **"locomotive"**: (optional)
---Whether the locomotive should snap to an adjacent train stop. Defaults to true.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field snap_to_train_stop? boolean
---Applies to **"logistic-container"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field request_filters? InventoryFilter[]
---Applies to **"particle"**: (required)
---
---Applies to **"artillery-flare"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field movement Vector
---Applies to **"particle"**: (required)
---
---Applies to **"artillery-flare"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field height float
---Applies to **"particle"**: (required)
---
---Applies to **"artillery-flare"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field vertical_speed float
---Applies to **"particle"**: (required)
---
---Applies to **"artillery-flare"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field frame_speed float
---Applies to **"projectile"**: (required)
---
---Applies to **"artillery-projectile"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field speed double
---Applies to **"projectile"**: (optional)
---
---Applies to **"artillery-projectile"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field max_range? double
---Applies to **"resource"**: (required)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field amount uint
---Applies to **"resource"**: (optional)
---If colliding trees are removed normally for this resource entity based off the prototype tree removal values. Default is true.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field enable_tree_removal? boolean
---Applies to **"resource"**: (optional)
---If colliding cliffs are removed. Default is true.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field enable_cliff_removal? boolean
---Applies to **"resource"**: (optional)
---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.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field snap_to_tile_center? boolean
---Applies to **"underground-belt"**: (optional)
---`"output"` or `"input"`; default is `"input"`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field type? string
---Applies to **"programmable-speaker"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field parameters? ProgrammableSpeakerParameters
---Applies to **"programmable-speaker"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field alert_parameters? ProgrammableSpeakerAlertParameters
---Applies to **"character-corpse"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field inventory_size? uint
---Applies to **"character-corpse"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field player_index? uint
---Applies to **"highlight-box"**: (optional)
---The bounding box defining the highlight box using absolute map coordinates. If specified, the general `position` parameter still needs to be present, but will be ignored. If not specified, the game falls back to the `source` parameter first, then the `target` parameter second. One of these three parameters need to be specified.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field bounding_box? BoundingBox
---Applies to **"highlight-box"**: (optional)
---Specifies the graphical appearance (color) of the highlight box. Defaults to `"electricity"`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field box_type? CursorBoxRenderType
---Applies to **"highlight-box"**: (optional)
---The blink interval for this highlight box. Makes it be shown every `blink_interval` ticks. Defaults to `0` (constantly shown).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field blink_interval? uint
---Applies to **"highlight-box"**: (optional)
---The amount of time in ticks that the highlight box will exist for. Defaults to existing forever.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field time_to_live? uint
---Applies to **"speech-bubble"**: (optional)
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---@field lifetime? uint
---Create an entity on this surface.
---
---**Events:**
--- * May raise [script_raised_built](https://lua-api.factorio.com/latest/events.html#script_raised_built) instantly.
---Raised if the `raise_built` flag was set and the entity was successfully created.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity)
---
---### Example
---```
---asm = game.surfaces[1].create_entity{name = "assembling-machine-1", position = {15, 3}, force = game.forces.player, recipe = "iron-stick"}
---```
---
---### Example
---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"}}
---}
---```
---
---### Example
---Creates a requester chest already set to request 128 iron plates.
---```
---game.surfaces[1].create_entity{
--- name = "logistic-chest-requester", position = {game.player.position.x+3, game.player.position.y},
--- force = game.player.force, request_filters = {{index = 1, name = "iron-plate", count = 128}}
---}
---```
---
---### Example
---```
---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
---```
---
---### Example
---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}
---```
---@param param LuaSurface.create_entity_param
---@return LuaEntity?@The created entity or `nil` if the creation failed.
create_entity=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@class LuaSurface.create_particle_param
---The particle name.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field name string
---Where to create the particle.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field position MapPosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field movement Vector
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field height float
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field vertical_speed float
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@field frame_speed float
---Creates a particle at the given location
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_particle)
---@param param LuaSurface.create_particle_param
create_particle=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_trivial_smoke)
---@class LuaSurface.create_trivial_smoke_param
---The smoke prototype name to create.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_trivial_smoke)
---@field name string
---Where to create the smoke.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_trivial_smoke)
---@field position MapPosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_trivial_smoke)
---@param param LuaSurface.create_trivial_smoke_param
create_trivial_smoke=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_unit_group)
---@class LuaSurface.create_unit_group_param
---Initial position of the new unit group.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_unit_group)
---@field position MapPosition
---Force of the new unit group. Defaults to `"enemy"`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_unit_group)
---@field force? ForceIdentification
---Create a new unit group at a given position.
---
---**Events:**
--- * Will raise [on_unit_group_created](https://lua-api.factorio.com/latest/events.html#on_unit_group_created) instantly.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_unit_group)
---@param param LuaSurface.create_unit_group_param
---@return LuaUnitGroup
create_unit_group=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@class LuaSurface.deconstruct_area_param
---The area to mark for deconstruction.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@field area BoundingBox
---The force whose bots should perform the deconstruction.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@field force ForceIdentification
---The player to set the last_user to if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@field player? PlayerIdentification
---If chunks covered by fog-of-war are skipped.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@field skip_fog_of_war? boolean
---The deconstruction item to use if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@field item? LuaItemStack
---Place a deconstruction request.
---
---**Events:**
--- * May raise [on_marked_for_deconstruction](https://lua-api.factorio.com/latest/events.html#on_marked_for_deconstruction) instantly.
---Raised for every entity that has been successfully marked for deconstruction.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.deconstruct_area)
---@param param LuaSurface.deconstruct_area_param
deconstruct_area=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.decorative_prototype_collides)
---@param prototype string@The decorative prototype to check
---@param position MapPosition@The position to check
decorative_prototype_collides=function(prototype,position)end,
---**Events:**
--- * Will raise [on_chunk_deleted](https://lua-api.factorio.com/latest/events.html#on_chunk_deleted) in a future tick.
---
--- * Will raise [on_pre_chunk_deleted](https://lua-api.factorio.com/latest/events.html#on_pre_chunk_deleted) in a future tick.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.delete_chunk)
---@param position ChunkPosition@The chunk position to delete
delete_chunk=function(position)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@class LuaSurface.destroy_decoratives_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field area? BoundingBox
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field position? TilePosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field name? string|string[]|LuaDecorativePrototype|LuaDecorativePrototype[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field from_layer? string
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field to_layer? string
---Soft decoratives can be drawn over rails.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field exclude_soft? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field limit? uint
---If the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@field invert? boolean
---Removes all decoratives from the given area. If no area and no position are given, then the entire surface is searched.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.destroy_decoratives)
---@param param LuaSurface.destroy_decoratives_param
destroy_decoratives=function(param)end,
---Sets the given script area to the new values.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.edit_script_area)
---@param id uint@The area to edit.
---@param area ScriptArea
edit_script_area=function(id,area)end,
---Sets the given script position to the new values.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.edit_script_position)
---@param id uint@The position to edit.
---@param area ScriptPosition
edit_script_position=function(id,area)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.entity_prototype_collides)
---@param prototype EntityPrototypeIdentification@The entity prototype to check
---@param position MapPosition@The position to check
---@param use_map_generation_bounding_box boolean@If the map generation bounding box should be used instead of the collision bounding box
---@param direction defines.direction?
entity_prototype_collides=function(prototype,position,use_map_generation_bounding_box,direction)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@class LuaSurface.find_decoratives_filtered_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field area? BoundingBox
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field position? TilePosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field name? string|string[]|LuaDecorativePrototype|LuaDecorativePrototype[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field from_layer? string
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field to_layer? string
---Soft decoratives can be drawn over rails.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field exclude_soft? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field limit? uint
---If the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---@field invert? boolean
---Find decoratives of a given name in a given area.
---
---If no filters are given, returns all decoratives in the search area. If multiple filters are specified, returns only decoratives matching every given filter. If no area and no position are given, the entire surface is searched.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_decoratives_filtered)
---
---### Example
---```
---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
---```
---@param param LuaSurface.find_decoratives_filtered_param
---@return DecorativeResult[]
find_decoratives_filtered=function(param)end,
---Find enemy units (entities with type "unit") of a given force within an area.
---
---**Note:** This is more efficient than [LuaSurface::find_entities](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_enemy_units)
---
---### Example
---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)
---```
---@param center MapPosition@Center of the search area
---@param radius double@Radius of the circular search area
---@param force LuaForce|string?@Force to find enemies of. If not given, uses the player force.
---@return LuaEntity[]
find_enemy_units=function(center,radius,force)end,
---Find entities in a given area.
---
---If no area is given all entities on the surface are returned.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities)
---
---### Example
---Will evaluate to a list of all entities within given area.
---```
---game.surfaces["nauvis"].find_entities({{-10, -10}, {10, 10}})
---```
---@param area BoundingBox?
---@return LuaEntity[]
find_entities=function(area)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@class LuaSurface.find_entities_filtered_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field area? BoundingBox
---Has precedence over area field.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field position? MapPosition
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field radius? double
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field type? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field ghost_name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field ghost_type? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field direction? defines.direction|defines.direction[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field force? ForceIdentification|ForceIdentification[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field to_be_deconstructed? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field to_be_upgraded? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field limit? uint
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field is_military_target? boolean
---Whether the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---@field invert? boolean
---Find all entities of the given type or name in the given area.
---
---If no filters (`name`, `type`, `force`, etc.) are given, this returns all entities in the search area. If multiple filters are specified, only entities matching all given filters are returned.
---
---- If no `area` or `position` are given, the entire surface is searched.
---- If `position` is given, this returns the entities colliding with that position (i.e the given position is within the entity's collision box).
---- If `position` and `radius` are given, this returns the entities within the radius of the position. Looks for the center of entities.
---- If `area` is specified, this returns the entities colliding with that area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities_filtered)
---
---### Example
---```
---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].
---```
---@param param LuaSurface.find_entities_filtered_param
---@return LuaEntity[]
find_entities_filtered=function(param)end,
---Find a specific entity at a specific position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entity)
---
---### Example
---```
---game.player.selected.surface.find_entity('filter-inserter', {0,0})
---```
---@param entity string@Entity to look for.
---@param position MapPosition@Coordinates to look at.
---@return LuaEntity?@`nil` if no such entity is found.
find_entity=function(entity,position)end,
---Find the logistic network that covers a given position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_logistic_network_by_position)
---@param position MapPosition
---@param force ForceIdentification@Force the logistic network should belong to.
---@return LuaLogisticNetwork?@The found network or `nil` if no such network was found.
find_logistic_network_by_position=function(position,force)end,
---Finds all of the logistics networks whose construction area intersects with the given position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_logistic_networks_by_construction_area)
---@param position MapPosition
---@param force ForceIdentification@Force the logistic networks should belong to.
---@return LuaLogisticNetwork[]
find_logistic_networks_by_construction_area=function(position,force)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy)
---@class LuaSurface.find_nearest_enemy_param
---Center of the search area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy)
---@field position MapPosition
---Radius of the circular search area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy)
---@field max_distance double
---The force the result will be an enemy of. Uses the player force if not specified.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy)
---@field force? ForceIdentification
---Find the enemy military target ([military entity](https://wiki.factorio.com/Military_units_and_structures)) closest to the given position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy)
---@param param LuaSurface.find_nearest_enemy_param
---@return LuaEntity?@The nearest enemy military target or `nil` if no enemy could be found within the given area.
find_nearest_enemy=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy_entity_with_owner)
---@class LuaSurface.find_nearest_enemy_entity_with_owner_param
---Center of the search area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy_entity_with_owner)
---@field position MapPosition
---Radius of the circular search area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy_entity_with_owner)
---@field max_distance double
---The force the result will be an enemy of. Uses the player force if not specified.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy_entity_with_owner)
---@field force? ForceIdentification
---Find the enemy entity-with-owner closest to the given position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_nearest_enemy_entity_with_owner)
---@param param LuaSurface.find_nearest_enemy_entity_with_owner_param
---@return LuaEntity@The nearest enemy entity-with-owner or `nil` if no enemy could be found within the given area.
find_nearest_enemy_entity_with_owner=function(param)end,
---Find a non-colliding position within a given radius.
---
---**Note:** Special care needs to be taken when using a radius of `0`. The game will not stop searching until it finds a suitable position, so it is important to make sure such a position exists. One particular case where it would not be able to find a solution is running it before any chunks have been generated.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_non_colliding_position)
---@param name string@Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.)
---@param center MapPosition@Center of the search area.
---@param radius double@Max distance from `center` to search in. A radius of `0` means an infinitely-large search area.
---@param precision double@The step length from the given position as it searches, in tiles. Minimum value is `0.01`.
---@param 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. Default false.
---@return MapPosition?@The non-colliding position. May be `nil` if no suitable position was found.
find_non_colliding_position=function(name,center,radius,precision,force_to_tile_center)end,
---Find a non-colliding position within a given rectangle.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_non_colliding_position_in_box)
---@param name string@Prototype name of the entity to find a position for. (The bounding box for the collision checking is taken from this prototype.)
---@param search_space BoundingBox@The rectangle to search inside.
---@param precision double@The step length from the given position as it searches, in tiles. Minimum value is 0.01.
---@param 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. Default false.
---@return MapPosition?@The non-colliding position. May be `nil` if no suitable position was found.
find_non_colliding_position_in_box=function(name,search_space,precision,force_to_tile_center)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@class LuaSurface.find_tiles_filtered_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field area? BoundingBox
---Ignored if not given with radius.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field position? MapPosition
---If given with position, will return all entities within the radius of the position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field radius? double
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field name? string|string[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field force? ForceIdentification|ForceIdentification[]
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field limit? uint
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field has_hidden_tile? boolean
---Can be further filtered by supplying a `force` filter.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field has_tile_ghost? boolean
---Can be further filtered by supplying a `force` filter.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field to_be_deconstructed? boolean
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field collision_mask? CollisionMaskLayer|CollisionMaskLayer[]
---Whether the filters should be inverted.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@field invert? boolean
---Find all tiles of the given name in the given area.
---
---If no filters are given, this returns all tiles in the search area.
---
---If no `area` or `position` and `radius` is given, the entire surface is searched. If `position` and `radius` are given, only tiles within the radius of the position are included.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_tiles_filtered)
---@param param LuaSurface.find_tiles_filtered_param
---@return LuaTile[]
find_tiles_filtered=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_units)
---@class LuaSurface.find_units_param
---Box to find units within.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_units)
---@field area BoundingBox
---Force performing the search.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_units)
---@field force LuaForce|string
---Only forces which meet the condition will be included in the search.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_units)
---@field condition ForceCondition
---Find units (entities with type "unit") of a given force and force condition within a given area.
---
---**Note:** This is more efficient than [LuaSurface::find_entities](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_entities).
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.find_units)
---
---### Example
---Find friendly units to "player" force
---```
---local friendly_units = game.player.surface.find_units({area = {{-10, -10},{10, 10}}, force = "player", condition = "friend")
---```
---
---### Example
---Find units of "player" force
---```
---local units = game.player.surface.find_units({area = {{-10, -10},{10, 10}}, force = "player", condition = "same"})
---```
---@param param LuaSurface.find_units_param
---@return LuaEntity[]
find_units=function(param)end,
---Blocks and generates all chunks that have been requested using all available threads.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.force_generate_chunk_requests)
force_generate_chunk_requests=function()end,
---Get an iterator going over every chunk on this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_chunks)
---@return LuaChunkIterator
get_chunks=function()end,
---Gets the closest entity in the list to this position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_closest)
---@param position MapPosition
---@param entities LuaEntity[]@The Entities to check
---@return LuaEntity?
get_closest=function(position,entities)end,
---Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position.
---
---**Note:** This won't find tiles in non-generated chunks.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_connected_tiles)
---@param position TilePosition@The tile position to start at.
---@param tiles string[]@The tiles to search for.
---@return TilePosition[]@The resulting set of tiles.
get_connected_tiles=function(position,tiles)end,
---Returns all the military targets (entities with force) on this chunk for the given force.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_entities_with_force)
---@param position ChunkPosition@The chunk's position.
---@param force LuaForce|string@Entities of this force will be returned.
---@return LuaEntity[]
get_entities_with_force=function(position,force)end,
---The hidden tile name.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_hidden_tile)
---@param position TilePosition@The tile position.
---@return string?@`nil` if there isn't one for the given position.
get_hidden_tile=function(position)end,
---Gets the map exchange string for the current map generation settings of this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_map_exchange_string)
---@return string
get_map_exchange_string=function()end,
---Get the pollution for a given position.
---
---**Note:** Pollution is stored per chunk, so this will return the same value for all positions in one chunk.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_pollution)
---
---### Example
---```
---game.surfaces[1].get_pollution({1,2})
---```
---@param position MapPosition
---@return double
get_pollution=function(position)end,
---Gets a random generated chunk position or 0,0 if no chunks have been generated on this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_random_chunk)
---@return ChunkPosition
get_random_chunk=function()end,
---Gets the resource amount of all resources on this surface
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_resource_counts)
---@return {[string]: uint}
get_resource_counts=function()end,
---Gets the first script area by name or id.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_script_area)
---@param key string|uint?@The name or id of the area to get.
---@return ScriptArea?
get_script_area=function(key)end,
---Gets the script areas that match the given name or if no name is given all areas are returned.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_script_areas)
---@param name string?
---@return ScriptArea[]
get_script_areas=function(name)end,
---Gets the first script position by name or id.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_script_position)
---@param key string|uint?@The name or id of the position to get.
---@return ScriptPosition?
get_script_position=function(key)end,
---Gets the script positions that match the given name or if no name is given all positions are returned.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_script_positions)
---@param name string?
---@return ScriptPosition[]
get_script_positions=function(name)end,
---Gets the starting area radius of this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_starting_area_radius)
---@return double
get_starting_area_radius=function()end,
---Get the tile at a given position. An alternative call signature for this method is passing it a single [TilePosition](https://lua-api.factorio.com/latest/Concepts.html#TilePosition).
---
---**Note:** Non-integer values will result in them being rounded down.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_tile)
---@param x int
---@param y int
---@return LuaTile
get_tile=function(x,y)end,
---Gets the total amount of pollution on the surface by iterating over all of the chunks containing pollution.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_total_pollution)
---@return double
get_total_pollution=function()end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_train_stops)
---@class LuaSurface.get_train_stops_param
---The name(s) of the train stops. Not providing names will match any stop.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_train_stops)
---@field name? string|string[]
---The force to search. Not providing a force will match stops in any force.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_train_stops)
---@field force? ForceIdentification
---Gets train stops matching the given filters.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_train_stops)
---@param param?LuaSurface.get_train_stops_param
---@return LuaEntity[]
get_train_stops=function(param)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.get_trains)
---@param force ForceIdentification?@The force to search. Not providing a force will match trains in any force.
---@return LuaTrain[]
get_trains=function(force)end,
---All methods and properties that this object supports.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.help)
---@return string
help=function()end,
---Is a given chunk generated?
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.is_chunk_generated)
---@param position ChunkPosition@The chunk's position.
---@return boolean
is_chunk_generated=function(position)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@class LuaSurface.play_sound_param
---The sound to play.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@field path SoundPath
---Where the sound should be played. If not given, it's played at the current position of each player.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@field position? MapPosition
---The volume of the sound to play. Must be between 0 and 1 inclusive.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@field volume_modifier? double
---The volume mixer to play the sound through. Defaults to the default mixer for the given sound type.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@field override_sound_type? SoundType
---Play a sound for every player on this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.play_sound)
---@param param LuaSurface.play_sound_param
play_sound=function(param)end,
---Spawn pollution at the given position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.pollute)
---@param source MapPosition@Where to spawn the pollution.
---@param amount double@How much pollution to add.
pollute=function(source,amount)end,
---Print text to the chat console of all players on this surface.
---
---**Note:** Messages that are identical to a message sent in the last 60 ticks are not printed again.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.print)
---@param message LocalisedString
---@param color Color?
print=function(message,color)end,
---Regenerate autoplacement of some decoratives on this surface. This can be used to autoplace newly-added decoratives.
---
---**Note:** All specified decorative prototypes must be autoplacable. If nothing is given all decoratives are generated on all chunks.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.regenerate_decorative)
---@param decoratives string|string[]?@Prototype names of decorative or decoratives to autoplace. When `nil` all decoratives with an autoplace are used.
---@param chunks ChunkPosition[]?@The chunk positions to regenerate the entities on. If not given all chunks are regenerated. Note chunks with status < entities are ignored.
regenerate_decorative=function(decoratives,chunks)end,
---Regenerate autoplacement of some entities on this surface. This can be used to autoplace newly-added entities.
---
---**Note:** All specified entity prototypes must be autoplacable. If nothing is given all entities are generated on all chunks.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.regenerate_entity)
---@param entities string|string[]?@Prototype names of entity or entities to autoplace. When `nil` all entities with an autoplace are used.
---@param chunks ChunkPosition[]?@The chunk positions to regenerate the entities on. If not given all chunks are regenerated. Note chunks with status < entities are ignored.
regenerate_entity=function(entities,chunks)end,
---Removes the given script area.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.remove_script_area)
---@param id uint
---@return boolean@If the area was actually removed. False when it didn't exist.
remove_script_area=function(id)end,
---Removes the given script position.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.remove_script_position)
---@param id uint
---@return boolean@If the position was actually removed. False when it didn't exist.
remove_script_position=function(id)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@class LuaSurface.request_path_param
---The dimensions of the object that's supposed to travel the path.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field bounding_box BoundingBox
---The list of masks the `bounding_box` collides with.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field collision_mask CollisionMaskWithFlags|string[]
---The position from which to start pathfinding.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field start MapPosition
---The position to find a path to.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field goal MapPosition
---The force for which to generate the path, determining which gates can be opened for example.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field force ForceIdentification
---How close the pathfinder needs to get to its `goal` (in tiles). Defaults to `1`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field radius? double
---Flags that affect pathfinder behavior.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field pathfind_flags? PathfinderFlags
---Whether the path request can open gates. Defaults to `false`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field can_open_gates? boolean
---Defines how coarse the pathfinder's grid is. Smaller values mean a coarser grid (negative numbers allowed). Allowed values are from -8 to 8. Defaults to `0`.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field path_resolution_modifier? int
---Makes the pathfinder ignore collisions with this entity if it is given.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@field entity_to_ignore? LuaEntity
---Generates a path with the specified constraints (as an array of [PathfinderWaypoints](https://lua-api.factorio.com/latest/Concepts.html#PathfinderWaypoint)) using the unit pathfinding algorithm. This path can be used to emulate pathing behavior by script for non-unit entities, such as vehicles. If you want to command actual units (such as biters or spitters) to move, use [LuaEntity::set_command](https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.set_command) instead.
---
---The resulting path is ultimately returned asynchronously via [on_script_path_request_finished](https://lua-api.factorio.com/latest/events.html#on_script_path_request_finished).
---
---**Events:**
--- * Will raise [on_script_path_request_finished](https://lua-api.factorio.com/latest/events.html#on_script_path_request_finished) in a future tick.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_path)
---@param param LuaSurface.request_path_param
---@return uint@A unique handle to identify this call when [on_script_path_request_finished](https://lua-api.factorio.com/latest/events.html#on_script_path_request_finished) fires.
request_path=function(param)end,
---Request that the game's map generator generate chunks at the given position for the given radius on this surface.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.request_to_generate_chunks)
---@param position MapPosition@Where to generate the new chunks.
---@param radius uint@The chunk radius from `position` to generate new chunks in.
request_to_generate_chunks=function(position,radius)end,
---Set generated status of a chunk. Useful when copying chunks.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_chunk_generated_status)
---@param position ChunkPosition@The chunk's position.
---@param status defines.chunk_generated_status@The chunk's new status.
set_chunk_generated_status=function(position,status)end,
---Set the hidden tile for the specified position. While during normal gameplay only [non-mineable](https://lua-api.factorio.com/latest/LuaTilePrototype.html#LuaTilePrototype.mineable_properties) tiles can become hidden, this method allows any kind of tile to be set as the hidden one.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_hidden_tile)
---@param position TilePosition@The tile position.
---@param tile string|LuaTilePrototype@The new hidden tile or `nil` to clear the hidden tile.
set_hidden_tile=function(position,tile)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@class LuaSurface.set_multi_command_param
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@field command Command
---Number of units to give the command to.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@field unit_count uint
---Force of the units this command is to be given to. If not specified, uses the enemy force.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@field force? ForceIdentification
---Radius to search for units. The search area is centered on the destination of the command.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@field unit_search_distance? uint
---Give a command to multiple units. This will automatically select suitable units for the task.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_multi_command)
---@param param LuaSurface.set_multi_command_param
---@return uint@Number of units actually sent. May be less than `count` if not enough units were available.
set_multi_command=function(param)end,
---Set tiles at specified locations. Can automatically correct the edges around modified tiles.
---
---Placing a [mineable](https://lua-api.factorio.com/latest/LuaTilePrototype.html#LuaTilePrototype.mineable_properties) tile on top of a non-mineable one will turn the latter into the [LuaTile::hidden_tile](https://lua-api.factorio.com/latest/LuaTile.html#LuaTile.hidden_tile) for that tile. Placing a mineable tile on a mineable one or a non-mineable tile on a non-mineable one will not modify the hidden tile. This restriction can however be circumvented by using [LuaSurface::set_hidden_tile](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_hidden_tile).
---
---**Note:** It is recommended to call this method once for all the tiles you want to change rather than calling it individually for every tile. As the tile correction is used after every step, calling it one by one could cause the tile correction logic to redo some of the changes. Also, many small API calls are generally more performance intensive than one big one.
---
---**Events:**
--- * May raise [script_raised_set_tiles](https://lua-api.factorio.com/latest/events.html#script_raised_set_tiles) instantly.
---Raised if the `raise_event` flag was set.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.set_tiles)
---@param tiles Tile[]
---@param correct_tiles boolean?@If `false`, the correction logic is not applied to the changed tiles. Defaults to `true`.
---@param remove_colliding_entities boolean|string?@`true`, `false`, or `abort_on_collision`. Defaults to `true`.
---@param remove_colliding_decoratives boolean?@`true` or `false`. Defaults to `true`.
---@param raise_event boolean?@`true` or `false`. Defaults to `false`.
set_tiles=function(tiles,correct_tiles,remove_colliding_entities,remove_colliding_decoratives,raise_event)end,
---Spill items on the ground centered at a given location.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.spill_item_stack)
---@param position MapPosition@Center of the spillage
---@param items ItemStackIdentification@Items to spill
---@param enable_looted boolean?@When true, each created item will be flagged with the [LuaEntity::to_be_looted](https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.to_be_looted) flag.
---@param force LuaForce|string?@When provided (and not `nil`) the items will be marked for deconstruction by this force.
---@param allow_belts boolean?@Whether items can be spilled onto belts. Defaults to `true`.
---@return LuaEntity[]@The created item-on-ground entities.
spill_item_stack=function(position,items,enable_looted,force,allow_belts)end,
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@class LuaSurface.upgrade_area_param
---The area to mark for upgrade.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@field area BoundingBox
---The force whose bots should perform the upgrade.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@field force ForceIdentification
---The player to set the last_user to if any.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@field player? PlayerIdentification
---If chunks covered by fog-of-war are skipped.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@field skip_fog_of_war? boolean
---The upgrade item to use.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@field item LuaItemStack
---Place an upgrade request.
---
---**Events:**
--- * May raise [on_marked_for_upgrade](https://lua-api.factorio.com/latest/events.html#on_marked_for_upgrade) instantly.
---Raised for every entity that has been successfully marked for upgrade.
---
---[View documentation](https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.upgrade_area)
---@param param LuaSurface.upgrade_area_param
upgrade_area=function(param)end,
}