zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_harpoon_te.lua
William Moodhe e9da54c2f9 ZS updates for 2014-2018
Too many changes to list.
2018-05-01 18:32:59 -04:00

39 lines
1.1 KiB
Lua

AddCSLuaFile()
SWEP.PrintName = "Tethered Harpoon"
SWEP.Base = "weapon_zs_harpoon"
function SWEP:SecondaryAttack()
if not self:CanPrimaryAttack() then return end
local owner = self:GetOwner()
local tr = owner:TraceLine(60)
if tr.HitWorld or (tr.Entity:IsValid() and not tr.Entity:IsPlayer()) then return end
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
self:SendWeaponAnim(ACT_VM_MISSCENTER)
owner:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE)
self.NextDeploy = CurTime() + 0.75
if SERVER then
local ent = ents.Create("projectile_harpoon_te")
if ent:IsValid() then
ent:SetPos(owner:GetShootPos())
ent:SetAngles(owner:EyeAngles())
ent:SetOwner(owner)
ent:SetPuller(owner)
ent.ProjDamage = self.MeleeDamage * 0.75
ent.BaseWeapon = self:GetClass()
ent:Spawn()
ent.Team = owner:Team()
local phys = ent:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
phys:SetVelocityInstantaneous(self:GetOwner():GetAimVector() * 700 * (owner.ObjectThrowStrengthMul or 1))
end
end
owner:StripWeapon(self:GetClass())
end
end