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

168 lines
3.8 KiB
Lua

AddCSLuaFile()
SWEP.PrintName = "'Hunter' Rifle"
SWEP.Description = "Fires special large caliber rounds. The reloading time is slow but it packs a powerful punch."
SWEP.Slot = 3
SWEP.SlotPos = 0
if CLIENT then
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 60
SWEP.HUD3DBone = "v_weapon.awm_parent"
SWEP.HUD3DPos = Vector(-1.25, -3.5, -16)
SWEP.HUD3DAng = Angle(0, 0, 0)
SWEP.HUD3DScale = 0.02
end
sound.Add(
{
name = "Weapon_Hunter.Single",
channel = CHAN_WEAPON,
volume = 1.0,
soundlevel = 100,
pitchstart = 134,
pitchend = 10,
sound = "weapons/awp/awp1.wav"
})
SWEP.Base = "weapon_zs_base"
SWEP.HoldType = "ar2"
SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl"
SWEP.WorldModel = "models/weapons/w_snip_awp.mdl"
SWEP.UseHands = true
SWEP.ReloadSound = Sound("Weapon_AWP.ClipOut")
SWEP.Primary.Sound = Sound("Weapon_Hunter.Single")
SWEP.Primary.Damage = 111
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 1.5
SWEP.ReloadDelay = SWEP.Primary.Delay
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "357"
SWEP.Primary.DefaultClip = 15
SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW
SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN
SWEP.ConeMax = 5.75
SWEP.ConeMin = 0
SWEP.IronSightsPos = Vector(5.015, -8, 2.52)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.WalkSpeed = SPEED_SLOWER
SWEP.Tier = 3
SWEP.TracerName = "AR2Tracer"
GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1)
GAMEMODE:AddNewRemantleBranch(SWEP, 1, "'Hunter' Explosive Rifle", "Uses twice as much ammo, reloads slowly, but overkill damage is dealt as an explosion", function(wept)
wept.Primary.ClipSize = 2
wept.RequiredClip = 2
wept.ReloadSpeed = 0.9
wept.OnZombieKilled = function(self, zombie, total, dmginfo)
local killer = self:GetOwner()
local minushp = -zombie:Health()
if killer:IsValid() and minushp > 10 then
local pos = zombie:GetPos()
timer.Simple(0.15, function()
util.BlastDamagePlayer(killer:GetActiveWeapon(), killer, pos, 72, minushp, DMG_ALWAYSGIB, 0.94)
end)
local effectdata = EffectData()
effectdata:SetOrigin(pos)
util.Effect("Explosion", effectdata, true, true)
end
end
end)
function SWEP:IsScoped()
return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime()
end
function SWEP:SendWeaponAnimation()
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
local owner = self:GetOwner()
local vm = owner:GetViewModel()
local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier()
if vm:IsValid() then
vm:SetPlaybackRate(0.5 * speed)
end
self:SetReloadFinish(CurTime() + 2.5 / speed)
end
function SWEP:MockReload()
local speed = self.ReloadSpeed * self:GetReloadSpeedMultiplier()
self:SetReloadFinish(CurTime() + 2.5 / speed)
end
function SWEP:Reload()
local owner = self:GetOwner()
if owner:IsHolding() then return end
if self:GetIronsights() then
self:SetIronsights(false)
end
if self:CanReload() then
self:MockReload()
end
end
function SWEP:Deploy()
self.BaseClass.Deploy(self)
if self:Clip1() <= 0 then
self:MockReload()
end
return true
end
function SWEP:Think()
self.BaseClass.Think(self)
if self:Clip1() <= 0 and self:GetPrimaryAmmoCount() <= 0 then
self:MockReload()
end
end
function SWEP.BulletCallback(attacker, tr, dmginfo)
local effectdata = EffectData()
effectdata:SetOrigin(tr.HitPos)
effectdata:SetNormal(tr.HitNormal)
util.Effect("hit_hunter", effectdata)
end
if CLIENT then
SWEP.IronsightsMultiplier = 0.25
function SWEP:GetViewModelPosition(pos, ang)
if GAMEMODE.DisableScopes then return end
if self:IsScoped() then
return pos + ang:Up() * 256, ang
end
return self.BaseClass.GetViewModelPosition(self, pos, ang)
end
function SWEP:DrawHUDBackground()
if GAMEMODE.DisableScopes then return end
if self:IsScoped() then
self:DrawRegularScope()
end
end
end