aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/testprayer.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-10-09 16:20:46 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-10-09 16:20:46 -0400
commitda81a0a23a3704dd2de3ab2249496c1ad1912d1c (patch)
tree915edc671acbb292191adad2f25f87ba26e567cf /gamemode/itemsystem/testprayer.lua
parent497be6ff15989c7bf9de5beb138d2ef042dca6bd (diff)
downloadartery-da81a0a23a3704dd2de3ab2249496c1ad1912d1c.tar.gz
artery-da81a0a23a3704dd2de3ab2249496c1ad1912d1c.tar.bz2
artery-da81a0a23a3704dd2de3ab2249496c1ad1912d1c.zip
Updated internal representation of inventories
Diffstat (limited to 'gamemode/itemsystem/testprayer.lua')
-rw-r--r--gamemode/itemsystem/testprayer.lua42
1 files changed, 42 insertions, 0 deletions
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)