123 lines
3.4 KiB
Lua
123 lines
3.4 KiB
Lua
if CLIENT then
|
|
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
|
|
SWEP.DrawWeaponInfoBox = false
|
|
SWEP.BounceWeaponIcon = false
|
|
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
|
|
end
|
|
|
|
SWEP.PrintName = "Repair Tool"
|
|
|
|
SWEP.Category = "Engiener Tools"
|
|
|
|
SWEP.Spawnable= true
|
|
SWEP.AdminSpawnable= true
|
|
SWEP.AdminOnly = false
|
|
|
|
SWEP.ViewModelFOV = 60
|
|
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
|
|
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
|
|
SWEP.ViewModelFlip = false
|
|
|
|
SWEP.AutoSwitchTo = false
|
|
SWEP.AutoSwitchFrom = false
|
|
|
|
SWEP.Slot = 0
|
|
SWEP.SlotPos = 0
|
|
|
|
SWEP.UseHands = true
|
|
|
|
SWEP.HoldType = "melee2"
|
|
|
|
SWEP.FiresUnderwater = false
|
|
|
|
SWEP.DrawCrosshair = false
|
|
|
|
SWEP.DrawAmmo = true
|
|
|
|
SWEP.Base = "weapon_base"
|
|
|
|
SWEP.CSMuzzleFlashes = true
|
|
|
|
SWEP.Sprint = 0
|
|
|
|
SWEP.Primary.ClipSize = 0
|
|
SWEP.Primary.DefaultClip = 0
|
|
SWEP.Primary.Automatic = true
|
|
SWEP.Primary.Ammo = "none"
|
|
|
|
SWEP.Secondary.ClipSize = 0
|
|
SWEP.Secondary.DefaultClip = 0
|
|
SWEP.Secondary.Automatic = false
|
|
SWEP.Secondary.Ammo = "none"
|
|
|
|
|
|
function SWEP:Initialize()
|
|
self:SetWeaponHoldType( self.HoldType )
|
|
end
|
|
|
|
function SWEP:Deploy()
|
|
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
|
|
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
|
|
Sprint = 0
|
|
end
|
|
|
|
function SWEP:Holster()
|
|
self.NextSecondaryAttack = 0
|
|
Sprint = 0
|
|
return true
|
|
end
|
|
|
|
function SWEP:PrimaryAttack()
|
|
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
|
|
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
|
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
|
self:SetNextPrimaryFire( CurTime() + 1)
|
|
self:SetNextSecondaryFire( CurTime() + 1)
|
|
|
|
if SERVER then
|
|
if self:GetOwner():GetEyeTrace().Entity.hp != self:GetOwner():GetEyeTrace().Entity.MaxHp then
|
|
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.hp + 100
|
|
if self:GetOwner():GetEyeTrace().Entity.hp == self:GetOwner():GetEyeTrace().Entity.MaxHp then
|
|
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.MaxHp
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
function SWEP:SecondaryAttack()
|
|
end
|
|
|
|
function SWEP:Reload()
|
|
|
|
end
|
|
function SWEP:DrawHUD()
|
|
if self:GetOwner():GetEyeTrace().Entity:GetClass() == 'util_structure'then
|
|
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 300, 60, Color( 50, 50, 50 , 180) )
|
|
local tW, tH = surface.GetTextSize(tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")))
|
|
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")*(290/self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), 50, Color( 0, 255, 0 ,125) )
|
|
draw.DrawText( tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), "Font3", ScrW()/2, ScrH()/2-15, Color( 255, 255, 255 ,255), 1 )
|
|
end
|
|
end
|
|
|
|
|
|
function SWEP:Think()
|
|
if SERVER then
|
|
if (Sprint == 0) then
|
|
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
|
|
Sprint = 1
|
|
end
|
|
end
|
|
if (Sprint == 1) then
|
|
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
|
|
Sprint = 2
|
|
end
|
|
if (Sprint == 2) then
|
|
if self.Owner:KeyReleased(IN_SPEED) then
|
|
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
|
|
Sprint = 0
|
|
end
|
|
end
|
|
end
|
|
end
|