diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-18 16:00:29 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-18 16:00:29 -0500 |
| commit | 25e4d04a331a6a0b9d897d4f721757730771ff97 (patch) | |
| tree | 4f410e968ea6e377c53e55e92a495f47a9e504a7 /gamemode/itemsystem | |
| parent | 8ed7aec95941c0752a0ae21d10594579c39677fb (diff) | |
| download | artery-25e4d04a331a6a0b9d897d4f721757730771ff97.tar.gz artery-25e4d04a331a6a0b9d897d4f721757730771ff97.tar.bz2 artery-25e4d04a331a6a0b9d897d4f721757730771ff97.zip | |
More documentation
* Documented the item table
* Documented the inventory table
* Started writing tutorials
Diffstat (limited to 'gamemode/itemsystem')
| -rw-r--r-- | gamemode/itemsystem/exampleitem.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gamemode/itemsystem/exampleitem.lua b/gamemode/itemsystem/exampleitem.lua index 269e2d6..196db20 100644 --- a/gamemode/itemsystem/exampleitem.lua +++ b/gamemode/itemsystem/exampleitem.lua @@ -1,3 +1,7 @@ +---An example item. +-- An item you can create a copy of as a starting point. This is the minimum needed for an item. Different inventories usually also require different fields and functions. +--@classmod itemtbl + --[[ An example item ]] @@ -6,19 +10,27 @@ local item = {} --Make sure we identify ourselves as a prayer item.isprayer = true ---Required, a name, all item names must be unique +---A name. +-- All items must have a .Name, which gives a string, an item should give the same string each time. You can generate an item's name from it's data by leaving this blank, and giving the item a metatable with a __index method that does the right thing item.Name = "Test item" --Optional, a tooltip to display when hovered over item.Tooltip = "An example item. Copy this file\nand edit it to make your own items!" ---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network +---Create a string representation of this item. +-- Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network. +--@tparam itemtbl self The item we need to serialize +--@treturn string The string representation of this item (can be length 0) item.Serialize = function(self) print("Trying to serailize!") return "" end ---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set. +---Recreates an item from data. +-- Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set. +--@tparam itemtbl self The prototype table we want to deserialize from +--@tparam string string The data given by a Serailize() method +--@treturn itemtbl The fully deserialized item item.DeSerialize = function(self,string) print("Trying to deserialize!") return self |
