Fix ProductionTabsWidget not detecting ProductionQueue getting enabled/disabled during its lifetime#21162
Conversation
|
Could there be situations where this fix has the opposite effect? Production queue becoming visible - where it was never meant to have one? |
|
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. |
I hope this PR can overcome the problem I met and mentioned above, but if it cannot, I will suggest this method used by @MustaphaTR :
|
|
Add: This PR is also very worthy for the mods that can switch mutiqueue production or singlequeue production in gameplay, if you can make it. |
|
@anvilvapre It shouldn't. The logic in the event of actor being added to world is basically the same as before. Plus it caches local player's @dnqbob Yes, I know about the bug, it affects us in OpenE2140 too. I actually fixed it in this PR #20705 (it's ready for the merge) - totally unintentionally.
No, I'm not going to do any hacks like this. I'd rather keep pushing devs to merge a PR that actually fixes a bug like this. |
|
Then I think maybe we should add |
|
No, this PR does not depend on #20705. They both affect widgets for production UI, but they change different parts of code base. The bug with the owner change is separate to this bug. |
|
But when we test if the owner change bug is truly fixed, it is better that put them together (more accurately, #20705 first and this PR the second), right? Without #20705, this PR will have owner change bug (more precisely, expose the owner change bug that production UI has) which will affect the gameplay severely, and normally OpenRA won't directly merge a PR with a known bug. Maybe from logic it is reluctantly to say this PR depends on #20705 as they fix unrelated things and #20705 happens to fix the bug in this PR. But at least "PR: Has dependencies" informs devs they should merge #20705 first to make the test here smoother. |
c478b9c to
6221f0a
Compare
|
Like @penev92 said, #20705 is not really about the owner change issue of |
|
If the owner change problem is fixed in this PR it will be no problem on removing dependency tag, otherwise I would suggest fix the owner change issue first and then merge this PR. |
RoosterDragon
left a comment
There was a problem hiding this comment.
Thanks for the detailed description in the ticket, it helped me with following through these changes.
This all looks good to me: we're detecting the tab state has gone out-of-sync and refreshing it. And by using the cache, the Tick method can cheaply check for this problem.
…ed/disabled during its lifetime
6221f0a to
2a0d136
Compare
This is a fix for
ProductionTabsWidgetnot picking up production queues' being enabled/disabled during their lifetime.ProductionQueueis enabled in itsTick()method based on whether there's at least oneProductiontrait enabled (if not, the queue is disabled). This value (ProductionQueue.Enabled) is used in several places, in this PRs case it's inProductionTabsWidget, when actor withProductionQueueis added/removed fromWorld.The issue (this PR fixes) is mainly visible, when
ProductionQueueis disabled immediately, when the production actor is created. Example would be OpenE2140 mod, where buildings are always constructed from MCV-like vehicles (called MCUs). In case of OpenE2140, the building should not be usable while its being constructed. This is implemented by putting condition onProductiontrait. The issue is triggered, when one MCU is transformed to building while another one is already being constructed. In this case, theProductionQueuefor the second building hasEnabled == false, so when the actor for the new building is created,ProductionTabsWidgetwrongly assumes the ProductionQueue for the second building (the one being constructed) is not available and thus does not create tab for it (i.e.ProductionTabobject).This is how the bug looks like in OpenE2140:
(GIF is intentionally slowed down, to make it easier to follow changes in the
ProductionTabsWidget)