[1.1.60 ] Upcoming breaking mod changes

Place to post guides, observations, things related to modding that are not mods themselves.
Locked
Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

[1.1.60 ] Upcoming breaking mod changes

Post by Bilka »

You can subscribe to this topic to get notified of new posts.

Upcoming changes:
  • 1.1.60 - 1.1.60 will require that roboport prototype recharge_minimum be larger or equal to energy_usage otherwise during low power the roboport will toggle on and off every tick eating a ton of CPU time: viewtopic.php?p=569094#p569094
Past changes:
  • 1.1.50 - We will remove ReactorPrototype::neighbour_collision_increase and LuaEntityPrototype::neighbour_collision_increase. Reactor entity won't extend its bounding box towards connected neighbour anymore.
  • 1.1.25 - defines.flow_precision_index.one_second removed, defines.flow_precision_index.five_seconds added
  • 1.1.0 - It's a major version, factorio_version in info.json needs to change.
  • 1.1.0 - Renames and more, see viewtopic.php?p=518171#p518171
  • 1.1.0 - Removal of legacy items/entities, see viewtopic.php?p=518834#p518834
  • 0.18.28 - No more lua functions in script data
  • 0.18.27 - Big update to GUI styles. With it come some big changes to style.lua, leading to badly looking mod guis or mods unable to load due to referencing deleted styles.
  • 0.18.27 - script.raise_event rework.
  • 0.18.22 - Removed migration for CustomInputPrototype consuming types that were removed in 0.15.24.
  • 0.18.19+ - Disallowing empty layers tables in sprite/animation definitions.
  • 0.18.0 - It's a major version, factorio_version in info.json needs to change.
  • 0.18.0 - Removed the "particle" prototype type. Added the "optimized-particle" prototype type. (Friday Facts #322 - New Particle system)
  • 0.18.0 - Color changes - sprites of mods may need to be adjusted, see Friday Facts #320 - Color correction .
  • 0.17.63 - Fluid connection overlap checks.
  • 0.17.56 - Removed label style want_ellipsis as it will be used automatically everywhere as with button.
  • 0.17.51 - Better resource_autoplace_settings, removed get_next_resource_index()
  • 0.17.46 - Icon size of base game icon changes, make sure to set icon_size on your prototypes!
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Currently nothing] Upcoming breaking mod API changes

Post by posila »

Soon we will merge and release the first batch of the new icons, if you add new prototypes by copying base ones (e.g. using table.deepcopy), make sure you set correct icon_size for your icons: 71586
posila wrote:
Wed Jun 05, 2019 11:08 am
Soon, we will merge and release the first batch of the new icons, which will have base size 64x64 px and mipmaps.

If you are adding new prototypes by copying a base prototype and changing some values on it (for example by using table.deepcopy; which is probably the best way to add a new prototype if you don't want to make completely custom graphics), make sure you also set icon_size to size of your icon (don't rely on your icon_size being already set in the base mod), otherwise your mod won't load anymore after we change our icon sizes.

Ideally, you should clear all possible icon definitions on the copy (icon = nil, icon_size = nil, icons = nil) and define your own icon from scratch

So far we have ran into PowerCubes not being loadable with the first batch of the new icons (charger-station is not overwriting icon_size)

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [Nothing] Upcoming breaking mod API changes

Post by Bilka »

With 0.17.51, resource_autoplace_settings has been made public (require('resource-autoplace').resource_autoplace_settings) and the API improved. Note the file location and name change, from data/base/prototype/entity/demo-resource-autoplace.lua → data/core/lualib/resource-autoplace.lua.
Furthermore, its functionality has slightly changed: It will automatically allocate a unique resource index for each patch_set_name. 'patch_set_name' and 'autoplace_control_name' can be independently specified. 'seed1' can be specified as a parameter. Due to the index being calculated automatically, the global function 'get_next_resource_index' is obsolete and has been deleted.

What this means for your resource generation: When you were previously using resource_autoplace_settings(params) and setting params.resource_index to get_next_resource_index(), you should now simply remove this line, the index will be set automatically and the patches won't overlap with anything.

As a side note, rail categories are removed in 0.17.51. This should not break any mods because they could not be changed anyway.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Nothing] Upcoming breaking mod API changes

Post by Klonan »

Version: 0.17.56:
Modding:
- Removed label style want_ellipsis as it will be used automatically everywhere as with button.
Any mod setting this property in LuaStyle through runtime scripting will now error.

As a side note, in 0.17.56 all rail bounding boxes are now hardcoded/not moddable. This is to avoid unpexected collision/rail block merging behaviour. This will not lead to errors, but changing the bounding boxes will simply no longer do anything.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Nothing] Upcoming breaking mod API changes

