Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions lua/weapons/glide_instant_repair.lua

This file was deleted.

70 changes: 70 additions & 0 deletions lua/weapons/glide_repair.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,76 @@ end
function SWEP:SecondaryAttack()
end

hook.Add( "InitPostEntity", "GLide_RepairSWEP::CAMI", function()
if not CAMI or not CAMI.RegisterPrivilege then return end

CAMI.RegisterPrivilege( {
Name = "GLide::RepairSWEP",
MinAccess = "admin"
} )
end )

local IS_SINGLEPLAYER = game.SinglePlayer()
local function IsAccess( ply, veh )
if IS_SINGLEPLAYER then
return true
end

if not CAMI or not CAMI.PlayerHasAccess then
return ply:IsAdmin()
elseif CAMI.PlayerHasAccess( ply, "GLide::RepairSWEP" ) then
return true
end

local Access = hook.Run( "GLide_RepairSWEP::CanAccess", ply, veh )
if Access == nil then
return false
end

return false
end

function SWEP:Reload()
local user = self:GetOwner()
if not IsValid( user ) then return end

self:SetNextPrimaryFire( CurTime() + 0.1 )

if not SERVER then return end

local ent = self.repairTarget
if not ent then return end

if not IsAccess( user, ent ) then return end

local wasHealthIncreased, hasFinished = Glide.PartialRepair( ent, 99999, 1.0 )

if wasHealthIncreased then
if user.ViewPunch then
user:ViewPunch( Angle( -5, 0, 0 ) )
end

self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
user:SetAnimation( PLAYER_ATTACK1 )

local trace = self.repairTrace

if trace then
local data = EffectData()
data:SetOrigin( trace.HitPos + trace.HitNormal * 5 )
data:SetNormal( trace.HitNormal )
data:SetScale( 1 )
data:SetMagnitude( 1 )
data:SetRadius( 10 )
util.Effect( "cball_bounce", data, false, true )
end
end

if hasFinished then
user:EmitSound( "buttons/lever6.wav", 75, math.random( 70, 80 ), 0.5 )
end
end

if not CLIENT then return end

function SWEP:DrawHUD()
Expand Down
Binary file removed materials/glide/vgui/glide_repair_wrench_admin.png
Binary file not shown.
Loading