cameroncondry / cbc-kitten-scientists

Add-on for the wonderful incremental browser game: http://kittensgame.com/web/
MIT License
113 stars 94 forks source link

Feature request: a button to "Set Stock values to what is required for buildings" #268

Open Genoce opened 4 years ago

Genoce commented 4 years ago

In the Crafting list, or maybe Options, add a toggle called "Stock values automatically match building costs" (or something) which would do the following:

When enabled, the script would check the current costs for buildings, and if higher than current value stored in Stock, would increase the Stock value to match the material requirement.

This should probably be ran every time a building is either sold or bought, or whenever any of your maximum storages are changed for any reason.

Full example case: next Pasture costs 305 Catnip and 31 wood. Next Hut costs 488 wood. Next Library costs 101 wood.

The script would then basically check for the highest values of all of your buildings:

1) "Pasture requires 305 catnip and 31 wood" -> change stock values of catnip to 305 and wood to 31. 2) "Hut costs 488 wood" -> change wood stock to 488 3) "Library costs 101 wood" -> wood stock is already 488, do nothing 4) ...like this, it continues to check through all the buildings on the list.

The script should ignore all buildings which you have no storage room for, so it can't set stock values to higher than you can currently have on hand. Also, if you manually set a value higher than what is required for a building, the script wouldn't change that value - in other words, the script could only make the values go up from what they are at the time of checking it.

Another option for implementing this, which would give more control for player: something like "doubleclick a grayed-out building to set Stock values to its cost". Do the same as above, but only for the building/research that you doubleclick.

There might be some more clever ways to implementing a feature like this, but anyway - some way to automatically save enough resources for building(s) would be cool.