aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/spell_fireball.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/itemsystem/items/spell_fireball.lua')
-rw-r--r--gamemode/itemsystem/items/spell_fireball.lua39
1 files changed, 33 insertions, 6 deletions
diff --git a/gamemode/itemsystem/items/spell_fireball.lua b/gamemode/itemsystem/items/spell_fireball.lua
index 78a3693..d8e6149 100644
--- a/gamemode/itemsystem/items/spell_fireball.lua
+++ b/gamemode/itemsystem/items/spell_fireball.lua
@@ -3,9 +3,14 @@ ITEM.Name = "Fireball"
ITEM.Class = "weapon"
ITEM.Desc = "Warning: Warm"
ITEM.Model = "models/props_debris/wood_board02a.mdl"
-ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_bow")
+ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_spellfireball.png")
ITEM.HoldType = "magic"
+//Load some nessessary stuff
+game.AddParticles("particles/particletest.pcf")
+PrecacheParticleSystem("firetest")
+
+
ITEM.Recipe = {
Resources = {
["Plank"] = 2,
@@ -15,7 +20,10 @@ ITEM.Recipe = {
Tools = {},
}
-ITEM.CD = 1
+ITEM.CD = 0.25
+
+ITEM.NumFireballs = 0
+ITEM.MaxFireballs = 3
local fireball = {}
fireball["model"] = "models/hunter/blocks/cube025x025x025.mdl"
@@ -60,12 +68,31 @@ function ITEM:DoFireball(pl)
pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110))
end
-function ITEM:DoFireballFail()
+function ITEM:OnSecondary(pl,tr)
+ ParticleEffect("firetest",pl:GetPos(),pl:GetAngles(),pl)
+ if(self.NumFireballs > 0) then
+ self:DoFireball(pl)
+ self.NumFireballs = self.NumFireballs-1
+ end
+end
+local fireballfunc = function(num,pl,self)
+ if not pl then
+ print("No pl to find the weapon of")
+ return
+ end
+ local weapon = pl:GetSelectedWeapon()
+ if(not weapon) then
+ print("Could not find the weapon")
+ end
+ if(self.NumFireballs < self.MaxFireballs) then
+ self.NumFireballs = self.NumFireballs+1
+ print("New num fireballs:" .. self.NumFireballs)
+ end
end
function ITEM:OnPrimary(pl,tr)
- ParticleEffect("particletest.pcf",pl:GetPos(),pl:GetAngles(),pl)
- if (CLIENT) then return end
- pl:Cast("Fireball",self.DoFireball)
+ if(CLIENT) then return end
+ print("Attempting to cast...")
+ pl:Cast("Fireball",fireballfunc,self)
end