[2.0.60] Incorrect handling of Selector combinator parameters table

robot256
Smart Inserter
Smart Inserter
Posts: 1269
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[2.0.60] Incorrect handling of Selector combinator parameters table

Post by robot256 »

SelectorCombinatorParameters states that quality_source_static can be specified as type QualityID, which can be either LuaQualityPrototype or the string name of a quality prototype. However, both read and write of quality_source_static are done with a table in the form {name=<quality name>}. This behavior is inconsistent with how other quality specifications are treated, so I believe the behavior should be changed to match the documentation.

Reproduction:

1. Paste the following blueprint, which is a selector combinator configured to transfer "rare" quality onto "epic U-238".

2. Move the cursor over the selector combinator and run the following console command.

Code: Select all

/c game.print(serpent.block(game.player.selected.get_control_behavior().parameters))
3. Observe the output:

Code: Select all

{
  operation = "quality-transfer",
  quality_destination_signal = {
    name = "uranium-238",
    quality = "epic"
  },
  quality_source_static = {
    name = "rare"
  }
}
4. Keep the cursor in place and run the following console command:

Code: Select all

/c local a=game.player.selected.get_control_behavior().parameters; a.quality_source_static="legendary"; game.player.selected.get_control_behavior().parameters=a
5. Observe that the quality_source_static parameter has been reset to "normal" because it did not read the value in the parameters given.
6. Run the final console command:

Code: Select all

/c local a=game.player.selected.get_control_behavior().parameters; a.quality_source_static={name="legendary"}; game.player.selected.get_control_behavior().parameters=a
7. Observe that the quality_source_static parameter has now changed to "legendary".
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16107
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.60] Incorrect handling of Selector combinator parameters table

Post by Rseding91 »

Thanks for the report. The way the parameters are saved/loaded are done through saving/loading a property tree. The only format that supports are tables and values - things such as lua prototypes aren't supported and so it won't ever work with them.

In this case the lua docs will need to be changed to reflect this.
If you want to get ahold of me I'm almost always on Discord.
robot256
Smart Inserter
Smart Inserter
Posts: 1269
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [2.0.60] Incorrect handling of Selector combinator parameters table

Post by robot256 »

Rseding91 wrote: Thu Aug 14, 2025 5:29 pm Thanks for the report. The way the parameters are saved/loaded are done through saving/loading a property tree. The only format that supports are tables and values - things such as lua prototypes aren't supported and so it won't ever work with them.

In this case the lua docs will need to be changed to reflect this.
That works too, thanks! That means it will stay the same and I won't need to change my "workaround" code.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Bilka
Factorio Staff
Factorio Staff
Posts: 3636
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [2.0.60] Incorrect handling of Selector combinator parameters table

Post by Bilka »

Docs fixed for 2.0.65.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Resolved Requests”