diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-08-27 17:08:46 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-08-27 17:08:46 -0400 |
| commit | 9adcb3c73a8d0e7ecfe66b30da630c6c2e67f03a (patch) | |
| tree | d65b57e144317e5b49ccdd549b2f97c61d54bd1d /gamemode/shared/prayersystem/prayers/preditorinstinct.lua | |
| parent | d4f197a35c207c9891d3f4dc5e9708af48c935de (diff) | |
| download | artery-9adcb3c73a8d0e7ecfe66b30da630c6c2e67f03a.tar.gz artery-9adcb3c73a8d0e7ecfe66b30da630c6c2e67f03a.tar.bz2 artery-9adcb3c73a8d0e7ecfe66b30da630c6c2e67f03a.zip | |
Moved prayers to their own system
Diffstat (limited to 'gamemode/shared/prayersystem/prayers/preditorinstinct.lua')
| -rw-r--r-- | gamemode/shared/prayersystem/prayers/preditorinstinct.lua | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua new file mode 100644 index 0000000..8ba7b87 --- /dev/null +++ b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua @@ -0,0 +1,67 @@ +--[[ + An example item +]] +local item = {} + +--Required, a name, all item names must be unique +item.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" + +--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_preditorinstinct") + net.Receive("art_prayer_preditorinstinct",function(ln,ply) + if ply:HasItem(item.Name) then + prayedplayers[ply] = true + timer.Simple(60,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_preditorinstinct") + net.SendToServer() + lastprayer = CurTime() + end + end +end +--called continuously to buff players +local buffedplayers = {} +local function buffplayers() + for k,v in pairs(prayedplayers) do + if buffedplayers[k] ~= nil then continue end + --Find nearby wounded players or npcs + print("Checking if ", k, "should be buffed") + local wents = ents.FindInSphere(k:GetPos()+Vector(0,0,64),500) + for i,j in pairs(wents) do + print("Checking if ",j, "has taken dammage") + if k ~= j and j:Health() < j:GetMaxHealth() then + print("I buffed a player",k, "because ", j ,"has taken dammage") + k:SetWalkSpeed(k:GetWalkSpeed()*1.3) + buffedplayers[k] = true + timer.Simple(60,function() + k:SetWalkSpeed(k:GetWalkSpeed()*(1/1.3)) + buffedplayers[k] = nil + end) + goto nextply + end + end + ::nextply:: + end + timer.Simple(2,buffplayers) +end +buffplayers() + +--Optional. Something run once when this item is drawn in a backpack +function item.DoOnPanel(dimagebutton) + dimagebutton:SetImage( "prayericons/preditorinstinct.png") +end + +ART.RegisterPrayer(item) |
