Help programming an incremental production system

Godot Version

4.72

Question

I am creating an incremental/idler game, and am struggling to get a production system, while this is both a question of my current code issues, i wanted to know what the best practices for a system like this would be.

My project is below:https://drive.google.com/file/d/1A2NpX5KU4G_iZ4qqblt-iNvINpA4vTzf/view?usp=sharing

Basically, the main issue I’m having is that my resource producing buildings are designed with a state machine that idles when storage is full, as to not waste resources.

But it fails to take into account future production, so it bounces between the idle and active states.

I may be failing to explain this properly, but i have attached the project files for your viewing.

Any and all criticism is welcome, i want to learn! Thank you for your time.

Hey,
Please provide the code that only does that specific thing, it will be harder to find the problem as we don’t know about your project structure.

Please explain further as your explanation is kind of difficult to understand. Thanks!