diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-02-28 09:41:23 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-02-28 09:41:23 -0500 |
| commit | 5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162 (patch) | |
| tree | ba03a7c2975e2c5c88732cc28be90365e6cd41aa /tutorials/tut030_inventories.md | |
| parent | a77ee4ce201de757ce4c5958d9e499a65b2cf416 (diff) | |
| download | artery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.tar.gz artery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.tar.bz2 artery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.zip | |
Fixed some types, worked on 0x050
Fixed typos in a bunch of tutorials, did a little more work on 0x050 -
Entities
Diffstat (limited to 'tutorials/tut030_inventories.md')
| -rw-r--r-- | tutorials/tut030_inventories.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tutorials/tut030_inventories.md b/tutorials/tut030_inventories.md index fbf654d..41fb293 100644 --- a/tutorials/tut030_inventories.md +++ b/tutorials/tut030_inventories.md @@ -6,7 +6,7 @@ Many gamemode bases try to build an inventory system into the gamemode, leaving In this tutorial, we'll build a simple rougelike inventory, where we expect items to have a "weight", and we can carry as many items as we want, as long as we don't exceed our "max weight". -Inventories and items in Artery are just tables, as per usual in lua. They have a few required fields each. On the left, under "Classes", open invtbl and itemtbl in new tabs. +Inventories and items in Artery are just tables, as per usual in lua. They have a few required fields each. On the left, under "Classes" (all the way at the bottom!), open invtbl and itemtbl in new tabs. ## A simple inventory @@ -115,7 +115,8 @@ garrysmod/addons/artery_rougelite/data/artery/global/rougeinv.lua for k,v in pairs(self.items) do ser[k] = { v.Name, - v:Serialize() + v:Serialize() --Take advantage of the fact that all items must also have a + -- Serialize() method } end return util.TableToJSON(ser) @@ -142,3 +143,6 @@ garrysmod/addons/artery_rougelite/data/artery/global/rougeinv.lua That was a bit long, but we're done! This is the absolute minimum needed to create an Artery inventory. Now you can go in-game and use the console command `artery_printinventories`, and in that list, you will see your newly made inventory! + +Next tutorial: @{tut040_items.md} +Further reading: @{tut031_metatables.md} |
