sirgwain / craig-stars

Web based Stars! clone
https://craig-stars.net
MIT License
10 stars 4 forks source link

Manually deleting and re-adding a partially built production queue item should preserve built % #462

Open Bertie690 opened 1 month ago

Bertie690 commented 1 month ago

More of a "minor QoL" idea than an actual gamebreaking change, but perhaps the server could keep a "record" of all the partially completed build items in each planet's production queues at the start of the turn. likely (likely as some sort of hash table). If a new item matching one of the incomplete items for that planet is added to the queue whilst no matching incomplete item exists (implying it was previously deleted by the player earlier this turn), it will set the new item's build% to the stored value, effectively restoring the in-progress build. TL;DR half built items should retain build progress when deleted and re-added provided it hapoens within the same turn.

sirgwain commented 1 month ago

Like each planet has a collection of previously started projects it can resume? A hobby garage of sorts?

Bertie690 commented 1 month ago

More or less. The hobby garage would get cleaned out and re-populated with any half built items at the start of the turn (so you can't carry over that half built starbase for 5 turns in a row), mainly serving to add protection against accidental misclicks and production queue clears.

Bertie690 commented 1 month ago

As an example of how it'd work, say I have 3 unfinished cruisers with the same ship design in my queue at the start of the turn: 1 each at 50%, 60% and 70% completion. If I clear the queue and add a single cruiser ship without ending the turn, the game will see we have 1 of that cruiser design in the queue and set its build % to the highest value found in the slice (70%). The next 2 cruisers added will go onto a new line and assume the next 2 highest values in our slice (60% and 50%), and any cruisers built after that point will cause a runtime panic function as normal.