aboutsummaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
authorApickx <apickx@cogarr.com>2018-03-08 20:16:54 -0500
committerApickx <apickx@cogarr.com>2018-03-08 20:16:54 -0500
commit39ff835f0672e8bf30d28eddbc89254ad822a77d (patch)
tree3390b567a16fd2afafa04eb2b3756685051a9d4f /gamemode
parent4f48a4ec5f7a92857f518bba67deb52ab0ced988 (diff)
downloadwintersurvival2-39ff835f0672e8bf30d28eddbc89254ad822a77d.tar.gz
wintersurvival2-39ff835f0672e8bf30d28eddbc89254ad822a77d.tar.bz2
wintersurvival2-39ff835f0672e8bf30d28eddbc89254ad822a77d.zip
Fixed the teleporter spell
Teleporter spell now works correctly
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/itemsystem/items/spell_teleport.lua60
1 files changed, 36 insertions, 24 deletions
diff --git a/gamemode/itemsystem/items/spell_teleport.lua b/gamemode/itemsystem/items/spell_teleport.lua
index 38bbac6..e86f388 100644
--- a/gamemode/itemsystem/items/spell_teleport.lua
+++ b/gamemode/itemsystem/items/spell_teleport.lua
@@ -10,6 +10,15 @@ ITEM.HoldType = "magic"
game.AddParticles("particles/particletest.pcf")
PrecacheParticleSystem("firetest")
+ITEM.Structure = {
+ {
+ Bone = "ValveBiped.Bip01_R_Hand",
+ Model = "models/props_junk/Rock001a.mdl",
+ Size = Vector(1,1,1),
+ Pos = Vector(0,0,0),
+ Ang = Angle(0,0,0),
+ },
+}
ITEM.Recipe = {
Resources = {
@@ -21,6 +30,7 @@ ITEM.Recipe = {
}
ITEM.CD = 0.25
+ITEM.Range = 9999
--[[
All saved points are stored in a global table where
@@ -37,39 +47,39 @@ function ITEM:DoTeleport(score,pl,self)
local D = ents.Create("ws_teleporter")
D:SetPos(pl:GetShootPos() + aim * 200)
- D:SetOwner(pl)
+ -- D:SetOwner(pl)
D:SetAngles(aim:Angle())
D.endpoint = savedpoint[pl]
D:Spawn()
D:Activate()
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 ITEM.savedpoint[ == nil then return end
- if score != 100 then return end
- print("Fully successfull teleport callback:")
- print(pl)
- pl:SetPos(self.savedpoint)
-
- local aim = pl:GetAimVector()
- local D = ents.Create("ws_teleporter")
- D:SetModel("models/props_wasteland/wood_fence02a.mdl")
-
- D:SetPos(pl:GetShootPos()+aim*200)
- D:SetOwner(pl)
- D:SetAngles(aim:Angle())
- D:Spawn()
- D.endpoint = self.savedpoint
+-- local teleportfunc = function(score, pl, self)
+-- print("teleportfunc called!")
+-- if ITEM.savedpoint[ == nil then return end
+-- if score != 100 then return end
+-- print("Fully successfull teleport callback:")
+-- print(pl)
+-- pl:SetPos(self.savedpoint)
+--
+-- local aim = pl:GetAimVector()
+--
+-- local D = ents.Create("ws_teleporter")
+-- D:SetModel("models/props_wasteland/wood_fence02a.mdl")
+--
+-- 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
- pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110))
-end
-]]--
function ITEM:OnSecondary(pl,tr)
- print("Endpoint set?")
+ pl:ChatPrint("Endpoint set?")
ParticleEffect("firetest",pl:GetPos(),pl:GetAngles(),pl)
savedpoint[pl] = pl:GetPos()
end
@@ -77,6 +87,8 @@ end
function ITEM:OnPrimary(pl,tr)
if CLIENT then return end
print("Attempting to cast...")
- pl:Cast("Gateway",teleportfunc,self)
+ pl:Cast("Gateway",function(score,pl,s)
+ self:DoTeleport(score,pl,s)
+ end,self)
end
RegisterItem(ITEM)