aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/materials/wintersurvival2/hud/ws2_icons/icon_spellfireball.pngbin0 -> 31157 bytes
-rw-r--r--content/particles/particles_manifest.txt4
-rw-r--r--gamemode/hud/games/rubickscircle.lua12
-rw-r--r--gamemode/init.lua2
-rw-r--r--gamemode/itemsystem/items/spell_fireball.lua39
-rw-r--r--gamemode/shared.lua2
-rw-r--r--gamemode/shared/player_spellcast.lua7
7 files changed, 57 insertions, 9 deletions
diff --git a/content/materials/wintersurvival2/hud/ws2_icons/icon_spellfireball.png b/content/materials/wintersurvival2/hud/ws2_icons/icon_spellfireball.png
new file mode 100644
index 0000000..2a299e7
--- /dev/null
+++ b/content/materials/wintersurvival2/hud/ws2_icons/icon_spellfireball.png
Binary files differ
diff --git a/content/particles/particles_manifest.txt b/content/particles/particles_manifest.txt
new file mode 100644
index 0000000..37c8bdc
--- /dev/null
+++ b/content/particles/particles_manifest.txt
@@ -0,0 +1,4 @@
+particles_manifest
+{
+ "file" "particles/particletest.pcf"
+}
diff --git a/gamemode/hud/games/rubickscircle.lua b/gamemode/hud/games/rubickscircle.lua
index 528f62b..5982fd1 100644
--- a/gamemode/hud/games/rubickscircle.lua
+++ b/gamemode/hud/games/rubickscircle.lua
@@ -1 +1,11 @@
-print(" second file to see if something's wrong with file function")
+--A file to show what functions are used for minigames
+print("rubick's circle included!")
+
+--Required functions
+--Called once when the plyer starts casting
+Game.Cast = function(spelltab,difficulty)
+end
+
+--Called continuously while the player is casting
+Game.Draw = function(self)
+end
diff --git a/gamemode/init.lua b/gamemode/init.lua
index d09a5b6..1515aac 100644
--- a/gamemode/init.lua
+++ b/gamemode/init.lua
@@ -36,6 +36,8 @@ function GM:Initialize()
resource.AddDir("models/gearfox")
resource.AddDir("sound/mawbase")
+ resource.AddDir("particles")
+
resource.AddFile("models/weapons/w_archersword/w_archersword.mdl")
resource.AddFile("materials/models/weapons/archersword.vmt")
end
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
diff --git a/gamemode/shared.lua b/gamemode/shared.lua
index 031025e..cdb05e9 100644
--- a/gamemode/shared.lua
+++ b/gamemode/shared.lua
@@ -16,6 +16,8 @@ GM.Website = "www.cogarr.org"
local Zero = Vector(0,0,0)
+
+
function GM:Move(ply,mv)
if (ply:IsPigeon() or !ply:Alive()) then mv:SetVelocity(-ply:GetVelocity()) return mv end
end
diff --git a/gamemode/shared/player_spellcast.lua b/gamemode/shared/player_spellcast.lua
index 0cf2108..20a6cb5 100644
--- a/gamemode/shared/player_spellcast.lua
+++ b/gamemode/shared/player_spellcast.lua
@@ -8,9 +8,10 @@ if(SERVER) then
util.AddNetworkString("CastSpell")
util.AddNetworkString("FinishedCasting")
- function meta:Cast(spellname, callback)
+ function meta:Cast(spellname, callback, weapon)
if(self.casting) then return end
self.casting = callback
+ self.wep = weapon
print("Casting " .. spellname)
net.Start("CastSpell")
net.WriteString(spellname)
@@ -20,7 +21,9 @@ if(SERVER) then
net.Receive("FinishedCasting",function(len,pl)
if(pl.casting) then
print("Finished casting message received by server: " .. pl:Nick())
- pl.casting(net.ReadInt(BITCOUNT),pl)
+ local score = net.ReadInt(BITCOUNT)
+ print("Calling callback with " .. score .. " and " .. pl:Nick())
+ pl.casting(score,pl,pl.wep)
pl.casting = nil
end
end)