zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/shared.lua

85 lines
1.7 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/Combine_turrets/Floor_turret.mdl"
SWEP.AmmoIfHas = true
SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "thumper"
SWEP.Primary.Delay = 2
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
2014-11-10 13:26:49 +08:00
self:SetHoldType("slam")
2014-10-02 08:49:54 +08:00
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
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()
if self.Owner:IsHolding() or self.Owner: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.Owner:ResetSpeed()
end
end
end
function SWEP:Deploy()
gamemode.Call("WeaponDeployed", self.Owner, self)
self.IdleAnimation = CurTime() + self:SequenceDuration()
return true
end
function SWEP:Holster()
return true
end
util.PrecacheModel("models/Combine_turrets/Floor_turret.mdl")