From 09de17b25912ca1ed79afcf9ecfc3291fe34a96d Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 24 Oct 2016 12:10:40 -0400 Subject: fixed prayers to work with the prayer system --- .../shared/prayersystem/prayers/lesserevasion.lua | 17 ++++++------ gamemode/shared/prayersystem/prayers/ninelives.lua | 28 +++++++++---------- gamemode/shared/prayersystem/prayers/notdarkrp.lua | 21 +++++++------- .../prayersystem/prayers/preditorinstinct.lua | 26 +++++++++--------- gamemode/shared/prayersystem/prayers/thickskin.lua | 32 +++++++++++----------- 5 files changed, 61 insertions(+), 63 deletions(-) (limited to 'gamemode/shared') diff --git a/gamemode/shared/prayersystem/prayers/lesserevasion.lua b/gamemode/shared/prayersystem/prayers/lesserevasion.lua index d4dc5f8..7e8a829 100644 --- a/gamemode/shared/prayersystem/prayers/lesserevasion.lua +++ b/gamemode/shared/prayersystem/prayers/lesserevasion.lua @@ -23,17 +23,18 @@ if SERVER then end) end -if CLIENT then - local lastprayer = CurTime() - prayer.Pray = function(self) - if CurTime() > lastprayer + 0 then - net.Start("art_prayer_lesserevasion") - net.SendToServer() - lastprayer = CurTime() - end + +local lastprayer = CurTime() +prayer.Pray = function(self) + if SERVER then return end + if CurTime() > lastprayer + 0 then + net.Start("art_prayer_lesserevasion") + net.SendToServer() + lastprayer = CurTime() end end + hook.Add( "SetupMove", "artery_prayer_lesserevasion", function( ply, mv, cmd ) if prayedplayers[ply] and not ply:OnGround() then local mdir = ART.playermovedir(ply) diff --git a/gamemode/shared/prayersystem/prayers/ninelives.lua b/gamemode/shared/prayersystem/prayers/ninelives.lua index 4c7a13a..1f5a4e6 100644 --- a/gamemode/shared/prayersystem/prayers/ninelives.lua +++ b/gamemode/shared/prayersystem/prayers/ninelives.lua @@ -1,13 +1,13 @@ --[[ - An example item + An example prayer ]] -local item = {} +local prayer = {} --Required, a name, all item names must be unique -item.Name = "Nine Lives" +prayer.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." +prayer.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 = {} @@ -23,17 +23,15 @@ if SERVER then 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("") +local lastprayer = CurTime() +prayer.Pray = function(self) + if SERVER then return end + if CurTime() > lastprayer + 0 then + net.Start("art_prayer_ninelives") + net.SendToServer() + lastprayer = CurTime() + end end hook.Add( "EntityTakeDamage" , "artery_ninelives" , function(ent,info) @@ -48,4 +46,4 @@ function prayer.DoOnPanel(dimagebutton) end -ART.RegisterPrayer(item) +ART.RegisterPrayer(prayer) diff --git a/gamemode/shared/prayersystem/prayers/notdarkrp.lua b/gamemode/shared/prayersystem/prayers/notdarkrp.lua index e62064c..7820351 100644 --- a/gamemode/shared/prayersystem/prayers/notdarkrp.lua +++ b/gamemode/shared/prayersystem/prayers/notdarkrp.lua @@ -11,19 +11,18 @@ prayer.Tooltip = "Hello, and welcome to Artery, Enjoy your stay" --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! -if CLIENT then - local lastpray = CurTime() +local lastpray = CurTime() - function prayer.Pray(self) - if CurTime() > lastpray + 5 then - local helppanel = vgui.Create("DFrame") - helppanel:SetSize(ScrW()/3,ScrH()) - helppanel:Center() - helppanel:MakePopup() - helppanel:SetText("Help") +function prayer.Pray(self) + if SERVER then return end + if CurTime() > lastpray + 5 then + local helppanel = vgui.Create("DFrame") + helppanel:SetSize(ScrW()/3,ScrH()) + helppanel:Center() + helppanel:MakePopup() + helppanel:SetText("Help") - lastpray = CurTime() - end + lastpray = CurTime() end end diff --git a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua index 8ba7b87..988904c 100644 --- a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua +++ b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua @@ -1,13 +1,13 @@ --[[ An example item ]] -local item = {} +local prayer = {} --Required, a name, all item names must be unique -item.Name = "Preditor Instinct" +prayer.Name = "Preditor Instinct" --Optional, a tooltip to display when hovered over -item.Tooltip = "A prayer to the rouge god to grant you 30% movement when chaseing a wounded target" +prayer.Tooltip = "A prayer to the rouge god to grant you 30% movement when chaseing a wounded target" --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 = {} @@ -22,14 +22,14 @@ if SERVER then end end) end -if CLIENT then - local lastprayer = CurTime() - prayer.Pray = function(self) - if CurTime() > lastprayer + 0 then - net.Start("art_prayer_preditorinstinct") - net.SendToServer() - lastprayer = CurTime() - end + +local lastprayer = CurTime() +prayer.Pray = function(self) + if SERVER then return end + if CurTime() > lastprayer + 0 then + net.Start("art_prayer_preditorinstinct") + net.SendToServer() + lastprayer = CurTime() end end --called continuously to buff players @@ -60,8 +60,8 @@ end buffplayers() --Optional. Something run once when this item is drawn in a backpack -function item.DoOnPanel(dimagebutton) +function prayer.DoOnPanel(dimagebutton) dimagebutton:SetImage( "prayericons/preditorinstinct.png") end -ART.RegisterPrayer(item) +ART.RegisterPrayer(prayer) diff --git a/gamemode/shared/prayersystem/prayers/thickskin.lua b/gamemode/shared/prayersystem/prayers/thickskin.lua index 41d5fb5..739a8b9 100644 --- a/gamemode/shared/prayersystem/prayers/thickskin.lua +++ b/gamemode/shared/prayersystem/prayers/thickskin.lua @@ -1,22 +1,22 @@ --[[ - An example item + An example prayer ]] -local item = {} +local prayer = {} --Required, a name, all item names must be unique -item.Name = "Thick Skin" +prayer.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" +prayer.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) +prayer.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) +prayer.DeSerialize = function(self,string) print("Trying to deserialize!") return self end @@ -34,14 +34,14 @@ if SERVER then end end) end -if CLIENT then - local lastprayer = CurTime() - prayer.Pray = function(self) - if CurTime() > lastprayer + 0 then - net.Start("art_prayer_thickskin") - net.SendToServer() - lastprayer = CurTime() - end + +local lastprayer = CurTime() +prayer.Pray = function(self) + if SERVER then return end + if CurTime() > lastprayer + 0 then + net.Start("art_prayer_thickskin") + net.SendToServer() + lastprayer = CurTime() end end hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info) @@ -51,9 +51,9 @@ hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info) end) --Optional. Something run once when this item is drawn in a backpack -function item.DoOnPanel(dimagebutton) +function prayer.DoOnPanel(dimagebutton) dimagebutton:SetImage( "prayericons/thickskin.png") end -ART.RegisterPrayer(item) +ART.RegisterPrayer(prayer) -- cgit v1.2.3-70-g09d2