86 lines
1.9 KiB
Lua
86 lines
1.9 KiB
Lua
|
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
|
||
|
SWEP.WorldModel = Model("models/props_c17/light_domelight02_off.mdl")
|
||
|
|
||
|
SWEP.PrintName = "Camera"
|
||
|
SWEP.Description = "Allows remote observation of other areas. Zombies cannot see the camera unless they are very close.\nPress PRIMARY ATTACK to deploy.\nPress USE on a deployed camera with no owner (blue light) to reclaim it."
|
||
|
|
||
|
SWEP.AmmoIfHas = true
|
||
|
|
||
|
SWEP.Primary.ClipSize = 1
|
||
|
SWEP.Primary.DefaultClip = 1
|
||
|
SWEP.Primary.Automatic = true
|
||
|
SWEP.Primary.Ammo = "camera"
|
||
|
SWEP.Primary.Delay = 2
|
||
|
|
||
|
SWEP.Secondary.ClipSize = -1
|
||
|
SWEP.Secondary.DefaultClip = -1
|
||
|
SWEP.Secondary.Automatic = false
|
||
|
SWEP.Secondary.Ammo = "none"
|
||
|
|
||
|
--SWEP.MaxStock = 20
|
||
|
|
||
|
SWEP.WalkSpeed = SPEED_NORMAL
|
||
|
|
||
|
SWEP.GhostStatus = "ghost_camera"
|
||
|
SWEP.DeployClass = "prop_camera"
|
||
|
|
||
|
SWEP.NoDeploySpeedChange = true
|
||
|
|
||
|
function SWEP:Initialize()
|
||
|
self:SetWeaponHoldType("slam")
|
||
|
GAMEMODE:DoChangeDeploySpeed(self)
|
||
|
self:HideViewAndWorldModel()
|
||
|
end
|
||
|
|
||
|
function SWEP:SetReplicatedAmmo(count)
|
||
|
self:SetDTInt(0, count)
|
||
|
end
|
||
|
|
||
|
function SWEP:GetReplicatedAmmo()
|
||
|
return self:GetDTInt(0)
|
||
|
end
|
||
|
|
||
|
function SWEP:SecondaryAttack()
|
||
|
end
|
||
|
|
||
|
function SWEP:Reload()
|
||
|
end
|
||
|
|
||
|
function SWEP:CanPrimaryAttack()
|
||
|
if self:GetOwner():IsHolding() or self:GetOwner():GetBarricadeGhosting() then return false end
|
||
|
|
||
|
if self:GetPrimaryAmmoCount() <= 0 then
|
||
|
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function SWEP:Think()
|
||
|
if self.IdleAnimation and self.IdleAnimation <= CurTime() then
|
||
|
self.IdleAnimation = nil
|
||
|
self:SendWeaponAnim(ACT_VM_IDLE)
|
||
|
end
|
||
|
|
||
|
if SERVER then
|
||
|
local count = self:GetPrimaryAmmoCount()
|
||
|
if count ~= self:GetReplicatedAmmo() then
|
||
|
self:SetReplicatedAmmo(count)
|
||
|
self:GetOwner():ResetSpeed()
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function SWEP:Deploy()
|
||
|
gamemode.Call("WeaponDeployed", self:GetOwner(), self)
|
||
|
|
||
|
self.IdleAnimation = CurTime() + self:SequenceDuration()
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function SWEP:Holster()
|
||
|
return true
|
||
|
end
|