2014-10-02 08:49:54 +08:00
|
|
|
AddCSLuaFile()
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.PrintName = "Drone Control"
|
|
|
|
SWEP.Description = "Controller for your Drone."
|
|
|
|
SWEP.Slot = 4
|
|
|
|
SWEP.SlotPos = 0
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if CLIENT then
|
2014-10-02 08:49:54 +08:00
|
|
|
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.Delay = 0
|
|
|
|
SWEP.Primary.ClipSize = -1
|
|
|
|
SWEP.Primary.DefaultClip = -1
|
|
|
|
SWEP.Primary.Automatic = false
|
|
|
|
SWEP.Primary.Ammo = "none"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.Secondary.Delay = 0
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.Secondary.Heal = 10
|
|
|
|
|
|
|
|
SWEP.Secondary.ClipSize = -1
|
|
|
|
SWEP.Secondary.DefaultClip = -1
|
|
|
|
SWEP.Secondary.Automatic = false
|
|
|
|
SWEP.Secondary.Ammo = "none"
|
|
|
|
|
|
|
|
SWEP.WalkSpeed = SPEED_FAST
|
|
|
|
|
|
|
|
SWEP.NoMagazine = true
|
|
|
|
SWEP.Undroppable = true
|
|
|
|
SWEP.NoPickupNotification = true
|
|
|
|
|
|
|
|
SWEP.HoldType = "slam"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.NoDeploySpeedChange = true
|
|
|
|
SWEP.NoTransfer = true
|
|
|
|
SWEP.AutoSwitchFrom = false
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
function SWEP:Initialize()
|
2014-11-12 08:15:49 +08:00
|
|
|
self:SetWeaponHoldType(self.HoldType)
|
2014-10-02 08:49:54 +08:00
|
|
|
self:SetDeploySpeed(10)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Think()
|
|
|
|
if self.IdleAnimation and self.IdleAnimation <= CurTime() then
|
|
|
|
self.IdleAnimation = nil
|
|
|
|
self:SendWeaponAnim(ACT_VM_IDLE)
|
|
|
|
end
|
|
|
|
|
|
|
|
if SERVER then
|
2018-05-02 06:32:59 +08:00
|
|
|
for _, ent in pairs(ents.FindByClass("prop_drone*")) do
|
|
|
|
if ent:IsValid() and ent:GetObjectOwner() == self:GetOwner() then
|
2014-10-02 08:49:54 +08:00
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():StripWeapon(self:GetClass())
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function SWEP:GetResupplyAmmoType()
|
|
|
|
local owner = self:GetOwner()
|
|
|
|
if owner:IsValid() and owner.DroneControlAmmo then
|
|
|
|
return owner.DroneControlAmmo
|
|
|
|
end
|
|
|
|
return "smg1"
|
|
|
|
end
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
function SWEP:PrimaryAttack()
|
2018-05-02 06:32:59 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SecondaryAttack()
|
2014-10-02 08:49:54 +08:00
|
|
|
if IsFirstTimePredicted() then
|
|
|
|
self:SetDTBool(0, not self:GetDTBool(0))
|
|
|
|
|
|
|
|
if CLIENT then
|
2018-05-02 06:32:59 +08:00
|
|
|
MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Reload()
|
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
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()
|
|
|
|
self:SetDTBool(0, false)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function SWEP:DrawWeaponSelection(x, y, w, h, alpha)
|
|
|
|
self:BaseDrawWeaponSelection(x, y, w, h, alpha)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|