Jump to content
Sign in to follow this  
Indomitus

Container Capacity

Recommended Posts

I've noticed that if we try to spawn into a container that is already full, the new items will spawn on the ground under the container.

Could we get a way to see the total number of slots in a container, and possibly also a way to see the available slots?  It would help avoid some messy situations.  All we really need is 1 or 2 tiles that return the count.

 

edit:

Also, a way to tell if an entity IS a container would be useful, especially if we're looking at items in a player's inventory.

Edited by Indomitus

Share this post


Link to post
Share on other sites
20 minutes ago, RedEagle_P1. said:

What are you shooting for, just out of curiosity? 

My immediate use case:  I'm scaling down the Scavenger Hunt game idea I told you about ages ago (wouldn't be surprised if you don't remember) to something suitable for mobile.  That means, among other things, I need to streamline the bajeezus out of the code.  One thing the game has to do is manage the contents of a lot of containers of varying size across the play area, because I'm going to have "found" items respawning at certain intervals from a queue.  I have a strategy I can use to track the available space, but it's kind of painful in terms of code complexity and size.  I can already get the number of occupied slots in a container.  If I could get the total number of slots and subtract from that, or just directly get the available slots, it would save a ton of memory and scripting overhead.

The full scale version of the game works fine, by the way, it's just really big.

Beyond that specific use, it's a generally useful piece of information for anyone building a game that involves spawning into containers.  If you don't watch the container's capacity, the items end up spawning on the ground under it or not spawning at all.

 

On 9/28/2019 at 10:06 AM, Indomitus said:

Also, a way to tell if an entity IS a container would be useful, especially if we're looking at items in a player's inventory.

And just to reply to myself for the sake of an answer to this one:  An Event Listener can watch for Containers, and trigger a Label and/or Entity Storage to be attached on their Create event.  This one's already implemented.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×