zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_arsenalcrate/cl_init.lua
2014-10-01 20:49:54 -04:00

45 lines
1.2 KiB
Lua

include("shared.lua")
SWEP.PrintName = "Arsenal Crate"
SWEP.Description = "This crate is invaluable to survival. It allows people to purchase new weapons, tools, ammunition, etc.\nThe deployer gets a 7% commission on purchases not made by themselves.\nPress PRIMARY ATTACK to deploy the crate.\nPress SECONDARY ATTACK and RELOAD to rotate the crate."
SWEP.DrawCrosshair = false
SWEP.Slot = 4
SWEP.SlotPos = 0
function SWEP:DrawHUD()
if GetConVarNumber("crosshair") ~= 1 then return end
self:DrawCrosshairDot()
end
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
function SWEP:Deploy()
gamemode.Call("WeaponDeployed", self.Owner, self)
return true
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