The main way for the player to get stuff is via looting. Any object that generates and stores loot is called a Lootbox.
Loot is handled in a simple manner with a lot of customisation:
A loot table stores entries for possible loot, how rare it is, how many could spawn at once. It should also have entries that activate upon a certain conditions (eg: The Loot table is activated in a certain biome, during blackout, player immunity or general well being is low and etc) to make the gameplay more enjoyable.
For certain items there should be some sort of modifiers that affect an item’s spawning properties (Eg: How spoiled a food is, tool durability, how many MicroItems are in an item)
A lootbox can be executed. When executed it will return a list of items. Using a foreach loop the items can either be added to an inventory or just spat out into the world
Almost all lootboxes are children of the SmartProp class to have the ability to interact more thoroughly with the prop, with the opening option being before the pick-up/carry one. Lootboxes divide into multiple categories
These lootboxes use spawnpoints to generate several items as Fixed physics Drops. They are much easier to set up and are best used with open or containers that are too small or impractical to use as storage solutions like shelves, exposed, tables, janitor carts, small drawers. Players may still place the items physically but they are not in an inventory
These lootboxes contain a single inventory and an inventory render. Used for simple containers like boxes, crates, singular drawers.
These are the most complex ones, having multiple inventories with containers. Useful for more large-scale containers like fridges, lockers, wardrobes and etc. They open up in a multi-inventory view with each inventory lined up.
The lootboxes are not just good for what’s inside them. Some lootboxes have special properties the player might want to take with them: