the inventory class will be implemented as a singleton.
Its basic functionality will be wrapping a std container, probably a map.
supported actions are ‘add’, ‘remove’, ‘replace’, ‘contains’ – all of which will be implemented as standard actions, usable via the node system.
In order to make the inventory system available similar to the way classic point&click adventures worked, a new trigger will be added to the node system.
The trigger’s responsibility will be to report to any connected component which item the user tried to use with the trigger’s parent object.
List of new actions/triggers:
- ‘used with’ trigger: outputs the item ID of the used inventory item
- ‘add to inventory’ action: removes an object from the scene and adds it to the inventory. Alternatively, if the action is not connected to any object, it can spawn a new item via its ID and directly add it to the inventory.
- ‘remove from inventory’ action: removes an action from the inventory and displays it in the scene. Alternatively, this action can remove & delete an object without it being transferred back to the scene.
- ‘replace’ action: replaces an item that already is contained in the inventory with a different object (see ‘add to inventory’). The difference her is that the ‘replace’ action won’t change the internal order of the inventory.
- ‘contains’ action: will return true or false, depending on whether or not a certain item id exists within the inventory.
Using these actions and the new trigger, more or less complex systems can be built where users can pick up items, combine them, use them with scene items, place them back on the floor, etc.
