109 lines
2 KiB
Lua
109 lines
2 KiB
Lua
|
AddCSLuaFile()
|
||
|
|
||
|
SWEP.PrintName = "Rollermine Control"
|
||
|
SWEP.Description = "Controller for your Rollermine."
|
||
|
|
||
|
if CLIENT then
|
||
|
SWEP.ViewModelFOV = 50
|
||
|
|
||
|
SWEP.BobScale = 0.5
|
||
|
SWEP.SwayScale = 0.5
|
||
|
|
||
|
SWEP.Slot = 4
|
||
|
SWEP.SlotPos = 0
|
||
|
end
|
||
|
|
||
|
SWEP.ViewModel = "models/weapons/c_slam.mdl"
|
||
|
SWEP.WorldModel = "models/weapons/w_slam.mdl"
|
||
|
SWEP.UseHands = true
|
||
|
|
||
|
SWEP.EntityClass = "prop_rollermine"
|
||
|
|
||
|
SWEP.Primary.Delay = 0
|
||
|
SWEP.Primary.ClipSize = -1
|
||
|
SWEP.Primary.DefaultClip = -1
|
||
|
SWEP.Primary.Automatic = false
|
||
|
SWEP.Primary.Ammo = "none"
|
||
|
|
||
|
SWEP.Secondary.Delay = 20
|
||
|
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"
|
||
|
|
||
|
SWEP.NoDeploySpeedChange = true
|
||
|
SWEP.NoTransfer = true
|
||
|
SWEP.AutoSwitchFrom = false
|
||
|
|
||
|
function SWEP:Initialize()
|
||
|
self:SetWeaponHoldType(self.HoldType)
|
||
|
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
|
||
|
for _, ent in pairs(ents.FindByClass(self.EntityClass)) do
|
||
|
if ent:IsValid() and ent:GetObjectOwner() == self:GetOwner() then
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
|
||
|
self:GetOwner():StripWeapon(self:GetClass())
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function SWEP:PrimaryAttack()
|
||
|
if IsFirstTimePredicted() then
|
||
|
self:SetDTBool(0, not self:GetDTBool(0))
|
||
|
|
||
|
if CLIENT then
|
||
|
MySelf:EmitSound(self:GetDTBool(0) and "buttons/button17.wav" or "buttons/button19.wav", 0)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function SWEP:SecondaryAttack()
|
||
|
end
|
||
|
|
||
|
function SWEP:Reload()
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
function SWEP:Deploy()
|
||
|
gamemode.Call("WeaponDeployed", self:GetOwner(), self)
|
||
|
|
||
|
self.IdleAnimation = CurTime() + self:SequenceDuration()
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function SWEP:Holster()
|
||
|
self:SetDTBool(0, false)
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function SWEP:Reload()
|
||
|
end
|
||
|
|
||
|
if not CLIENT then return end
|
||
|
|
||
|
function SWEP:DrawWeaponSelection(x, y, w, h, alpha)
|
||
|
self:BaseDrawWeaponSelection(x, y, w, h, alpha)
|
||
|
end
|