add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
TOOL.Category = "LFS/LVS"
TOOL.Name = "#tool.sw_aamloadout_editor_v3.name"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar[ "aamloadout" ] = 0
if CLIENT then
language.Add( "tool.sw_aamloadout_editor_v3.name", "AAM Loadout Editor" )
language.Add( "tool.sw_aamloadout_editor_v3.desc", "A tool used to set AAM loadout on LFS/LVS-Vehicles" )
language.Add( "tool.sw_aamloadout_editor_v3.0", "Left click on a LFS/LVS-Vehicle to set AAM loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_aamloadout_editor_v3.1", "Left click on a LFS/LVS-Vehicle to set AAM loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_aamloadout_editor_v3.AAMloadout", "Loadout" )
end
function TOOL:LeftClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.AAMLoadouts) then
ent:SetAAMLoadout( self:GetClientNumber( "aamloadout" ) )
end
return true
end
function TOOL:RightClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.AAMLoadouts) then
ent:SetAAMLoadout(0)
end
return true
end
function TOOL:Reload( trace )
end
function TOOL:Think()
end
function TOOL.BuildCPanel( panel )
panel:AddControl( "Header", { Text = "#tool.sw_aamloadout_editor_v3.name", Description = "#tool.sw_aamloadout_editor_v3.desc" } )
panel:AddControl( "Slider",
{
Label = "#tool.sw_aamloadout_editor_v3.AAMloadout",
Type = "Int",
Min = "0",
Max = "10",
Command = "sw_aamloadout_editor_v3_aamloadout",
Help = false
})
end

View File

@@ -0,0 +1,53 @@
TOOL.Category = "LFS/LVS"
TOOL.Name = "#tool.sw_loadout_editor_v3.name"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar[ "loadout" ] = 0
if CLIENT then
language.Add( "tool.sw_loadout_editor_v3.name", "Loadout Editor" )
language.Add( "tool.sw_loadout_editor_v3.desc", "A tool used to set loadout on LFS/LVS-Vehicles" )
language.Add( "tool.sw_loadout_editor_v3.0", "Left click on a LFS/LVS-Vehicle to set loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_loadout_editor_v3.1", "Left click on a LFS/LVS-Vehicle to set loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_loadout_editor_v3.loadout", "Loadout" )
end
function TOOL:LeftClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.Loadouts) then
ent:SetLoadout( self:GetClientNumber( "loadout" ) )
end
return true
end
function TOOL:RightClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.Loadouts) then
ent:SetLoadout(0)
end
return true
end
function TOOL:Reload( trace )
end
function TOOL:Think()
end
function TOOL.BuildCPanel( panel )
panel:AddControl( "Header", { Text = "#tool.sw_loadout_editor_v3.name", Description = "#tool.sw_loadout_editor_v3.desc" } )
panel:AddControl( "Slider",
{
Label = "#tool.sw_loadout_editor_v3.loadout",
Type = "Int",
Min = "0",
Max = "50",
Command = "sw_loadout_editor_v3_loadout",
Help = false
})
end

View File

