diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-10-21 22:51:41 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-10-21 22:51:41 -0400 |
| commit | 50537786ae45d0e12a1dc4265e0d40d2fd4fbc4b (patch) | |
| tree | a75d44f275eeee4464570b0b3d238244830fcaf1 /gamemode/itemsystem/items/spell_teleport.lua | |
| parent | 82bcf2c8e3c64fb06bd0094ab5d889bd15a4948a (diff) | |
| parent | b0169e7ca20fd9fa4ae889af8fff16d2bf638a18 (diff) | |
| download | wintersurvival2-50537786ae45d0e12a1dc4265e0d40d2fd4fbc4b.tar.gz wintersurvival2-50537786ae45d0e12a1dc4265e0d40d2fd4fbc4b.tar.bz2 wintersurvival2-50537786ae45d0e12a1dc4265e0d40d2fd4fbc4b.zip | |
Various bugfixes and updates, gamemode should be playable again
Diffstat (limited to 'gamemode/itemsystem/items/spell_teleport.lua')
| -rw-r--r-- | gamemode/itemsystem/items/spell_teleport.lua | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/gamemode/itemsystem/items/spell_teleport.lua b/gamemode/itemsystem/items/spell_teleport.lua index 4faed17..686d5d1 100644 --- a/gamemode/itemsystem/items/spell_teleport.lua +++ b/gamemode/itemsystem/items/spell_teleport.lua @@ -6,7 +6,7 @@ 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 +--Load some nessessary stuff game.AddParticles("particles/particletest.pcf") PrecacheParticleSystem("firetest") @@ -22,33 +22,37 @@ ITEM.Recipe = { ITEM.CD = 0.25 -ITEM.savedpoint = nil +--[[ + All saved points are stored in a global table where + ITEM.savedpoint[player] = <saved point vector> +]] +ITEM.savedpoint = {} function ITEM:DoTeleport(score,pl,self) print("DoTeleport called!") - if(self.savedpoint == nil) then return end - print("Fully successfull teleport callback:") + if ITEM.savedpoint[pl] == 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:SetPos(pl:GetShootPos() + aim * 200) D:SetOwner(pl) D:SetAngles(aim:Angle()) - D.endpoint = self.savedpoint + D.endpoint = ITEM.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(self.savedpoint == nil) then return end - if(score != 100) then return end - print("Fully successfull teleport callback:") + 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") @@ -59,18 +63,19 @@ local teleportfunc = function(score, pl, self) 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() + ITEM.savedpoint[pl] = pl:GetPos() end function ITEM:OnPrimary(pl,tr) - if(CLIENT) then return end + if CLIENT then return end print("Attempting to cast...") pl:Cast("Gateway",teleportfunc,self) end |
