blob: 3cdb52e695f70fb2996e35c923919dbf94ff8148 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)
|