Post by Klonan »

017.63 Fluid overlap checks,

The game will check prototypes on startup for any overlapping pipe connections,
If there are any, it will show an error:

Image

This is to be released tomorrow, Tuesday 6th August

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.18] Upcoming breaking mod changes

Post by Klonan »

0.18.2

We are merging in some more sound changes, so I took the opportunity to cleanup the sound definitions and where they live

So if you were copy pasting base game things, they won't work anymore, such as:

Code: Select all

walking_sound = make_biter_walk_sounds(0.4)- > walking_sound = sounds.biter_walk(0.4),

sound =  make_biter_roars_big(0.4) -> sound =  sounds.biter_roars_big(0.4),

vehicle_impact_sound = generic_impact_sound(), -> vehicle_impact_sound = sounds.generic_impact,
You can require the new sound file with:

Code: Select all

local sounds = require("__base__.prototypes.entity.demo-sounds")
You have been warned

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

[0.18.19+] Upcoming breaking mod changes

Post by posila »

It is currently possible to define sprite or animation with layers set to empty table. This effectivelly makes animation to not load, while circumventing checks that mandatory animations are defined. This causes the game to crash when it tries to draw such animation or sprite.

From 0.18.19, sprite and animation definitions with empty layers will add warning (prefixed with "DATA WARNING" so you can search for it) to logs.

From 0.18.20, the game will fail to load with an error, even if for optional sprites. If sprite/animation is optional, just set it to nil, don't make it a table of empty layers.

Code: Select all

-- this won't be allowed
optional_picture = { layers = {} } 

-- instead of that do
optional_picture = nil
For mandatory definitions, you can use empty.png from core game.

Code: Select all

picture = { filename = "__core__/graphics/empty.png", size = 1 }
You can discuss here: 83721

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.18.19+] Upcoming breaking mod changes

Post by Klonan »

We're cleaning up an old mod hotkey setting:

Code: Select all

- Removed migration for CustomInputPrototype consuming types that were removed in 0.15.24.
So any mods using the old 'script-only' type should be updated.
factorio-run_2020-04-29_20-12-33.png
factorio-run_2020-04-29_20-12-33.png (18.71 KiB) Viewed 22866 times
In short

Consuming type "all" -> "game-only"
Type "script-only" -> "none"

More info: https://wiki.factorio.com/Prototype/CustomInput
https://wiki.factorio.com/Types/ConsumingType

Twinsen
Factorio Staff
Factorio Staff
Posts: 1329
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [0.18.19+] Upcoming breaking mod changes

Post by Twinsen »

Next week, with the release of 0.18.27 there will be a big update to GUI styles.
With it come some big changes to style.lua, leading to badly looking mod guis or mods unable to load due to referencing deleted styles.
To help out, I will list what we found to be the common mod breaking changes with some recommendations and will also include a very brief style guide to help with improving your mod styles to make them look closer to the base game.
Mod breaking changes:
  • __core__/graphics/clear.png was removed, along with it's utility sprite. Use cancel.png, no-recipe.png or your own replacement
  • orangebuttongraphcialset() bluebuttongraphcialset(...) were removed from style.lua. Use the modern version of those sprites or include the styles manually in your mod.
  • green_icon_button style was removed. Use tool_button_green instead
  • red_icon_button style was removed. Use tool_button_red instead
  • selected_logistic_slot_button was removed. Use slot_button. For selected version use it's toggled state.
  • slot_button has changed it's style(see below). It is recommended to use the new style in your mod. The old style is available as compact_slot, for specific use cases.
  • filter_slot_button was removed. Use the new slot_button instead.
  • close_button was removed. Use frame_action_button instead.
  • search_button was removed. Use frame_action_button or tool_button depending on where it's placed
Quick style guide:
Windows:
Windows are created inside using standalone_inner_frame_in_outer_frame. For windows that contain multiple sub-windows (e.g. most windows that hold a character inventory) outer_frame is used as the outer frame and inner_frame_in_outer_frame is used for each internal window.

The current UI style dictates that almost all windows contain an inner frame. For that use inside_shallow_frame_with_padding, or inside_shallow_frame if you wish to manage the paddings yourself.
gui-style-inner-frame.PNG
gui-style-inner-frame.PNG (14.26 KiB) Viewed 22097 times
Slots and slot buttons:

