aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-03-05 11:55:32 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-03-05 11:55:32 -0500
commit52cf408ce832952c92804e114746b1e427576a8e (patch)
treeafcb3ec7264bb98cd992d27452bce51a3467731c
parent8d1447d13b2ec82588f52467be56b90c8ffe9e80 (diff)
downloadwintersurvival2-52cf408ce832952c92804e114746b1e427576a8e.tar.gz
wintersurvival2-52cf408ce832952c92804e114746b1e427576a8e.tar.bz2
wintersurvival2-52cf408ce832952c92804e114746b1e427576a8e.zip
Added debug data to find bug in circle minigame
-rw-r--r--content/materials/wintersurvival2/hud/ws2_icons/icon_spellteleport.pngbin0 -> 35470 bytes
-rw-r--r--entities/entities/ws_teleporter/cl_init.lua5
-rw-r--r--entities/entities/ws_teleporter/init.lua16
-rw-r--r--entities/entities/ws_teleporter/shared.lua16
-rw-r--r--gamemode/hud/games/rubickscircle.lua84
-rw-r--r--gamemode/itemsystem/items/runefire.lua5
-rw-r--r--gamemode/itemsystem/items/spell_fireball.lua8
-rw-r--r--gamemode/itemsystem/items/spell_teleport.lua73
8 files changed, 155 insertions, 52 deletions
diff --git a/content/materials/wintersurvival2/hud/ws2_icons/icon_spellteleport.png b/content/materials/wintersurvival2/hud/ws2_icons/icon_spellteleport.png
new file mode 100644
index 0000000..798f8ef
--- /dev/null
+++ b/content/materials/wintersurvival2/hud/ws2_icons/icon_spellteleport.png
Binary files differ
diff --git a/entities/entities/ws_teleporter/cl_init.lua b/entities/entities/ws_teleporter/cl_init.lua
new file mode 100644
index 0000000..6bc006e
--- /dev/null
+++ b/entities/entities/ws_teleporter/cl_init.lua
@@ -0,0 +1,5 @@
+include('shared.lua')
+
+function ENT:Draw()
+ self.Entity:DrawModel()
+end
diff --git a/entities/entities/ws_teleporter/init.lua b/entities/entities/ws_teleporter/init.lua
new file mode 100644
index 0000000..08d73f5
--- /dev/null
+++ b/entities/entities/ws_teleporter/init.lua
@@ -0,0 +1,16 @@
+AddCSLuaFile("cl_init.lua")
+AddCSLuaFile("shared.lua")
+
+include('shared.lua')
+
+function ENT:Initialize()
+ self:PhysicsInit(SOLID_VPHYSICS)
+ self:SetMoveType(MOVETYPE_NONE)
+ self:SetSolid(SOLID_VPHYSICS)
+ if(self.model) then
+ self:SetModel(self.model)
+ else
+ print("Teleporter constructed without model!, this might be an error!")
+ end
+ if (!self.Item) then self:Remove() end
+end
diff --git a/entities/entities/ws_teleporter/shared.lua b/entities/entities/ws_teleporter/shared.lua
new file mode 100644
index 0000000..000ebf6
--- /dev/null
+++ b/entities/entities/ws_teleporter/shared.lua
@@ -0,0 +1,16 @@
+ENT.Type = "anim"
+ENT.Base = "base_anim"
+
+function ENT:OnRemove()
+end
+
+function ENT:PhysicsCollide(data, phys)
+ print("We're collideing!")
+ if(self.endpoint) then
+ if(data.HitEntity:IsPlayer()) then
+ data.HitEntity:SetPos(self.endpoint)
+ end
+ else
+ print("Teleporter without endpoint, this might be an error!")
+ end
+end
diff --git a/gamemode/hud/games/rubickscircle.lua b/gamemode/hud/games/rubickscircle.lua
index cd50bf2..2e81bba 100644
--- a/gamemode/hud/games/rubickscircle.lua
+++ b/gamemode/hud/games/rubickscircle.lua
@@ -53,7 +53,7 @@ Game.Cast = function(spelltab,difficulty)
spelltab.ANIMATE_REMOVE_DURATION = 0.5
spelltab.MaxColor = 3
- spelltab.GoalNum = 5
+ spelltab.GoalNum = 2
@@ -107,7 +107,7 @@ Game.Draw = function(self)
if not input.IsKeyTrapping() then
input.StartKeyTrapping()
end
- draw.DrawText( "Fill in the empty circles with the appropriate colors", "TargetID", ScrW() * 0.5, ScrH() * 0.25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
+ draw.DrawText( "Fill in the empty circles with the appropriate colors. Click the circle to select them, and use Q nd E to rotate the circles.", "TargetID", ScrW() * 0.5, ScrH() * 0.25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
--Draw the rings
for i = 0, self.numcircle-1 do
if(self.SelectedCircle == i) then
@@ -166,47 +166,45 @@ Game.Draw = function(self)
surface.DrawCircle(x,y,20,nextcol)
--Deal with moveing stuff
- if(self.Animateingringnum != -1) then
- if(CurTime() > self.Animateingstart+self.ANIMATE_MOVEING_DURATION) then
- if(self.Animateingdirection == 1) then
- local tmp = self.Circles[self.SelectedCircle][7]
- for i = 0, 6 do
- self.Circles[self.SelectedCircle][7-i]=self.Circles[self.SelectedCircle][6-i]
- end
- self.Circles[self.SelectedCircle][0] = tmp
- self.Animateingringnum = -1
- self.Animateingdirection = 0
- --Add the new dot in, or fail if we can't
- if(self.Circles[self.numcircle-1][self.NextInputDirection] != 0) then
- print("self fail :(")
- self.Score = 0
- self.scoreboard:Remove()
- else
- self.Circles[self.numcircle-1][self.NextInputDirection] = self.NextInputColor
- self.NextInputDirection = math.Round(math.random(0,7))
- self.NextInputColor = math.Round(math.random(1,self.MaxColor))
- end
- self.ProcessMoved(self)
- elseif(self.Animateingdirection == -1) then
- local tmp = self.Circles[self.SelectedCircle][0]
- for i = 0, 6 do
- self.Circles[self.SelectedCircle][i]=self.Circles[self.SelectedCircle][i+1]
- end
- self.Circles[self.SelectedCircle][7] = tmp
- self.Animateingringnum = -1
- self.Animateingdirection = 0
- --Add the new dot in, or fail if we can't
- if(self.Circles[self.numcircle-1][self.NextInputDirection] != 0) then
- print("self fail :(")
- self.Score = 0
- self.scoreboard:Remove()
- else
- self.Circles[self.numcircle-1][self.NextInputDirection] = self.NextInputColor
- self.NextInputDirection = math.Round(math.random(0,7))
- self.NextInputColor = math.Round(math.random(1,self.MaxColor))
- end
- self.ProcessMoved(self)
+ if(self.Animateingringnum != -1 and CurTime() > self.Animateingstart+self.ANIMATE_MOVEING_DURATION) then
+ if(self.Animateingdirection == 1) then
+ local tmp = self.Circles[self.SelectedCircle][7]
+ for i = 0, 6 do
+ self.Circles[self.SelectedCircle][7-i]=self.Circles[self.SelectedCircle][6-i]
+ end
+ self.Circles[self.SelectedCircle][0] = tmp
+ self.Animateingringnum = -1
+ self.Animateingdirection = 0
+ --Add the new dot in, or fail if we can't
+ if(self.Circles[self.numcircle-1][self.NextInputDirection] != 0) then
+ print("self fail :(")
+ self.Score = 0
+ self.scoreboard:Remove()
+ else
+ self.Circles[self.numcircle-1][self.NextInputDirection] = self.NextInputColor
+ self.NextInputDirection = math.Round(math.random(0,7))
+ self.NextInputColor = math.Round(math.random(1,self.MaxColor))
+ end
+ self.ProcessMoved(self)
+ elseif(self.Animateingdirection == -1) then
+ local tmp = self.Circles[self.SelectedCircle][0]
+ for i = 0, 6 do
+ self.Circles[self.SelectedCircle][i]=self.Circles[self.SelectedCircle][i+1]
+ end
+ self.Circles[self.SelectedCircle][7] = tmp
+ self.Animateingringnum = -1
+ self.Animateingdirection = 0
+ --Add the new dot in, or fail if we can't
+ if(self.Circles[self.numcircle-1][self.NextInputDirection] != 0) then
+ print("self fail :(")
+ self.Score = 0
+ self.scoreboard:Remove()
+ else
+ self.Circles[self.numcircle-1][self.NextInputDirection] = self.NextInputColor
+ self.NextInputDirection = math.Round(math.random(0,7))
+ self.NextInputColor = math.Round(math.random(1,self.MaxColor))
end
+ self.ProcessMoved(self)
end
elseif(self.AnimateFalling and CurTime() > self.AnimateFallingStartTime + self.ANIMATE_FALLING_DURATION) then
for k,v in pairs(self.AnimateFallingColumnNum) do
@@ -285,7 +283,7 @@ end
--What to do when anything moved
Game.ProcessMoved = function(self)
- PrintTable(self.Circles)
+ PrintTable(self)
if(self.Circles == nil) then
print("OH NO, CIRCLES WAS NIL!")
return
diff --git a/gamemode/itemsystem/items/runefire.lua b/gamemode/itemsystem/items/runefire.lua
index 419712e..e629558 100644
--- a/gamemode/itemsystem/items/runefire.lua
+++ b/gamemode/itemsystem/items/runefire.lua
@@ -4,6 +4,7 @@ ITEM.Class = "resource"
ITEM.Desc = "A perpetually warm stone"
ITEM.Model = "models/props_combine/breenlight.mdl"
ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_runefire.png")
+game.AddParticles("particles/particletest.pcf")
ITEM.Structure = {
{
@@ -37,11 +38,13 @@ function ITEM:OnUse(user)
end
function ITEM:OnPrimary(ply,tr)
+ ParticleEffect("firetest",ply:GetPos()+Vector(0,0,72),ply:GetAngles(),ply)
if(CLIENT) then
- game.AddParticles("particles/particletest.pcf")
+
else
if(tr.Hit && tr.Entity && tr.Entity:IsPlayer()) then
tr.Entity:Ignite(5)
+ user.RemoveItem(self.Name,1)
end
end
diff --git a/gamemode/itemsystem/items/spell_fireball.lua b/gamemode/itemsystem/items/spell_fireball.lua
index d8e6149..ef955bf 100644
--- a/gamemode/itemsystem/items/spell_fireball.lua
+++ b/gamemode/itemsystem/items/spell_fireball.lua
@@ -77,14 +77,6 @@ function ITEM:OnSecondary(pl,tr)
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)
diff --git a/gamemode/itemsystem/items/spell_teleport.lua b/gamemode/itemsystem/items/spell_teleport.lua
new file mode 100644
index 0000000..6294955
--- /dev/null
+++ b/gamemode/itemsystem/items/spell_teleport.lua
@@ -0,0 +1,73 @@
+
+ITEM.Name = "Teleport"
+ITEM.Class = "weapon"
+ITEM.Desc = "Right click to set target location, left click to open a portal there."
+ITEM.Model = "models/props_debris/wood_board02a.mdl"
+ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_spellteleport.png")
+ITEM.HoldType = "magic"
+
+//Load some nessessary stuff
+game.AddParticles("particles/particletest.pcf")
+PrecacheParticleSystem("firetest")
+
+
+ITEM.Recipe = {
+ Resources = {
+ ["Plank"] = 2,
+ ["Rope"] = 1,
+ ["Sap"] = 1,
+ },
+ Tools = {},
+}
+
+ITEM.CD = 0.25
+
+ITEM.savedpoint = nil
+
+function ITEM:DoTeleport(score,pl,self)
+ print("DoTeleport called!")
+ if(self.savedpoint == nil) then return end
+ print("Fully successfull teleport callback:")
+ print(pl)
+ local aim = pl:GetAimVector()
+
+ local D = ents.Create("ws_teleporter")
+
+
+ D:SetPos(pl:GetShootPos()+aim*200)
+ D:SetOwner(pl)
+ D:SetAngles(aim:Angle())
+ D:Spawn()
+ D.endpoint = self.savedpoint
+ pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110))
+end
+
+local teleportfunc = function(score, pl, self)
+ print("teleportfunc called!")
+ if(self.savedpoint == nil) then return end
+ print("Fully successfull teleport callback:")
+ print(pl)
+ local aim = pl:GetAimVector()
+
+ local D = ents.Create("ws_teleporter")
+
+
+ D:SetPos(pl:GetShootPos()+aim*200)
+ D:SetOwner(pl)
+ D:SetAngles(aim:Angle())
+ D:Spawn()
+ D.endpoint = self.savedpoint
+ pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110))
+end
+
+function ITEM:OnSecondary(pl,tr)
+ print("Endpoint set?")
+ ParticleEffect("firetest",pl:GetPos(),pl:GetAngles(),pl)
+ self.savedpoint = pl:GetPos()
+end
+
+function ITEM:OnPrimary(pl,tr)
+ if(CLIENT) then return end
+ print("Attempting to cast...")
+ pl:Cast("Gateway",teleportfunc,self)
+end