get_entity_count(name) changed | → uint | Count entities of given type. [...] |
Count entities of given type. [...] | ||
disable_research() | Disable research for this force. | |
Disable research for this force. | ||
enable_research() | Enable research for this force. | |
Enable research for this force. | ||
disable_all_prototypes() | Disable all recipes and technologies. [...] | |
Disable all recipes and technologies. [...] | ||
enable_all_prototypes() | Enables all recipes and technologies. [...] | |
Enables all recipes and technologies. [...] | ||
reset_recipes() | Load the original version of all recipes from the prototypes. | |
Load the original version of all recipes from the prototypes. | ||
enable_all_recipes() | Unlock all recipes. | |
Unlock all recipes. | ||
enable_all_technologies() | Unlock all technologies. | |
Unlock all technologies. | ||
research_all_technologies(include_disabled_prototypes?) | Research all technologies. | |
Research all technologies. | ||
reset_technologies() | Load the original versions of technologies from prototypes. [...] | |
Load the original versions of technologies from prototypes. [...] | ||
reset() | Reset everything. [...] | |
Reset everything. [...] | ||
reset_technology_effects() | Reapplies all possible research effects, including unlocked recipes. [...] | |
Reapplies all possible research effects, including unlocked recipes. [...] | ||
chart(surface, area) | Chart a portion of the map. [...] | |
Chart a portion of the map. [...] | ||
clear_chart(surface?) | Erases chart data for this force. | |
Erases chart data for this force. | ||
rechart(surface?) | Force a rechart of the whole chart. | |
Force a rechart of the whole chart. | ||
chart_all(surface?) | Chart all generated chunks. | |
Chart all generated chunks. | ||
copy_from(force) new | Copies all of the given changeable values (except charts) from the given force to this force. | |
Copies all of the given changeable values (except charts) from the given force to this force. | ||
copy_chart(source_force, source_surface, destination_surface) new | Copies the given surface's chart from the given force to this force. | |
Copies the given surface's chart from the given force to this force. | ||
is_chunk_charted(surface, position) | → boolean | Has a chunk been charted? |
Has a chunk been charted? | ||
is_chunk_visible(surface, position) | → boolean | Is the given chunk currently charted and visible (not covered by fog of war) on the map. |
Is the given chunk currently charted and visible (not covered by fog of war) on the map. | ||
is_chunk_requested_for_charting(surface, position) | → boolean | Has a chunk been requested for charting? |
Has a chunk been requested for charting? | ||
cancel_charting(surface?) | Cancels pending chart requests for the given surface or all surfaces. | |
Cancels pending chart requests for the given surface or all surfaces. | ||
get_ammo_damage_modifier(ammo) | → double | |
set_ammo_damage_modifier(ammo, modifier) | ||
get_gun_speed_modifier(ammo) | → double | |
set_gun_speed_modifier(ammo, modifier) | ||
get_turret_attack_modifier(turret) changed | → double | |
set_turret_attack_modifier(turret, modifier) changed | ||
set_cease_fire(other, cease_fire) changed | Add | |
Add | ||
get_cease_fire(other) changed | → boolean | Is |
Is | ||
set_friend(other, friend) changed | Add | |
Add | ||
get_friend(other) changed | → boolean | Is |
Is | ||
is_pathfinder_busy() | → boolean | Is pathfinder busy? [...] |
Is pathfinder busy? [...] | ||
kill_all_units() | Kill all units and flush the pathfinder. | |
Kill all units and flush the pathfinder. | ||
find_logistic_network_by_position(position, surface) | → LuaLogisticNetwork? | |
set_spawn_position(position, surface) | ||
get_spawn_position(surface) | → MapPosition | |
set_surface_hidden(surface, hidden) new | ||
get_surface_hidden(surface) new | → boolean | |
unchart_chunk(position, surface) | ||
get_item_launched(item) changed | → uint | Gets the count of a given item launched in rockets. |
Gets the count of a given item launched in rockets. | ||
set_item_launched(item, count) changed | Sets the count of a given item launched in rockets. | |
Sets the count of a given item launched in rockets. | ||
print(message, print_settings?) changed | Print text to the chat console of all players on this force. [...] | |
Print text to the chat console of all players on this force. [...] | ||
add_chart_tag(surface, tag) | → LuaCustomChartTag? | Adds a custom chart tag to the given surface and returns the new tag or |
Adds a custom chart tag to the given surface and returns the new tag or | ||
find_chart_tags(surface, area?) | → array[LuaCustomChartTag] | Finds all custom chart tags within the given bounding box on the given surface. |
Finds all custom chart tags within the given bounding box on the given surface. | ||
reset_evolution() | Resets evolution for this force to zero. | |
Resets evolution for this force to zero. | ||
play_sound{path=…, position?=…, volume_modifier?=…, override_sound_type?=…} | Play a sound for every player in this force. [...] | |
Play a sound for every player in this force. [...] | ||
get_hand_crafting_disabled_for_recipe(recipe) changed | → boolean | Gets if the given recipe is explicitly disabled from being hand crafted. |
Gets if the given recipe is explicitly disabled from being hand crafted. | ||
set_hand_crafting_disabled_for_recipe(recipe, hand_crafting_disabled) changed | Sets if the given recipe can be hand-crafted. [...] | |
Sets if the given recipe can be hand-crafted. [...] | ||
add_research(technology) changed | → boolean | Add this technology to the back of the research queue if the queue is enabled. [...] |
Add this technology to the back of the research queue if the queue is enabled. [...] | ||
cancel_current_research() | Stop the research currently in progress. [...] | |
Stop the research currently in progress. [...] | ||
get_linked_inventory(prototype, link_id) changed | → LuaInventory? | Gets the linked inventory for the given prototype and link ID if it exists or |
Gets the linked inventory for the given prototype and link ID if it exists or | ||
is_friend(other) changed | → boolean | Is this force a friend? [...] |
Is this force a friend? [...] | ||
is_enemy(other) changed | → boolean | Is this force an enemy? [...] |
Is this force an enemy? [...] | ||
lock_space_location(name) new | Locks the planet to not be accessible to this force. | |
Locks the planet to not be accessible to this force. | ||
unlock_space_location(name) new | Unlocks the planet to be accessible to this force. | |
Unlocks the planet to be accessible to this force. | ||
is_space_location_unlocked(name) new | Is the specified planet unlocked for this force? | |
Is the specified planet unlocked for this force? | ||
lock_quality(quality) new | Locks the quality to not be accessible to this force. | |
Locks the quality to not be accessible to this force. | ||
unlock_quality(quality) new | Unlocks the quality to be accessible to this force. | |
Unlocks the quality to be accessible to this force. | ||
is_quality_unlocked(quality) new | Is the specified quality unlocked for this force? | |
Is the specified quality unlocked for this force? | ||
lock_space_platforms() new | Locks the space platforms, which disables the space platforms button | |
Locks the space platforms, which disables the space platforms button | ||
unlock_space_platforms() new | Unlocks the space platforms, which enables the space platforms button | |
Unlocks the space platforms, which enables the space platforms button | ||
is_space_platforms_unlocked() new | → boolean | Are the space platforms unlocked? [...] |
Are the space platforms unlocked? [...] | ||
create_space_platform{name?=…, planet=…, starter_pack=…} new | → LuaSpacePlatform? | Creates a new space platform on this force. |
Creates a new space platform on this force. | ||
get_evolution_factor(surface?) new | → double | Fetches the evolution factor of this force on the given surface. |
Fetches the evolution factor of this force on the given surface. | ||
get_evolution_factor_by_pollution(surface?) new | → double | Fetches the pollution part of the evolution factor of this force on the given surface. |
Fetches the pollution part of the evolution factor of this force on the given surface. | ||
get_evolution_factor_by_time(surface?) new | → double | Fetches the time part of the evolution factor of this force on the given surface. |
Fetches the time part of the evolution factor of this force on the given surface. | ||
get_evolution_factor_by_killing_spawners(surface?) new | → double | Fetches the spawner kill part of the evolution factor of this force on the given surface. |
Fetches the spawner kill part of the evolution factor of this force on the given surface. | ||
set_evolution_factor(factor, surface?) new | Sets the evolution factor of this force on the given surface. | |
Sets the evolution factor of this force on the given surface. | ||
set_evolution_factor_by_pollution(factor, surface?) new | Sets the pollution part of the evolution factor of this force on the given surface. | |
Sets the pollution part of the evolution factor of this force on the given surface. | ||
set_evolution_factor_by_time(factor, surface?) new | Sets the time part of the evolution factor of this force on the given surface. | |
Sets the time part of the evolution factor of this force on the given surface. | ||
set_evolution_factor_by_killing_spawners(factor, surface?) new | Sets the spawner kill part of the evolution factor of this force on the given surface. | |
Sets the spawner kill part of the evolution factor of this force on the given surface. | ||
get_item_production_statistics(surface) new | → LuaFlowStatistics | The item production statistics for this force for the given surface. |
The item production statistics for this force for the given surface. | ||
get_fluid_production_statistics(surface) new | → LuaFlowStatistics | The fluid production statistics for this force for the given surface. |
The fluid production statistics for this force for the given surface. | ||
get_kill_count_statistics(surface) new | → LuaFlowStatistics | The kill counter statistics for this force for the given surface. |
The kill counter statistics for this force for the given surface. | ||
get_entity_build_count_statistics(surface) new | → LuaFlowStatistics | The entity build statistics for this force (built and mined) for the given surface. |
The entity build statistics for this force (built and mined) for the given surface. | ||
name | :: R string | Name of the force. |
Name of the force. | ||
technologies | :: R LuaCustomTable[string → LuaTechnology] | Technologies owned by this force, indexed by |
Technologies owned by this force, indexed by | ||
recipes | :: R LuaCustomTable[string → LuaRecipe] | Recipes available to this force, indexed by |
Recipes available to this force, indexed by | ||
manual_mining_speed_modifier | :: RW double | Multiplier of the manual mining speed. [...] |
Multiplier of the manual mining speed. [...] | ||
manual_crafting_speed_modifier | :: RW double | Multiplier of the manual crafting speed. [...] |
Multiplier of the manual crafting speed. [...] | ||
laboratory_speed_modifier | :: RW double | |
laboratory_productivity_bonus | :: RW double | |
worker_robots_speed_modifier | :: RW double | |
worker_robots_battery_modifier | :: RW double | |
worker_robots_storage_bonus | :: RW double | |
current_research | :: R LuaTechnology? | The currently ongoing technology research, if any. |
The currently ongoing technology research, if any. | ||
research_progress | :: RW double | Progress of current research, as a number in range |
Progress of current research, as a number in range | ||
previous_research | :: RW LuaTechnology? | The previous research, if any. |
The previous research, if any. | ||
inserter_stack_size_bonus | :: RW double | The inserter stack size bonus for non stack inserters |
The inserter stack size bonus for non stack inserters | ||
bulk_inserter_capacity_bonus new | :: RW uint | Number of items that can be transferred by bulk inserters. [...] |
Number of items that can be transferred by bulk inserters. [...] | ||
belt_stack_size_bonus new | :: RW uint | Belt stack size bonus. |
Belt stack size bonus. | ||
character_trash_slot_count | :: RW double | Number of character trash slots. |
Number of character trash slots. | ||
maximum_following_robot_count | :: RW uint | Maximum number of follower robots. |
Maximum number of follower robots. | ||
following_robots_lifetime_modifier | :: RW double | Additional lifetime for following robots. |
Additional lifetime for following robots. | ||
create_ghost_on_entity_death new | :: RW boolean | When an entity dies, a ghost will be placed for automatic reconstruction. |
When an entity dies, a ghost will be placed for automatic reconstruction. | ||
players | :: R array[LuaPlayer] | Players belonging to this force. |
Players belonging to this force. | ||
ai_controllable | :: RW boolean | Enables some higher-level AI behaviour for this force. [...] |
Enables some higher-level AI behaviour for this force. [...] | ||
logistic_networks | :: R dictionary[string → array[LuaLogisticNetwork]] | List of logistic networks, grouped by surface. |
List of logistic networks, grouped by surface. | ||
character_running_speed_modifier | :: RW double | Modifies the running speed of all characters in this force by the given value as a percentage. [...] |
Modifies the running speed of all characters in this force by the given value as a percentage. [...] | ||
artillery_range_modifier | :: RW double | |
beacon_distribution_modifier new | :: RW double | |
character_build_distance_bonus | :: RW uint | |
character_item_drop_distance_bonus | :: RW uint | |
character_reach_distance_bonus | :: RW uint | |
character_resource_reach_distance_bonus | :: RW double | |
character_item_pickup_distance_bonus | :: RW double | |
character_loot_pickup_distance_bonus | :: RW double | |
character_inventory_slots_bonus | :: RW uint | The number of additional inventory slots the character main inventory has. |
The number of additional inventory slots the character main inventory has. | ||
deconstruction_time_to_live | :: RW uint | The time, in ticks, before a deconstruction order is removed. |
The time, in ticks, before a deconstruction order is removed. | ||
character_health_bonus | :: RW double | |
max_successful_attempts_per_tick_per_construction_queue | :: RW uint | |
max_failed_attempts_per_tick_per_construction_queue | :: RW uint | |
character_logistic_requests | :: RW boolean |
|
| ||
rockets_launched | :: RW uint | The number of rockets launched. |
The number of rockets launched. | ||
items_launched changed | :: R array[ItemCountWithQuality] | All of the items that have been launched in rockets. |
All of the items that have been launched in rockets. | ||
connected_players | :: R array[LuaPlayer] | The connected players belonging to this force. [...] |
The connected players belonging to this force. [...] | ||
mining_drill_productivity_bonus | :: RW double | |
train_braking_force_bonus | :: RW double | |
friendly_fire | :: RW boolean | If friendly fire is enabled for this force. |
If friendly fire is enabled for this force. | ||
share_chart | :: RW boolean | If sharing chart data is enabled for this force. |
If sharing chart data is enabled for this force. | ||
index | :: R uint | This force's index in LuaGameScript::forces (unique ID). [...] |
This force's index in LuaGameScript::forces (unique ID). [...] | ||
research_queue changed | :: RW array[TechnologyID] | The research queue of this force. [...] |
The research queue of this force. [...] | ||
research_enabled | :: R boolean | Whether research is enabled for this force, see LuaForce::enable_research and LuaForce::disable_research. |
Whether research is enabled for this force, see LuaForce::enable_research and LuaForce::disable_research. | ||
platforms new | :: R dictionary[uint → LuaSpacePlatform] | The space platforms that belong to this force mapped by their index value. [...] |
The space platforms that belong to this force mapped by their index value. [...] | ||
custom_color | :: RW Color? | Custom color for this force. [...] |
Custom color for this force. [...] | ||
color | :: R Color | Effective color of this force. |
Effective color of this force. | ||
valid | :: R boolean | Is this object valid? [...] |
Is this object valid? [...] | ||
object_name | :: R string | The class name of this object. [...] |
The class name of this object. [...] |
include_disabled_prototypes | :: boolean? | Whether technologies that are explicitly disabled in the prototype should also be researched. Defaults to |
Whether technologies that are explicitly disabled in the prototype should also be researched. Defaults to |
on_research_finished instantly |
surface | :: SurfaceIdentification | |
area | :: BoundingBox | The area on the given surface to chart. |
The area on the given surface to chart. |
-- Charts a 2048x2048 rectangle centered around the origin.
game.player.force.chart(game.player.surface, {{x = -1024, y = -1024}, {x = 1024, y = 1024}})
surface | :: SurfaceIdentification? | Which surface to erase chart data for or if not provided all surfaces charts are erased. |
Which surface to erase chart data for or if not provided all surfaces charts are erased. |
surface | :: SurfaceIdentification? | Which surface to rechart or all if not given. |
Which surface to rechart or all if not given. |
surface | :: SurfaceIdentification? | Which surface to chart or all if not given. |
Which surface to chart or all if not given. |
source_force | :: ForceID | The force to copy from |
The force to copy from | ||
source_surface | :: SurfaceIdentification | The surface to copy from. |
The surface to copy from. | ||
destination_surface | :: SurfaceIdentification | The surface to copy to. |
The surface to copy to. |
surface | :: SurfaceIdentification | |
position | :: ChunkPosition | Position of the chunk. |
Position of the chunk. |
surface | :: SurfaceIdentification | |
position | :: ChunkPosition | Position of the chunk. |
Position of the chunk. |
position | :: MapPosition | Position to find a network for |
Position to find a network for | ||
surface | :: SurfaceIdentification | Surface to search on |
Surface to search on |
→ LuaLogisticNetwork? | The found network or |
position | :: MapPosition | The new position on the given surface. |
The new position on the given surface. | ||
surface | :: SurfaceIdentification | Surface to set the spawn position for. |
Surface to set the spawn position for. |
position | :: ChunkPosition | The chunk position to unchart. |
The chunk position to unchart. | ||
surface | :: SurfaceIdentification | Surface to unchart on. |
Surface to unchart on. |
surface | :: SurfaceIdentification | Which surface to add the tag to. |
Which surface to add the tag to. | ||
tag | :: ChartTagSpec | The tag to add. |
The tag to add. |
on_chart_tag_added? instantly | Raised if the chart tag was successfully added. |
path | :: SoundPath | The sound to play. |
The sound to play. | ||
position | :: MapPosition? | Where the sound should be played. If not given, it's played at the current position of each player. |
Where the sound should be played. If not given, it's played at the current position of each player. | ||
volume_modifier | :: double? | The volume of the sound to play. Must be between 0 and 1 inclusive. |
The volume of the sound to play. Must be between 0 and 1 inclusive. | ||
override_sound_type | :: SoundType? | The volume mixer to play the sound through. Defaults to the default mixer for the given sound type. |
The volume mixer to play the sound through. Defaults to the default mixer for the given sound type. |
technology | :: TechnologyID |
→ boolean | Whether the technology was successfully added. |
on_research_started? instantly | Raised if the technology was successfully added. |
name | :: string? | The platform name. If not provided, a random name will be used. |
The platform name. If not provided, a random name will be used. | ||
planet | :: SpaceLocationID | The planet that the platform will orbit. |
The planet that the platform will orbit. | ||
starter_pack | :: ItemID | The starter pack required to build the platform. |
The starter pack required to build the platform. |
factor | :: double | |
surface | :: SurfaceIdentification? | Defaults to "nauvis". |
Defaults to "nauvis". |
factor | :: double | |
surface | :: SurfaceIdentification? | Defaults to "nauvis". |
Defaults to "nauvis". |
factor | :: double | |
surface | :: SurfaceIdentification? | Defaults to "nauvis". |
Defaults to "nauvis". |
factor | :: double | |
surface | :: SurfaceIdentification? | Defaults to "nauvis". |
Defaults to "nauvis". |
game.player.print(game.player.force.name) -- => "player"
-- Researches the technology for the player's force
game.player.force.technologies["steel-processing"].researched = true
-- Prints the category of the given recipe
game.player.print(game.player.force.recipes["transport-belt"].category)
-- Double the player's mining speed
game.player.force.manual_mining_speed_modifier = 1
-- Double the player's crafting speed
game.player.force.manual_crafting_speed_modifier = 1