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

93 lines
1.8 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
AddCSLuaFile()
SWEP.PrintName = "Detonation Pack Remote"
SWEP.Description = "Allows the user to remotely detonate their detonation packs."
SWEP.Slot = 4
SWEP.SlotPos = 0
2014-10-02 08:49:54 +08:00
if CLIENT then
SWEP.ViewModelFOV = 50
SWEP.BobScale = 0.5
SWEP.SwayScale = 0.5
end
SWEP.ViewModel = "models/weapons/c_slam.mdl"
SWEP.WorldModel = "models/weapons/w_slam.mdl"
SWEP.UseHands = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_NORMAL
SWEP.NoMagazine = true
SWEP.Undroppable = true
SWEP.NoPickupNotification = true
SWEP.HoldType = "slam"
SWEP.NoDeploySpeedChange = true
2014-10-02 08:49:54 +08:00
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
2014-10-02 08:49:54 +08:00
end
if SERVER then
function SWEP:Think()
for _, ent in pairs(ents.FindByClass("prop_detpack")) do
if ent:GetOwner() == self:GetOwner() then
2014-10-02 08:49:54 +08:00
return
end
end
self:GetOwner():StripWeapon(self:GetClass())
2014-10-02 08:49:54 +08:00
end
end
function SWEP:PrimaryAttack()
self:SendWeaponAnim(ACT_SLAM_DETONATOR_DETONATE)
if CLIENT then return end
for _, ent in pairs(ents.FindByClass("prop_detpack")) do
if ent:GetOwner() == self:GetOwner() and ent:GetExplodeTime() == 0 then
2014-10-02 08:49:54 +08:00
ent:SetExplodeTime(CurTime() + ent.ExplosionDelay)
end
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
return false
end
2014-10-02 08:49:54 +08:00
function SWEP:Deploy()
gamemode.Call("WeaponDeployed", self:GetOwner(), self)
2014-10-02 08:49:54 +08:00
self:SendWeaponAnim(ACT_SLAM_DETONATOR_IDLE)
return true
end
function SWEP:Holster()
return true
end
if not CLIENT then return end
function SWEP:DrawWeaponSelection(x, y, w, h, alpha)
self:BaseDrawWeaponSelection(x, y, w, h, alpha)
2014-10-02 08:49:54 +08:00
end
function SWEP:Think()
end