This component allows your prefab to be picked up and stashed away. Generally this component doesn’t need any specification.

Component InventoryItem Fields

booleancanbepickedupYou don't always want items to be "items", e.g. when on fire.
booleancangoincontainerFor things that just cannot be put away, like mobiles
booleankeepondeathFor the secrets you take with you into the afterlife
stringimagename, atlasname This is mostly used by mods, to define the image on a tile.
functionondropfnFires when dropped on the ground. Arg: inst
functiononpickupfnFires when taken. Returning true means the item is destroyed. Args: inst, pickupguy
functiononputininventoryfnFires when placed in a tile. Args: inst, owner
functiononactiveitemfnHandled in "inventory"
instownerwhoever holds the item, can be nil

Component InventoryItem Methods

SetOnDroppedFn, SetOnActiveItemFn, SetOnPickupFn, SetOnPutInInventoryFnfnnilyou can set those functions indirectly too
GetSlotNum-number or nilgets the current slot of the item
GetContainer-component or nilreturns either the "container" or the "inventory" component of the owner
HibernateLivingItem-nilshuts things with brains up and down (used in other functions)
WakeLivingItem-nilactivates things with brains again (used in other functions)
OnPutInInventoryownernilproperly removes traces from the world (used in other functions)
OnRemoved-nilas in, on removed from inventory, not from existance (used in other functions)
OnDroppedrandomdirnilmostly for setting position and bouncing
OnPickuppicker_uppertrue or nilif this returns true (custom function) then the item won't be given
ChangeImageNamenewnamenildoes not change the atlas
RemoveFromOwnerwholestackfunction "RemoveItem" of the containerThis is passed onto the container
GetGrandOwner-grandowner or nilgets the true owner (e.g. twigs in a backpack on a Wilson)

Component InventoryItem Events

NameDataFires in/when...
onputininventorynilfires when stashed in a tile
ondroppednilfires when dropped on the ground
onpickupownerwhen picked from the ground