@@ -0,0 +1,180 @@
include("shared.lua")
local posX = {
0.29,
0.5,
0.71,
0.71,
0.71,
0.5,
0.29,
0.29,
}
local posY = {
0.29,
0.29,
0.29,
0.5,
0.71,
0.71,
0.71,
0.5,
}
local COLOR_GREEN = Color(0,255,0,255)
local COLOR_BLACK = Color(0,0,0,255)
local COLOR_WHITE = Color(255,255,255,255)
local COLOR_WHITE_HOVERED = Color(200,200,200,150)
local HOOK_ADDED = false
local LANGUAGE
local ints = {
[8] = 1,
[2] = 2,
[4] = 3,
}
local function DrawCircle( X, Y, radius )
local segmentdist = 360 / ( 2 * math.pi * radius / 2 )
for a = 0, 360, segmentdist do
surface.DrawLine( X + math.cos( math.rad( a ) ) * radius, Y - math.sin( math.rad( a ) ) * radius, X + math.cos( math.rad( a + segmentdist ) ) * radius, Y - math.sin( math.rad( a + segmentdist ) ) * radius )
end
end
function SWEP:DrawHUD()
local X = ScrW()
local Y = ScrH()
if self.Zoom.Val == 0 then
local tr = self.Owner:GetEyeTrace()
if IsValid(tr.Entity) and tr.StartPos:DistToSqr(tr.HitPos) < self.MaxPairDistance then
if (tr.Entity.LVS or tr.Entity.LFS or (tr.Entity.SWBombV3 and tr.Entity.HaveGuidance)) and tr.Entity:GetNWBool("HaveDesignator") == false then
if !IsValid(self:GetNWEntity("PairedObj")) then
draw.DrawText("Click to pair designator","Trebuchet24",X*0.5,Y*0.25,color_white,TEXT_ALIGN_CENTER)
else
return
end
end
end
end
if IsValid(self:GetNWEntity("Projectile")) then
local Pos = self:GetNWVector("TarPos"):ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
DrawCircle( Pos.x, Pos.y, 10 )
local Pos2 = self:GetNWEntity("Projectile"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/mis.png"))
surface.DrawTexturedRect(Pos2.x,Pos2.y,25,25)
end
if IsValid(self:GetNWEntity("PairedObj")) and self:GetNWEntity("PairedObj").SWBombV3 then
local Pos = self:GetNWVector("TarPos"):ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
DrawCircle( Pos.x, Pos.y, 10 )
local Pos2 = self:GetNWEntity("PairedObj"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/mis.png"))
surface.DrawTexturedRect(Pos2.x,Pos2.y,25,25)
end
if IsValid(self:GetNWEntity("PairedObj")) and not self:GetNWEntity("PairedObj").SWBombV3 then
local Pos = self:GetNWEntity("PairedObj"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/plane.png"))
surface.DrawTexturedRect(Pos.x,Pos.y,25,25)
end
surface.SetDrawColor(0,0,0,self.Zoom.Val*255)
surface.SetTexture(surface.GetTextureID("models/sw/shared/sights/binoculars"))
surface.DrawTexturedRect(0,-(X-Y)/2,X,X)
local tr = self.Owner:GetEyeTrace()
local range = (math.ceil(100*(tr.StartPos:Distance(tr.HitPos)*0.024))/100)
if tr.HitSky then
range = "-"
else
range = range.."m"
end
surface.SetTextColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetTextPos( (X*0.165), (Y/2) )
surface.DrawText( "Range: "..range )
surface.SetTextPos( (X*0.165), (Y/2) + 16)
surface.DrawText( "X: "..(math.ceil(100*tr.HitPos.x))/100)
surface.SetTextPos( (X*0.165), (Y/2) + 32)
surface.DrawText( "Y: "..(math.ceil(100*tr.HitPos.y)/100) )
surface.SetTextPos( (X*0.165), (Y/2) + 48)
surface.DrawText( "Z: "..(math.ceil(100*tr.HitPos.z)/100) )
if self:GetNWBool("NVG") == true then
surface.SetTextPos( (X*0.165), (Y/2) + 64)
surface.DrawText( "NVG: ON" )
local dlight = DynamicLight(self:EntIndex())
dlight.r = self.Zoom.Val*255
dlight.g = self.Zoom.Val*255
dlight.b = self.Zoom.Val*255
dlight.minlight = 0
dlight.style = 0
dlight.Brightness = self.Zoom.Val*0.1
dlight.Pos = EyePos()
dlight.Size = self.Zoom.Val*2048
dlight.Decay = self.Zoom.Val*10000
dlight.DieTime = CurTime() + 0.1
local mat_color = Material( "pp/colour" )
render.UpdateScreenEffectTexture()
mat_color:SetTexture( "$fbtexture", render.GetScreenEffectTexture() )
mat_color:SetFloat( "$pp_colour_addr", -self.Zoom.Val*255 )
mat_color:SetFloat( "$pp_colour_addg", 0 )
mat_color:SetFloat( "$pp_colour_addb", 0)
mat_color:SetFloat( "$pp_colour_mulr", 0 )
mat_color:SetFloat( "$pp_colour_mulg", 0 )
mat_color:SetFloat( "$pp_colour_mulb", 0 )
mat_color:SetFloat( "$pp_colour_brightness", self.Zoom.Val*0.01 )
mat_color:SetFloat( "$pp_colour_contrast", 1+self.Zoom.Val*5 )
mat_color:SetFloat( "$pp_colour_colour", 1 )
render.SetMaterial( mat_color )
render.DrawScreenQuad()
DrawBloom(self.Zoom.Val*0.5,self.Zoom.Val*1,self.Zoom.Val*10,self.Zoom.Val*10,self.Zoom.Val*2,self.Zoom.Val*1,self.Zoom.Val*1,self.Zoom.Val*1,self.Zoom.Val*1)
else
surface.SetTextPos( (X*0.165), (Y/2) + 64)
surface.DrawText( "NVG: OFF" )
end
end
function SWEP:CalcView(ply,pos,ang,fov)
return pos,ang,fov - (self.Zoom.Val * self.Zoom.FOV)
end
function SWEP:AdjustMouseSensitivity()
return self.Owner:KeyDown(IN_ATTACK2) and 0.1 or 1
end
function SWEP:CalcViewModelView(ViewModel,OldEyePos)
if self.Zoom.Val > 0.8 then
return Vector(0,0,0)
else
return OldEyePos - Vector(0,0,1.3)
end
end
function SWEP:Think()
local keydown = self.Owner:KeyDown(IN_ATTACK2)
self.Zoom.Val = math.Clamp(self.Zoom.Val + (keydown and self.Zoom.Rate or -self.Zoom.Rate),0,1)
if keydown and not self.IsZooming then
self.IsZooming = true
self.IsUnZooming = false
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
elseif !keydown and not self.IsUnZooming and self.IsZooming then
self.IsZooming = false
self.IsUnZooming = true
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end
if keydown then
local Zoom = self.Zoom.FOV
local ZoomSwitch = self.Owner:KeyDown(IN_SPEED)
if self.OldZoomSwitch ~= ZoomSwitch then
if ZoomSwitch and Zoom == 70 then
self.Zoom.FOV = 40
elseif ZoomSwitch and Zoom == 40 then
self.Zoom.FOV = 70
end
self.OldZoomSwitch = ZoomSwitch
end
local NVGSwitch = self.Owner:KeyDown(IN_ZOOM)
if self.OldNVGSwitch ~= NVGSwitch then
if NVGSwitch and self:GetNWBool("NVG") == true then
self:SetNWBool("NVG",false)
self:EmitSound("sw/misc/nv_off.wav")
elseif NVGSwitch and self:GetNWBool("NVG") == false then
self:SetNWBool("NVG",true)
self:EmitSound("sw/misc/nv_on.wav")
end
self.OldNVGSwitch = NVGSwitch
end
end
end

View File

@@ -0,0 +1,64 @@
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function SWEP:PrimaryAttack()
if self.Owner:KeyDown(IN_ATTACK2) then
if IsValid(self:GetNWEntity("PairedObj")) then
if self:GetNWEntity("PairedObj").SWBombV3 and self:GetNWEntity("PairedObj").HaveGuidance then
local tr = self.Owner:GetEyeTrace()
self:GetNWEntity("PairedObj").GuidanceActive = true
self:GetNWEntity("PairedObj").target = tr.Entity
self:GetNWEntity("PairedObj").targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
self:SetNWVector("TarPos", tr.HitPos )
self:EmitSound("sw/misc/point.wav")
print(tr.HitPos)
end
if IsValid(self:GetNWEntity("PairedObj"):GetNWEntity("Missile")) then
if self:GetNWEntity("PairedObj"):GetNWEntity("Missile").SWBombV3 and self:GetNWEntity("PairedObj"):GetNWEntity("Missile").HaveGuidance then
local tr = self.Owner:GetEyeTrace()
self:SetNWEntity("Projectile",self:GetNWEntity("PairedObj"):GetNWEntity("Missile"))
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").GuidanceActive = true
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").LaserGuided = false
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").target = tr.Entity
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
self:SetNWVector("TarPos", tr.HitPos )
self:EmitSound("sw/misc/point.wav")
print(tr.HitPos)
end
end
end
end
if self.Owner:KeyDown(IN_ATTACK2) then return end
local tr = self.Owner:GetEyeTrace()
if IsValid(tr.Entity) and tr.StartPos:DistToSqr(tr.HitPos) < self.MaxPairDistance then
if ((tr.Entity.LVS or tr.Entity.LFS) and tr.Entity.Pairable ) or (tr.Entity.SWBombV3 and tr.Entity.HaveGuidance) then
if !IsValid(self:GetNWEntity("PairedObj")) then
tr.Entity:SetNWBool("HaveDesignator",true)
self:SetNWEntity("PairedObj",tr.Entity)
self:SetNWBool("Paired",true)
self.Owner:PrintMessage(HUD_PRINTCENTER,"You have paired target designator with:"..self:GetNWEntity("PairedObj").PrintName)
else
return
end
end
end
end
function SWEP:SecondaryAttack()
end
function SWEP:CanReload(ct)
return self.NextReload <= ct
end
function SWEP:Reload()
local ct = CurTime()
if not self:CanReload(ct) then return end
self.NextReload = ct + 0.3
end
function SWEP:OnRemove()
if IsValid(self) and IsValid(self:GetNWEntity("PairedObj")) then
self:GetNWEntity("PairedObj"):SetNWBool("HaveDesignator",false)
self:SetNWEntity("PairedObj",nil)
self:SetNWBool("Paired",false)
end
end

View File

@@ -0,0 +1,98 @@
AddCSLuaFile()
SWEP.Base = "weapon_base"
SWEP.Spawnable = true
SWEP.AdminSpawnable = false
SWEP.MaxPairDistance = 500^2
SWEP.Category = "SW Weapons Factory"
SWEP.Author = "Shermann Wolf"
SWEP.Contact = "shermannwolf@gmail.com"
SWEP.Purpose = ""
SWEP.Instructions = "Right click on bomb/missile/aircraft to pair it with your laser pointer,and left click to point target for it"
SWEP.PrintName = "Laser target designator"
SWEP.WorldModel = "models/sw/shared/weapons/w_binoculars.mdl"
SWEP.ViewModel = "models/sw/shared/weapons/v_binoculars.mdl"
SWEP.TarPos = nil
SWEP.Primary = {
Ammo = "None",
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
NextShot = 0,
FireRate = 0.00001
}
SWEP.Secondary = SWEP.Primary
SWEP.NextReload = 0
SWEP.DrawAmmo = false
SWEP.Zoom = {}
SWEP.Zoom.FOV = 70
SWEP.Zoom.Rate = 0.035
SWEP.Zoom.Val = 0
SWEP.UseHands = true
local pairs = pairs
local IsValid = IsValid
local CLIENT = CLIENT
local SERVER = SERVER
local SINGLEPLAYER = game.SinglePlayer()
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
return true
end
function SWEP:Initialize()
self:SetNWEntity("PairedObj",nil)
self:SetNWEntity("Projectile",nil)
self:SetNWBool("Paired",false)
self:SetHoldType("camera")
end
function SWEP:Holster(wep)
return true
end
function SWEP:DrawHUD()
surface.SetDrawColor(0,0,0,self.Zoom.Val*255)
surface.SetTexture(surface.GetTextureID("models/sw/shared/sights/binoculars"))
local X = ScrW()
local Y = ScrH()
surface.DrawTexturedRect(0,-(X-Y)/2,X,X)
end
function SWEP:CalcViewModelView(ViewModel,OldEyePos)
if self.Zoom.Val > 0.8 then
return Vector(0,0,0)
else
return OldEyePos - Vector(0,0,1.3)
end
end
function SWEP:Think()
local keydown = self.Owner:KeyDown(IN_ATTACK2)
self.Zoom.Val = math.Clamp(self.Zoom.Val + (keydown and 0.1 or -0.1),0,1)
if keydown and not self.IsZooming then
self.IsZooming = true
self.IsUnZooming = false
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
elseif !keydown and not self.IsUnZooming and self.IsZooming then
self.IsZooming = false
self.IsUnZooming = true
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end
end
function SWEP:CalcView(ply,pos,ang,fov)
fov = fov - (self.Zoom.Val*self.Zoom.FOV)
return pos,ang,fov
end
function SWEP:AdjustMouseSensitivity()
return self.Owner:KeyDown(IN_ATTACK2) and 0.1 or 1
end
function SWEP:CanPrimaryAttack(ct)
return self.Primary.NextShot <= ct
end
function SWEP:PrimaryAttack()
local ct = CurTime()
if not self:CanPrimaryAttack(ct) then return end
self.Primary.NextShot = ct + self.Primary.FireRate
end
function SWEP:CanSecondaryAttack(ct)
end
function SWEP:SecondaryAttack()
end
function SWEP:CanReload(ct)
end
function SWEP:Reload()
end

View File

@@ -0,0 +1,215 @@
AddCSLuaFile()
SWEP.Category = "[LVS]"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.ViewModel = "models/weapons/c_fuelfillerlvs.mdl"
SWEP.WorldModel = "models/props_equipment/gas_pump_p13.mdl"
SWEP.UseHands = true
SWEP.HoldType = "slam"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.RangeToCap = 24
SWEP.HitDistance = 128
function SWEP:GetTank( entity )
if entity.lvsGasStationRefillMe then
return entity
end
if not entity.LVS or not entity.GetFuelTank then return NULL end
if not (entity:GetVehicleType() == "helicopter" or entity:GetVehicleType() == "plane") then return end
return entity:GetFuelTank()
end
function SWEP:GetCap( entity )
if entity.lvsGasStationRefillMe then
return entity
end
if not entity.LVS or not entity.GetFuelTank then return NULL end
if not (entity:GetVehicleType() == "helicopter" or entity:GetVehicleType() == "plane") then return end
local FuelTank = entity:GetFuelTank()
if not IsValid( FuelTank ) then return NULL end
return FuelTank:GetDoorHandler()
end
if CLIENT then
SWEP.PrintName = "Aircraft fuel Filler Pistol"
SWEP.Slot = 1
SWEP.SlotPos = 3
SWEP.DrawWeaponInfoBox = false
function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
end
function SWEP:DrawWorldModel()
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local id = ply:LookupAttachment("anim_attachment_rh")
local attachment = ply:GetAttachment( id )
if not attachment then return end
local pos = attachment.Pos + attachment.Ang:Forward() * 6 + attachment.Ang:Right() * -1.5 + attachment.Ang:Up() * 2.2
local ang = attachment.Ang
ang:RotateAroundAxis(attachment.Ang:Up(), 20)
ang:RotateAroundAxis(attachment.Ang:Right(), -30)
ang:RotateAroundAxis(attachment.Ang:Forward(), 0)
self:SetRenderOrigin( pos )
self:SetRenderAngles( ang )
self:DrawModel()
end
local function DrawText( pos, text, col )
local data2D = pos:ToScreen()
if not data2D.visible then return end
local font = "TargetIDSmall"
local x = data2D.x
local y = data2D.y
draw.SimpleText( text, font, x + 1, y + 1, Color( 0, 0, 0, 120 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.SimpleText( text, font, x + 2, y + 2, Color( 0, 0, 0, 50 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.SimpleText( text, font, x, y, col or color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
function SWEP:DrawHUD()
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local startpos = ply:GetShootPos()
local endpos = startpos + ply:GetAimVector() * self.HitDistance
local trace = util.TraceLine( {
start = startpos ,
endpos = endpos,
filter = ply,
mask = MASK_SHOT_HULL
} )
if not IsValid( trace.Entity ) then
trace = util.TraceHull( {
start = startpos ,
endpos = endpos,
filter = ply,
mins = Vector( -10, -10, -8 ),
maxs = Vector( 10, 10, 8 ),
mask = MASK_SHOT_HULL
} )
end
local FuelTank = self:GetTank( trace.Entity )
local FuelCap = self:GetCap( trace.Entity )
if not IsValid( FuelTank ) then return end
if not IsValid( FuelCap ) then
DrawText( trace.HitPos, math.Round(FuelTank:GetFuel() * 100,1).."%", Color(0,255,0,255) )
return
end
if FuelCap:IsOpen() then
if (trace.HitPos - FuelCap:GetPos()):Length() > self.RangeToCap then
DrawText( trace.HitPos, "Aim at Fuel Cap!", Color(255,255,0,255) )
else
DrawText( trace.HitPos, math.Round(FuelTank:GetFuel() * 100,1).."%", Color(0,255,0,255) )
end
return
end
local Key = input.LookupBinding( "+use" )
if not isstring( Key ) then Key = "[+use is not bound to a key]" end
DrawText( FuelCap:GetPos(), "Press "..Key.." to Open", Color(255,255,0,255) )
end
end
function SWEP:Initialize()
self:SetHoldType( self.HoldType )
end
function SWEP:PrimaryAttack()
self:SetNextPrimaryFire( CurTime() + 0.5 )
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local startpos = ply:GetShootPos()
local endpos = startpos + ply:GetAimVector() * self.HitDistance
local trace = util.TraceLine( {
start = startpos ,
endpos = endpos,
filter = ply,
mask = MASK_SHOT_HULL
} )
if not IsValid( trace.Entity ) then
trace = util.TraceHull( {
start = startpos ,
endpos = endpos,
filter = ply,
mins = Vector( -10, -10, -8 ),
maxs = Vector( 10, 10, 8 ),
mask = MASK_SHOT_HULL
} )
end
self:Refuel( trace )
end
function SWEP:SecondaryAttack()
end
function SWEP:Refuel( trace )
local entity = trace.Entity
if CLIENT or not IsValid( entity ) then return end
local FuelCap = self:GetCap( entity )
local FuelTank = self:GetTank( entity )
if not IsValid( FuelTank ) or FuelTank:GetDestroyed() then return end
if FuelTank:GetBase():GetEngineActive() then
FuelTank:SetDestroyed(true)
end
if IsValid( FuelCap ) then
if not FuelCap:IsOpen() then return end
if (trace.HitPos - FuelCap:GetPos()):Length() > self.RangeToCap then return end
end
if FuelTank:GetFuel() ~= 1 then
FuelTank:SetFuel( math.min( FuelTank:GetFuel() + (entity.lvsGasStationFillSpeed or 0.05), 1 ) )
entity:OnRefueled()
end
end