2014-10-02 08:49:54 +08:00
SWEP.ViewModel = " models/weapons/v_pistol.mdl "
SWEP.WorldModel = " models/Combine_turrets/Floor_turret.mdl "
2018-05-02 06:32:59 +08:00
SWEP.PrintName = " Gun Turret "
SWEP.Description = " This automated turret requires constant upkeep to be useful. \n Press PRIMARY ATTACK to deploy the turret. \n Press SECONDARY ATTACK and RELOAD to rotate the turret. \n Press USE on a deployed turret to give it some of your ammunition. \n Press USE on a deployed turret with no owner (blue light) to reclaim it. "
2014-10-02 08:49:54 +08:00
SWEP.AmmoIfHas = true
SWEP.Primary . ClipSize = 1
SWEP.Primary . DefaultClip = 1
SWEP.Primary . Automatic = true
SWEP.Primary . Ammo = " thumper "
SWEP.Primary . Delay = 2
2018-05-02 06:32:59 +08:00
SWEP.Primary . Damage = 8.8
2014-10-02 08:49:54 +08:00
SWEP.Secondary . ClipSize = - 1
SWEP.Secondary . DefaultClip = - 1
SWEP.Secondary . Automatic = false
SWEP.Secondary . Ammo = " none "
2018-05-02 06:32:59 +08:00
SWEP.MaxStock = 5
2014-10-02 08:49:54 +08:00
SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
2018-05-02 06:32:59 +08:00
SWEP.GhostStatus = " ghost_gunturret "
SWEP.DeployClass = " prop_gunturret "
SWEP.Channel = " turret "
SWEP.TurretAmmoType = " smg1 "
SWEP.TurretAmmoStartAmount = 250
SWEP.TurretSpread = 2
SWEP.NoDeploySpeedChange = true
SWEP.AllowQualityWeapons = true
GAMEMODE : AttachWeaponModifier ( SWEP , WEAPON_MODIFIER_TURRET_SPREAD , - 0.4 )
2014-10-02 08:49:54 +08:00
function SWEP : Initialize ( )
2014-11-12 08:15:49 +08:00
self : SetWeaponHoldType ( " slam " )
2018-05-02 06:32:59 +08:00
GAMEMODE : DoChangeDeploySpeed ( self )
2014-10-02 08:49:54 +08:00
self : HideViewAndWorldModel ( )
2018-05-02 06:32:59 +08:00
self.ResupplyAmmoType = self.TurretAmmoType
2014-10-02 08:49:54 +08:00
end
function SWEP : SetReplicatedAmmo ( count )
self : SetDTInt ( 0 , count )
end
function SWEP : GetReplicatedAmmo ( )
return self : GetDTInt ( 0 )
end
function SWEP : GetWalkSpeed ( )
if self : GetPrimaryAmmoCount ( ) > 0 then
return self.FullWalkSpeed
end
end
function SWEP : SecondaryAttack ( )
end
function SWEP : Reload ( )
end
function SWEP : CanPrimaryAttack ( )
2018-05-02 06:32:59 +08:00
if self : GetOwner ( ) : IsHolding ( ) or self : GetOwner ( ) : GetBarricadeGhosting ( ) then return false end
2014-10-02 08:49:54 +08:00
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 )
2018-05-02 06:32:59 +08:00
self : GetOwner ( ) : ResetSpeed ( )
2014-10-02 08:49:54 +08:00
end
end
end
function SWEP : Deploy ( )
2018-05-02 06:32:59 +08:00
gamemode.Call ( " WeaponDeployed " , self : GetOwner ( ) , self )
2014-10-02 08:49:54 +08:00
self.IdleAnimation = CurTime ( ) + self : SequenceDuration ( )
return true
end
function SWEP : Holster ( )
return true
end
util.PrecacheModel ( " models/Combine_turrets/Floor_turret.mdl " )