HomeWildfire Games

Split tasks from ProductionQueue.
Concern RaisedrP26000

Description

Split tasks from ProductionQueue.

The task of the production queue should first and foremost be that; a queue for production items.
Hence, the specifics of training/researching are delegated to specific components.

As a side effect, this improves the test coverage and fixes:

  • Resource not refunding when hitting the entity limit. Introduced in r25753 / rP25753.
  • Autoqueue changing when unable to spawn. Introduced in r25779 / rP25779.

Modders can change their templates using https://code.wildfiregames.com/P256.

Differential revision: https://code.wildfiregames.com/D4333
Fixes: #6363
Comments by: @Silier
Refs. #6364

Event Timeline

Silier added inline comments.Wed, Nov 17, 3:58 PM
/ps/trunk/binaries/data/mods/public/simulation/components/ProductionQueue.js
49

this should be inlined

65

if this is -1 ?

158

so here you are saying it is or technology or entity while else in the code it looks like it can be both at the same time. which case it is?

314

this and below can be more generic and branches can be removed

317

if it is or technology or unit at the same time, why dont pass interface ID to item on creation and make both interfaces implementing same functions so they can be called without branching.
Also that would make it possible to remove this.entity and this.technology and have just this.item or something

/ps/trunk/binaries/data/mods/public/simulation/components/Researcher.js
224

why not inlined

Silier added inline comments.Wed, Nov 17, 4:01 PM
/ps/trunk/binaries/data/mods/public/simulation/components/ProductionQueue.js
314

ok, wrong comment, but still can be merged into one here and checked in item

Freagarach marked 7 inline comments as done.Thu, Nov 18, 7:02 PM
Freagarach added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/ProductionQueue.js
158

I didn't want to modify the GUI (too much) in this patch. Hence I assumed here (and at the addition stage) only one of the two is possible. But the rest is flexible enough for it to be implemented some day.

317

Because e.g. the Researcher don't need the count, so their interfaces are different.
Also, someone might want to implement queuing both at the same time.

/ps/trunk/binaries/data/mods/public/simulation/components/Researcher.js
224

Since this was a (almost straight) copy-pasta.

Silier raised a concern with this commit.Sun, Nov 28, 7:54 AM

See comments on diff

This commit now has outstanding concerns.Sun, Nov 28, 7:54 AM