diff options
Diffstat (limited to 'gamemode/itemsystem')
| -rw-r--r-- | gamemode/itemsystem/exampleitem.lua | 2 | ||||
| -rw-r--r-- | gamemode/itemsystem/testprayer.lua | 42 |
2 files changed, 43 insertions, 1 deletions
diff --git a/gamemode/itemsystem/exampleitem.lua b/gamemode/itemsystem/exampleitem.lua index 6beb1f6..d7af511 100644 --- a/gamemode/itemsystem/exampleitem.lua +++ b/gamemode/itemsystem/exampleitem.lua @@ -7,7 +7,7 @@ local item = {} item.Name = "Test item" --Optional, a tooltip to display when hovered over -item.Tooltip = "An old axe, probably good for fighting." +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 item.Serialize = function(self) diff --git a/gamemode/itemsystem/testprayer.lua b/gamemode/itemsystem/testprayer.lua new file mode 100644 index 0000000..3cdb52e --- /dev/null +++ b/gamemode/itemsystem/testprayer.lua @@ -0,0 +1,42 @@ +--[[ + An example item +]] +local item = {} + +--Required, a name, all item names must be unique +item.Name = "Test prayer" + +--Optional, a tooltip to display when hovered over +item.Tooltip = "A test prayer" +item.Description = "This is a test prayer\nYou can equip it!" + +--Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network +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. +item.DeSerialize = function(self,string) + print("Trying to deserialize!") + return self +end + +--Optional. Something run once when this item is drawn in a backpack +function item.DoOnPanel(self,dimagebutton) + dimagebutton:SetImage("icon16/bomb.png") +end + +--Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right +item.onClick = function(self,owner) + print("pew pew!") +end + +--Client-side only +item.Pray = function(self) + print("I prayed with a test item!") +end + +--Don't forget to register the item! +local itm = nrequire("item.lua") +itm.RegisterItem(item) |
