zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_hunter.lua

116 lines
2.8 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
AddCSLuaFile()
if CLIENT then
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
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 = 115
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 = 0.115
SWEP.ConeMin = 0
SWEP.IronSightsPos = Vector(5.015, -8, 2.52)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.WalkSpeed = SPEED_SLOWER
SWEP.TracerName = "AR2Tracer"
function SWEP:IsScoped()
return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime()
end
--[[function SWEP:EmitFireSound()
self:EmitSound(self.Primary.Sound, 85, 80)
end]]
function SWEP:SendWeaponAnimation()
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
end
function SWEP.BulletCallback(attacker, tr, dmginfo)
local effectdata = EffectData()
effectdata:SetOrigin(tr.HitPos)
effectdata:SetNormal(tr.HitNormal)
util.Effect("hit_hunter", effectdata)
GenericBulletCallback(attacker, tr, dmginfo)
end
if CLIENT then
SWEP.IronsightsMultiplier = 0.25
function SWEP:GetViewModelPosition(pos, ang)
if self:IsScoped() then
return pos + ang:Up() * 256, ang
end
return self.BaseClass.GetViewModelPosition(self, pos, ang)
end
local matScope = Material("zombiesurvival/scope")
function SWEP:DrawHUDBackground()
if self:IsScoped() then
local scrw, scrh = ScrW(), ScrH()
local size = math.min(scrw, scrh)
surface.SetMaterial(matScope)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect((scrw - size) * 0.5, (scrh - size) * 0.5, size, size)
surface.SetDrawColor(0, 0, 0, 255)
if scrw > size then
local extra = (scrw - size) * 0.5
surface.DrawRect(0, 0, extra, scrh)
surface.DrawRect(scrw - extra, 0, extra, scrh)
end
if scrh > size then
local extra = (scrh - size) * 0.5
surface.DrawRect(0, 0, scrw, extra)
surface.DrawRect(0, scrh - extra, scrw, extra)
end
end
end
end