-
Notifications
You must be signed in to change notification settings - Fork 4
/
Scripting_dump.txt
78 lines (75 loc) · 7.52 KB
/
Scripting_dump.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Scripting 0.12.0
Changed all the identifiers/methods/events/parameters. Underscores are used as word delimiter (findentities -> find_entities).
Changed glob to global.
New object LuaSurface, accessible from player/entity as read property surface.
Some commands moved from LuaGame to LuaSurface: get_pollution, can_place_entity, find_entity, find_entities, find_entities_filtered,
find_non_colliding_position, find_enemy_units, find_nearest_enemy, set_multi_command, create_entity, create_unit_group, build_enemy_base,
get_tile, get_tileproperties, set_tiles, pollute, get_chunks, is_chunk_generated
Added LuaGame::local_player console command: when entered through the console it will reference the local player doing the console command. Only works when run through the console.
Added LuaFluidPrototype - similar to LuaItemPrototype but for fluids.
math.random can now accept negative values for ranges eg x + math.random(-10, 10)
Added LuaRecipe::hidden and energy read.
New object LuaGroup, accessible from LuaEntityPrototype as read property group/subgroup.
LuaGroup contains: name, type, inventory_order, group, subgroups
Added several new options to LuaEntityPrototype: mineable_properties, items_to_place_this, collision_box, selection_box, order,
group, subgroup, healing_per_tick, emissions_per_tick, corpses, selectable_in_game, weight, resistances, fast_replaceable_group,
loot, repair_speed_modifier
LuaItemPrototype::group now returns the new LuaGroup object.
Added LuaEntity::is_crafting() - returns true/false if the assembling machine or furnace is currently crafting a recipe.
Added LuaEntity::crafting_progress/bonus_progress - a percent of 1: the current crafting progress or bonus progress.
Added the ability to compare LuaObjects using "==" as in: "if game.player == game.players[1]" for all LuaObjects.
Removed all LuaObject::equals(): the == operator can be used in its place.
Added new blend modes for sprites using "blend_mode" property. Possible values: "normal", "additive", "multiplicative".
Added on_player_driving_changed_state event - passes the player_index who's driving state changed.
Added LuaEntity::belt_to_ground_type - returns the type "input"/"output" of the transport-belt-to-ground.
Added several methods for manipulating gates: is_opened, is_opening, is_closed, is_closing, request_to_open, request_to_close.
Changed LuaEntity::neighbours:
For electric poles: the wire connections: {copper={}, red={}, green={}}
For transport-belt-to-ground: the input/output entity it's connected to (or none)
For entities with fluid - the entities the fluid connections connect to indexed by the fluid connection
#entity.fluidbox can now be read from any entity and will return the number of fluidboxes the entity has (0 for non-fluid handling entities).
Added the ability to specify map colors for all entities: map_color, friendly_map_color, and enemy_map_color
Added the ability to disable drawing the station name for train-stop type entities: chart_name = "false" in the prototype.
LuaEntity::backer_name can now be read/written for all entities that support backer names (furnace, assembling machine, lab, locomotive, radar, roboport, trainstop).
LuaEntity::recipe can now be set to nil to remove the recipe from an assembling machine.
Added LuaItemPrototype default_request_amount, resistances, item_to_clear.
Added LuaChart::chart_all (charts all the generated parts of the map).
Expanded LuaEntity::get_item_count and LuaEntity::clear to work with all transport belt entities.
New object LuaTransportLine, accessible from entity as read method get_transport_line(index) - an interface to the items on transport belts.
Added LuaSurface::count_entities_filtered - the same as find_entities_filtered but simply returns a count. The benefits being: it's much faster
than find_entities_filtered when the entity references aren't desired.
Added LuaForce::enable_research() - enables research for the force if it was disabled.
Added LuaSurface::spill_item_stack() - takes a item_stack and position and drops the items on the ground item bomb style.
Changed LuaEntity::stack, LuaEntity::held_stack and LuaPlayer::cursor_stack to return LuaItemStack objects.
Changed LuaItemStack to allow reading any inventory slot even when the item in the slot is invalid. LuaItemStack::valid_for_read should be used
before accessing the normal properties/methods for a given LuaItemStack.
Removed LuaEntity::clear_circuit_condition() - LuaEntity::set_circuit_condition(index, nil) can be used instead.
Added "force" option to LuaSurface::find_entities_filtered/count_entities_filtered.
ItemStack counts can be excluded and defaults to 1, ItemStacks can be strings and default to a full stack.
Added LuaItemStack::count write support.
Added LuaItemStack::can_set_stack(), set_stack(), clear() - write support to a specific item stack.
Removed LuaEntity::stack, held_stack write support - LuaItemStack::set_stack() can be used.
Removed LuaPlayer::cursor_stack write support - LuaItemStack::set_stack() can be used.
Added LuaTrain::cargo_wagons read - returns only the cargo wagons for the given train.
Added LuaEntity::remove_market_item - takes an index to remove from a Market entity offer list.
Added LuaEntity::get_market_items - returns a table of offers the Market entity offers.
Added LuaForce::research_progress read/write - a percent of 1 - the current research progress (0 if no research).
Added LuaEntityPrototype::turret_range read - the range of a given turret entity prototype.
Added player_index to the on_put_item event.
Added ghosts from manual building and blueprints to the on_built_entity event.
Added LuaPlayer::enable_flashlight() - counterpart to disable_flashlight().
Replaced LuaGameScript::kill_all_enemies() by LuaForce::kill_all_units().
Changed on_researched events to return the relaed LuaTechnology object.
Added LuaTechnology::force read - the LuaForce the technology belongs to.
Added LuaGame::create_surface - takes a string name and optionally a table of map gen settings and creates a new surface.
Changed LuaPlayer::teleport to allow optionally a surface name, index or object to teleport the player to. The surface must exist.
Added LuaSurface::request_to_generate_chunks - takes a position and radius and requests to generate those chunks - will not generate chunks outside the map bounds.
Added LuaSurface::map_gen_settings - the current map gen settings for the surface.
Added LuaGame::server_save - in a multiplayer game with a server, this will make the server save the game. Only works with a headless server, i.e. one launched through the --start-server option.
Added LuaGuiElement::parent read - the parent of the LuaGuiElement if any else nil.
Added LuaPlayer::index read - the numeric index of the LuaPlayer object.
Scripting 0.12.1
LuaSurface::set_multi_command now takes an optional third argument specifying the force to send the command to. Default is the enemy force
Default mods are always enabled if mod-list.json is lost (even when enable new mods option is disabled).
LuaSurface can be invalid when read from LuaPlayer and Player entity if the player is disconnected from the game (MP disconnect) - use LuaSurface.valid to check. Note: LuaSurface currently never switches between valid and not valid so the check only has to be done when it's first read from the LuaPlayer.
Changed default maximum range of projectiles from 10^308 to 1000.