zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_slugrifle.lua
JetBoom 45b5b7e952 Slug Rifle headshot damage now displays 9999.
Slug Rifle headshots now display 9999 as their damage value (this is
only display damage, the actual damage isn't even relevant).
Slug Rifle passive no longer works on bosses.
2014-11-08 23:14:15 -05:00

138 lines
5.2 KiB
Lua

AddCSLuaFile()
if CLIENT then
SWEP.PrintName = "'Tiny' Slug Rifle"
SWEP.Description = "This powerful rifle instantly kills any zombie with a head shot."
SWEP.Slot = 3
SWEP.SlotPos = 0
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 50
SWEP.HUD3DBone = "v_weapon.xm1014_Bolt"
SWEP.HUD3DPos = Vector(-1, 0, 0)
SWEP.HUD3DAng = Angle(0, 0, 0)
SWEP.HUD3DScale = 0.02
SWEP.VElements = {
["base"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360x2.mdl", bone = "v_weapon.xm1014_Parent", rel = "", pos = Vector(0, -6, -9), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.094), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["base+"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "v_weapon.xm1014_Parent", rel = "base", pos = Vector(0, 0, 8.5), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "models/screenspace", skin = 0, bodygroup = {} },
["base++"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "v_weapon.xm1014_Parent", rel = "base", pos = Vector(0, 0, 2), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["base"] = { type = "Model", model = "models/props_phx/construct/metal_plate_curve360x2.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(13, 1, -7), angle = Angle(80, 0, 0), size = Vector(0.014, 0.014, 0.094), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["base+"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 8.5), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["base++"] = { type = "Model", model = "models/props_phx/construct/metal_angle360.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, 0, 2), angle = Angle(0, 0, 0), size = Vector(0.014, 0.014, 0.014), color = Color(255, 255, 255, 45), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
end
SWEP.Base = "weapon_zs_base"
SWEP.HoldType = "ar2"
SWEP.ViewModel = "models/weapons/cstrike/c_shot_xm1014.mdl"
SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl"
SWEP.UseHands = true
SWEP.Primary.Sound = Sound("Weapon_AWP.Single")
SWEP.Primary.Damage = 135
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 1.5
SWEP.ReloadDelay = SWEP.Primary.Delay
SWEP.Primary.ClipSize = 2
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "357"
SWEP.Primary.DefaultClip = 10
SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW
SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN
SWEP.ConeMax = 0.12
SWEP.ConeMin = 0.005
SWEP.IronSightsPos = Vector() --Vector(-7.3, 9, 2.3)
SWEP.IronSightsAng = Vector(0, -1, 0)
SWEP.WalkSpeed = SPEED_SLOWER
function SWEP:IsScoped()
return self:GetIronsights() and self.fIronTime and self.fIronTime + 0.25 <= CurTime()
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
SWEP.NextReload = 0
function SWEP:Reload()
if CurTime() < self.NextReload then return end
self.NextReload = CurTime() + self.ReloadDelay
local owner = self.Owner
if self:Clip1() < self.Primary.ClipSize and 0 < owner:GetAmmoCount(self.Primary.Ammo) then
self:DefaultReload(ACT_VM_RELOAD)
owner:DoReloadEvent()
self:SetNextPrimaryFire(CurTime() + self.ReloadDelay)
timer.Simple(0.25, function()
if self:IsValid() and IsValid(owner) then
self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH)
end
end)
end
end
function SWEP.BulletCallback(attacker, tr, dmginfo)
if tr.HitGroup == HITGROUP_HEAD then
local ent = tr.Entity
if ent:IsValid() and ent:IsPlayer() then
if ent:Team() == TEAM_UNDEAD and ent:GetZombieClassTable().Boss then
GenericBulletCallback(attacker, tr, dmginfo)
return
end
ent.Gibbed = CurTime()
end
if gamemode.Call("PlayerShouldTakeDamage", ent, attacker) then
ent:SetHealth(math.max(ent:Health() - 400, 1))
end
end
INFDAMAGEFLOATER = true
GenericBulletCallback(attacker, tr, dmginfo)
end