The most used slots are as follows:
  • slot is a slot(inventory slot). It's meant to hold items in an inventory, armor slots, ammo slots, etc. They hold real items.
    gui-style-slot.PNG
    gui-style-slot.PNG (9.62 KiB) Viewed 22097 times
  • slot_button is a round slot sized button intended to hold items/signals/fluids. The held items are not real. It's meant for setting up filters, requests, etc. They are buttons and thus should be interactive and clickable. For purely informative non-interactive slots, use transparent_slot
    gui-style-slot-button.PNG
    gui-style-slot-button.PNG (5.85 KiB) Viewed 22097 times
  • slot_sized_button is a normal button in the size of a slot. They are intended for gui actions such as changing recipe.
    gui-style-slot-sized-button.PNG
    gui-style-slot-sized-button.PNG (3.29 KiB) Viewed 22097 times
  • slot_table is the table that should be used to hold these types of slots or slot buttons.
All slots and slot buttons are 40x40 with an internal 2px margin defined by the sprite.
The old legacy slots should be avoided, but are still in use because they are compact (36x36). They are called "compact", so the equivalent style names are:
  • compact_slot (can be used as a slot button)
  • compact_slot_sized_button
  • compact_slot_table
Other:
  • transparent_slot is a compact(36x36) slot that draws the items directly(with a shadow). It's intended for showing items that are non-interactive (not slots, not clickable buttons), e.g. in tooltips or in lists.
    gui-style-transparent-slot.PNG
    gui-style-transparent-slot.PNG (25.07 KiB) Viewed 22097 times
Because of their graphics, slot button lists can't be placed directly inside the inside_shallow_frame. Slot buttons need to be placed in a slot_button_deep_frame, which is then placed inside the inside_shallow_frame
gui-style-slot-frame.PNG
gui-style-slot-frame.PNG (6.43 KiB) Viewed 22097 times
For single slot buttons, slot_button_in_shallow_frame should be used.
gui-style-slot-button-in-shallow-frame.PNG
gui-style-slot-button-in-shallow-frame.PNG (1.72 KiB) Viewed 22097 times

Other:
  • tool_button is a small buttons that should be used in subheaders, or near textboxes
    gui-style-tool-button.png
    gui-style-tool-button.png (13.07 KiB) Viewed 22097 times
  • frame_action_button are the buttons placed in the header of the frame, such as close or search.
    gui-style-frame-action-button.PNG
    gui-style-frame-action-button.PNG (9.65 KiB) Viewed 22097 times
  • heading_2_label should be used for titles inside windows, heading_3_label for titles inside those sections.
    gui-style-heading-2-example.PNG
    gui-style-heading-2-example.PNG (5.93 KiB) Viewed 22097 times
  • most of the styles mentioned here have versions with alternative colors, for example tool_button_red tool_button_green red_slot yellow_slot blue_slot yellow_slot_button red_slot_button compact_red_slot

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.18.27] Upcoming breaking mod changes

Post by Bilka »

Together with the big update to the GUI styles, we are reworking script.raise_event.

script.raise_event will be restricted to raising events generated with script.generate_event_name and raising the following built-in events:
  • on_console_chat
  • on_player_crafted_item
  • on_player_fast_transferred
  • on_biter_base_built
  • on_market_item_purchased
  • script_raised_built
  • script_raised_destroy
  • script_raised_revive
  • script_raised_set_tiles
No other built-in events will be raisable directly.

All the raisable built-in events will have the data that you pass to them validated so that mandatory fields must be present and fields must have the correct types. Failing to provide correct and complete event data will result in an error for the mod raising the event.
Extra data that is provided in the event data table e.g. non_existant_event_field = "foo" is not passed along with game events, however the 4 script_raised_* events will pass it along.

Event filtering now also works for events raised by mods, this was the major point of these changes.

More info can be found in the discussion thread about these changes: viewtopic.php?p=495226#p495226
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2228
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [0.18.28] Upcoming breaking mod changes

Post by boskid »

With 0.18.28 we are going to include some changes related to saving and loading of lua script data that reduces save and load times a lot by means of native serialisation (not using serpent.dump). This however comes with a cost of not supporting (already unsupported) lua functions in script data (global) at all. Mods and saves that are storing functions in script data will be required to have a migration that removes them from script data.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [1.1.0] Upcoming breaking mod changes

Post by Bilka »

