49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
|
include("shared.lua")
|
||
|
|
||
|
SWEP.PrintName = "Gun Turret"
|
||
|
SWEP.Description = "This automated turret requires constant upkeep to be useful.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your SMG ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it."
|
||
|
SWEP.DrawCrosshair = false
|
||
|
|
||
|
SWEP.Slot = 4
|
||
|
SWEP.SlotPos = 0
|
||
|
|
||
|
function SWEP:DrawHUD()
|
||
|
if GetConVarNumber("crosshair") ~= 1 then return end
|
||
|
self:DrawCrosshairDot()
|
||
|
end
|
||
|
|
||
|
function SWEP:Deploy()
|
||
|
self.IdleAnimation = CurTime() + self:SequenceDuration()
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function SWEP:DrawWorldModel()
|
||
|
end
|
||
|
SWEP.DrawWorldModelTranslucent = SWEP.DrawWorldModel
|
||
|
|
||
|
function SWEP:PrimaryAttack()
|
||
|
end
|
||
|
|
||
|
function SWEP:DrawWeaponSelection(...)
|
||
|
return self:BaseDrawWeaponSelection(...)
|
||
|
end
|
||
|
|
||
|
function SWEP:Think()
|
||
|
if self.Owner:KeyDown(IN_ATTACK2) then
|
||
|
self:RotateGhost(FrameTime() * 60)
|
||
|
end
|
||
|
if self.Owner:KeyDown(IN_RELOAD) then
|
||
|
self:RotateGhost(FrameTime() * -60)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local nextclick = 0
|
||
|
function SWEP:RotateGhost(amount)
|
||
|
if nextclick <= RealTime() then
|
||
|
surface.PlaySound("npc/headcrab_poison/ph_step4.wav")
|
||
|
nextclick = RealTime() + 0.3
|
||
|
end
|
||
|
RunConsoleCommand("_zs_ghostrotation", math.NormalizeAngle(GetConVarNumber("_zs_ghostrotation") + amount))
|
||
|
end
|