[2.0.50] "same-force" flag in SelectionModeData mode does not work
[2.0.50] "same-force" flag in SelectionModeData mode does not work
Steps to reproduce the bug:
1. Enable my mod, attached to this post.
2. Start new game with default map and mod settings.
3. Try to select any entity from the player force, such as a player-built burner mining drill.
- Attachments
-
- hextorio_0.3.2.zip
- (2.18 MiB) Downloaded 16 times
Re: [2.0.50] "same-force" flag in SelectionModeData mode does not work
It seems you need to specify more than just "same-force" (either in flags or in entity_filters/entity_type_filters). I've added "any-entity" to flags:
and placed the iron chest + burner mining drill. The selection was made while I was still in force "neutral", so it doesn't include the stone-furnace because it is not of the same force as the player.
I've started the game and built the stone-furnace. Then, I used Code: Select all
/c p = game.player; p.force = "neutral"
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: [2.0.50] "same-force" flag in SelectionModeData mode does not work
Thanks for the report. Answer provided by Pi-C is accurate: you need to specify "any-entity" for the selection tool to work.
Extended explanation involves describing some implementation details that may need to be added to documentation given that it happened to not be obvious. There are effectively 3 groups of mode flags: "negative filters", "positive filters" and "extras".
Negative filters involve: "nothing", "avoid-rolling-stock", "avoid-vehicle", "same-force", "not-same-force", "friend" and "enemy". Those filters on their own can only make entities selected by other filters to become rejected. For instance "nothing" filter rejects all entities given. "same-force" is a filter that rejects entities of different force. They do not select entities on their own but are usable as filters to exclude entities.
Positive filters involve: "any-entity", "entity-with-health", "is-military-target", "entity-with-owner", "items", "trees", "buildable-type", "items-to-place" (has items to place), "controllable", "controllable-add", "controllable-remove", "entity-ghost" and "tile-ghost". One of those filters passing is sufficient for entity to be selected (given it was not rejected by negative filters).
Extra filters are a weird mix between positive and negative filters, those are "blueprint", "deconstruct", "cancel-deconstruct", "upgrade", "cancel-upgrade" and "downgrade". This is best described starting from the original issue that made them not be a true "positive filters": there was a need for weird ability of making cut-tool to select only entities that match 2 conditions at the same time, a "blueprint" and "deconstruct", because only blueprintable entities can be put into blueprint however cut tool should not select entities that are marked as not deconstructible so in those cases both of those conditions must be fulfilled. This extra filters set has its own special rules because of that: when any of those extra filters is used, then original set of positive filters is ignored, instead only negative filters and those extra filters are checked: entity must match all of the selected extra filters to become selected.
Extended explanation involves describing some implementation details that may need to be added to documentation given that it happened to not be obvious. There are effectively 3 groups of mode flags: "negative filters", "positive filters" and "extras".
Negative filters involve: "nothing", "avoid-rolling-stock", "avoid-vehicle", "same-force", "not-same-force", "friend" and "enemy". Those filters on their own can only make entities selected by other filters to become rejected. For instance "nothing" filter rejects all entities given. "same-force" is a filter that rejects entities of different force. They do not select entities on their own but are usable as filters to exclude entities.
Positive filters involve: "any-entity", "entity-with-health", "is-military-target", "entity-with-owner", "items", "trees", "buildable-type", "items-to-place" (has items to place), "controllable", "controllable-add", "controllable-remove", "entity-ghost" and "tile-ghost". One of those filters passing is sufficient for entity to be selected (given it was not rejected by negative filters).
Extra filters are a weird mix between positive and negative filters, those are "blueprint", "deconstruct", "cancel-deconstruct", "upgrade", "cancel-upgrade" and "downgrade". This is best described starting from the original issue that made them not be a true "positive filters": there was a need for weird ability of making cut-tool to select only entities that match 2 conditions at the same time, a "blueprint" and "deconstruct", because only blueprintable entities can be put into blueprint however cut tool should not select entities that are marked as not deconstructible so in those cases both of those conditions must be fulfilled. This extra filters set has its own special rules because of that: when any of those extra filters is used, then original set of positive filters is ignored, instead only negative filters and those extra filters are checked: entity must match all of the selected extra filters to become selected.