From d4f197a35c207c9891d3f4dc5e9708af48c935de Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 9 Aug 2016 17:53:52 -0400 Subject: Added some weapons --- gamemode/shared/itemsystem/prayers/thickskin.lua | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 gamemode/shared/itemsystem/prayers/thickskin.lua (limited to 'gamemode/shared/itemsystem/prayers/thickskin.lua') 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) -- cgit v1.2.3-70-g09d2