Repository navigation
Update Production's Faction when its owner changes - #21219
Conversation
| [Desc("e.g. Infantry, Vehicles, Aircraft, Buildings")] | ||
| public readonly string[] Produces = Array.Empty<string>(); | ||
|
|
||
| [Desc("When owner is changed, should the Faction be updated to the new owner's faction?")] |
There was a problem hiding this comment.
I think this should explain what "faction" really means. Afaik it changes so that the produced units are of your own faction, meaning that if you capture an enemy war factory you'd no longer be able to build an MCV of their faction?
There was a problem hiding this comment.
In case of CNC/RA-like mod, yes. If it's another mod, it depends on how other stuff (like tech tree) is implemented. In case of OpenE2140, our prerequisites are mainly research technologies (custom feature), some of which are faction-specific and some are same for both factions. And as such, this allow producing units of the other faction, when production factory of that other faction is captured.
Like I said in the PR comment, it's up to a mod developer to choose what behavior they want. It seems it's likely going to be used in other mods (apart from OpenE2140), since @dnqbob has been requesting this feature/fix as well.
There was a problem hiding this comment.
But in base openra the bug is just about the UI no? It's something that should be fixed in TS as well
There was a problem hiding this comment.
Again it depends on the mod. For ORA default mods (TS too) I assume the behavior needs to stay the same (i.e. Faction does not change after owner change), hence the switch defaults to false.
Also it's not just UI thing, there are other places, where Production.Faction is used, such as PlaceBuildingOrderGenerator (in VariantWrapper) or *Production classes.
I already had a UI-only solution for this bug (#20705), but that was rejected.
There was a problem hiding this comment.
@PunkPun if you capture a Nod war factory in TS you will want to be able to build Nod units.
There was a problem hiding this comment.
Hence, this is (Production.UpdateFactionOnOwnerChange) entirely optional and so is the Sticky flag on ProductionQueue. I can rename Sticky flag, but that would require update rule.
There was a problem hiding this comment.
Actually I hope the bug below can be fixed in this PR, for #21162
This issue (Production UI upgrade) has some very nasty side effect on fixing.
You need a test on owner change before/after disable or enable. There can be some bugs that owner changed facility can still produce on old owner's production UI.
It is not only the problem of faction change, it is the problem of when you losing control of production actor (owner changed) it is still on your production UI and you can produce unit on that actor.
This PR makes it possible to optionally change
Production.Faction(i.e. custom property onProductiontrait, not faction ofPlayer) when the actor's owner changes. It fixes the discrepancy between faction stored inProductiontrait and the faction of the actual owner of the actor.This behavior is however disabled by default to keep backward compatibility. Each mod should decide, which actors are going to get
Productiontrait that behaves like this.Related to #21162 and #20705.