Storage Items Level 2

I was creating models for some storage items and asked myself if there is some possibility to make them pop-up from other models.

You can see the storage Field in his first state is absolute empty. But the filled with the Harvested materials.

So in theory it could be possible to use the same code also for storage models right?


Implementing a code that recognize if the store is empty use model1.cq, if the model is 20% full use model2.cq, 40% model3.cq and so on…

Is this already possible?

1 Like

Items such as Berry Bushes has two states: default and depleted - each state uses its own model.

I don’t know how to set up different states for entities; but if you would set up states and have your entity switch states depending on the “percentage of used storage capacity”, you could implement similar functionallity as well.
For Berry Bushes, I believe the state-switching is utilizied via the
"stonehearth:renewable_resource_node"
I could be wrong though :stuck_out_tongue:

There might be some lua coding involved when it comes to checking how much “space” is used in your inventory items; but, I’m sure there are someone here on this forum who would be able to help you (and me - because I will totally steal this idea some day!!) with the state-switching :slight_smile:

1 Like

Hahahaha xD yes probably this one will only works with lua :frowning:

The percentage was only as example. But i would be enough when you can define for single elements something like

0/30 --> use model 1
10/30 --> use model 2
20/30 --> use model 3
30/30 --> use model 4

I think this could be a nice idea for players too to see how much free storage you have

Yes, also some models i have created before have two states. (Brightbell Flower Planter for example). But they work with a time set. Like the trees that growing in the game :frowning:

this one is a little bit more complicate …

1 Like

If you make this work Pingu, it will be so freakin awesome! :jubilant:

2 Likes

Hopefully my skills are advanced enough to work on something like that xD

2 Likes

I have not tried to dive into the lua files used for functions within Stonehearth, yet - but I’m hoping that it’s possible to browse my way to funtions like “stonehearth:renewable_resource_node” found in the json-files of flowers, trees, etc.
As you say, the usage of this function is what makes the states change for plant items (this is my guess at least). If we find this function we could study it, learn from it, and expand upon it in order to make a state-changer for your storage items :smiley:

I will be busy and not able to do too much scripting this week; but if nothing else, by next week I should start diving into lua myself.
I will keep an eye on this post, and if I don’t see that you’ve solved it by then I might look into it as well ^^

And I totally agree with @Fornjotr - this feature would be amazing, @pingu!

1 Like

Yes, you are right @Hamnisu, for this week i’m really busy too. Still working on a small update for a big add-on of the mod but if i have some time to dedicate it i will do so :wink:

Otherwise we have to come back to this next week :jubilant:

Hey again. So, I was just able to join the stream and took this time to ask where to find this “stonehearth:renewable_resource_node” stuff.
The answer is that this is a component, and thus, it is found at
stonehearth\components\renewable_resource_node

I have not started looking into this at all (it’s 3 am for me, reallt sleepy, lol!); but at least we know where to start looking into lua stuff now :slight_smile:

2 Likes

Ahhh lua :frowning:
maybe i can ask some friends for help to understand it. For me it’s a little bit to complicated xD

But it’s nice to see that you have found the start point :+1:

I dont know s**t squat when it comes to lua either - but, practice make perfect they say!
If you get some help and figure it out, don’t forget to keep me in the loop :blush:

1 Like

Sure xD
I post every progress in this thread :smiley:

1 Like