[2.0.60] Incorrect handling of Selector combinator parameters table

Post your bugs and problems so we can fix them.
robot256
Smart Inserter
Smart Inserter
Posts: 1240
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.
Post Reply

Return to “Bug Reports”