aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/prayersystem/prayers/ninelives.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/shared/prayersystem/prayers/ninelives.lua')
-rw-r--r--gamemode/shared/prayersystem/prayers/ninelives.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/gamemode/shared/prayersystem/prayers/ninelives.lua b/gamemode/shared/prayersystem/prayers/ninelives.lua
new file mode 100644
index 0000000..4c7a13a
--- /dev/null
+++ b/gamemode/shared/prayersystem/prayers/ninelives.lua
@@ -0,0 +1,51 @@
+--[[
+ An example item
+]]
+local item = {}
+
+--Required, a name, all item names must be unique
+item.Name = "Nine Lives"
+
+--Optional, a tooltip to display when hovered over
+item.Tooltip = "A prayer to the rouge god to prevent fall dammage for the next 9 falls that you would have taken dammage, or for 5 minutes, whichever comes first."
+
+--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_ninelives")
+ net.Receive("art_prayer_ninelives",function(ln,ply)
+ if ply:HasPrayer("Nine Lives") then
+ prayedplayers[ply] = 9
+ timer.Simple(60 * 5,function()
+ prayedplayers[ply] = nil
+ end)
+ end
+ end)
+end
+
+if CLIENT then
+ local lastprayer = CurTime()
+ prayer.Pray = function(self)
+ if CurTime() > lastprayer + 0 then
+ net.Start("art_prayer_ninelives")
+ net.SendToServer()
+ lastprayer = CurTime()
+ end
+ end
+
+ hook.Add("")
+end
+
+hook.Add( "EntityTakeDamage" , "artery_ninelives" , function(ent,info)
+ if info:GetDamageType() == DMG_FALL and prayedplayers[ent] ~= nil and prayedplayers[ent] > 0 then
+ info:SetDamage(0)
+ end
+end)
+
+--Optional. Something run once when this item is drawn in a backpack
+function prayer.DoOnPanel(dimagebutton)
+ dimagebutton:SetImage( "prayericons/ninelives.png")
+end
+
+
+ART.RegisterPrayer(item)