These are the mod breaking changes currently expected to be in 1.1.0, taken from the changelog:
  • Renamed clean-cursor to clear-cursor on all the relevant places (locale, key-binding name)
  • Removed 'mineable wreckage' entity. (89381)
  • Data stage:
  • Added new item flag "spawnable", every item has to have that flag to be creatable through the shortcuts directly. (87777)
  • Renamed create-blueprint-item shortcut action to spawn-item and item_to_create to item_to_spawn.
  • Changed collision mask 'layer-11' to 'rail-layer'. Increased the total number of collision masks from 14 to 55.
  • Removed rocket silo rocket prototype "result_items" because it did nothing.
  • Unified laser and beam related ammo categories to just "laser" and "beam".
  • Renamed technology "laser-turret-speed"->"laser-shooting-speed", it now affects both robots and laser turrets.
  • Renamed technology "turrets"->"gun-turret", "laser-turrets"->"laser-turret", "combat-robotics"->"defender", "combat-robotics-2"->"distractor", "combat-robotics-3"->"destroyer", "tanks"->"tank", "stone-walls"->"stone-wall", "gates"->"gate"
  • Changed internal spidertron specification in a way to make torso and leg scaling much easier.
  • Renamed "source_effects" property of line trigger item to "range_effects", due to ambiguity with source_effects on action delivery. (90591)
  • Control stage:
  • Renamed the clean_cursor method to clear_cursor.
  • Renamed on_put_item event to on_pre_build.
  • Changed 'control_behavior.parameters.parameters' to just 'control_behavior.parameters' for LuaDeciderCombinatorControlBehavior, LuaConstantCombinatorControlBehavior, and LuaArithmeticCombinatorControlBehavior.
  • Removed LuaEntityPrototype::production read. (Added LuaEntityPrototype::max_energy_production read.)
Note: Mods may break/misbehave due to new features (which aren't listed above). For example, if a mod removes the long handed inserter from the game, the new long handed inserter tips and tricks simulation will misbehave.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [1.1.0] Upcoming breaking mod changes

Post by Bilka »

The following legacy prototypes will be removed in 1.1.0:
  • Removed 'small-plane', 'computer', 'railgun-dart' and 'railgun' items.
  • Removed 'bait-chest', 'crash-site-assembling-machine-1-broken', 'crash-site-assembling-machine-1-repaired', 'crash-site-assembling-machine-2-broken', 'crash-site-assembling-machine-2-repaired', 'crash-site-electric-pole', 'crash-site-generator', 'crash-site-lab-broken' and 'crash-site-lab-repaired' entities.
  • Removed 'mineable wreckage' entity. (already mentioned in the previous post)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [1.1.0] Upcoming breaking mod changes

Post by Bilka »

More mod breaking changes that are coming in 1.1.0:
  • Base game technology icons now use 4 mipmaps and icon size 256 instead of icon size 128 and no mipmaps.
  • The data stage files are no longer divided into demo and non-demo. This means the files with the demo- prefix were either merged into files without the prefix and/or the prefix was removed from the file name.
  • The data stage global variable "resource_autoplace" is now local. It can still be accessed via the require: local resource_autoplace = require("resource-autoplace")
  • mod-gui.lua no longer defines 'mod_gui' as a global variable, it is now only returned when required: local mod_gui = require("mod-gui")
  • Renamed logistic-container prototype property 'logistic_slots_count' to 'max_logistic_slots'
  • Removed fluid turret prototype property 'indicator_light'. (Added fluid turret prototype properties 'enough_fuel_indicator_light' and 'not_enough_fuel_indicator_light'.)
  • Changed collision mask 'layer-12' to 'transport-belt-layer'.
  • Constrained collision_box and collision_mask of transport belt connectable prototypes so it is not possible to build the entities in overlapping positions. (82294)
  • Removed the "auto-character-logistic-trash-slots" modifier and forceDataValues. The auto trash are now always enabled when any trash slots present.
  • Removed LuaBootstrap::is_game_in_debug_mode read.
  • Rail signals have to have collision mask that collides with any other rail signal. By default rail signals now include `rail-layer` to achieve that. (82623)
  • Rail signals collision box is hardcoded. (82623)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2228
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.0] Upcoming breaking mod changes

Post by boskid »

In 1.1.6 the `defines.build_check_type.ghost_place` will be removed as there will be 3 new values added:
- defines.build_check_type.manual_ghost
- defines.build_check_type.script_ghost
- defines.build_check_type.blueprint_ghost

Rseding91
Factorio Staff
Factorio Staff
Posts: 13176
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.6] Upcoming breaking mod changes

Post by Rseding91 »

In 1.1.25 I changed defines.flow_precision_index.one_second to five_seconds since that's what it actually is.
If you want to get ahold of me I'm almost always on Discord.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [None] Upcoming breaking mod changes

Post by posila »

In 1.1.50 we will remove ReactorPrototype::neighbour_collision_increase and LuaEntityPrototype::neighbour_collision_increase. Reactor entity won't extend its bounding box towards connected neighbour anymore.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13176
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.50] Upcoming breaking mod changes

Post by Rseding91 »

1.1.60 will require that roboport prototype recharge_minimum be larger or equal to energy_usage otherwise during low power the roboport will toggle on and off every tick eating a ton of CPU time: viewtopic.php?p=569094#p569094
If you want to get ahold of me I'm almost always on Discord.

Locked

Return to “Modding discussion”