diff --git a/docs/entities/bags.rst b/docs/entities/bags.rst index a84acf1..79b882e 100644 --- a/docs/entities/bags.rst +++ b/docs/entities/bags.rst @@ -1,4 +1,46 @@ .. _doc_entities_bags: Bags -==== \ No newline at end of file +==== + +For implementing inventories use the :ref:`Bag` base class. + +Right now :ref:`Bags` implements a really simple system (think of Skyrim). +Later more implementations will be added (as subclasses). +If you need a Diablo-like inventory grid, this is a work-in-progress version: +https://github.com/Relintai/entity_spell_system/blob/master/inventory/grid_bag.h +It's not in the build right now, but at least you won't start from scratch, if you want to create one +like this. The item size properties were removed from items, they'll be added back. + +Every :ref:`Entity` contains a :ref:`Bags` property, both server, and clientside. +See :ref:`Entity.sbag`, and :ref:`Entity.cbag`. + +For networked players, whenever the contents of an :ref:`Entity`'s bag changes, the +system automatically sends a message to the :ref:`Entity`'s owner, thus keeping the +state consistent on both server and client. + +The system can also send a bag's contents all at once, for example this happens whenever you replace an +:ref:`Entity`'s bags, using the serverside properties. + +By default Entities won't actually create their own bags, because for example mobs don't need bags by default. + +.. note:: Right now for the player the :ref:`setup_actionbars` will allocate bags. + This will be changed. Also since the module needs the ability to easily switch bag implementations, bag + allocation will probably be pushed into a virtual function, like setup_bags() -> _setup_bags() (virtual). + +Target Bags +=========== + +See :ref:`starget_bag`, and :ref:`ctarget_bag`. + +With these it becomes possible to implement checsts, bank, loot, with minimal code. + +For example when a mob dies, loot is generated into their bags, then when you click their corpse, that bag gets set +as you player's target bag. When you do this, the system sends the contents to that player, and they can manipulate +the contents, based on what the server allows. + +If you want to see how to setup loot interaction, check the _son_death method here: +https://github.com/Relintai/broken_seals/blob/master/game/player/Mob.gd + +It you want to see how to setup loot, check the _sinteract method here: +https://github.com/Relintai/broken_seals/blob/master/game/scripts/entities/EntityDataGD.gd diff --git a/docs/entities/crafting.rst b/docs/entities/crafting.rst index 6ad2d1b..fb0e8ae 100644 --- a/docs/entities/crafting.rst +++ b/docs/entities/crafting.rst @@ -1,4 +1,19 @@ .. _doc_entities_crafting: Crafting -======== \ No newline at end of file +======== + +The module supports crafting. In order to set it up, first you'll probably need a gui. + +As a starter you can take Broken Seal's crafting window from here: +https://github.com/Relintai/broken_seals/tree/master/game/ui/crafting + +Or if you want to implement one yourself, implement the ability to your window to display recipes, +and then you can just get recipes from your target entity with functions like +:ref:`getc_craft_recipe` **(** int craft_recipe **)** , +and :ref:`getc_craft_recipe_count` **(** **)**. + +.. note:: You usually want to use the client side functions/properties for uis. The serverside + versions will have the ability to have additional, hidden entries. This will allow + for more effects, for example you can remove the player's ability to temporarily + see/craft certain things, without them actually forgeting them.