diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-08-09 17:53:52 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-08-09 17:53:52 -0400 |
| commit | d4f197a35c207c9891d3f4dc5e9708af48c935de (patch) | |
| tree | ee8fd3960c3a3fb4ecaf0f62b50d251f007ebaf3 /gamemode/shared/itemsystem/prayers/thickskin.lua | |
| parent | 2fe3c4551344870e3784733fce2d95027b5c8382 (diff) | |
| download | artery-d4f197a35c207c9891d3f4dc5e9708af48c935de.tar.gz artery-d4f197a35c207c9891d3f4dc5e9708af48c935de.tar.bz2 artery-d4f197a35c207c9891d3f4dc5e9708af48c935de.zip | |
Added some weapons
Diffstat (limited to 'gamemode/shared/itemsystem/prayers/thickskin.lua')
| -rw-r--r-- | gamemode/shared/itemsystem/prayers/thickskin.lua | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/gamemode/shared/itemsystem/prayers/thickskin.lua b/gamemode/shared/itemsystem/prayers/thickskin.lua new file mode 100644 index 0000000..9dc77bd --- /dev/null +++ b/gamemode/shared/itemsystem/prayers/thickskin.lua @@ -0,0 +1,78 @@ +--[[ + An example item +]] +local item = {} + +--Required, a name, all item names must be unique +item.Name = "Thick Skin" + +--Optional, a tooltip to display when hovered over +item.Tooltip = "A prayer to the warrior god to grant you 20% resistance to all dammage" + +--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, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file! +local prayedplayers = {} +if SERVER then + util.AddNetworkString("art_prayer_thickskin") + net.Receive("art_prayer_thickskin",function(ln,ply) + if ply:HasItem("Thick Skin") then + prayedplayers[ply] = true + timer.Simple(120,function() + prayedplayers[ply] = nil + end) + end + end) +end +function item.GetOptions(self) + local options = {} + options["Pray"] = function() + print("I want to pray for thick skin!") + net.Start("art_prayer_thickskin") + net.SendToServer() + end + return options +end +hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info) + if prayedplayers[ent] then + info:SetDamage(info:GetDamage()*0.8) + end +end) + +--Optional. Something run once when this item is drawn in a backpack +function item.DoOnPanel(dimagebutton) + dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") +end + +--Optional. Something run once when this item is drawn in an equiped slot +function item.DoOnEqupPanel(dimagebutton) + print("called with panel:",panel) + dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") +end + +--Optional. Called continuously, use if you need the item to display different stuff at different tiems in the backpack. +function item.Paint(self,width,height) + draw.RoundedBox(4, 0,0,width,height,Color(0,100,0)) +end + +--Optional. Called continuously, use if you need the item to display different stuff at different tiems when equiped. +function item.PaintEquiped(self,width,height) + draw.RoundedBox(4, 0,0,width,height,Color(0,100,0)) +end + +--Required, the shape of this item in a backpack. +item.Shape = { + {true}, +} + +ART.RegisterItem(item) |
