mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
81
lua/lvs_framework/autorun/cl_camera.lua
Normal file
81
lua/lvs_framework/autorun/cl_camera.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
function LVS:CalcView( vehicle, ply, pos, angles, fov, pod )
|
||||
local view = {}
|
||||
view.origin = pos
|
||||
view.angles = angles
|
||||
view.fov = fov
|
||||
view.drawviewer = false
|
||||
|
||||
if not pod:GetThirdPersonMode() then return view end
|
||||
|
||||
local mn = vehicle:OBBMins()
|
||||
local mx = vehicle:OBBMaxs()
|
||||
local radius = ( mn - mx ):Length()
|
||||
local radius = radius + radius * pod:GetCameraDistance()
|
||||
|
||||
local TargetOrigin = view.origin + ( view.angles:Forward() * -radius ) + view.angles:Up() * radius * pod:GetCameraHeight()
|
||||
local WallOffset = 4
|
||||
|
||||
local tr = util.TraceHull( {
|
||||
start = view.origin,
|
||||
endpos = TargetOrigin,
|
||||
filter = function( e )
|
||||
local c = e:GetClass()
|
||||
local collide = not c:StartWith( "prop_physics" ) and not c:StartWith( "prop_dynamic" ) and not c:StartWith( "prop_ragdoll" ) and not e:IsVehicle() and not c:StartWith( "gmod_" ) and not c:StartWith( "lvs_" ) and not c:StartWith( "player" ) and not e.LVS
|
||||
|
||||
return collide
|
||||
end,
|
||||
mins = Vector( -WallOffset, -WallOffset, -WallOffset ),
|
||||
maxs = Vector( WallOffset, WallOffset, WallOffset ),
|
||||
} )
|
||||
|
||||
view.origin = tr.HitPos
|
||||
view.drawviewer = true
|
||||
|
||||
if tr.Hit and not tr.StartSolid then
|
||||
view.origin = view.origin + tr.HitNormal * WallOffset
|
||||
end
|
||||
|
||||
return view
|
||||
end
|
||||
|
||||
hook.Add( "CalcView", "!!!!LVS_calcview", function(ply, pos, angles, fov)
|
||||
if ply:GetViewEntity() ~= ply then return end
|
||||
|
||||
local pod = ply:GetVehicle()
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( pod ) or not IsValid( vehicle ) then return end
|
||||
|
||||
local newfov = vehicle:LVSCalcFov( fov, ply )
|
||||
|
||||
local base = pod:lvsGetWeapon()
|
||||
|
||||
if IsValid( base ) then
|
||||
local weapon = base:GetActiveWeapon()
|
||||
|
||||
if weapon and weapon.CalcView then
|
||||
return weapon.CalcView( base, ply, pos, angles, newfov, pod )
|
||||
else
|
||||
return vehicle:LVSCalcView( ply, pos, angles, newfov, pod )
|
||||
end
|
||||
else
|
||||
local weapon = vehicle:GetActiveWeapon()
|
||||
|
||||
if weapon and weapon.CalcView then
|
||||
return weapon.CalcView( vehicle, ply, pos, angles, newfov, pod )
|
||||
else
|
||||
return vehicle:LVSCalcView( ply, pos, angles, newfov, pod )
|
||||
end
|
||||
end
|
||||
end )
|
||||
51
lua/lvs_framework/autorun/cl_fonts.lua
Normal file
51
lua/lvs_framework/autorun/cl_fonts.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local THE_FONT = {
|
||||
font = "Verdana",
|
||||
extended = false,
|
||||
size = 14,
|
||||
weight = 600,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = true,
|
||||
additive = false,
|
||||
outline = false,
|
||||
}
|
||||
surface.CreateFont( "LVS_VERSION", THE_FONT )
|
||||
|
||||
THE_FONT.extended = false
|
||||
THE_FONT.size = 20
|
||||
THE_FONT.weight = 2000
|
||||
surface.CreateFont( "LVS_FONT", THE_FONT )
|
||||
|
||||
THE_FONT.size = 16
|
||||
surface.CreateFont( "LVS_FONT_SWITCHER", THE_FONT )
|
||||
|
||||
THE_FONT.font = "Arial"
|
||||
THE_FONT.size = 14
|
||||
THE_FONT.weight = 1
|
||||
THE_FONT.shadow = false
|
||||
surface.CreateFont( "LVS_FONT_PANEL", THE_FONT )
|
||||
|
||||
THE_FONT.size = 20
|
||||
THE_FONT.weight = 2000
|
||||
surface.CreateFont( "LVS_FONT_HUD", THE_FONT )
|
||||
|
||||
THE_FONT.size = 40
|
||||
THE_FONT.weight = 2000
|
||||
THE_FONT.shadow = true
|
||||
surface.CreateFont( "LVS_FONT_HUD_LARGE", THE_FONT )
|
||||
340
lua/lvs_framework/autorun/cl_hud.lua
Normal file
340
lua/lvs_framework/autorun/cl_hud.lua
Normal file
@@ -0,0 +1,340 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
--LVS.HudForceDefault = true
|
||||
|
||||
LVS.HudEditors = LVS.HudEditors or {}
|
||||
LVS.HudEditorsHide = {}
|
||||
|
||||
local function ResetFrame( id )
|
||||
if not LVS.HudEditors[ id ] then return end
|
||||
|
||||
LVS.HudEditors[ id ].w = LVS.HudEditors[ id ].DefaultWidth
|
||||
LVS.HudEditors[ id ].h = LVS.HudEditors[ id ].DefaultHeight
|
||||
LVS.HudEditors[ id ].X = LVS.HudEditors[ id ].DefaultX
|
||||
LVS.HudEditors[ id ].Y = LVS.HudEditors[ id ].DefaultY
|
||||
LVS.HudEditorsHide[ id ] = nil
|
||||
end
|
||||
|
||||
local function MakeFrame( id, X, Y, w, h, minw, minh, text )
|
||||
local Frame = vgui.Create("DFrame")
|
||||
Frame:SetSize( w, h )
|
||||
Frame:SetPos( X, Y )
|
||||
Frame:SetTitle( text )
|
||||
Frame:SetScreenLock( true )
|
||||
Frame:MakePopup()
|
||||
Frame:SetSizable( true )
|
||||
Frame:SetMinWidth( minw )
|
||||
Frame:SetMinHeight( minh )
|
||||
Frame.id = id
|
||||
Frame.OnClose = function( self )
|
||||
ResetFrame( self.id )
|
||||
end
|
||||
Frame.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0,0,0,150)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(80,80,80,255)
|
||||
surface.DrawRect(0, 0, 2, h)
|
||||
surface.DrawRect(w - 2, 0, 2, h)
|
||||
surface.DrawRect(0, 0, w, 2)
|
||||
surface.DrawRect(0, h - 2, w, 2)
|
||||
|
||||
if not LVS.HudEditors[ self.id ] then return end
|
||||
|
||||
LVS.HudEditors[ self.id ].w = self:GetWide()
|
||||
LVS.HudEditors[ self.id ].h = self:GetTall()
|
||||
|
||||
LVS.HudEditors[ self.id ].X = math.min( self:GetX(), ScrW() - self:GetWide() )
|
||||
LVS.HudEditors[ self.id ].Y = math.min( self:GetY(), ScrH() - self:GetTall() )
|
||||
end
|
||||
|
||||
local DCheckbox = vgui.Create( "DCheckBoxLabel", Frame )
|
||||
DCheckbox:Dock( RIGHT )
|
||||
DCheckbox:DockMargin( 0, 0, 0, 0 )
|
||||
DCheckbox:SetText("Hide")
|
||||
DCheckbox:SizeToContents()
|
||||
DCheckbox.id = id
|
||||
DCheckbox:SetChecked( LVS.HudEditorsHide[ id ] == true )
|
||||
DCheckbox.OnChange = function( self, bVal )
|
||||
if not self.id then return end
|
||||
|
||||
if bVal then LVS.HudEditorsHide[ self.id ] = true return end
|
||||
|
||||
LVS.HudEditorsHide[ self.id ] = nil
|
||||
end
|
||||
|
||||
LVS.HudEditors[ id ].Frame = Frame
|
||||
|
||||
return Frame
|
||||
end
|
||||
|
||||
local ScreenWidth = ScrW()
|
||||
local ScreenHeight = ScrH()
|
||||
|
||||
local function SaveEditors()
|
||||
if LVS.HudForceDefault then return end
|
||||
|
||||
if ScreenWidth ~= ScrW() or ScreenHeight ~= ScrH() then return end -- player changed resolution while ingame... don't save because everything is fucked up now...
|
||||
|
||||
local SaveString = ""
|
||||
for id, data in pairs( LVS.HudEditors ) do
|
||||
local w = data.w
|
||||
local h = data.h
|
||||
|
||||
local X = math.min( data.X / ScrW(), 1 )
|
||||
local Y = math.min( data.Y / ScrH(), 1 )
|
||||
|
||||
local hide = LVS.HudEditorsHide[ id ] and "?" or " "
|
||||
|
||||
SaveString = SaveString..id.."~"..hide.."~"..w.."#"..h.."/"..X.."#"..Y.."\n"
|
||||
end
|
||||
|
||||
file.Write( "lvs_hud_settings.txt", SaveString )
|
||||
end
|
||||
|
||||
local function LoadEditors()
|
||||
if LVS.HudForceDefault then return end
|
||||
|
||||
local LoadString = file.Read( "lvs_hud_settings.txt" )
|
||||
|
||||
if not LoadString then return end
|
||||
|
||||
for _, garbage in pairs( string.Explode( "\n", LoadString ) ) do
|
||||
local data1 = string.Explode( "~", garbage )
|
||||
|
||||
if not data1[3] then continue end
|
||||
|
||||
local data2 = string.Explode( "/", data1[3] )
|
||||
|
||||
local size = string.Explode( "#", data2[1] )
|
||||
local pos = string.Explode( "#", data2[2] )
|
||||
|
||||
local ID = data1[1]
|
||||
|
||||
if not LVS.HudEditors[ ID ] or not size[1] or not size[2] or not pos[1] or not pos[2] then continue end
|
||||
|
||||
LVS.HudEditors[ ID ].w = size[1]
|
||||
LVS.HudEditors[ ID ].h = size[2]
|
||||
LVS.HudEditors[ ID ].X = math.min( pos[1] * ScrW(), ScrW() - size[1] )
|
||||
LVS.HudEditors[ ID ].Y = math.min( pos[2] * ScrH(), ScrH() - size[2] )
|
||||
|
||||
if data1[2] == "?" then
|
||||
LVS.HudEditorsHide[ ID ] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LVS:AddHudEditor( id, X, Y, w, h, minw, minh, text, func )
|
||||
LVS.HudEditors[ id ] = {
|
||||
DefaultX = X,
|
||||
DefaultY = Y,
|
||||
DefaultWidth = w,
|
||||
DefaultHeight = h,
|
||||
X = X,
|
||||
Y = Y,
|
||||
w = w,
|
||||
h = h,
|
||||
minw = minw,
|
||||
minh = minh,
|
||||
text = text,
|
||||
func = func,
|
||||
}
|
||||
end
|
||||
|
||||
hook.Add( "OnContextMenuOpen", "!!!!!LVS_hud", function()
|
||||
if not IsValid( LocalPlayer():lvsGetVehicle() ) then return end
|
||||
|
||||
if not GetConVar( "lvs_edit_hud" ):GetBool() then return end
|
||||
|
||||
LVS:OpenEditors()
|
||||
|
||||
return false
|
||||
end )
|
||||
|
||||
hook.Add( "InitPostEntity", "!!!lvs_load_hud", function()
|
||||
LoadEditors()
|
||||
end )
|
||||
|
||||
function LVS:OpenEditors()
|
||||
for id, editor in pairs( LVS.HudEditors ) do
|
||||
if IsValid( editor.Frame ) then continue end
|
||||
|
||||
MakeFrame( id, editor.X, editor.Y, editor.w, editor.h, editor.minw, editor.minh, editor.text )
|
||||
end
|
||||
|
||||
local T = CurTime()
|
||||
local ply = LocalPlayer()
|
||||
local pod = ply:GetVehicle()
|
||||
|
||||
ply.SwitcherTime = T + 9999
|
||||
|
||||
if not IsValid( pod ) then return end
|
||||
|
||||
pod._SelectActiveTime = T + 9999
|
||||
end
|
||||
|
||||
function LVS:CloseEditors()
|
||||
SaveEditors()
|
||||
|
||||
for id, editor in pairs( LVS.HudEditors ) do
|
||||
if not IsValid( editor.Frame ) then continue end
|
||||
editor.Frame:Remove()
|
||||
end
|
||||
|
||||
local T = CurTime()
|
||||
local ply = LocalPlayer()
|
||||
local pod = ply:GetVehicle()
|
||||
|
||||
ply.SwitcherTime = T
|
||||
|
||||
if not IsValid( pod ) then return end
|
||||
|
||||
pod._SelectActiveTime = T
|
||||
end
|
||||
|
||||
hook.Add( "OnContextMenuClose", "!!!!!LVS_hud", function()
|
||||
LVS:CloseEditors()
|
||||
end )
|
||||
|
||||
function LVS:DrawDiamond( X, Y, radius, perc )
|
||||
if perc <= 0 then return end
|
||||
|
||||
local segmentdist = 90
|
||||
|
||||
draw.NoTexture()
|
||||
|
||||
for a = 90, 360, segmentdist do
|
||||
local Xa = math.Round( math.sin( math.rad( -a ) ) * radius, 0 )
|
||||
local Ya = math.Round( math.cos( math.rad( -a ) ) * radius, 0 )
|
||||
|
||||
local C = math.sqrt( radius ^ 2 + radius ^ 2 )
|
||||
|
||||
if a == 90 then
|
||||
C = C * math.min(math.max(perc - 0.75,0) / 0.25,1)
|
||||
elseif a == 180 then
|
||||
C = C * math.min(math.max(perc - 0.5,0) / 0.25,1)
|
||||
elseif a == 270 then
|
||||
C = C * math.min(math.max(perc - 0.25,0) / 0.25,1)
|
||||
elseif a == 360 then
|
||||
C = C * math.min(math.max(perc,0) / 0.25,1)
|
||||
end
|
||||
|
||||
if C > 0 then
|
||||
local AxisMoveX = math.Round( math.sin( math.rad( -a + 135) ) * (C + 3) * 0.5, 0 )
|
||||
local AxisMoveY =math.Round( math.cos( math.rad( -a + 135) ) * (C + 3) * 0.5, 0 )
|
||||
|
||||
surface.DrawTexturedRectRotated(X - Xa - AxisMoveX, Y - Ya - AxisMoveY,3, math.ceil( C ), a - 45)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function PaintIdentifier( ent )
|
||||
if not LVS.ShowIdent or LVS:IsIndicatorForced() then return end
|
||||
|
||||
local VehicleIdentifierRange = ent.VehicleIdentifierRange
|
||||
local MyPos = ent:GetPos()
|
||||
local MyTeam = ent:GetAITEAM()
|
||||
|
||||
for _, v in pairs( LVS:GetVehicles() ) do
|
||||
if not IsValid( v ) or v == ent then continue end
|
||||
|
||||
local rPos = v:LocalToWorld( v:OBBCenter() )
|
||||
|
||||
local Pos = rPos:ToScreen()
|
||||
local Dist = (MyPos - rPos):Length()
|
||||
|
||||
if Dist > VehicleIdentifierRange or util.TraceLine( {start = ent:LocalToWorld( ent:OBBCenter() ),endpos = rPos,mask = MASK_NPCWORLDSTATIC,} ).Hit then continue end
|
||||
|
||||
local Alpha = 255 * (1 - (Dist / VehicleIdentifierRange) ^ 2)
|
||||
local Team = v:GetAITEAM()
|
||||
local IndicatorColor = Color( 255, 0, 0, Alpha )
|
||||
|
||||
if Team == 0 then
|
||||
if MyTeam == 0 then continue end
|
||||
|
||||
IndicatorColor = Color( 0, 255, 0, Alpha )
|
||||
else
|
||||
if Team == 1 or Team == 2 then
|
||||
if Team ~= MyTeam and MyTeam ~= 0 then
|
||||
IndicatorColor = Color( 255, 0, 0, Alpha )
|
||||
else
|
||||
IndicatorColor = Color( 0, 127, 255, Alpha )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Team > 3 then continue end
|
||||
|
||||
v:LVSHudPaintVehicleIdentifier( Pos.x, Pos.y, IndicatorColor, v )
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add( "HUDPaint", "!!!!!LVS_hud", function()
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if ply:GetViewEntity() ~= ply then return end
|
||||
|
||||
local Pod = ply:GetVehicle()
|
||||
local Parent = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( Pod ) or not IsValid( Parent ) then
|
||||
ply._lvsoldPassengers = {}
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local X = ScrW()
|
||||
local Y = ScrH()
|
||||
|
||||
PaintIdentifier( Parent )
|
||||
Parent:LVSHudPaint( X, Y, ply )
|
||||
|
||||
local base = Pod:lvsGetWeapon()
|
||||
if IsValid( base ) then
|
||||
local weapon = base:GetActiveWeapon()
|
||||
if weapon and weapon.HudPaint then
|
||||
weapon.HudPaint( base, X, Y, ply )
|
||||
end
|
||||
else
|
||||
local weapon = Parent:GetActiveWeapon()
|
||||
if ply == Parent:GetDriver() and weapon and weapon.HudPaint then
|
||||
weapon.HudPaint( Parent, X, Y, ply )
|
||||
end
|
||||
end
|
||||
|
||||
for id, editor in pairs( LVS.HudEditors ) do
|
||||
if LVS.HudEditorsHide[ id ] then continue end
|
||||
|
||||
local ScaleX = editor.w / editor.DefaultWidth
|
||||
local ScaleY = editor.h / editor.DefaultHeight
|
||||
|
||||
local PosX = editor.X / ScaleX
|
||||
local PosY = editor.Y / ScaleY
|
||||
|
||||
local Width = editor.w / ScaleX
|
||||
local Height = editor.h / ScaleY
|
||||
|
||||
local ScrW = X / ScaleX
|
||||
local ScrH = Y / ScaleY
|
||||
|
||||
if ScaleX == 1 and ScaleY == 1 then
|
||||
editor:func( Parent, PosX, PosY, Width, Height, ScrW, ScrH, ply )
|
||||
else
|
||||
local m = Matrix()
|
||||
m:Scale( Vector( ScaleX, ScaleY, 1 ) )
|
||||
|
||||
cam.PushModelMatrix( m )
|
||||
editor:func( Parent, PosX, PosY, Width, Height, ScrW, ScrH, ply )
|
||||
cam.PopModelMatrix()
|
||||
end
|
||||
end
|
||||
end )
|
||||
772
lua/lvs_framework/autorun/cl_menu.lua
Normal file
772
lua/lvs_framework/autorun/cl_menu.lua
Normal file
@@ -0,0 +1,772 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local icon_load_version = Material("gui/html/refresh")
|
||||
|
||||
local bgMat = Material( "lvs/controlpanel_bg.png" )
|
||||
local adminMat = Material( "icon16/shield.png" )
|
||||
local gradient_mat = Material( "gui/gradient" )
|
||||
local gradient_down = Material( "gui/gradient_down" )
|
||||
|
||||
local FrameSizeX = 600
|
||||
local FrameSizeY = 400
|
||||
|
||||
local function ClientSettings( Canvas )
|
||||
local TopPanel = vgui.Create( "DPanel", Canvas )
|
||||
TopPanel:SetSize( FrameSizeX, FrameSizeY * 0.35 )
|
||||
TopPanel.Paint = function( self, w, h )
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
surface.SetMaterial( gradient_mat )
|
||||
surface.DrawTexturedRect( 1, 0, w, 1 )
|
||||
|
||||
draw.DrawText( "Mouse", "LVS_FONT", 4, 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
end
|
||||
TopPanel:Dock( BOTTOM )
|
||||
|
||||
local RightPanel = vgui.Create( "DPanel", Canvas )
|
||||
RightPanel:SetSize( FrameSizeX * 0.5, FrameSizeY )
|
||||
RightPanel.Paint = function( self, w, h )
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
surface.SetMaterial( gradient_down )
|
||||
surface.DrawTexturedRect( 0, 0, 1, h )
|
||||
draw.DrawText( "Misc/Performance", "LVS_FONT", 4, 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
end
|
||||
RightPanel:Dock( RIGHT )
|
||||
|
||||
local RightPanelRight = vgui.Create( "DPanel", RightPanel )
|
||||
RightPanelRight:SetSize( FrameSizeX * 0.25, FrameSizeY )
|
||||
RightPanelRight.Paint = function() end
|
||||
RightPanelRight:Dock( RIGHT )
|
||||
|
||||
local LeftPanel = vgui.Create( "DPanel", Canvas )
|
||||
LeftPanel:SetSize( FrameSizeX * 0.5, FrameSizeY )
|
||||
LeftPanel.Paint = function( self, w, h )
|
||||
draw.DrawText( "Preferences", "LVS_FONT", 4, 4, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
end
|
||||
LeftPanel:Dock( LEFT )
|
||||
|
||||
local CheckBoxPanel = vgui.Create( "DPanel", TopPanel )
|
||||
CheckBoxPanel:DockMargin( 0, 0, 0, 0 )
|
||||
CheckBoxPanel:SetSize( FrameSizeX, 55 )
|
||||
CheckBoxPanel.Paint = function() end
|
||||
CheckBoxPanel:Dock( TOP )
|
||||
|
||||
if GetConVar( "lvs_mouseaim_type" ):GetInt() == 1 and not LVS:IsDirectInputForced() then
|
||||
local CheckBoxType = vgui.Create( "DCheckBoxLabel", CheckBoxPanel )
|
||||
CheckBoxType:SetSize( FrameSizeX * 0.5, 55 )
|
||||
CheckBoxType:DockMargin( 16, 36, 0, 0 )
|
||||
CheckBoxType:Dock( LEFT )
|
||||
CheckBoxType:SetText( "Mouse-Aim for:" )
|
||||
CheckBoxType:SetConVar("lvs_mouseaim_type")
|
||||
CheckBoxType.OnChange = function( self, bVal )
|
||||
if not isbool( self.first ) then self.first = true return end
|
||||
timer.Simple(0.1, function() LVS:OpenMenu( true ) end )
|
||||
end
|
||||
|
||||
local DScrollPanel = vgui.Create("DScrollPanel", CheckBoxPanel )
|
||||
DScrollPanel:SetSize( FrameSizeX * 0.25, 55 )
|
||||
DScrollPanel:DockMargin( 8, 0, 8, 0 )
|
||||
DScrollPanel:Dock( LEFT )
|
||||
|
||||
for _, vehicletype in pairs( LVS:GetVehicleTypes() ) do
|
||||
local ScrollOption = vgui.Create( "DCheckBoxLabel", DScrollPanel )
|
||||
ScrollOption:SetText( vehicletype )
|
||||
ScrollOption:Dock( TOP )
|
||||
ScrollOption:DockMargin( 0, 0, 0, 5 )
|
||||
ScrollOption:SetConVar("lvs_mouseaim_type_"..vehicletype)
|
||||
end
|
||||
else
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", CheckBoxPanel )
|
||||
CheckBox:SetSize( FrameSizeX * 0.5, 55 )
|
||||
CheckBox:DockMargin( 16, 36, 0, 0 )
|
||||
CheckBox:Dock( LEFT )
|
||||
CheckBox:SetText( "Mouse-Aim Steering" )
|
||||
CheckBox:SetConVar("lvs_mouseaim")
|
||||
CheckBox.OnChange = function( self, bVal )
|
||||
if not isbool( self.first ) then self.first = true return end
|
||||
timer.Simple(0.1, function() LVS:OpenMenu( true ) end )
|
||||
end
|
||||
if LVS:IsDirectInputForced() then
|
||||
CheckBox:SetText( "[DISABLED] Use Mouse-Aim Steering" )
|
||||
CheckBox:SetDisabled( true )
|
||||
end
|
||||
|
||||
if not LVS:IsDirectInputForced() then
|
||||
local CheckBoxType = vgui.Create( "DCheckBoxLabel", CheckBoxPanel )
|
||||
CheckBoxType:SetSize( FrameSizeX * 0.5, 55 )
|
||||
CheckBoxType:DockMargin( 16, 36, 0, 0 )
|
||||
CheckBoxType:Dock( LEFT )
|
||||
CheckBoxType:SetText( "Edit Mouse-Aim per Type" )
|
||||
CheckBoxType:SetConVar("lvs_mouseaim_type")
|
||||
CheckBoxType.OnChange = function( self, bVal )
|
||||
if not isbool( self.first ) then self.first = true return end
|
||||
timer.Simple(0.1, function() LVS:OpenMenu( true ) end )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if GetConVar( "lvs_mouseaim" ):GetInt() == 0 or LVS:IsDirectInputForced() then
|
||||
local L = vgui.Create( "DPanel", TopPanel )
|
||||
L:SetSize( FrameSizeX * 0.5, FrameSizeY )
|
||||
L.Paint = function() end
|
||||
L:Dock( LEFT )
|
||||
|
||||
local R = vgui.Create( "DPanel", TopPanel )
|
||||
R:SetSize( FrameSizeX * 0.5, FrameSizeY )
|
||||
R.Paint = function() end
|
||||
R:Dock( RIGHT )
|
||||
|
||||
local slider = vgui.Create( "DNumSlider", R )
|
||||
slider:DockMargin( 16, 4, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "Y Sensitivity" )
|
||||
slider:SetMin( -10 )
|
||||
slider:SetMax( 10 )
|
||||
slider:SetDecimals( 3 )
|
||||
slider:SetConVar( "lvs_sensitivity_y" )
|
||||
|
||||
local slider = vgui.Create( "DNumSlider", L )
|
||||
slider:DockMargin( 16, 4, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "X Sensitivity" )
|
||||
slider:SetMin( 0 )
|
||||
slider:SetMax( 10 )
|
||||
slider:SetDecimals( 3 )
|
||||
slider:SetConVar( "lvs_sensitivity_x" )
|
||||
|
||||
local slider = vgui.Create( "DNumSlider", L )
|
||||
slider:DockMargin( 16, 4, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "Return Delta" )
|
||||
slider:SetMin( 0 )
|
||||
slider:SetMax( 10 )
|
||||
slider:SetDecimals( 3 )
|
||||
slider:SetConVar( "lvs_return_delta" )
|
||||
else
|
||||
local slider = vgui.Create( "DNumSlider", TopPanel )
|
||||
slider:DockMargin( 16, 4, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "Camera Focus" )
|
||||
slider:SetMin( -1 )
|
||||
slider:SetMax( 1 )
|
||||
slider:SetDecimals( 2 )
|
||||
slider:SetConVar( "lvs_camerafocus" )
|
||||
end
|
||||
|
||||
local slider = vgui.Create( "DNumSlider", LeftPanel )
|
||||
slider:DockMargin( 16, 36, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "Engine Volume" )
|
||||
slider:SetMin( 0 )
|
||||
slider:SetMax( 1 )
|
||||
slider:SetDecimals( 2 )
|
||||
slider:SetConVar( "lvs_volume" )
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanel )
|
||||
CheckBox:DockMargin( 16, 43, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Show Team Identifier" )
|
||||
CheckBox:SetConVar("lvs_show_identifier")
|
||||
if LVS:IsIndicatorForced() then
|
||||
CheckBox:SetText( "[DISABLED] Team Identifier" )
|
||||
CheckBox:SetDisabled( true )
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanel )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Show Hit/Kill Marker" )
|
||||
CheckBox:SetConVar("lvs_hitmarker")
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanel )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Enable HUD Editor" )
|
||||
CheckBox:SetConVar("lvs_edit_hud")
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanelRight )
|
||||
CheckBox:DockMargin( 16, 43, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Trail Effects" )
|
||||
CheckBox:SetConVar("lvs_show_traileffects")
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanelRight )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Wind/Dust FX/SFX" )
|
||||
CheckBox:SetConVar("lvs_show_effects")
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanelRight )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Scrape/Impact FX" )
|
||||
CheckBox:SetConVar("lvs_show_physicseffects")
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", RightPanelRight )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Bullet near miss SFX" )
|
||||
CheckBox:SetConVar("lvs_bullet_nearmiss")
|
||||
end
|
||||
|
||||
local function ClientControls( Canvas )
|
||||
local TextHint = vgui.Create("DPanel", Canvas)
|
||||
TextHint:DockMargin( 4, 20, 4, 2 )
|
||||
TextHint:SetText("")
|
||||
TextHint:Dock( TOP )
|
||||
TextHint.Paint = function(self, w, h )
|
||||
draw.DrawText( "You need to re-enter the vehicle in order for the changes to take effect!", "LVS_FONT_PANEL", w * 0.5, -1, Color( 255, 50, 50, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DScrollPanel = vgui.Create("DScrollPanel", Canvas)
|
||||
DScrollPanel:DockMargin( 0, 0, 0, 24 )
|
||||
DScrollPanel:Dock( FILL )
|
||||
|
||||
for category, _ in pairs( LVS.KEYS_CATEGORIES ) do
|
||||
local Header = vgui.Create("DPanel", DScrollPanel )
|
||||
Header:DockMargin( 0, 4, 4, 2 )
|
||||
Header:SetText("")
|
||||
Header:Dock( TOP )
|
||||
Header.Paint = function(self, w, h )
|
||||
surface.SetMaterial( gradient_mat )
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
surface.DrawTexturedRect( 0, 0, w, 1 )
|
||||
|
||||
draw.DrawText( category, "LVS_FONT", 4, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
for _, entry in pairs( LVS.KEYS_REGISTERED ) do
|
||||
if entry.category ~= category then continue end
|
||||
|
||||
local DPanel = vgui.Create( "DPanel", DScrollPanel )
|
||||
DPanel.Paint = function(self, w, h ) end
|
||||
DPanel:DockMargin( 4, 2, 4, 2 )
|
||||
DPanel:SetSize( FrameSizeX, 25 )
|
||||
DPanel:Dock( TOP )
|
||||
|
||||
local ConVar = GetConVar( entry.cmd )
|
||||
|
||||
local DLabel = vgui.Create("DLabel", DPanel)
|
||||
DLabel:DockMargin( 16, 0, 0, 0 )
|
||||
DLabel:SetText( entry.printname )
|
||||
DLabel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DLabel:Dock( LEFT )
|
||||
|
||||
local DBinder = vgui.Create("DBinder", DPanel)
|
||||
DBinder:DockMargin( 0, 0, 0, 0 )
|
||||
DBinder:SetValue( ConVar:GetInt() )
|
||||
DBinder:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DBinder:Dock( RIGHT )
|
||||
DBinder.ConVar = ConVar
|
||||
DBinder.OnChange = function(self,iNum)
|
||||
self.ConVar:SetInt(iNum)
|
||||
|
||||
LocalPlayer():lvsBuildControls()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local Header = vgui.Create("DPanel", DScrollPanel )
|
||||
Header:DockMargin( 0, 16, 0, 0 )
|
||||
Header:SetText("")
|
||||
Header:Dock( TOP )
|
||||
Header.Paint = function(self, w, h )
|
||||
surface.SetMaterial( gradient_mat )
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
surface.DrawTexturedRect( 0, 0, w, 1 )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create("DButton",DScrollPanel)
|
||||
DButton:SetText("Reset")
|
||||
DButton:DockMargin( 4, 0, 4, 4 )
|
||||
DButton:SetSize( FrameSizeX, 32 )
|
||||
DButton:Dock( TOP )
|
||||
DButton.DoClick = function()
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
|
||||
for _, entry in pairs( LVS.KEYS_REGISTERED ) do
|
||||
GetConVar( entry.cmd ):SetInt( entry.default )
|
||||
end
|
||||
|
||||
LocalPlayer():lvsBuildControls()
|
||||
|
||||
LVS:OpenClientControls()
|
||||
end
|
||||
end
|
||||
|
||||
local function ServerSettings( Canvas )
|
||||
local slider = vgui.Create( "DNumSlider", Canvas )
|
||||
slider:DockMargin( 16, 32, 16, 4 )
|
||||
slider:Dock( TOP )
|
||||
slider:SetText( "Player Default AI-Team" )
|
||||
slider:SetMin( 0 )
|
||||
slider:SetMax( 3 )
|
||||
slider:SetDecimals( 0 )
|
||||
slider:SetConVar( "lvs_default_teams" )
|
||||
function slider:OnValueChanged( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_default_teams")
|
||||
net.WriteString( tostring( math.Round(val,0) ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Freeze Player AI-Team" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_freeze_teams" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_freeze_teams")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Only allow Players of matching AI-Team to enter Vehicles" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_teampassenger" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_teampassenger")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "LVS-AI ignore NPC's" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_ai_ignorenpcs" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_ai_ignorenpcs")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "LVS-AI ignore Players's" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_ai_ignoreplayers" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_ai_ignoreplayers")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Disable Mouse Aim" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_force_directinput" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_force_directinput")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local CheckBox = vgui.Create( "DCheckBoxLabel", Canvas )
|
||||
CheckBox:DockMargin( 16, 16, 4, 4 )
|
||||
CheckBox:SetSize( FrameSizeX, 30 )
|
||||
CheckBox:Dock( TOP )
|
||||
CheckBox:SetText( "Hide Team Identifier" )
|
||||
CheckBox:SetValue( GetConVar( "lvs_force_forceindicator" ):GetInt() )
|
||||
CheckBox:SizeToContents()
|
||||
function CheckBox:OnChange( val )
|
||||
net.Start("lvs_admin_setconvar")
|
||||
net.WriteString("lvs_force_forceindicator")
|
||||
net.WriteString( tostring( val and 1 or 0 ) )
|
||||
net.SendToServer()
|
||||
end
|
||||
end
|
||||
|
||||
function LVS:OpenClientSettings()
|
||||
if not IsValid( LVS.Frame ) then return end
|
||||
|
||||
local BasePanel = LVS.Frame:CreatePanel()
|
||||
|
||||
local DPanel = vgui.Create( "DPanel", BasePanel )
|
||||
DPanel.Paint = function(self, w, h ) end
|
||||
DPanel:DockMargin( 0, 0, 0, 0 )
|
||||
DPanel:SetSize( FrameSizeX, 25 )
|
||||
DPanel:Dock( TOP )
|
||||
|
||||
local TabPanel = vgui.Create( "DPanel", BasePanel )
|
||||
TabPanel.Paint = function(self, w, h ) end
|
||||
TabPanel:DockMargin( 0, 0, 0, 0 )
|
||||
TabPanel:SetSize( FrameSizeX, 25 )
|
||||
TabPanel:Dock( TOP )
|
||||
|
||||
local SettingsPanel = vgui.Create( "DPanel", TabPanel )
|
||||
SettingsPanel:DockMargin( 0, 0, 0, 0 )
|
||||
SettingsPanel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
SettingsPanel:Dock( LEFT )
|
||||
SettingsPanel.Paint = function(self, w, h )
|
||||
draw.DrawText( "SETTINGS", "LVS_FONT", w * 0.5, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create( "DButton", TabPanel )
|
||||
DButton:DockMargin( 0, 0, 0, 0 )
|
||||
DButton:SetText( "" )
|
||||
DButton:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DButton:Dock( RIGHT )
|
||||
DButton.DoClick = function()
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
LVS:OpenClientControls()
|
||||
end
|
||||
DButton.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
local Hovered = self:IsHovered()
|
||||
|
||||
if Hovered then
|
||||
surface.SetDrawColor( 120, 120, 120, 255 )
|
||||
else
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
end
|
||||
|
||||
surface.DrawRect(1, 0, w-2, h-1)
|
||||
|
||||
local Col = Hovered and Color( 255, 255, 255, 255 ) or Color( 150, 150, 150, 255 )
|
||||
draw.DrawText( "CONTROLS", "LVS_FONT", w * 0.5, 0, Col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create( "DButton", DPanel )
|
||||
DButton:DockMargin( 0, 0, 0, 0 )
|
||||
DButton:SetText( "" )
|
||||
DButton:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DButton:Dock( RIGHT )
|
||||
DButton.DoClick = function()
|
||||
if LocalPlayer():IsSuperAdmin() then
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
LVS:OpenServerMenu()
|
||||
else
|
||||
surface.PlaySound( "buttons/button11.wav" )
|
||||
end
|
||||
end
|
||||
DButton.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
local Hovered = self:IsHovered()
|
||||
|
||||
if Hovered then
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 120, 120, 120, 255 ) )
|
||||
else
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 80, 80, 80, 255 ) )
|
||||
end
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, Hovered and 255 or 50 )
|
||||
surface.SetMaterial( adminMat )
|
||||
surface.DrawTexturedRect( 3, 2, 16, 16 )
|
||||
|
||||
local Col = Hovered and Color( 255, 255, 255, 255 ) or Color( 150, 150, 150, 255 )
|
||||
draw.DrawText( "SERVER", "LVS_FONT", w * 0.5, 0, Col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local ClientPanel = vgui.Create( "DPanel", DPanel )
|
||||
ClientPanel.Paint = function(self, w, h ) end
|
||||
ClientPanel:DockMargin( 0, 0, 0, 0 )
|
||||
ClientPanel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
ClientPanel:Dock( LEFT )
|
||||
ClientPanel.Paint = function(self, w, h )
|
||||
draw.DrawText( "CLIENT", "LVS_FONT", w * 0.5, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local Canvas = vgui.Create( "DPanel", BasePanel )
|
||||
Canvas.Paint = function(self, w, h ) end
|
||||
Canvas:DockMargin( 0, 0, 0, 0 )
|
||||
Canvas:SetSize( FrameSizeX, 25 )
|
||||
Canvas:Dock( FILL )
|
||||
|
||||
ClientSettings( Canvas )
|
||||
end
|
||||
|
||||
function LVS:OpenClientControls()
|
||||
if not IsValid( LVS.Frame ) then return end
|
||||
|
||||
local BasePanel = LVS.Frame:CreatePanel()
|
||||
|
||||
local DPanel = vgui.Create( "DPanel", BasePanel )
|
||||
DPanel.Paint = function(self, w, h ) end
|
||||
DPanel:DockMargin( 0, 0, 0, 0 )
|
||||
DPanel:SetSize( FrameSizeX, 25 )
|
||||
DPanel:Dock( TOP )
|
||||
|
||||
local TabPanel = vgui.Create( "DPanel", BasePanel )
|
||||
TabPanel.Paint = function(self, w, h ) end
|
||||
TabPanel:DockMargin( 0, 0, 0, 0 )
|
||||
TabPanel:SetSize( FrameSizeX, 25 )
|
||||
TabPanel:Dock( TOP )
|
||||
|
||||
local SettingsPanel = vgui.Create( "DPanel", TabPanel )
|
||||
SettingsPanel:DockMargin( 0, 0, 0, 0 )
|
||||
SettingsPanel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
SettingsPanel:Dock( RIGHT )
|
||||
SettingsPanel.Paint = function(self, w, h )
|
||||
draw.DrawText( "CONTROLS", "LVS_FONT", w * 0.5, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create( "DButton", TabPanel )
|
||||
DButton:DockMargin( 0, 0, 0, 0 )
|
||||
DButton:SetText( "" )
|
||||
DButton:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DButton:Dock( LEFT )
|
||||
DButton.DoClick = function()
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
LVS:OpenClientSettings()
|
||||
end
|
||||
DButton.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
local Hovered = self:IsHovered()
|
||||
|
||||
if Hovered then
|
||||
surface.SetDrawColor( 120, 120, 120, 255 )
|
||||
else
|
||||
surface.SetDrawColor( 80, 80, 80, 255 )
|
||||
end
|
||||
|
||||
surface.DrawRect(1, 1, w-2, h-2)
|
||||
|
||||
local Col = Hovered and Color( 255, 255, 255, 255 ) or Color( 150, 150, 150, 255 )
|
||||
draw.DrawText( "SETTINGS", "LVS_FONT", w * 0.5, 0, Col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create( "DButton", DPanel )
|
||||
DButton:DockMargin( 0, 0, 0, 0 )
|
||||
DButton:SetText( "" )
|
||||
DButton:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DButton:Dock( RIGHT )
|
||||
DButton.DoClick = function()
|
||||
if LocalPlayer():IsSuperAdmin() then
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
LVS:OpenServerMenu()
|
||||
else
|
||||
surface.PlaySound( "buttons/button11.wav" )
|
||||
end
|
||||
end
|
||||
DButton.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
local Hovered = self:IsHovered()
|
||||
|
||||
if Hovered then
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 120, 120, 120, 255 ) )
|
||||
else
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 80, 80, 80, 255 ) )
|
||||
end
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, Hovered and 255 or 50 )
|
||||
surface.SetMaterial( adminMat )
|
||||
surface.DrawTexturedRect( 3, 2, 16, 16 )
|
||||
|
||||
local Col = Hovered and Color( 255, 255, 255, 255 ) or Color( 150, 150, 150, 255 )
|
||||
draw.DrawText( "SERVER", "LVS_FONT", w * 0.5, 0, Col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local ClientPanel = vgui.Create( "DPanel", DPanel )
|
||||
ClientPanel.Paint = function(self, w, h ) end
|
||||
ClientPanel:DockMargin( 0, 0, 0, 0 )
|
||||
ClientPanel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
ClientPanel:Dock( LEFT )
|
||||
ClientPanel.Paint = function(self, w, h )
|
||||
draw.DrawText( "CLIENT", "LVS_FONT", w * 0.5, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local Canvas = vgui.Create( "DPanel", BasePanel )
|
||||
Canvas.Paint = function(self, w, h ) end
|
||||
Canvas:DockMargin( 0, 0, 0, 0 )
|
||||
Canvas:SetSize( FrameSizeX, 25 )
|
||||
Canvas:Dock( FILL )
|
||||
|
||||
ClientControls( Canvas )
|
||||
end
|
||||
|
||||
function LVS:OpenServerMenu()
|
||||
if not IsValid( LVS.Frame ) then return end
|
||||
|
||||
local BasePanel = LVS.Frame:CreatePanel()
|
||||
|
||||
local DPanel = vgui.Create( "DPanel", BasePanel )
|
||||
DPanel.Paint = function(self, w, h ) end
|
||||
DPanel:DockMargin( 0, 0, 0, 0 )
|
||||
DPanel:SetSize( FrameSizeX, 25 )
|
||||
DPanel:Dock( TOP )
|
||||
|
||||
local ServerPanel = vgui.Create( "DPanel", DPanel )
|
||||
ServerPanel.Paint = function(self, w, h ) end
|
||||
ServerPanel:DockMargin( 0, 0, 0, 0 )
|
||||
ServerPanel:SetSize( FrameSizeX * 0.5, 32 )
|
||||
ServerPanel:Dock( RIGHT )
|
||||
ServerPanel.Paint = function(self, w, h )
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( adminMat )
|
||||
surface.DrawTexturedRect( 3, 2, 16, 16 )
|
||||
draw.DrawText( "SERVER", "LVS_FONT", w * 0.5, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local DButton = vgui.Create( "DButton", DPanel )
|
||||
DButton:DockMargin( 0, 0, 0, 0 )
|
||||
DButton:SetText( "" )
|
||||
DButton:SetSize( FrameSizeX * 0.5, 32 )
|
||||
DButton:Dock( LEFT )
|
||||
DButton.DoClick = function()
|
||||
surface.PlaySound( "buttons/button14.wav" )
|
||||
LVS:OpenClientSettings()
|
||||
end
|
||||
DButton.Paint = function(self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
local Hovered = self:IsHovered()
|
||||
|
||||
if Hovered then
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 120, 120, 120, 255 ) )
|
||||
else
|
||||
draw.RoundedBox( 4, 1, 1, w-2, h-2, Color( 80, 80, 80, 255 ) )
|
||||
end
|
||||
|
||||
local Col = Hovered and Color( 255, 255, 255, 255 ) or Color( 150, 150, 150, 255 )
|
||||
draw.DrawText( "CLIENT", "LVS_FONT", w * 0.5, 0, Col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local Canvas = vgui.Create( "DPanel", BasePanel )
|
||||
Canvas.Paint = function(self, w, h ) end
|
||||
Canvas:DockMargin( 0, 0, 0, 0 )
|
||||
Canvas:SetSize( FrameSizeX, 25 )
|
||||
Canvas:Dock( FILL )
|
||||
|
||||
ServerSettings( Canvas )
|
||||
end
|
||||
|
||||
function LVS:CloseMenu()
|
||||
if not IsValid( LVS.Frame ) then return end
|
||||
|
||||
LVS.Frame:Close()
|
||||
LVS.Frame = nil
|
||||
end
|
||||
|
||||
function LVS:OpenMenu( keep_position )
|
||||
local xPos
|
||||
local yPos
|
||||
|
||||
if IsValid( LVS.Frame ) then
|
||||
if keep_position then
|
||||
xPos = LVS.Frame:GetX()
|
||||
yPos = LVS.Frame:GetY()
|
||||
end
|
||||
|
||||
LVS:CloseMenu()
|
||||
end
|
||||
|
||||
LVS.Frame = vgui.Create( "DFrame" )
|
||||
LVS.Frame:SetSize( FrameSizeX, FrameSizeY )
|
||||
LVS.Frame:SetTitle( "" )
|
||||
LVS.Frame:SetDraggable( true )
|
||||
LVS.Frame:SetScreenLock( true )
|
||||
LVS.Frame:MakePopup()
|
||||
LVS.Frame:Center()
|
||||
if keep_position and xPos and yPos then
|
||||
LVS.Frame:SetPos( xPos, yPos )
|
||||
end
|
||||
|
||||
LVS.Frame.Paint = function(self, w, h )
|
||||
draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
|
||||
draw.RoundedBoxEx( 8, 1, 26, w-2, h-27, Color( 120, 120, 120, 255 ), false, false, true, true )
|
||||
draw.RoundedBoxEx( 8, 0, 0, w, 25, LVS.ThemeColor, true, true )
|
||||
|
||||
draw.SimpleText( "[LVS] - Control Panel ", "LVS_FONT", 5, 11, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
||||
|
||||
surface.SetDrawColor( 255, 255, 255, 50 )
|
||||
surface.SetMaterial( bgMat )
|
||||
surface.DrawTexturedRect( 0, -50, w, w )
|
||||
end
|
||||
LVS.Frame.CreatePanel = function( self )
|
||||
|
||||
if IsValid( self.OldPanel ) then
|
||||
self.OldPanel:Remove()
|
||||
self.OldPanel = nil
|
||||
end
|
||||
|
||||
local DPanel = vgui.Create( "DPanel", LVS.Frame )
|
||||
DPanel:SetPos( 0, 25 )
|
||||
DPanel:SetSize( FrameSizeX, FrameSizeY - 25 )
|
||||
DPanel.Paint = function(self, w, h )
|
||||
local Col = Color( 255, 191, 0, 255 )
|
||||
|
||||
if LVS.VERSION_GITHUB == 0 then
|
||||
surface.SetMaterial( icon_load_version )
|
||||
surface.SetDrawColor( Col )
|
||||
surface.DrawTexturedRectRotated( w - 14, h - 14, 16, 16, -CurTime() * 200 )
|
||||
|
||||
draw.SimpleText( "v"..LVS:GetVersion()..LVS.VERSION_TYPE, "LVS_VERSION", w - 23, h - 14, Col, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local Current = LVS:GetVersion()
|
||||
local Latest = LVS.VERSION_GITHUB
|
||||
|
||||
local Pref = "v"
|
||||
|
||||
if Current >= Latest and not LVS.VERSION_ADDONS_OUTDATED then
|
||||
Col = Color(0,255,0,255)
|
||||
else
|
||||
Col = Color(255,0,0,255)
|
||||
Pref = "OUTDATED v"
|
||||
end
|
||||
|
||||
draw.SimpleText( Pref..LVS:GetVersion()..LVS.VERSION_TYPE, "LVS_VERSION", w - 7, h - 14, Col, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
self.OldPanel = DPanel
|
||||
|
||||
return DPanel
|
||||
end
|
||||
|
||||
LVS:OpenClientSettings()
|
||||
end
|
||||
|
||||
list.Set( "DesktopWindows", "LVSMenu", {
|
||||
title = "[LVS] Settings",
|
||||
icon = "icon64/iconlvs.png",
|
||||
init = function( icon, window )
|
||||
LVS:OpenMenu()
|
||||
end
|
||||
} )
|
||||
|
||||
concommand.Add( "lvs_openmenu", function( ply, cmd, args ) LVS:OpenMenu() end )
|
||||
326
lua/lvs_framework/autorun/lvs_bulletsystem.lua
Normal file
326
lua/lvs_framework/autorun/lvs_bulletsystem.lua
Normal file
@@ -0,0 +1,326 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local LVS = LVS
|
||||
|
||||
LVS._ActiveBullets = {}
|
||||
|
||||
function LVS:GetBullet( index )
|
||||
if not LVS._ActiveBullets then return end
|
||||
|
||||
return LVS._ActiveBullets[ index ]
|
||||
end
|
||||
|
||||
local NewBullet = {}
|
||||
NewBullet.__index = NewBullet
|
||||
|
||||
function NewBullet:SetPos( pos )
|
||||
self.curpos = pos
|
||||
end
|
||||
|
||||
function NewBullet:GetPos()
|
||||
if not self.curpos then return self.Src end
|
||||
|
||||
return self.curpos
|
||||
end
|
||||
|
||||
function NewBullet:GetDir()
|
||||
return self.Dir or vector_origin
|
||||
end
|
||||
|
||||
function NewBullet:GetTimeAlive()
|
||||
return CurTime() - self.StartTime
|
||||
end
|
||||
|
||||
function NewBullet:GetSpawnTime()
|
||||
if SERVER then
|
||||
return self.StartTime
|
||||
else
|
||||
return math.min( self.StartTimeCL, CurTime() ) -- time when the bullet is received on client
|
||||
end
|
||||
end
|
||||
|
||||
function NewBullet:GetLength()
|
||||
return math.min((CurTime() - self:GetSpawnTime()) * 14,1)
|
||||
end
|
||||
|
||||
local function HandleBullets()
|
||||
local T = CurTime()
|
||||
local FT = FrameTime()
|
||||
|
||||
for id, bullet in pairs( LVS._ActiveBullets ) do -- loop through bullet table
|
||||
if bullet:GetSpawnTime() + 5 < T then -- destroy all bullets older than 5 seconds
|
||||
LVS._ActiveBullets[ id ] = nil
|
||||
continue
|
||||
end
|
||||
|
||||
local start = bullet.Src
|
||||
local dir = bullet.Dir
|
||||
local TimeAlive = bullet:GetTimeAlive()
|
||||
local pos = dir * TimeAlive * bullet.Velocity
|
||||
local mul = bullet:GetLength()
|
||||
local Is2ndTickAlive = TimeAlive > FT * 2 -- this system is slow. Takes atleast 2 ticks before it spawns. We need to trace from startpos until lua catches up
|
||||
|
||||
-- startpos, direction and curtime of creation is networked to client.
|
||||
-- The Bullet position is simulated by doing startpos + dir * time * velocity
|
||||
if SERVER then
|
||||
bullet:SetPos( start + pos )
|
||||
else
|
||||
if IsValid( bullet.Entity ) then -- if the vehicle entity is valid...
|
||||
local inv = 1 - mul
|
||||
|
||||
-- ..."parent" the bullet to the vehicle for a very short time. This will give the illusion of the bullet not lagging behind even tho it is fired later on client
|
||||
bullet:SetPos( start * mul + bullet.Entity:LocalToWorld( bullet.SrcEntity ) * inv + pos )
|
||||
else
|
||||
bullet:SetPos( start + pos )
|
||||
end
|
||||
end
|
||||
|
||||
local Filter = bullet.Filter
|
||||
|
||||
local trace = util.TraceHull( {
|
||||
start = Is2ndTickAlive and start + pos - dir or start,
|
||||
endpos = start + pos + dir * bullet.Velocity * FT,
|
||||
filter = Filter,
|
||||
mins = bullet.Mins,
|
||||
maxs = bullet.Maxs,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
|
||||
--debugoverlay.Line( Is2ndTickAlive and start + pos - dir or start, start + pos + dir * bullet.Velocity * FT, Color( 255, 255, 255 ), true )
|
||||
|
||||
if CLIENT then
|
||||
if not bullet.Muted and mul == 1 and LVS.EnableBulletNearmiss then
|
||||
-- whats more expensive, spamming this effect or doing distance checks to localplayer for each bullet think? Alternative method?
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( bullet:GetPos() )
|
||||
effectdata:SetFlags( 2 )
|
||||
util.Effect( "TracerSound", effectdata )
|
||||
end
|
||||
|
||||
if not bullet.HasHitWater then
|
||||
local traceWater = util.TraceLine( {
|
||||
start = start + pos - dir,
|
||||
endpos = start + pos + dir * bullet.Velocity * FT,
|
||||
filter = Filter,
|
||||
mask = MASK_WATER,
|
||||
} )
|
||||
|
||||
if traceWater.Hit then
|
||||
LVS._ActiveBullets[ id ].HasHitWater = true
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( traceWater.HitPos )
|
||||
effectdata:SetScale( 10 + bullet.HullSize * 0.5 )
|
||||
effectdata:SetFlags( 2 )
|
||||
util.Effect( "WaterSplash", effectdata, true, true )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if trace.Hit then
|
||||
-- hulltrace doesnt hit the wall due to its hullsize...
|
||||
-- so this needs an extra trace line
|
||||
local traceImpact = util.TraceLine( {
|
||||
start = Is2ndTickAlive and start + pos - dir or start,
|
||||
endpos = start + pos + dir * 250,
|
||||
filter = Filter,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
|
||||
if SERVER then
|
||||
local EndPos = traceImpact.Hit and traceImpact.HitPos or trace.HitPos
|
||||
|
||||
local dmginfo = DamageInfo()
|
||||
dmginfo:SetDamage( bullet.Damage )
|
||||
dmginfo:SetAttacker( (IsValid( bullet.Attacker ) and bullet.Attacker) or (IsValid( bullet.Entity ) and bullet.Entity) or game.GetWorld() )
|
||||
dmginfo:SetDamageType( DMG_AIRBOAT )
|
||||
dmginfo:SetInflictor( (IsValid( bullet.Entity ) and bullet.Entity) or (IsValid( bullet.Attacker ) and bullet.Attacker) or game.GetWorld() )
|
||||
dmginfo:SetDamagePosition( EndPos )
|
||||
dmginfo:SetDamageForce( bullet.Dir * bullet.Force )
|
||||
|
||||
if bullet.Callback then
|
||||
bullet.Callback( bullet.Attacker, traceImpact, dmginfo )
|
||||
end
|
||||
|
||||
trace.Entity:TakeDamageInfo( dmginfo )
|
||||
|
||||
if IsValid( trace.Entity ) and trace.Entity.GetBloodColor then
|
||||
local BloodColor = trace.Entity:GetBloodColor()
|
||||
|
||||
if BloodColor and BloodColor ~= DONT_BLEED then
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( EndPos )
|
||||
effectdata:SetColor( BloodColor )
|
||||
util.Effect( "BloodImpact", effectdata, true, true )
|
||||
end
|
||||
end
|
||||
|
||||
if bullet.SplashDamage and bullet.SplashDamageRadius then
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( EndPos )
|
||||
effectdata:SetNormal( trace.HitWorld and trace.HitNormal or dir )
|
||||
effectdata:SetMagnitude( bullet.SplashDamageRadius / 250 )
|
||||
util.Effect( bullet.SplashDamageEffect, effectdata )
|
||||
|
||||
dmginfo:SetDamageType( bullet.SplashDamageType )
|
||||
dmginfo:SetDamage( bullet.SplashDamage )
|
||||
|
||||
util.BlastDamageInfo( dmginfo, EndPos, bullet.SplashDamageRadius )
|
||||
end
|
||||
else
|
||||
if not traceImpact.HitSky then
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( traceImpact.HitPos )
|
||||
effectdata:SetEntity( traceImpact.Entity )
|
||||
effectdata:SetStart( start )
|
||||
effectdata:SetNormal( traceImpact.HitNormal )
|
||||
effectdata:SetSurfaceProp( traceImpact.SurfaceProps )
|
||||
util.Effect( "Impact", effectdata )
|
||||
end
|
||||
end
|
||||
|
||||
LVS._ActiveBullets[ id ] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local vector_one = Vector(1,1,1)
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString( "lvs_fire_bullet" )
|
||||
|
||||
hook.Add( "Tick", "!!!!lvs_bullet_handler", function( ply, ent ) -- from what i understand, think can "skip" on lag, while tick still simulates all steps
|
||||
HandleBullets()
|
||||
end )
|
||||
|
||||
function LVS:FireBullet( data )
|
||||
local bullet = {}
|
||||
|
||||
setmetatable( bullet, NewBullet )
|
||||
|
||||
bullet.TracerName = data.TracerName or "lvs_tracer_orange"
|
||||
bullet.Src = data.Src or vector_origin
|
||||
bullet.Dir = (data.Dir + VectorRand() * (data.Spread or vector_origin) * 0.5):GetNormalized()
|
||||
bullet.Force = data.Force or 10
|
||||
bullet.HullSize = data.HullSize or 5
|
||||
bullet.Mins = -vector_one * bullet.HullSize
|
||||
bullet.Maxs = vector_one * bullet.HullSize
|
||||
bullet.Velocity = data.Velocity or 2500
|
||||
bullet.Attacker = IsValid( data.Attacker ) and data.Attacker or (IsValid( data.Entity ) and data.Entity or game.GetWorld())
|
||||
bullet.Damage = data.Damage or 10
|
||||
bullet.Entity = data.Entity
|
||||
if IsValid( bullet.Entity ) and bullet.Entity.GetCrosshairFilterEnts then
|
||||
bullet.Filter = bullet.Entity:GetCrosshairFilterEnts()
|
||||
else
|
||||
bullet.Filter = bullet.Entity
|
||||
end
|
||||
bullet.SrcEntity = data.SrcEntity or vector_origin
|
||||
bullet.Callback = data.Callback
|
||||
bullet.SplashDamage = data.SplashDamage
|
||||
bullet.SplashDamageRadius = data.SplashDamageRadius
|
||||
bullet.SplashDamageEffect = data.SplashDamageEffect or "lvs_bullet_impact"
|
||||
bullet.SplashDamageType = data.SplashDamageType or DMG_SONIC
|
||||
bullet.StartTime = CurTime()
|
||||
|
||||
local ReplaceEffect = isstring( bullet.SplashDamageEffect )
|
||||
|
||||
if InfMap then
|
||||
for _, ply in ipairs( player.GetAll() ) do
|
||||
local NewPos = Vector( bullet.Src.x, bullet.Src.y, bullet.Src.z ) - InfMap.unlocalize_vector( Vector(), ply.CHUNK_OFFSET )
|
||||
|
||||
net.Start( "lvs_fire_bullet", true )
|
||||
net.WriteString( bullet.TracerName )
|
||||
net.WriteFloat( NewPos.x )
|
||||
net.WriteFloat( NewPos.y )
|
||||
net.WriteFloat( NewPos.z )
|
||||
net.WriteAngle( bullet.Dir:Angle() )
|
||||
net.WriteFloat( bullet.StartTime )
|
||||
net.WriteFloat( bullet.HullSize )
|
||||
net.WriteEntity( bullet.Entity )
|
||||
net.WriteFloat( bullet.SrcEntity.x )
|
||||
net.WriteFloat( bullet.SrcEntity.y )
|
||||
net.WriteFloat( bullet.SrcEntity.z )
|
||||
net.WriteFloat( bullet.Velocity )
|
||||
net.Send( ply )
|
||||
end
|
||||
else
|
||||
net.Start( "lvs_fire_bullet", true )
|
||||
net.WriteString( bullet.TracerName )
|
||||
net.WriteFloat( bullet.Src.x )
|
||||
net.WriteFloat( bullet.Src.y )
|
||||
net.WriteFloat( bullet.Src.z )
|
||||
net.WriteAngle( bullet.Dir:Angle() )
|
||||
net.WriteFloat( bullet.StartTime )
|
||||
net.WriteFloat( bullet.HullSize )
|
||||
net.WriteEntity( bullet.Entity )
|
||||
net.WriteFloat( bullet.SrcEntity.x )
|
||||
net.WriteFloat( bullet.SrcEntity.y )
|
||||
net.WriteFloat( bullet.SrcEntity.z )
|
||||
net.WriteFloat( bullet.Velocity )
|
||||
net.SendPVS( bullet.Src )
|
||||
end
|
||||
|
||||
table.insert(LVS._ActiveBullets, bullet )
|
||||
end
|
||||
else
|
||||
local Index = 0
|
||||
local MaxIndex = 4094 -- this is the util.effect limit
|
||||
|
||||
net.Receive( "lvs_fire_bullet", function( length )
|
||||
local bullet = {}
|
||||
|
||||
setmetatable( bullet, NewBullet )
|
||||
|
||||
bullet.TracerName = net.ReadString()
|
||||
bullet.Src = Vector(net.ReadFloat(),net.ReadFloat(),net.ReadFloat())
|
||||
bullet.Dir = net.ReadAngle():Forward()
|
||||
bullet.StartTime = net.ReadFloat()
|
||||
bullet.HullSize = net.ReadFloat()
|
||||
bullet.Mins = -vector_one * bullet.HullSize
|
||||
bullet.Maxs = vector_one * bullet.HullSize
|
||||
bullet.Entity = net.ReadEntity()
|
||||
if IsValid( bullet.Entity ) and bullet.Entity.GetCrosshairFilterEnts then
|
||||
bullet.Filter = bullet.Entity:GetCrosshairFilterEnts()
|
||||
else
|
||||
bullet.Filter = bullet.Entity
|
||||
end
|
||||
bullet.SrcEntity = Vector(net.ReadFloat(),net.ReadFloat(),net.ReadFloat())
|
||||
bullet.Velocity = net.ReadFloat()
|
||||
|
||||
if net.ReadBool() then
|
||||
bullet.SplashDamageEffect = net.ReadString()
|
||||
else
|
||||
bullet.SplashDamageEffect = "lvs_bullet_impact"
|
||||
end
|
||||
|
||||
bullet.StartTimeCL = CurTime() + RealFrameTime()
|
||||
|
||||
local ply = LocalPlayer()
|
||||
bullet.Muted = IsValid( ply ) and bullet.Entity == ply:lvsGetVehicle()
|
||||
|
||||
Index = Index + 1
|
||||
if Index > MaxIndex then
|
||||
Index = 1
|
||||
end
|
||||
|
||||
LVS._ActiveBullets[ Index ] = bullet
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( bullet.Src )
|
||||
effectdata:SetNormal( bullet.Dir )
|
||||
effectdata:SetMaterialIndex( Index )
|
||||
util.Effect( bullet.TracerName, effectdata )
|
||||
end )
|
||||
|
||||
hook.Add( "Think", "!!!!_lvs_bullet_think_cl", function()
|
||||
HandleBullets()
|
||||
end )
|
||||
end
|
||||
126
lua/lvs_framework/autorun/lvs_convar.lua
Normal file
126
lua/lvs_framework/autorun/lvs_convar.lua
Normal file
@@ -0,0 +1,126 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
-- 2022 and i still havent bothered creating a system that does this automatically
|
||||
|
||||
LVS.cVar_FreezeTeams = CreateConVar( "lvs_freeze_teams", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"enable/disable auto ai-team switching" )
|
||||
LVS.FreezeTeams = LVS.cVar_FreezeTeams and LVS.cVar_FreezeTeams:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_freeze_teams", function( convar, oldValue, newValue )
|
||||
LVS.FreezeTeams = tonumber( newValue ) ~=0
|
||||
end, "lvs_freezeteams_callback" )
|
||||
|
||||
LVS.cVar_TeamPassenger = CreateConVar( "lvs_teampassenger", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"only allow players of matching ai-team to enter the vehicle? 1 = team only, 0 = everyone can enter" )
|
||||
LVS.TeamPassenger = LVS.cVar_TeamPassenger and LVS.cVar_TeamPassenger:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_teampassenger", function( convar, oldValue, newValue )
|
||||
LVS.TeamPassenger = tonumber( newValue ) ~= 0
|
||||
end, "lvs_teampassenger_callback" )
|
||||
|
||||
LVS.cVar_PlayerDefaultTeam = CreateConVar( "lvs_default_teams", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"set default player ai-team" )
|
||||
LVS.PlayerDefaultTeam = LVS.cVar_PlayerDefaultTeam and LVS.cVar_PlayerDefaultTeam:GetInt() or 0
|
||||
cvars.AddChangeCallback( "lvs_default_teams", function( convar, oldValue, newValue )
|
||||
LVS.PlayerDefaultTeam = math.Round( tonumber( newValue ), 0 )
|
||||
end, "lvs_defaultteam_callback" )
|
||||
|
||||
LVS.cVar_IgnoreNPCs = CreateConVar( "lvs_ai_ignorenpcs", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"should LVS-AI ignore NPCs?" )
|
||||
LVS.IgnoreNPCs = LVS.cVar_IgnoreNPCs and LVS.cVar_IgnoreNPCs:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_ai_ignoreplayers", function( convar, oldValue, newValue )
|
||||
LVS.IgnorePlayers = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
LVS.cVar_playerignore = CreateConVar( "lvs_ai_ignoreplayers", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"should LVS-AI ignore Players?" )
|
||||
LVS.IgnorePlayers = LVS.cVar_playerignore and LVS.cVar_playerignore:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_ai_ignorenpcs", function( convar, oldValue, newValue )
|
||||
LVS.IgnoreNPCs = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString( "lvs_admin_setconvar" )
|
||||
|
||||
net.Receive( "lvs_admin_setconvar", function( length, ply )
|
||||
if not IsValid( ply ) or not ply:IsSuperAdmin() then return end
|
||||
|
||||
local ConVar = net.ReadString()
|
||||
local Value = tonumber( net.ReadString() )
|
||||
|
||||
RunConsoleCommand( ConVar, Value )
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
CreateClientConVar( "lvs_mouseaim", 0, true, true)
|
||||
CreateClientConVar( "lvs_mouseaim_type", 0, true, false)
|
||||
CreateClientConVar( "lvs_edit_hud", 1, true, false)
|
||||
CreateClientConVar( "lvs_sensitivity_x", 1, true, true)
|
||||
CreateClientConVar( "lvs_sensitivity_y", 1, true, true)
|
||||
CreateClientConVar( "lvs_return_delta", 1, true, true)
|
||||
|
||||
LVS.cvarCamFocus = CreateClientConVar( "lvs_camerafocus", 0, true, false)
|
||||
|
||||
local cvarVolume = CreateClientConVar( "lvs_volume", 0.5, true, false)
|
||||
LVS.EngineVolume = cvarVolume and cvarVolume:GetFloat() or 0.5
|
||||
cvars.AddChangeCallback( "lvs_volume", function( convar, oldValue, newValue )
|
||||
LVS.EngineVolume = math.Clamp( tonumber( newValue ), 0, 1 )
|
||||
end)
|
||||
|
||||
local cvarTrail = CreateClientConVar( "lvs_show_traileffects", 1, true, false)
|
||||
LVS.ShowTraileffects = cvarTrail and cvarTrail:GetBool() or true
|
||||
cvars.AddChangeCallback( "lvs_show_traileffects", function( convar, oldValue, newValue )
|
||||
LVS.ShowTraileffects = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarEffects = CreateClientConVar( "lvs_show_effects", 1, true, false)
|
||||
LVS.ShowEffects = cvarEffects and cvarEffects:GetBool() or true
|
||||
cvars.AddChangeCallback( "lvs_show_effects", function( convar, oldValue, newValue )
|
||||
LVS.ShowEffects = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarPhysEffects = CreateClientConVar( "lvs_show_physicseffects", 1, true, false)
|
||||
LVS.ShowPhysicsEffects = cvarPhysEffects and cvarPhysEffects:GetBool() or true
|
||||
cvars.AddChangeCallback( "lvs_show_physicseffects", function( convar, oldValue, newValue )
|
||||
LVS.ShowPhysicsEffects = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarShowIdent = CreateClientConVar( "lvs_show_identifier", 1, true, false)
|
||||
LVS.ShowIdent = cvarShowIdent and cvarShowIdent:GetBool() or true
|
||||
cvars.AddChangeCallback( "lvs_show_identifier", function( convar, oldValue, newValue )
|
||||
LVS.ShowIdent = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarHitMarker = CreateClientConVar( "lvs_hitmarker", 1, true, false)
|
||||
LVS.ShowHitMarker = cvarHitMarker and cvarHitMarker:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_hitmarker", function( convar, oldValue, newValue )
|
||||
LVS.ShowHitMarker = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarAntiAlias = GetConVar( "mat_antialias" )
|
||||
LVS.AntiAliasingEnabled = cvarAntiAlias and (cvarAntiAlias:GetInt() > 3) or false
|
||||
cvars.AddChangeCallback( "mat_antialias", function( convar, oldValue, newValue )
|
||||
LVS.AntiAliasingEnabled = tonumber( newValue ) > 3
|
||||
end)
|
||||
|
||||
local cvarBulletSFX = CreateClientConVar( "lvs_bullet_nearmiss", 1, true, false)
|
||||
LVS.EnableBulletNearmiss = cvarBulletSFX and cvarBulletSFX:GetBool() or true
|
||||
cvars.AddChangeCallback( "lvs_bullet_nearmiss", function( convar, oldValue, newValue )
|
||||
LVS.EnableBulletNearmiss = tonumber( newValue ) ~=0
|
||||
end)
|
||||
|
||||
local cvarDev = GetConVar( "developer" )
|
||||
LVS.DeveloperEnabled = cvarDev and (cvarDev:GetInt() >= 1) or false
|
||||
cvars.AddChangeCallback( "developer", function( convar, oldValue, newValue )
|
||||
LVS.DeveloperEnabled = (tonumber( newValue ) or 0) >= 1
|
||||
end)
|
||||
|
||||
cvars.AddChangeCallback( "lvs_mouseaim", function( convar, oldValue, newValue )
|
||||
LocalPlayer():lvsBuildControls()
|
||||
|
||||
net.Start("lvs_toggle_mouseaim")
|
||||
net.SendToServer()
|
||||
end)
|
||||
70
lua/lvs_framework/autorun/lvs_damagenotify.lua
Normal file
70
lua/lvs_framework/autorun/lvs_damagenotify.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
if CLIENT then
|
||||
net.Receive( "lvs_hurtmarker", function( len )
|
||||
if not LVS.ShowHitMarker then return end
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
vehicle:HurtMarker( net.ReadFloat() )
|
||||
end )
|
||||
|
||||
net.Receive( "lvs_hitmarker", function( len )
|
||||
if not LVS.ShowHitMarker then return end
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
if net.ReadBool() then
|
||||
vehicle:CritMarker()
|
||||
else
|
||||
vehicle:HitMarker()
|
||||
end
|
||||
end )
|
||||
|
||||
net.Receive( "lvs_killmarker", function( len )
|
||||
if not LVS.ShowHitMarker then return end
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
vehicle:KillMarker()
|
||||
end )
|
||||
|
||||
net.Receive( "lvs_armormarker", function( len )
|
||||
if not LVS.ShowHitMarker then return end
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
vehicle:ArmorMarker( net.ReadBool() )
|
||||
end )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
util.AddNetworkString( "lvs_hitmarker" )
|
||||
util.AddNetworkString( "lvs_hurtmarker" )
|
||||
util.AddNetworkString( "lvs_killmarker" )
|
||||
util.AddNetworkString( "lvs_armormarker" )
|
||||
118
lua/lvs_framework/autorun/lvs_entitytracker.lua
Normal file
118
lua/lvs_framework/autorun/lvs_entitytracker.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
LVS.VehiclesStored = LVS.VehiclesStored or {}
|
||||
LVS.NPCsStored = LVS.NPCsStored or {}
|
||||
|
||||
function LVS:GetNPCs()
|
||||
for index, ent in pairs( LVS.NPCsStored ) do
|
||||
if not IsValid( ent ) then
|
||||
LVS.NPCsStored[ index ] = nil
|
||||
end
|
||||
end
|
||||
|
||||
return LVS.NPCsStored
|
||||
end
|
||||
|
||||
function LVS:GetVehicles()
|
||||
for index, ent in pairs( LVS.VehiclesStored ) do
|
||||
if not IsValid( ent ) then
|
||||
LVS.VehiclesStored[ index ] = nil
|
||||
end
|
||||
end
|
||||
|
||||
return LVS.VehiclesStored
|
||||
end
|
||||
|
||||
local Teams = {
|
||||
["npc_breen"] = 1,
|
||||
["npc_combine_s"] = 1,
|
||||
["npc_combinedropship"] = 1,
|
||||
["npc_combinegunship"] = 1,
|
||||
["npc_crabsynth"] = 1,
|
||||
["npc_cscanner"] = 1,
|
||||
["npc_helicopter"] = 1,
|
||||
["npc_manhack"] = 1,
|
||||
["npc_metropolice"] = 1,
|
||||
["npc_mortarsynth"] = 1,
|
||||
["npc_sniper"] = 1,
|
||||
["npc_stalker"] = 1,
|
||||
["npc_strider"] = 1,
|
||||
["npc_hunter"] = 1,
|
||||
|
||||
["monster_human_grunt"] = 1,
|
||||
["monster_human_assassin"] = 1,
|
||||
["monster_sentry"] = 1,
|
||||
|
||||
["npc_kleiner"] = 2,
|
||||
["npc_monk"] = 2,
|
||||
["npc_mossman"] = 2,
|
||||
["npc_vortigaunt"] = 2,
|
||||
["npc_alyx"] = 2,
|
||||
["npc_barney"] = 2,
|
||||
["npc_citizen"] = 2,
|
||||
["npc_dog"] = 2,
|
||||
["npc_eli"] = 2,
|
||||
["monster_scientist"] = 2,
|
||||
["monster_barney"] = 2,
|
||||
|
||||
["npc_zombine"] = 3,
|
||||
["npc_fastzombie"] = 3,
|
||||
["npc_headcrab"] = 3,
|
||||
["npc_headcrab_black"] = 3,
|
||||
["npc_headcrab_fast"] = 3,
|
||||
["npc_antlion"] = 3,
|
||||
["npc_antlionguard"] = 3,
|
||||
["npc_zombie"] = 3,
|
||||
["npc_zombie_torso"] = 3,
|
||||
["npc_poisonzombie"] = 3,
|
||||
["monster_alien_grunt"] = 3,
|
||||
["monster_alien_slave"] = 3,
|
||||
["monster_gargantua"] = 3,
|
||||
["monster_bullchicken"] = 3,
|
||||
["monster_headcrab"] = 3,
|
||||
["monster_babycrab"] = 3,
|
||||
["monster_zombie"] = 3,
|
||||
["monster_houndeye"] = 3,
|
||||
["monster_nihilanth"] = 3,
|
||||
["monster_bigmomma"] = 3,
|
||||
["monster_babycrab"] = 3,
|
||||
}
|
||||
function LVS:GetNPCRelationship( npc_class )
|
||||
return Teams[ npc_class ] or 0
|
||||
end
|
||||
|
||||
hook.Add( "OnEntityCreated", "!!!!lvsEntitySorter", function( ent )
|
||||
timer.Simple( 2, function()
|
||||
if not IsValid( ent ) then return end
|
||||
|
||||
if isfunction( ent.IsNPC ) and ent:IsNPC() then
|
||||
table.insert( LVS.NPCsStored, ent )
|
||||
|
||||
if SERVER then
|
||||
hook.Run( "LVS.UpdateRelationship", ent )
|
||||
end
|
||||
end
|
||||
|
||||
if ent.LVS then
|
||||
if CLIENT and ent.PrintName then
|
||||
language.Add( ent:GetClass(), ent.PrintName)
|
||||
end
|
||||
|
||||
table.insert( LVS.VehiclesStored, ent )
|
||||
|
||||
if SERVER then
|
||||
LVS:FixVelocity()
|
||||
|
||||
hook.Run( "LVS.UpdateRelationship", ent )
|
||||
end
|
||||
end
|
||||
end )
|
||||
end )
|
||||
66
lua/lvs_framework/autorun/lvs_force_directinput.lua
Normal file
66
lua/lvs_framework/autorun/lvs_force_directinput.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local cVar_forcedirect = CreateConVar( "lvs_force_directinput", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"Force Direct Input Steering Method?" )
|
||||
local cVar_forceindicator = CreateConVar( "lvs_force_forceindicator", "0", {FCVAR_REPLICATED , FCVAR_ARCHIVE},"Force Direct Input Steering Method?" )
|
||||
|
||||
function LVS:IsDirectInputForced()
|
||||
return LVS.ForceDirectInput == true
|
||||
end
|
||||
|
||||
function LVS:IsIndicatorForced()
|
||||
return LVS.ForceIndicator == true
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString( "lvs_forced_input_getter" )
|
||||
|
||||
local function UpdateForcedSettings( ply )
|
||||
net.Start( "lvs_forced_input_getter" )
|
||||
|
||||
net.WriteBool( LVS:IsDirectInputForced() )
|
||||
net.WriteBool( LVS:IsIndicatorForced() )
|
||||
|
||||
if IsValid( ply ) then
|
||||
net.Send( ply )
|
||||
else
|
||||
net.Broadcast()
|
||||
end
|
||||
end
|
||||
|
||||
LVS.ForceDirectInput = cVar_forcedirect and cVar_forcedirect:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_force_directinput", function( convar, oldValue, newValue )
|
||||
LVS.ForceDirectInput = tonumber( newValue ) ~=0
|
||||
|
||||
UpdateForcedSettings()
|
||||
end)
|
||||
|
||||
LVS.ForceIndicator = cVar_forceindicator and cVar_forceindicator:GetBool() or false
|
||||
cvars.AddChangeCallback( "lvs_force_forceindicator", function( convar, oldValue, newValue )
|
||||
LVS.ForceIndicator = tonumber( newValue ) ~=0
|
||||
|
||||
UpdateForcedSettings()
|
||||
end)
|
||||
|
||||
net.Receive( "lvs_forced_input_getter", function( length, ply )
|
||||
UpdateForcedSettings( ply )
|
||||
end)
|
||||
else
|
||||
net.Receive( "lvs_forced_input_getter", function( length )
|
||||
LVS.ForceDirectInput = net.ReadBool()
|
||||
LVS.ForceIndicator = net.ReadBool()
|
||||
end )
|
||||
|
||||
hook.Add( "InitPostEntity", "!11!!!lvsIsPlayerReady", function()
|
||||
net.Start( "lvs_forced_input_getter" )
|
||||
net.SendToServer()
|
||||
end )
|
||||
end
|
||||
221
lua/lvs_framework/autorun/lvs_hookers.lua
Normal file
221
lua/lvs_framework/autorun/lvs_hookers.lua
Normal file
@@ -0,0 +1,221 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
hook.Add( "InitPostEntity", "!!!lvsBullshitFixer", function()
|
||||
timer.Simple(1, function()
|
||||
LVS.MapDoneLoading = true
|
||||
end)
|
||||
|
||||
if SERVER then return end
|
||||
|
||||
-- this needs to be here to make sure all sents are registered
|
||||
for _, vehicletype in ipairs( LVS:GetVehicleTypes() ) do
|
||||
CreateClientConVar( "lvs_mouseaim_type_"..vehicletype, 0, true, false)
|
||||
end
|
||||
end )
|
||||
|
||||
local function SetDistance( vehicle, ply )
|
||||
local iWheel = ply:GetCurrentCommand():GetMouseWheel()
|
||||
|
||||
if iWheel == 0 or not vehicle.SetCameraDistance then return end
|
||||
|
||||
local newdist = math.Clamp( vehicle:GetCameraDistance() - iWheel * 0.03 * ( 1.1 + vehicle:GetCameraDistance() ), -1, 10 )
|
||||
|
||||
vehicle:SetCameraDistance( newdist )
|
||||
end
|
||||
|
||||
local function SetHeight( vehicle, ply )
|
||||
local iWheel = ply:GetCurrentCommand():GetMouseWheel()
|
||||
|
||||
if iWheel == 0 or not vehicle.SetCameraHeight then return end
|
||||
|
||||
local newdist = math.Clamp( vehicle:GetCameraHeight() - iWheel * 0.03 * ( 1.1 + vehicle:GetCameraHeight() ), -1, 10 )
|
||||
|
||||
vehicle:SetCameraHeight( newdist )
|
||||
end
|
||||
|
||||
hook.Add( "VehicleMove", "!!!!lvs_vehiclemove", function( ply, vehicle, mv )
|
||||
if not ply.lvsGetVehicle then return end
|
||||
|
||||
local veh = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( veh ) then return end
|
||||
|
||||
if SERVER and ply:lvsKeyDown( "VIEWDIST" ) then
|
||||
if ply:lvsKeyDown( "VIEWHEIGHT" ) then
|
||||
SetHeight( vehicle, ply )
|
||||
else
|
||||
SetDistance( vehicle, ply )
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT and not IsFirstTimePredicted() then return end
|
||||
|
||||
local KeyThirdPerson = ply:lvsKeyDown("THIRDPERSON")
|
||||
|
||||
if ply._lvsOldThirdPerson ~= KeyThirdPerson then
|
||||
ply._lvsOldThirdPerson = KeyThirdPerson
|
||||
|
||||
if KeyThirdPerson and vehicle.SetThirdPersonMode then
|
||||
vehicle:SetThirdPersonMode( not vehicle:GetThirdPersonMode() )
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end )
|
||||
|
||||
hook.Add("CalcMainActivity", "!!!lvs_playeranimations", function(ply)
|
||||
if not ply.lvsGetVehicle then return end
|
||||
|
||||
local Ent = ply:lvsGetVehicle()
|
||||
|
||||
if IsValid( Ent ) then
|
||||
local A,B = Ent:CalcMainActivity( ply )
|
||||
|
||||
if A and B then
|
||||
return A, B
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("UpdateAnimation", "!!!lvs_playeranimations", function( ply, velocity, maxseqgroundspeed )
|
||||
if not ply.lvsGetVehicle then return end
|
||||
|
||||
local Ent = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( Ent ) then return end
|
||||
|
||||
return Ent:UpdateAnimation( ply, velocity, maxseqgroundspeed )
|
||||
end)
|
||||
|
||||
hook.Add( "StartCommand", "!!!!LVS_grab_command", function( ply, cmd )
|
||||
if not ply.lvsGetVehicle then return end
|
||||
|
||||
local veh = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( veh ) then return end
|
||||
|
||||
veh:StartCommand( ply, cmd )
|
||||
end )
|
||||
|
||||
hook.Add( "CanProperty", "!!!!lvsEditPropertiesDisabler", function( ply, property, ent )
|
||||
if ent.LVS and not ply:IsAdmin() and property == "editentity" then return false end
|
||||
end )
|
||||
|
||||
LVS.ToolsDisable = {
|
||||
["rb655_easy_animation"] = true,
|
||||
["rb655_easy_bonemerge"] = true,
|
||||
["rb655_easy_inspector"] = true,
|
||||
}
|
||||
hook.Add( "CanTool", "!!!!lvsCanToolDisabler", function( ply, tr, toolname, tool, button )
|
||||
if LVS.ToolsDisable[ toolname ] and IsValid( tr.Entity ) and tr.Entity.LVS then return false end
|
||||
end )
|
||||
|
||||
if CLIENT then
|
||||
local hide = {
|
||||
["CHudHealth"] = true,
|
||||
["CHudBattery"] = true,
|
||||
["CHudAmmo"] = true,
|
||||
}
|
||||
local function HUDShouldDrawLVS( name )
|
||||
if hide[ name ] then return false end
|
||||
end
|
||||
|
||||
hook.Add( "LVS.PlayerEnteredVehicle", "!!!!lvs_player_enter", function( ply, veh )
|
||||
hook.Add( "HUDShouldDraw", "!!!!lvs_hidehud", HUDShouldDrawLVS )
|
||||
|
||||
local cvar = GetConVar( "lvs_mouseaim_type" )
|
||||
|
||||
if not cvar or cvar:GetInt() ~= 1 or not veh.GetVehicleType then return end
|
||||
|
||||
local vehicletype = veh:GetVehicleType()
|
||||
|
||||
local cvar_type = GetConVar( "lvs_mouseaim_type_"..vehicletype )
|
||||
local cvar_mouseaim = GetConVar( "lvs_mouseaim" )
|
||||
|
||||
if not cvar_type or not cvar_mouseaim then return end
|
||||
|
||||
cvar_mouseaim:SetInt( cvar_type:GetInt() )
|
||||
end )
|
||||
|
||||
hook.Add( "LVS.PlayerLeaveVehicle", "!!!!lvs_player_exit", function( ply, veh )
|
||||
hook.Remove( "HUDShouldDraw", "!!!!lvs_hidehud" )
|
||||
end )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local DamageFix = {
|
||||
["npc_hunter"] = true,
|
||||
["npc_stalker"] = true,
|
||||
["npc_strider"] = true,
|
||||
["npc_combinegunship"] = true,
|
||||
["npc_helicopter"] = true,
|
||||
}
|
||||
|
||||
hook.Add( "EntityTakeDamage", "!!!_lvs_fix_vehicle_explosion_damage", function( target, dmginfo )
|
||||
if not target:IsPlayer() then
|
||||
if target.LVS then
|
||||
local attacker = dmginfo:GetAttacker()
|
||||
|
||||
if IsValid( attacker ) and DamageFix[ attacker:GetClass() ] then
|
||||
dmginfo:SetDamageType( DMG_AIRBOAT )
|
||||
dmginfo:SetDamageForce( dmginfo:GetDamageForce():GetNormalized() * 15000 )
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local veh = target:lvsGetVehicle()
|
||||
|
||||
if not IsValid( veh ) or dmginfo:IsDamageType( DMG_DIRECT ) then return end
|
||||
|
||||
if target:GetCollisionGroup() == COLLISION_GROUP_PLAYER then return end
|
||||
|
||||
dmginfo:SetDamage( 0 )
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerEnteredVehicle", "!!!!lvs_player_enter", function( ply, Pod )
|
||||
local veh = ply:lvsGetVehicle()
|
||||
|
||||
if IsValid( veh ) then
|
||||
net.Start( "lvs_player_enterexit" )
|
||||
net.WriteBool( true )
|
||||
net.WriteEntity( veh )
|
||||
net.Send( ply )
|
||||
|
||||
ply._lvsIsInVehicle = true
|
||||
end
|
||||
|
||||
if not Pod.HidePlayer then return end
|
||||
|
||||
ply:SetNoDraw( true )
|
||||
|
||||
if pac then pac.TogglePartDrawing( ply, 0 ) end
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerLeaveVehicle", "!!!!lvs_player_exit", function( ply, Pod )
|
||||
if ply._lvsIsInVehicle then
|
||||
net.Start( "lvs_player_enterexit" )
|
||||
net.WriteBool( false )
|
||||
net.WriteEntity( ply:lvsGetVehicle() )
|
||||
net.Send( ply )
|
||||
|
||||
ply._lvsIsInVehicle = nil
|
||||
end
|
||||
|
||||
if not Pod.HidePlayer then return end
|
||||
|
||||
ply:SetNoDraw( false )
|
||||
|
||||
if pac then pac.TogglePartDrawing( ply, 1 ) end
|
||||
end )
|
||||
168
lua/lvs_framework/autorun/lvs_keybinding.lua
Normal file
168
lua/lvs_framework/autorun/lvs_keybinding.lua
Normal file
@@ -0,0 +1,168 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
hook.Add( "LVS:Initialize", "!!11lvs_default_keys", function()
|
||||
local KEYS = {
|
||||
{
|
||||
name = "ATTACK",
|
||||
category = "Armament",
|
||||
name_menu = "Attack",
|
||||
default = MOUSE_LEFT,
|
||||
cmd = "lvs_lmb"
|
||||
},
|
||||
{
|
||||
name = "ZOOM",
|
||||
category = "Armament",
|
||||
name_menu = "Zoom",
|
||||
default = MOUSE_RIGHT,
|
||||
cmd = "lvs_rmb"
|
||||
},
|
||||
{
|
||||
name = "~SELECT~WEAPON#1",
|
||||
category = "Armament",
|
||||
name_menu = "Select Weapon 1",
|
||||
cmd = "lvs_select_weapon1"
|
||||
},
|
||||
{
|
||||
name = "~SELECT~WEAPON#2",
|
||||
category = "Armament",
|
||||
name_menu = "Select Weapon 2",
|
||||
cmd = "lvs_select_weapon2"
|
||||
},
|
||||
{
|
||||
name = "~SELECT~WEAPON#3",
|
||||
category = "Armament",
|
||||
name_menu = "Select Weapon 3",
|
||||
cmd = "lvs_select_weapon3"
|
||||
},
|
||||
{
|
||||
name = "~SELECT~WEAPON#4",
|
||||
category = "Armament",
|
||||
name_menu = "Select Weapon 4",
|
||||
cmd = "lvs_select_weapon4"
|
||||
},
|
||||
--[[ only adding 4 because i dont want to bloat the menu. There can be added as many keys as neededed the system should figure it out by itself
|
||||
{
|
||||
name = "~SELECT~WEAPON#5",
|
||||
category = "Armament",
|
||||
name_menu = "Select Weapon 5",
|
||||
cmd = "lvs_select_weapon5"
|
||||
},
|
||||
]]
|
||||
{
|
||||
name = "EXIT",
|
||||
category = "Misc",
|
||||
name_menu = "Exit Vehicle",
|
||||
default = "+use",
|
||||
cmd = "lvs_exit"
|
||||
},
|
||||
{
|
||||
name = "VIEWDIST",
|
||||
category = "Misc",
|
||||
name_menu = "Enable Mouse-Wheel Set-Camera-Distance",
|
||||
default = MOUSE_MIDDLE,
|
||||
cmd = "lvs_viewzoom"
|
||||
},
|
||||
{
|
||||
name = "VIEWHEIGHT",
|
||||
category = "Misc",
|
||||
name_menu = "Set-Camera-Distance => Set-Camera-Height",
|
||||
default = "phys_swap",
|
||||
cmd = "lvs_viewheight"
|
||||
},
|
||||
{
|
||||
name = "THIRDPERSON",
|
||||
category = "Misc",
|
||||
name_menu = "Toggle Thirdperson",
|
||||
default = "+duck",
|
||||
cmd = "lvs_thirdperson"
|
||||
},
|
||||
{
|
||||
name = "FREELOOK",
|
||||
category = "Misc",
|
||||
name_menu = "Freelook (Hold)",
|
||||
default = "+walk",
|
||||
cmd = "lvs_freelook"
|
||||
},
|
||||
{
|
||||
name = "ENGINE",
|
||||
category = "Misc",
|
||||
name_menu = "Toggle Engine",
|
||||
default = "+reload",
|
||||
cmd = "lvs_startengine"
|
||||
},
|
||||
{
|
||||
name = "VSPEC",
|
||||
category = "Misc",
|
||||
name_menu = "Toggle Vehicle-specific Function",
|
||||
default = "+jump",
|
||||
cmd = "lvs_special"
|
||||
},
|
||||
}
|
||||
|
||||
for _, v in pairs( KEYS ) do
|
||||
LVS:AddKey( v.name, v.category, v.name_menu, v.cmd, v.default )
|
||||
end
|
||||
end )
|
||||
|
||||
if SERVER then return end
|
||||
|
||||
concommand.Add( "lvs_mouseaim_toggle", function( ply, cmd, args )
|
||||
local OldVar = GetConVar( "lvs_mouseaim" ):GetInt()
|
||||
|
||||
if OldVar == 0 then
|
||||
ply:PrintMessage( HUD_PRINTTALK, "[LVS] Mouse-Aim: Enabled" )
|
||||
RunConsoleCommand( "lvs_mouseaim", "1" )
|
||||
|
||||
else
|
||||
ply:PrintMessage( HUD_PRINTTALK, "[LVS] Mouse-Aim: Disabled" )
|
||||
RunConsoleCommand( "lvs_mouseaim", "0" )
|
||||
end
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerBindPress", "!!!!_LVS_PlayerBindPress", function( ply, bind, pressed )
|
||||
if not ply.lvsGetVehicle then return end
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
if not ply:lvsKeyDown( "VIEWDIST" ) then
|
||||
if string.find( bind, "invnext" ) then
|
||||
vehicle:NextWeapon()
|
||||
end
|
||||
if string.find( bind, "invprev" ) then
|
||||
vehicle:PrevWeapon()
|
||||
end
|
||||
end
|
||||
|
||||
if string.find( bind, "+zoom" ) then
|
||||
if vehicle.lvsDisableZoom then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
hook.Add( "SpawnMenuOpen", "!!!lvs_spawnmenudisable", function()
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not ply._lvsDisableSpawnMenu or not IsValid( ply:lvsGetVehicle() ) then return end
|
||||
|
||||
return false
|
||||
end )
|
||||
|
||||
hook.Add( "ContextMenuOpen", "!!!lvs_contextmenudisable", function()
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not ply._lvsDisableContextMenu or not IsValid( ply:lvsGetVehicle() ) then return end
|
||||
|
||||
return false
|
||||
end )
|
||||
75
lua/lvs_framework/autorun/lvs_net.lua
Normal file
75
lua/lvs_framework/autorun/lvs_net.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString( "lvs_player_request_filter" )
|
||||
util.AddNetworkString( "lvs_player_enterexit" )
|
||||
util.AddNetworkString( "lvs_toggle_mouseaim" )
|
||||
|
||||
net.Receive( "lvs_toggle_mouseaim", function( length, ply )
|
||||
ply:lvsBuildControls()
|
||||
|
||||
local veh = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( veh ) then return end
|
||||
|
||||
veh:AlignView( ply )
|
||||
end)
|
||||
|
||||
net.Receive( "lvs_player_request_filter", function( length, ply )
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local ent = net.ReadEntity()
|
||||
|
||||
if not IsValid( ent ) or not ent.GetCrosshairFilterEnts then return end -- TODO: Make this loop around and wait for ent.IsInitialized to exist and ent:IsInitialized() to return true
|
||||
|
||||
local CrosshairFilterEnts = table.Copy( ent:GetCrosshairFilterEnts() )
|
||||
|
||||
for id, entity in pairs( CrosshairFilterEnts ) do
|
||||
if not IsValid( entity ) or entity:GetNoDraw() then
|
||||
CrosshairFilterEnts[ id ] = nil
|
||||
end
|
||||
end
|
||||
|
||||
net.Start( "lvs_player_request_filter" )
|
||||
net.WriteEntity( ent )
|
||||
net.WriteTable( CrosshairFilterEnts )
|
||||
net.Send( ply )
|
||||
end)
|
||||
else
|
||||
net.Receive( "lvs_player_request_filter", function( length )
|
||||
local LVSent = net.ReadEntity()
|
||||
|
||||
if not IsValid( LVSent ) then return end
|
||||
|
||||
local Filter = {}
|
||||
|
||||
for _, entity in pairs( net.ReadTable() ) do
|
||||
if not IsValid( entity ) then continue end
|
||||
table.insert( Filter, entity )
|
||||
end
|
||||
|
||||
LVSent.CrosshairFilterEnts = Filter
|
||||
end )
|
||||
|
||||
net.Receive( "lvs_player_enterexit", function( len )
|
||||
local Enable = net.ReadBool()
|
||||
local Vehicle = net.ReadEntity()
|
||||
|
||||
if not IsValid( Vehicle ) then return end
|
||||
|
||||
if Enable then
|
||||
hook.Run( "LVS.PlayerEnteredVehicle", LocalPlayer(), Vehicle )
|
||||
else
|
||||
hook.Run( "LVS.PlayerLeaveVehicle", LocalPlayer(), Vehicle )
|
||||
end
|
||||
end )
|
||||
end
|
||||
336
lua/lvs_framework/autorun/lvs_player.lua
Normal file
336
lua/lvs_framework/autorun/lvs_player.lua
Normal file
@@ -0,0 +1,336 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local meta = FindMetaTable( "Player" )
|
||||
|
||||
function meta:lvsGetAITeam()
|
||||
return self:GetNWInt( "lvsAITeam", LVS.PlayerDefaultTeam )
|
||||
end
|
||||
|
||||
function meta:lvsGetVehicle()
|
||||
local Pod = self:GetVehicle()
|
||||
|
||||
if not IsValid( Pod ) then return NULL end
|
||||
|
||||
if Pod.LVSchecked then
|
||||
|
||||
return Pod.LVSBaseEnt
|
||||
|
||||
else
|
||||
local Parent = Pod:GetParent()
|
||||
|
||||
if not IsValid( Parent ) then return NULL end
|
||||
|
||||
if not Parent.LVS then
|
||||
Pod.LVSchecked = LVS.MapDoneLoading
|
||||
Pod.LVSBaseEnt = NULL
|
||||
|
||||
return NULL
|
||||
end
|
||||
|
||||
Pod.LVSchecked = LVS.MapDoneLoading
|
||||
Pod.LVSBaseEnt = Parent
|
||||
|
||||
return Parent
|
||||
end
|
||||
end
|
||||
|
||||
function meta:lvsGetWeaponHandler()
|
||||
local Pod = self:GetVehicle()
|
||||
|
||||
if not IsValid( Pod ) then return NULL end
|
||||
|
||||
local weapon = Pod:lvsGetWeapon()
|
||||
|
||||
if IsValid( weapon ) then
|
||||
return weapon
|
||||
else
|
||||
local veh = self:lvsGetVehicle()
|
||||
|
||||
if not IsValid( veh ) then return NULL end
|
||||
|
||||
if veh:GetDriver() == self then
|
||||
return veh
|
||||
else
|
||||
return NULL
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function meta:lvsGetControls()
|
||||
if not istable( self.LVS_BINDS ) then
|
||||
self:lvsBuildControls()
|
||||
end
|
||||
|
||||
return self.LVS_BINDS
|
||||
end
|
||||
|
||||
function meta:lvsMouseAim()
|
||||
if LVS:IsDirectInputForced() then
|
||||
return false
|
||||
end
|
||||
|
||||
return self._lvsMouseAim
|
||||
end
|
||||
|
||||
function meta:lvsMouseSensitivity()
|
||||
local X = self._lvsMouseX or 1
|
||||
local Y = self._lvsMouseY or 1
|
||||
local delta = self._lvsReturnDelta or 1
|
||||
|
||||
return X, Y, delta
|
||||
end
|
||||
|
||||
function meta:lvsBuildControls()
|
||||
if istable( self.LVS_BINDS ) then
|
||||
table.Empty( self.LVS_BINDS )
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self._lvsMouseAim = self:GetInfoNum( "lvs_mouseaim", 0 ) == 1
|
||||
|
||||
self.LVS_BINDS = table.Copy( LVS.KEYS_CATEGORIES )
|
||||
|
||||
for _,v in pairs( LVS.KEYS_REGISTERED ) do
|
||||
if v.id == "~SKIP~" then continue end
|
||||
|
||||
local ButtonID = self:GetInfoNum( v.cmd, 0 )
|
||||
|
||||
if not self.LVS_BINDS[v.category][ ButtonID ] then
|
||||
self.LVS_BINDS[v.category][ ButtonID ] = {}
|
||||
end
|
||||
|
||||
table.insert( self.LVS_BINDS[v.category][ ButtonID ], v.id )
|
||||
end
|
||||
|
||||
net.Start( "lvs_buildcontrols" )
|
||||
net.Send( self )
|
||||
|
||||
self._lvsMouseX = self:GetInfoNum( "lvs_sensitivity_x", 1 )
|
||||
self._lvsMouseY = self:GetInfoNum( "lvs_sensitivity_y", 1 )
|
||||
self._lvsReturnDelta = self:GetInfoNum( "lvs_return_delta", 1 )
|
||||
else
|
||||
self._lvsMouseAim = GetConVar( "lvs_mouseaim" ):GetInt() == 1
|
||||
self._lvsMouseX = GetConVar( "lvs_sensitivity_x" ):GetFloat()
|
||||
self._lvsMouseY = GetConVar( "lvs_sensitivity_y" ):GetFloat()
|
||||
self._lvsReturnDelta = GetConVar( "lvs_return_delta" ):GetFloat()
|
||||
|
||||
self.LVS_BINDS = {}
|
||||
|
||||
local KeySpawnMenu = input.LookupBinding( "+menu" )
|
||||
if isstring( KeySpawnMenu ) then
|
||||
KeySpawnMenu = input.GetKeyCode( KeySpawnMenu )
|
||||
end
|
||||
|
||||
local KeyContextMenu = input.LookupBinding( "+menu_context" )
|
||||
if isstring( KeyContextMenu ) then
|
||||
KeyContextMenu = input.GetKeyCode( KeyContextMenu )
|
||||
end
|
||||
|
||||
self._lvsDisableSpawnMenu = nil
|
||||
self._lvsDisableContextMenu = nil
|
||||
|
||||
for _,v in pairs( LVS.KEYS_REGISTERED ) do
|
||||
if v.id == "~SKIP~" then continue end
|
||||
|
||||
local KeyCode = GetConVar( v.cmd ):GetInt()
|
||||
|
||||
self.LVS_BINDS[ v.id ] = KeyCode
|
||||
|
||||
if KeyCode == KeySpawnMenu then
|
||||
self._lvsDisableSpawnMenu = true
|
||||
end
|
||||
if KeyCode == KeyContextMenu then
|
||||
self._lvsDisableContextMenu = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local IS_MOUSE_ENUM = {
|
||||
[MOUSE_LEFT] = true,
|
||||
[MOUSE_RIGHT] = true,
|
||||
[MOUSE_MIDDLE] = true,
|
||||
[MOUSE_4] = true,
|
||||
[MOUSE_5] = true,
|
||||
[MOUSE_WHEEL_UP] = true,
|
||||
[MOUSE_WHEEL_DOWN] = true,
|
||||
}
|
||||
|
||||
local function GetInput( ply, name )
|
||||
if SERVER then
|
||||
if not ply._lvsKeyDown then
|
||||
ply._lvsKeyDown = {}
|
||||
end
|
||||
|
||||
return ply._lvsKeyDown[ name ]
|
||||
else
|
||||
local Key = ply:lvsGetControls()[ name ]
|
||||
|
||||
if IS_MOUSE_ENUM[ Key ] then
|
||||
return input.IsMouseDown( Key )
|
||||
else
|
||||
return input.IsKeyDown( Key )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function meta:lvsKeyDown( name )
|
||||
if not self:lvsGetInputEnabled() then return false end
|
||||
|
||||
local Pressed = GetInput( self, name )
|
||||
local NewPressed = hook.Run( "LVS.PlayerKeyDown", self, name, Pressed )
|
||||
|
||||
if isbool( NewPressed ) then
|
||||
return NewPressed
|
||||
else
|
||||
return Pressed
|
||||
end
|
||||
end
|
||||
|
||||
function meta:lvsGetInputEnabled()
|
||||
return (self._lvsKeyDisabler or 0) < CurTime()
|
||||
end
|
||||
|
||||
function meta:lvsSetInputDisabled( disable )
|
||||
if CLIENT then
|
||||
net.Start( "lvs_buildcontrols" )
|
||||
net.WriteBool( disable )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
if disable then
|
||||
self._lvsKeyDisabler = CurTime() + 120
|
||||
else
|
||||
self._lvsKeyDisabler = CurTime() + 0.25
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
net.Receive( "lvs_buildcontrols", function( len )
|
||||
local ply = LocalPlayer()
|
||||
if not IsValid( ply ) then return end
|
||||
ply:lvsBuildControls()
|
||||
end )
|
||||
|
||||
local OldVisible = false
|
||||
local function KeyBlocker()
|
||||
local Visible = gui.IsGameUIVisible() or vgui.CursorVisible()
|
||||
|
||||
if Visible ~= OldVisible then
|
||||
OldVisible = Visible
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
if Visible then
|
||||
ply:lvsSetInputDisabled( true )
|
||||
else
|
||||
ply:lvsSetInputDisabled( false )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add( "LVS.PlayerEnteredVehicle", "!!!!!lvs_keyblocker_enable", function( ply, veh )
|
||||
hook.Add("PostDrawHUD", "!!!lvs_keyblocker", KeyBlocker )
|
||||
end )
|
||||
|
||||
hook.Add( "LVS.PlayerLeaveVehicle", "!!!!!lvs_keyblocker_disable", function( ply, veh )
|
||||
hook.Remove("PostDrawHUD", "!!!lvs_keyblocker" )
|
||||
end )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
util.AddNetworkString( "lvs_buildcontrols" )
|
||||
|
||||
net.Receive( "lvs_buildcontrols", function( len, ply )
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
ply:lvsSetInputDisabled( net.ReadBool() )
|
||||
end )
|
||||
|
||||
function meta:lvsSetInput( name, value )
|
||||
if not self._lvsKeyDown then
|
||||
self._lvsKeyDown = {}
|
||||
end
|
||||
|
||||
self._lvsKeyDown[ name ] = value
|
||||
end
|
||||
|
||||
LVS.TEAMS = {
|
||||
[0] = "FRIENDLY TO EVERYONE",
|
||||
[1] = "Team 1",
|
||||
[2] = "Team 2",
|
||||
[3] = "HOSTILE TO EVERYONE",
|
||||
}
|
||||
|
||||
function meta:lvsSetAITeam( nTeam )
|
||||
nTeam = nTeam or LVS.PlayerDefaultTeam
|
||||
|
||||
if self:lvsGetAITeam() ~= nTeam then
|
||||
self:PrintMessage( HUD_PRINTTALK, "[LVS] Your AI-Team has been updated to: "..(LVS.TEAMS[ nTeam ] or "") )
|
||||
end
|
||||
|
||||
self:SetNWInt( "lvsAITeam", nTeam )
|
||||
end
|
||||
|
||||
hook.Add( "PlayerButtonUp", "!!!lvsButtonUp", function( ply, button )
|
||||
for _, KeyBind in pairs( ply:lvsGetControls() ) do
|
||||
local KeyTBL = KeyBind[ button ]
|
||||
|
||||
if not KeyTBL then continue end
|
||||
|
||||
for _, KeyName in pairs( KeyTBL ) do
|
||||
ply:lvsSetInput( KeyName, false )
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerButtonDown", "!!!lvsButtonDown", function( ply, button )
|
||||
if not ply:lvsGetInputEnabled() then return end
|
||||
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
local vehValid = IsValid( vehicle )
|
||||
|
||||
for _, KeyBind in pairs( ply:lvsGetControls() ) do
|
||||
local KeyTBL = KeyBind[ button ]
|
||||
|
||||
if not KeyTBL then continue end
|
||||
|
||||
for _, KeyName in pairs( KeyTBL ) do
|
||||
ply:lvsSetInput( KeyName, true )
|
||||
|
||||
if not vehValid then continue end
|
||||
|
||||
if string.StartWith( KeyName, "~SELECT~" ) then
|
||||
local exp_string = string.Explode( "#", KeyName )
|
||||
local base = ply:lvsGetWeaponHandler()
|
||||
|
||||
if exp_string[2] and IsValid( base ) then
|
||||
base:SelectWeapon( tonumber( exp_string[2] ) )
|
||||
end
|
||||
end
|
||||
|
||||
if KeyName == "EXIT" then
|
||||
if vehicle:GetDriver() == ply and vehicle:GetlvsLockedStatus() then vehicle:UnLock() end
|
||||
|
||||
if vehicle:GetlvsLockedStatus() then continue end
|
||||
|
||||
ply:ExitVehicle()
|
||||
end
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
hook.Add("CanExitVehicle","!!!lvsCanExitVehicle",function(vehicle,ply)
|
||||
if IsValid( ply:lvsGetVehicle() ) then return false end
|
||||
end)
|
||||
146
lua/lvs_framework/autorun/lvs_pod.lua
Normal file
146
lua/lvs_framework/autorun/lvs_pod.lua
Normal file
@@ -0,0 +1,146 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local meta = FindMetaTable( "Vehicle" )
|
||||
|
||||
if CLIENT then
|
||||
function meta:GetCameraHeight()
|
||||
if not self._lvsCamHeight then
|
||||
self._lvsCamHeight = 0
|
||||
|
||||
net.Start("lvs_camera")
|
||||
net.WriteEntity( self )
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
return self._lvsCamHeight
|
||||
end
|
||||
|
||||
function meta:SetCameraHeight( newheight )
|
||||
self._lvsCamHeight = newheight
|
||||
end
|
||||
|
||||
function meta:lvsGetWeapon()
|
||||
if self._lvsWeaponEntChecked then
|
||||
return self._lvsWeaponEnt
|
||||
end
|
||||
|
||||
local found = false
|
||||
|
||||
for _, ent in ipairs( self:GetChildren() ) do
|
||||
if not ent.LVS_GUNNER then continue end
|
||||
|
||||
self._lvsWeaponEntChecked = true
|
||||
self._lvsWeaponEnt = ent
|
||||
|
||||
found = true
|
||||
|
||||
break
|
||||
end
|
||||
|
||||
return found and self._lvsWeaponEnt or NULL
|
||||
end
|
||||
|
||||
net.Receive( "lvs_select_weapon", function( length)
|
||||
local ply = LocalPlayer()
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) or vehicle:GetDriver() ~= ply then return end
|
||||
|
||||
vehicle._SelectActiveTime = CurTime() + 2
|
||||
end)
|
||||
|
||||
|
||||
net.Receive( "lvs_camera", function( length, ply )
|
||||
local pod = net.ReadEntity()
|
||||
|
||||
if not IsValid( pod ) then return end
|
||||
|
||||
pod:SetCameraHeight( net.ReadFloat() )
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function meta:GetCameraHeight()
|
||||
return (self._lvsCamHeight or 0)
|
||||
end
|
||||
|
||||
util.AddNetworkString( "lvs_select_weapon" )
|
||||
util.AddNetworkString( "lvs_camera" )
|
||||
|
||||
net.Receive( "lvs_select_weapon", function( length, ply )
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local ID = net.ReadInt( 5 )
|
||||
local Increment = net.ReadBool()
|
||||
|
||||
local base = ply:lvsGetWeaponHandler()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
if Increment then
|
||||
base:SelectWeapon( base:GetSelectedWeapon() + ID )
|
||||
else
|
||||
base:SelectWeapon( ID )
|
||||
end
|
||||
end)
|
||||
|
||||
net.Receive( "lvs_camera", function( length, ply )
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local pod = net.ReadEntity()
|
||||
|
||||
if not IsValid( pod ) then return end
|
||||
|
||||
net.Start("lvs_camera")
|
||||
net.WriteEntity( pod )
|
||||
net.WriteFloat( pod:GetCameraHeight() )
|
||||
net.Send( ply )
|
||||
end)
|
||||
|
||||
function meta:SetCameraHeight( newheight )
|
||||
self._lvsCamHeight = newheight
|
||||
|
||||
net.Start("lvs_camera")
|
||||
net.WriteEntity( self )
|
||||
net.WriteFloat( newheight )
|
||||
net.Broadcast()
|
||||
end
|
||||
|
||||
function meta:lvsAddWeapon( ID )
|
||||
if IsValid( self._lvsWeaponEnt ) then
|
||||
return self._lvsWeaponEnt
|
||||
end
|
||||
|
||||
local weapon = ents.Create( "lvs_base_gunner" )
|
||||
|
||||
if not IsValid( weapon ) then return NULL end
|
||||
|
||||
weapon:SetPos( self:LocalToWorld( Vector(0,0,33.182617) ) ) -- location exactly where ply:GetShootPos() is. This will make AI-Tracing easier.
|
||||
weapon:SetAngles( self:LocalToWorldAngles( Angle(0,90,0) ) )
|
||||
weapon:SetOwner( self )
|
||||
weapon:Spawn()
|
||||
weapon:Activate()
|
||||
weapon:SetParent( self )
|
||||
weapon:SetPodIndex( ID )
|
||||
weapon:SetDriverSeat( self )
|
||||
|
||||
self._lvsWeaponEnt = weapon
|
||||
|
||||
weapon:SetSelectedWeapon( 1 )
|
||||
|
||||
return weapon
|
||||
end
|
||||
|
||||
function meta:lvsGetWeapon()
|
||||
return self._lvsWeaponEnt
|
||||
end
|
||||
147
lua/lvs_framework/autorun/lvs_soundscripts.lua
Normal file
147
lua/lvs_framework/autorun/lvs_soundscripts.lua
Normal file
@@ -0,0 +1,147 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.Physics.Scrape",
|
||||
channel = CHAN_STATIC,
|
||||
level = 80,
|
||||
sound = "lvs/physics/scrape_loop.wav"
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.Physics.Wind",
|
||||
channel = CHAN_STATIC,
|
||||
level = 140,
|
||||
sound = "lvs/physics/wind_loop.wav",
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.Physics.Water",
|
||||
channel = CHAN_STATIC,
|
||||
level = 140,
|
||||
sound = "lvs/physics/water_loop.wav",
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.DYNAMIC_EXPLOSION",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1.0,
|
||||
level = 130,
|
||||
pitch = {90, 110},
|
||||
sound = "^lvs/explosion_dist.wav"
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.MISSILE_EXPLOSION",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1.0,
|
||||
level = 130,
|
||||
pitch = {90, 120},
|
||||
sound = {
|
||||
"ambient/levels/streetwar/city_battle17.wav",
|
||||
"ambient/levels/streetwar/city_battle18.wav",
|
||||
"ambient/levels/streetwar/city_battle19.wav",
|
||||
}
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.BOMB_EXPLOSION_DYNAMIC",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1,
|
||||
level = 135,
|
||||
pitch = {90, 110},
|
||||
sound = {
|
||||
"^lvs/explosions/dyn1.wav",
|
||||
"^lvs/explosions/dyn2.wav",
|
||||
"^lvs/explosions/dyn3.wav",
|
||||
"^lvs/explosions/dyn4.wav",
|
||||
}
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.BOMB_EXPLOSION",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1,
|
||||
level = 75,
|
||||
pitch = {90, 110},
|
||||
sound = {
|
||||
"lvs/explosions/close1.wav",
|
||||
"lvs/explosions/close2.wav",
|
||||
"lvs/explosions/close3.wav",
|
||||
"lvs/explosions/close4.wav",
|
||||
}
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.BULLET_EXPLOSION_DYNAMIC",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1,
|
||||
level = 135,
|
||||
pitch = {90, 110},
|
||||
sound = {
|
||||
"^lvs/explosions/med_dyn1.wav",
|
||||
"^lvs/explosions/med_dyn2.wav",
|
||||
"^lvs/explosions/med_dyn3.wav",
|
||||
"^lvs/explosions/med_dyn4.wav",
|
||||
}
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.BULLET_EXPLOSION",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1,
|
||||
level = 75,
|
||||
pitch = {90, 110},
|
||||
sound = {
|
||||
"lvs/explosions/med_close1.wav",
|
||||
"lvs/explosions/med_close2.wav",
|
||||
"lvs/explosions/med_close3.wav",
|
||||
"lvs/explosions/med_close4.wav",
|
||||
}
|
||||
} )
|
||||
|
||||
|
||||
sound.Add( {
|
||||
name = "LVS.EXPLOSION",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 1.0,
|
||||
level = 115,
|
||||
pitch = {95, 115},
|
||||
sound = "lvs/explosion.wav"
|
||||
} )
|
||||
|
||||
if CLIENT then
|
||||
local SoundList = {}
|
||||
|
||||
hook.Add( "EntityEmitSound", "!!!lvs_fps_rape_fixer", function( t )
|
||||
if not t.Entity.LVS and not t.Entity._LVS then return end
|
||||
|
||||
local SoundFile = t.SoundName
|
||||
|
||||
if SoundList[ SoundFile ] == true then
|
||||
return true
|
||||
|
||||
elseif SoundList[ SoundFile ] == false then
|
||||
return false
|
||||
|
||||
else
|
||||
local File = string.Replace( SoundFile, "^", "" )
|
||||
|
||||
local Exists = file.Exists( "sound/"..File , "GAME" )
|
||||
|
||||
SoundList[ SoundFile ] = Exists
|
||||
|
||||
if not Exists then
|
||||
print("[LVS] '"..SoundFile.."' not found. Soundfile will not be played and is filtered for this game session to avoid fps issues.")
|
||||
end
|
||||
end
|
||||
end )
|
||||
end
|
||||
119
lua/lvs_framework/autorun/simfphys_init.lua
Normal file
119
lua/lvs_framework/autorun/simfphys_init.lua
Normal file
@@ -0,0 +1,119 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
FUELTYPE_NONE = -1
|
||||
FUELTYPE_PETROL = 0
|
||||
FUELTYPE_DIESEL = 1
|
||||
FUELTYPE_ELECTRIC = 2
|
||||
|
||||
hook.Add( "LVS:Initialize", "[LVS] - Car [Fake Physics] - Keys", function()
|
||||
local KEYS = {
|
||||
{
|
||||
name_menu = "Forward",
|
||||
default = KEY_W,
|
||||
cmd = "cl_simfphys_keyforward"
|
||||
},
|
||||
{
|
||||
name_menu = "Reverse",
|
||||
default = KEY_S,
|
||||
cmd = "cl_simfphys_keyreverse"
|
||||
},
|
||||
{
|
||||
name_menu = "Steer Left",
|
||||
default = KEY_A,
|
||||
cmd = "cl_simfphys_keyleft",
|
||||
},
|
||||
{
|
||||
name_menu = "Steer Right",
|
||||
default = KEY_D,
|
||||
cmd = "cl_simfphys_keyright",
|
||||
},
|
||||
{
|
||||
name_menu = "Throttle Modifier",
|
||||
default = KEY_LSHIFT,
|
||||
cmd = "cl_simfphys_keywot",
|
||||
},
|
||||
{
|
||||
name_menu = "Clutch",
|
||||
default = KEY_LALT,
|
||||
cmd = "cl_simfphys_keyclutch",
|
||||
},
|
||||
{
|
||||
name_menu = "Gear Up",
|
||||
default = MOUSE_LEFT,
|
||||
cmd = "cl_simfphys_keygearup",
|
||||
},
|
||||
{
|
||||
name_menu = "Gear Down",
|
||||
default = MOUSE_RIGHT,
|
||||
cmd = "cl_simfphys_keygeardown",
|
||||
},
|
||||
{
|
||||
name_menu = "Handbrake",
|
||||
default = KEY_SPACE,
|
||||
cmd = "cl_simfphys_keyhandbrake",
|
||||
},
|
||||
{
|
||||
name_menu = "Cruise Control",
|
||||
default = KEY_R,
|
||||
cmd = "cl_simfphys_cruisecontrol",
|
||||
},
|
||||
{
|
||||
name_menu = "Lights",
|
||||
default = KEY_F,
|
||||
cmd = "cl_simfphys_lights",
|
||||
},
|
||||
{
|
||||
name_menu = "Foglights",
|
||||
default = KEY_V,
|
||||
cmd = "cl_simfphys_foglights",
|
||||
},
|
||||
{
|
||||
name_menu = "Horn / Siren",
|
||||
default = KEY_H,
|
||||
cmd = "cl_simfphys_keyhorn",
|
||||
},
|
||||
{
|
||||
name_menu = "Start/Stop Engine",
|
||||
default = KEY_I,
|
||||
cmd = "cl_simfphys_keyengine",
|
||||
},
|
||||
{
|
||||
name_menu = "Tilt Backward",
|
||||
default = KEY_PAD_8,
|
||||
cmd = "cl_simfphys_key_air_forward",
|
||||
},
|
||||
{
|
||||
name_menu = "Tilt Forward",
|
||||
default = KEY_PAD_2,
|
||||
cmd = "cl_simfphys_key_air_reverse",
|
||||
},
|
||||
{
|
||||
name_menu = "Tilt Left",
|
||||
default = KEY_A,
|
||||
cmd = "cl_simfphys_key_air_left",
|
||||
},
|
||||
{
|
||||
name_menu = "Tilt Right",
|
||||
default = KEY_D,
|
||||
cmd = "cl_simfphys_key_air_right",
|
||||
},
|
||||
{
|
||||
name_menu = "Turnsignals",
|
||||
default = KEY_COMMA,
|
||||
cmd = "cl_simfphys_key_turnmenu",
|
||||
},
|
||||
}
|
||||
|
||||
for _, v in pairs( KEYS ) do
|
||||
LVS:AddKey( "~SKIP~", "LVS-Cars [Fake Physics]", v.name_menu, v.cmd, v.default )
|
||||
end
|
||||
end )
|
||||
721
lua/lvs_framework/autorun/simfphys_vehicles.lua
Normal file
721
lua/lvs_framework/autorun/simfphys_vehicles.lua
Normal file
@@ -0,0 +1,721 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local light_table = {
|
||||
L_HeadLampPos = Vector(-42,148,21.1),
|
||||
L_HeadLampAng = Angle(15,90,0),
|
||||
R_HeadLampPos = Vector(42,148,21.1),
|
||||
R_HeadLampAng = Angle(15,90,0),
|
||||
|
||||
L_RearLampPos = Vector(45.6,-147,27.2),
|
||||
L_RearLampAng = Angle(40,-90,0),
|
||||
R_RearLampPos = Vector(-45.6,-147,27.2),
|
||||
R_RearLampAng = Angle(40,-90,0),
|
||||
|
||||
Headlight_sprites = {
|
||||
Vector(-46.3,145.6,21.1),
|
||||
Vector(46.3,145.6,21.1)
|
||||
},
|
||||
Headlamp_sprites = {
|
||||
Vector(-37.6,145.7,21),
|
||||
Vector(37.6,145.7,21)
|
||||
},
|
||||
Rearlight_sprites = {
|
||||
Vector(45.6,-146.2,27.2),
|
||||
Vector(-45.6,-146.2,27.2)
|
||||
},
|
||||
Brakelight_sprites = {
|
||||
Vector(45.6,-146.2,27.2),
|
||||
Vector(-45.6,-146.2,27.2)
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_lights", "conapc", light_table)
|
||||
|
||||
|
||||
local light_table = {
|
||||
L_HeadLampPos = Vector(32.7,79.5,29.0),
|
||||
L_HeadLampAng = Angle(15,90,0),
|
||||
R_HeadLampPos = Vector(-30.75,79.5,28.9),
|
||||
R_HeadLampAng = Angle(15,90,0),
|
||||
|
||||
L_RearLampPos = Vector(15.9,-139.2,53),
|
||||
L_RearLampAng = Angle(40,-90,0),
|
||||
R_RearLampPos = Vector(-17.44,-139.2,53),
|
||||
R_RearLampAng = Angle(40,-90,0),
|
||||
|
||||
Headlight_sprites = {
|
||||
Vector(-34.5,77.5,29),
|
||||
Vector(36.4,77.5,29.5),
|
||||
Vector(-27.1,77.5,29),
|
||||
Vector(29,77.5,29.5)
|
||||
},
|
||||
Headlamp_sprites = {
|
||||
{pos =Vector(-34.5,77.5,29),size = 60},
|
||||
{pos =Vector(36.4,77.5,29.5),size = 60},
|
||||
{pos =Vector(-27.1,77.5,29),size = 60},
|
||||
{pos =Vector(29,77.5,29.5),size = 60},
|
||||
},
|
||||
Rearlight_sprites = {
|
||||
Vector(25.8,-139.2,53),Vector(24.28,-139.2,53),Vector(22.76,-139.2,53),Vector(21.24,-139.2,53),Vector(19.72,-139.2,53),Vector(18.2,-139.2,53),Vector(16.68,-139.2,53),Vector(15.16,-139.2,53),Vector(13.64,-139.2,53),Vector(12.12,-139.2,53),Vector(10.6,-139.2,53),Vector(9.08,-139.2,53),Vector(7.56,-139.2,53),Vector(6.04,-139.2,53),
|
||||
Vector(-27.32,-139.2,53),Vector(-25.8,-139.2,53),Vector(-24.28,-139.2,53),Vector(-22.76,-139.2,53),Vector(-21.24,-139.2,53),Vector(-19.72,-139.2,53),Vector(-18.2,-139.2,53),Vector(-16.68,-139.2,53),Vector(-15.16,-139.2,53),Vector(-13.64,-139.2,53),Vector(-12.12,-139.2,53),Vector(-10.6,-139.2,53),Vector(-9.08,-139.2,53),Vector(-7.56,-139.2,53)
|
||||
},
|
||||
Brakelight_sprites = {
|
||||
Vector(25.8,-139.2,53),Vector(24.28,-139.2,53),Vector(22.76,-139.2,53),Vector(21.24,-139.2,53),Vector(19.72,-139.2,53),Vector(18.2,-139.2,53),Vector(16.68,-139.2,53),Vector(15.16,-139.2,53),Vector(13.64,-139.2,53),Vector(12.12,-139.2,53),Vector(10.6,-139.2,53),Vector(9.08,-139.2,53),Vector(7.56,-139.2,53),Vector(6.04,-139.2,53),
|
||||
Vector(-27.32,-139.2,53),Vector(-25.8,-139.2,53),Vector(-24.28,-139.2,53),Vector(-22.76,-139.2,53),Vector(-21.24,-139.2,53),Vector(-19.72,-139.2,53),Vector(-18.2,-139.2,53),Vector(-16.68,-139.2,53),Vector(-15.16,-139.2,53),Vector(-13.64,-139.2,53),Vector(-12.12,-139.2,53),Vector(-10.6,-139.2,53),Vector(-9.08,-139.2,53),Vector(-7.56,-139.2,53)
|
||||
},
|
||||
Turnsignal_sprites = {
|
||||
Left = {
|
||||
{pos =Vector(-34.5,77.5,29),size = 80,material = "sprites/light_ignorez",color = Color( 255, 200, 0, 200)},
|
||||
{pos =Vector(-34.5,77.5,29),size = 40,color = Color( 255, 200, 0, 200)},
|
||||
{pos = Vector(-34.73,-139.52,52.38),material = "sprites/light_ignorez",size = 40,color = Color( 255, 60, 0, 125)},
|
||||
{pos = Vector(-34.73,-139.52,52.38),size = 80,color = Color( 255, 0, 0, 90)},
|
||||
},
|
||||
Right = {
|
||||
{pos =Vector(36,77.5,29),size = 80,material = "sprites/light_ignorez",color = Color( 255, 200, 0, 200)},
|
||||
{pos =Vector(36,77.5,29),size = 40,color = Color( 255, 200, 0, 200)},
|
||||
{pos = Vector(33.23,-139.52,52.38),material = "sprites/light_ignorez",size = 40,color = Color( 255, 60, 0, 125)},
|
||||
{pos = Vector(33.23,-139.52,52.38),size = 80,color = Color( 255, 0, 0, 90)},
|
||||
},
|
||||
},
|
||||
}
|
||||
list.Set( "simfphys_lights", "jalopy", light_table)
|
||||
|
||||
|
||||
local light_table = {
|
||||
L_HeadLampPos = Vector(-11,55,35),
|
||||
L_HeadLampAng = Angle(20,90,0),
|
||||
R_HeadLampPos = Vector(11,55,35),
|
||||
R_HeadLampAng = Angle(20,90,0),
|
||||
|
||||
L_RearLampPos = Vector(-14.9,-99.9,39.13),
|
||||
L_RearLampAng = Angle(40,-90,0),
|
||||
|
||||
Headlight_sprites = {
|
||||
Vector(-11,57,38.8),
|
||||
Vector(11,57,38.8)
|
||||
},
|
||||
Headlamp_sprites = {
|
||||
Vector(-11,57,38.8),
|
||||
Vector(11,57,38.8)
|
||||
},
|
||||
Rearlight_sprites = {
|
||||
Vector(-14.9,-101,39.13)
|
||||
},
|
||||
Brakelight_sprites = {
|
||||
Vector(-14.9,-101,39.1)
|
||||
},
|
||||
}
|
||||
list.Set( "simfphys_lights", "jeep", light_table)
|
||||
|
||||
local V = {
|
||||
Name = "HL2 Jeep",
|
||||
Model = "models/buggy.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Half Life 2 / Synergy",
|
||||
|
||||
Members = {
|
||||
Mass = 1700,
|
||||
|
||||
--OnTick = function(ent) print("hi") end,
|
||||
--OnSpawn = function(ent) print("i spawned") end,
|
||||
--OnDelete = function(ent) print("im removed :(") end,
|
||||
--OnDestroyed = function(ent) print("im destroyed :((((") end,
|
||||
|
||||
LightsTable = "jeep",
|
||||
|
||||
FrontWheelRadius = 18,
|
||||
RearWheelRadius = 20,
|
||||
|
||||
CustomMassCenter = Vector(0,0,0),
|
||||
|
||||
SeatOffset = Vector(0,0,-2),
|
||||
SeatPitch = 0,
|
||||
|
||||
SpeedoMax = 120,
|
||||
|
||||
StrengthenSuspension = false,
|
||||
|
||||
FrontHeight = 13.5,
|
||||
FrontConstant = 27000,
|
||||
FrontDamping = 2800,
|
||||
FrontRelativeDamping = 2800,
|
||||
|
||||
RearHeight = 13.5,
|
||||
RearConstant = 32000,
|
||||
RearDamping = 2900,
|
||||
RearRelativeDamping = 2900,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 535,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 44,
|
||||
Efficiency = 1.337,
|
||||
GripOffset = 0,
|
||||
BrakePower = 40,
|
||||
|
||||
IdleRPM = 750,
|
||||
LimitRPM = 6500,
|
||||
|
||||
PeakTorque = 100,
|
||||
PowerbandStart = 2200,
|
||||
PowerbandEnd = 6300,
|
||||
|
||||
FuelFillPos = Vector(17.64,-14.55,30.06),
|
||||
|
||||
PowerBias = 0.5,
|
||||
|
||||
EngineSoundPreset = -1,
|
||||
|
||||
snd_pitch = 1,
|
||||
snd_idle = "simulated_vehicles/jeep/jeep_idle.wav",
|
||||
|
||||
snd_low = "simulated_vehicles/jeep/jeep_low.wav",
|
||||
snd_low_revdown = "simulated_vehicles/jeep/jeep_revdown.wav",
|
||||
snd_low_pitch = 0.9,
|
||||
|
||||
snd_mid = "simulated_vehicles/jeep/jeep_mid.wav",
|
||||
snd_mid_gearup = "simulated_vehicles/jeep/jeep_second.wav",
|
||||
|
||||
snd_mid_pitch = 1,
|
||||
|
||||
Sound_Idle = "simulated_vehicles/misc/nanjing_loop.wav",
|
||||
Sound_IdlePitch = 1,
|
||||
|
||||
Sound_Mid = "simulated_vehicles/misc/m50.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 58,
|
||||
Sound_MidFadeOutRate = 0.476,
|
||||
|
||||
Sound_High = "simulated_vehicles/misc/v8high2.wav",
|
||||
Sound_HighPitch = 1,
|
||||
Sound_HighVolume = 0.75,
|
||||
Sound_HighFadeInRPMpercent = 58,
|
||||
Sound_HighFadeInRate = 0.19,
|
||||
|
||||
Sound_Throttle = "",
|
||||
Sound_ThrottlePitch = 0,
|
||||
Sound_ThrottleVolume = 0,
|
||||
|
||||
snd_horn = "simulated_vehicles/horn_1.wav",
|
||||
|
||||
DifferentialGear = 0.3,
|
||||
Gears = {-0.15,0,0.15,0.25,0.35,0.45}
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_jeep", V )
|
||||
|
||||
|
||||
local V = {
|
||||
Name = "HL2 Combine APC",
|
||||
Model = "models/combine_apc.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Half Life 2 / Synergy",
|
||||
|
||||
Members = {
|
||||
Mass = 3500,
|
||||
MaxHealth = 3000,
|
||||
|
||||
GibModels = {
|
||||
"models/combine_apc_destroyed_gib01.mdl",
|
||||
"models/combine_apc_destroyed_gib02.mdl",
|
||||
"models/combine_apc_destroyed_gib03.mdl",
|
||||
"models/combine_apc_destroyed_gib04.mdl",
|
||||
"models/combine_apc_destroyed_gib05.mdl",
|
||||
"models/combine_apc_destroyed_gib06.mdl",
|
||||
},
|
||||
|
||||
FrontWheelRadius = 28,
|
||||
RearWheelRadius = 28,
|
||||
|
||||
SeatOffset = Vector(-25,0,104),
|
||||
SeatPitch = 0,
|
||||
|
||||
PassengerSeats = {
|
||||
},
|
||||
|
||||
FrontHeight = 10,
|
||||
FrontConstant = 50000,
|
||||
FrontDamping = 3000,
|
||||
FrontRelativeDamping = 3000,
|
||||
|
||||
RearHeight = 10,
|
||||
RearConstant = 50000,
|
||||
RearDamping = 3000,
|
||||
RearRelativeDamping = 3000,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 535,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 70,
|
||||
Efficiency = 1.8,
|
||||
GripOffset = 0,
|
||||
BrakePower = 70,
|
||||
BulletProofTires = true,
|
||||
|
||||
IdleRPM = 750,
|
||||
LimitRPM = 6000,
|
||||
PeakTorque = 100,
|
||||
PowerbandStart = 1500,
|
||||
PowerbandEnd = 5800,
|
||||
Turbocharged = false,
|
||||
Supercharged = false,
|
||||
|
||||
FuelFillPos = Vector(32.82,-78.31,81.89),
|
||||
|
||||
PowerBias = 0,
|
||||
|
||||
EngineSoundPreset = 0,
|
||||
|
||||
Sound_Idle = "simulated_vehicles/c_apc/apc_idle.wav",
|
||||
Sound_IdlePitch = 1,
|
||||
|
||||
Sound_Mid = "simulated_vehicles/c_apc/apc_mid.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 100,
|
||||
Sound_MidFadeOutRate = 1,
|
||||
|
||||
Sound_High = "",
|
||||
|
||||
Sound_Throttle = "",
|
||||
|
||||
snd_horn = "ambient/alarms/apc_alarm_pass1.wav",
|
||||
|
||||
DifferentialGear = 0.3,
|
||||
Gears = {-0.1,0,0.1,0.2,0.3}
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_combineapc", V )
|
||||
|
||||
|
||||
local V = {
|
||||
Name = "HL2:EP2 Jalopy",
|
||||
Model = "models/vehicle.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Half Life 2 / Synergy",
|
||||
|
||||
Members = {
|
||||
Mass = 1700,
|
||||
LightsTable = "jalopy",
|
||||
|
||||
FrontWheelRadius = 18,
|
||||
RearWheelRadius = 20,
|
||||
|
||||
SeatOffset = Vector(-1,0,5),
|
||||
SeatPitch = 3,
|
||||
|
||||
PassengerSeats = {
|
||||
{
|
||||
pos = Vector(21,-22,21),
|
||||
ang = Angle(0,0,9),
|
||||
}
|
||||
},
|
||||
|
||||
ExhaustPositions = {
|
||||
{
|
||||
pos = Vector(-21.63,-142.52,37.55),
|
||||
ang = Angle(90,-90,0)
|
||||
},
|
||||
{
|
||||
pos = Vector(19.65,-144.09,38.03),
|
||||
ang = Angle(90,-90,0)
|
||||
}
|
||||
},
|
||||
|
||||
FrontHeight = 11.5,
|
||||
FrontConstant = 27000,
|
||||
FrontDamping = 2800,
|
||||
FrontRelativeDamping = 2800,
|
||||
|
||||
RearHeight = 8.5,
|
||||
RearConstant = 32000,
|
||||
RearDamping = 2900,
|
||||
RearRelativeDamping = 2900,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 535,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 45,
|
||||
Efficiency = 1.22,
|
||||
GripOffset = -0.5,
|
||||
BrakePower = 50,
|
||||
|
||||
IdleRPM = 750,
|
||||
LimitRPM = 6000,
|
||||
PeakTorque = 130,
|
||||
PowerbandStart = 2200,
|
||||
PowerbandEnd = 5800,
|
||||
Turbocharged = false,
|
||||
Supercharged = false,
|
||||
|
||||
FuelFillPos = Vector(-39.07,-108.1,60.81),
|
||||
FuelTankSize = 80,
|
||||
|
||||
PowerBias = 1,
|
||||
|
||||
EngineSoundPreset = -1,
|
||||
|
||||
snd_pitch = 0.9,
|
||||
snd_idle = "simulated_vehicles/jalopy/jalopy_idle.wav",
|
||||
|
||||
snd_low = "simulated_vehicles/jalopy/jalopy_low.wav",
|
||||
snd_low_revdown = "simulated_vehicles/jalopy/jalopy_revdown.wav",
|
||||
snd_low_pitch = 0.95,
|
||||
|
||||
snd_mid = "simulated_vehicles/jalopy/jalopy_mid.wav",
|
||||
snd_mid_gearup = "simulated_vehicles/jalopy/jalopy_second.wav",
|
||||
snd_mid_pitch = 1.1,
|
||||
|
||||
Sound_Idle = "simulated_vehicles/jalopy/jalopy_idle.wav",
|
||||
Sound_IdlePitch = 0.95,
|
||||
|
||||
Sound_Mid = "simulated_vehicles/jalopy/jalopy_mid.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 55,
|
||||
Sound_MidFadeOutRate = 0.25,
|
||||
|
||||
Sound_High = "simulated_vehicles/jalopy/jalopy_high.wav",
|
||||
Sound_HighPitch = 0.75,
|
||||
Sound_HighVolume = 0.9,
|
||||
Sound_HighFadeInRPMpercent = 55,
|
||||
Sound_HighFadeInRate = 0.4,
|
||||
|
||||
Sound_Throttle = "",
|
||||
Sound_ThrottlePitch = 0,
|
||||
Sound_ThrottleVolume = 0,
|
||||
|
||||
DifferentialGear = 0.3,
|
||||
Gears = {-0.15,0,0.15,0.25,0.35,0.45}
|
||||
}
|
||||
}
|
||||
if (file.Exists( "models/vehicle.mdl", "GAME" )) then
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_jalopy", V )
|
||||
end
|
||||
|
||||
|
||||
local V = {
|
||||
Name = "Driveable Couch",
|
||||
Model = "models/props_c17/FurnitureCouch002a.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Base",
|
||||
SpawnAngleOffset = 90,
|
||||
|
||||
Members = {
|
||||
Mass = 500,
|
||||
|
||||
CustomWheels = true,
|
||||
CustomSuspensionTravel = 10,
|
||||
|
||||
CustomWheelModel = "models/props_phx/wheels/magnetic_small_base.mdl",
|
||||
|
||||
CustomWheelPosFL = Vector(12,22,-15),
|
||||
CustomWheelPosFR = Vector(12,-22,-15),
|
||||
CustomWheelPosRL = Vector(-12,22,-15),
|
||||
CustomWheelPosRR = Vector(-12,-22,-15),
|
||||
CustomWheelAngleOffset = Angle(90,0,0),
|
||||
|
||||
CustomMassCenter = Vector(0,0,0),
|
||||
|
||||
CustomSteerAngle = 35,
|
||||
|
||||
SeatOffset = Vector(-3,-13.5,21),
|
||||
SeatPitch = 15,
|
||||
SeatYaw = 90,
|
||||
--SeatAnim = "sit_zen", -- driver seat animation
|
||||
|
||||
PassengerSeats = {
|
||||
{
|
||||
pos = Vector(0,-14,-12),
|
||||
ang = Angle(0,-90,0),
|
||||
--anim = "sit_zen", -- passenger seat animation
|
||||
}
|
||||
},
|
||||
|
||||
FrontHeight = 7,
|
||||
FrontConstant = 12000,
|
||||
FrontDamping = 400,
|
||||
FrontRelativeDamping = 50,
|
||||
|
||||
RearHeight = 7,
|
||||
RearConstant = 12000,
|
||||
RearDamping = 400,
|
||||
RearRelativeDamping = 50,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 120,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 20,
|
||||
Efficiency = 1,
|
||||
GripOffset = 0,
|
||||
BrakePower = 5,
|
||||
BulletProofTires = true,
|
||||
|
||||
IdleRPM = 600,
|
||||
LimitRPM = 10000,
|
||||
PeakTorque = 40,
|
||||
PowerbandStart = 650,
|
||||
PowerbandEnd = 700,
|
||||
Turbocharged = false,
|
||||
Supercharged = false,
|
||||
DoNotStall = true,
|
||||
|
||||
FuelType = FUELTYPE_ELECTRIC,
|
||||
FuelTankSize = 80,
|
||||
|
||||
PowerBias = 0,
|
||||
|
||||
EngineSoundPreset = 0,
|
||||
|
||||
Sound_Idle = "",
|
||||
Sound_IdlePitch = 0,
|
||||
|
||||
Sound_Mid = "vehicles/apc/apc_idle1.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 100,
|
||||
Sound_MidFadeOutRate = 1,
|
||||
|
||||
Sound_High = "",
|
||||
|
||||
Sound_Throttle = "",
|
||||
|
||||
snd_horn = "simulated_vehicles/horn_0.wav",
|
||||
|
||||
DifferentialGear = 0.7,
|
||||
Gears = {-0.1,0,0.1}
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_couch", V )
|
||||
|
||||
|
||||
local V = {
|
||||
Name = "HL2 APC",
|
||||
Model = "models/props_vehicles/apc001.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Half Life 2 / Synergy",
|
||||
SpawnOffset = Vector(0,0,50),
|
||||
|
||||
Members = {
|
||||
Mass = 4800,
|
||||
MaxHealth = 2800,
|
||||
|
||||
EnginePos = Vector(-16.1,-81.68,47.25),
|
||||
|
||||
LightsTable = "conapc",
|
||||
|
||||
GibModels = {
|
||||
"models/blu/conscript_apc.mdl",
|
||||
"models/props_vehicles/apc_tire001.mdl",
|
||||
"models/props_vehicles/apc_tire001.mdl",
|
||||
"models/props_vehicles/apc_tire001.mdl",
|
||||
"models/props_vehicles/apc_tire001.mdl",
|
||||
"models/props_c17/TrapPropeller_Engine.mdl",
|
||||
"models/gibs/helicopter_brokenpiece_01.mdl",
|
||||
"models/gibs/manhack_gib01.mdl",
|
||||
"models/gibs/manhack_gib02.mdl",
|
||||
"models/gibs/manhack_gib03.mdl",
|
||||
"models/combine_apc_destroyed_gib02.mdl",
|
||||
"models/combine_apc_destroyed_gib03.mdl",
|
||||
"models/combine_apc_destroyed_gib04.mdl",
|
||||
"models/combine_apc_destroyed_gib05.mdl",
|
||||
},
|
||||
|
||||
CustomWheels = true,
|
||||
CustomSuspensionTravel = 10,
|
||||
|
||||
CustomWheelModel = "models/props_vehicles/apc_tire001.mdl",
|
||||
CustomWheelPosFL = Vector(-45,77,-22),
|
||||
CustomWheelPosFR = Vector(45,77,-22),
|
||||
CustomWheelPosRL = Vector(-45,-74,-22),
|
||||
CustomWheelPosRR = Vector(45,-74,-22),
|
||||
CustomWheelAngleOffset = Angle(0,180,0),
|
||||
|
||||
CustomMassCenter = Vector(0,0,0),
|
||||
|
||||
CustomSteerAngle = 35,
|
||||
|
||||
SeatOffset = Vector(65,-13,50),
|
||||
SeatPitch = 15,
|
||||
SeatYaw = 0,
|
||||
|
||||
PassengerSeats = {
|
||||
{
|
||||
pos = Vector(13,75,-2),
|
||||
ang = Angle(0,0,0)
|
||||
},
|
||||
},
|
||||
|
||||
Attachments = {
|
||||
{
|
||||
model = "models/hunter/plates/plate075x105.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
pos = Vector(0.04,57.5,16.74),
|
||||
ang = Angle(90,-90,0)
|
||||
},
|
||||
{
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
pos = Vector(-25.08,91.34,29.46),
|
||||
ang = Angle(4.2,-109.19,68.43)
|
||||
},
|
||||
{
|
||||
pos = Vector(-24.63,77.76,8.65),
|
||||
ang = Angle(24.05,-12.81,-1.87),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(24.63,77.76,8.65),
|
||||
ang = Angle(24.05,-167.19,1.87),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(-30.17,61.36,32.79),
|
||||
ang = Angle(-1.21,-92.38,-130.2),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(30.17,61.36,32.79),
|
||||
ang = Angle(-1.21,-87.62,130.2),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(0,72.92,40.54),
|
||||
ang = Angle(0,-180,0.79),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(25.08,91.34,29.46),
|
||||
ang = Angle(4.2,-70.81,-68.43),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(-29.63,79.02,19.28),
|
||||
ang = Angle(90,-18,0),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(29.63,79.02,19.28),
|
||||
ang = Angle(90,-162,0),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(0,75.33,5.91),
|
||||
ang = Angle(0,0,0),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(0,98.02,35.74),
|
||||
ang = Angle(63,90,0),
|
||||
model = "models/hunter/plates/plate025x025.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
},
|
||||
{
|
||||
pos = Vector(0,100.55,7.41),
|
||||
ang = Angle(90,-90,0),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255)
|
||||
}
|
||||
},
|
||||
|
||||
FrontHeight = 20,
|
||||
FrontConstant = 50000,
|
||||
FrontDamping = 4000,
|
||||
FrontRelativeDamping = 3000,
|
||||
|
||||
RearHeight = 20,
|
||||
RearConstant = 50000,
|
||||
RearDamping = 4000,
|
||||
RearRelativeDamping = 3000,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 535,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 140,
|
||||
Efficiency = 1.25,
|
||||
GripOffset = -14,
|
||||
BrakePower = 120,
|
||||
BulletProofTires = true,
|
||||
|
||||
IdleRPM = 750,
|
||||
LimitRPM = 5500,
|
||||
PeakTorque = 180,
|
||||
PowerbandStart = 1000,
|
||||
PowerbandEnd = 4500,
|
||||
Turbocharged = false,
|
||||
Supercharged = false,
|
||||
|
||||
FuelFillPos = Vector(-61.39,49.54,15.79),
|
||||
FuelType = FUELTYPE_DIESEL,
|
||||
FuelTankSize = 120,
|
||||
|
||||
PowerBias = 0,
|
||||
|
||||
EngineSoundPreset = 0,
|
||||
|
||||
Sound_Idle = "simulated_vehicles/misc/nanjing_loop.wav",
|
||||
Sound_IdlePitch = 1,
|
||||
|
||||
Sound_Mid = "simulated_vehicles/misc/m50.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 58,
|
||||
Sound_MidFadeOutRate = 0.476,
|
||||
|
||||
Sound_High = "simulated_vehicles/misc/v8high2.wav",
|
||||
Sound_HighPitch = 1,
|
||||
Sound_HighVolume = 0.75,
|
||||
Sound_HighFadeInRPMpercent = 58,
|
||||
Sound_HighFadeInRate = 0.19,
|
||||
|
||||
Sound_Throttle = "",
|
||||
Sound_ThrottlePitch = 0,
|
||||
Sound_ThrottleVolume = 0,
|
||||
|
||||
snd_horn = "simulated_vehicles/horn_2.wav",
|
||||
|
||||
DifferentialGear = 0.27,
|
||||
Gears = {-0.09,0,0.09,0.18,0.28,0.35}
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_conscriptapc", V )
|
||||
1124
lua/lvs_framework/autorun/simfphys_vehicles_extra.lua
Normal file
1124
lua/lvs_framework/autorun/simfphys_vehicles_extra.lua
Normal file
File diff suppressed because it is too large
Load Diff
1485
lua/lvs_framework/autorun/simfphys_vehicles_prewar.lua
Normal file
1485
lua/lvs_framework/autorun/simfphys_vehicles_prewar.lua
Normal file
File diff suppressed because it is too large
Load Diff
79
lua/lvs_framework/autorun/sv_entityrelationship.lua
Normal file
79
lua/lvs_framework/autorun/sv_entityrelationship.lua
Normal file
@@ -0,0 +1,79 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local function ApplyTeamRules( teamVeh, IsEnemy )
|
||||
if teamVeh == 0 then
|
||||
IsEnemy = false
|
||||
end
|
||||
|
||||
if teamVeh == 3 then
|
||||
IsEnemy = true
|
||||
end
|
||||
|
||||
return IsEnemy
|
||||
end
|
||||
|
||||
function LVS:SetNPCRelationship( NPC )
|
||||
for _, lvsVeh in pairs( LVS:GetVehicles() ) do
|
||||
local teamVeh = lvsVeh:GetAITEAM()
|
||||
|
||||
local IsEnemy = ApplyTeamRules( teamVeh, lvsVeh:IsEnemy( NPC ) )
|
||||
|
||||
local IsActive = (lvsVeh:GetAI() or #lvsVeh:GetEveryone() > 0) and not lvsVeh:IsDestroyed()
|
||||
|
||||
if IsActive and IsEnemy then
|
||||
NPC:AddEntityRelationship( lvsVeh, D_HT, 25 )
|
||||
NPC:UpdateEnemyMemory( lvsVeh, lvsVeh:GetPos() )
|
||||
else
|
||||
local D_, _ = NPC:Disposition( lvsVeh )
|
||||
|
||||
if D_ ~= D_NU then
|
||||
NPC:AddEntityRelationship( lvsVeh, D_NU )
|
||||
NPC:ClearEnemyMemory( lvsVeh )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LVS:SetVehicleRelationship( lvsVeh )
|
||||
local teamVeh = lvsVeh:GetAITEAM()
|
||||
|
||||
local Pos = lvsVeh:GetPos()
|
||||
local IsActive = (lvsVeh:GetAI() or #lvsVeh:GetEveryone() > 0) and not lvsVeh:IsDestroyed()
|
||||
|
||||
for _, NPC in pairs( LVS:GetNPCs() ) do
|
||||
local IsEnemy = ApplyTeamRules( teamVeh, lvsVeh:IsEnemy( NPC ) )
|
||||
|
||||
if IsActive and IsEnemy then
|
||||
NPC:AddEntityRelationship( lvsVeh, D_HT, 25 )
|
||||
NPC:UpdateEnemyMemory( lvsVeh, Pos )
|
||||
else
|
||||
local D_, _ = NPC:Disposition( lvsVeh )
|
||||
|
||||
if D_ ~= D_NU then
|
||||
NPC:AddEntityRelationship( lvsVeh, D_NU )
|
||||
NPC:ClearEnemyMemory( lvsVeh )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add( "LVS.UpdateRelationship", "!!!!lvsEntityRelationship", function( ent )
|
||||
timer.Simple(0.1, function()
|
||||
if not IsValid( ent ) then return end
|
||||
|
||||
if isfunction( ent.IsNPC ) and ent:IsNPC() then
|
||||
LVS:SetNPCRelationship( ent )
|
||||
else
|
||||
LVS:SetVehicleRelationship( ent )
|
||||
end
|
||||
end)
|
||||
end )
|
||||
148
lua/lvs_framework/autorun/sv_exit.lua
Normal file
148
lua/lvs_framework/autorun/sv_exit.lua
Normal file
@@ -0,0 +1,148 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
hook.Add( "PlayerUse", "!!!LVS_FIX_RE_ENTER", function( ply, ent )
|
||||
if ent.LVS and (ply._lvsNextUse or 0) > CurTime() then return false end
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerLeaveVehicle", "!!LVS_Exit", function( ply, Pod )
|
||||
if not ply:IsPlayer() then return end
|
||||
|
||||
local Vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( Vehicle ) then return end
|
||||
|
||||
if not LVS.FreezeTeams then
|
||||
ply:lvsSetAITeam( Vehicle:GetAITEAM() )
|
||||
end
|
||||
|
||||
ply._lvsNextUse = CurTime() + 0.25
|
||||
|
||||
local Center = Vehicle:LocalToWorld( Vehicle:OBBCenter() )
|
||||
local Vel = Vehicle:GetVelocity()
|
||||
local radius = Vehicle:BoundingRadius()
|
||||
|
||||
local HullMin, HullMax = ply:GetHull()
|
||||
local FilterPlayer = { Pod, ply }
|
||||
local FilterAll = { Pod, ply, Vehicle }
|
||||
|
||||
for _, filterEntity in pairs( constraint.GetAllConstrainedEntities( Vehicle ) ) do
|
||||
if IsValid( filterEntity ) then
|
||||
table.insert( FilterAll, filterEntity )
|
||||
end
|
||||
end
|
||||
|
||||
hook.Run( "LVS.UpdateRelationship", Vehicle )
|
||||
|
||||
if Vel:Length() > (Pod.PlaceBehindVelocity or 100) then
|
||||
local tr = util.TraceHull( {
|
||||
start = Center,
|
||||
endpos = Center - Vel:GetNormalized() * (radius + 50),
|
||||
maxs = HullMax,
|
||||
mins = HullMin,
|
||||
filter = FilterAll
|
||||
} )
|
||||
|
||||
local exitpoint = tr.HitPos + Vector(0,0,10)
|
||||
|
||||
if util.IsInWorld( exitpoint ) then
|
||||
ply:SetPos( exitpoint )
|
||||
ply:SetEyeAngles( (Center - exitpoint):Angle() )
|
||||
end
|
||||
else
|
||||
if isvector( Pod.ExitPos ) then
|
||||
local exitpoint = Vehicle:LocalToWorld( Pod.ExitPos )
|
||||
|
||||
if util.IsInWorld( exitpoint ) then
|
||||
ply:SetPos( exitpoint )
|
||||
ply:SetEyeAngles( (Pod:GetPos() - exitpoint):Angle() )
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local PodPos = Pod:LocalToWorld( Vector(0,0,10) )
|
||||
|
||||
local PodDistance = 130
|
||||
local AngleStep = 45
|
||||
|
||||
local StartAngle = 135
|
||||
|
||||
local W = ply:KeyDown( IN_FORWARD )
|
||||
local A = ply:KeyDown( IN_MOVELEFT ) or ply:KeyDown( IN_BACK )
|
||||
local D = ply:KeyDown( IN_MOVERIGHT )
|
||||
|
||||
if W or A or D then
|
||||
if A then StartAngle = 180 end
|
||||
if D then StartAngle = 0 end
|
||||
if W then if D then StartAngle = -45 else StartAngle = 225 end end
|
||||
end
|
||||
|
||||
for ang = StartAngle, (StartAngle + 360 - AngleStep), AngleStep do
|
||||
local X = math.Round( math.cos( math.rad( -ang ) ) * PodDistance )
|
||||
local Y = math.Round( math.sin( math.rad( -ang ) ) * PodDistance )
|
||||
local Z = Pod:WorldToLocal( Center ).z
|
||||
|
||||
local EndPos = Pod:LocalToWorld( Vector(X,Y,Z) )
|
||||
|
||||
local HitWall = util.TraceLine( {start = PodPos,endpos = EndPos,filter = FilterAll} ).Hit
|
||||
|
||||
if not util.IsInWorld( EndPos ) then continue end
|
||||
|
||||
if HitWall then continue end
|
||||
|
||||
local HitVehicle = util.TraceHull( {
|
||||
start = EndPos,
|
||||
endpos = EndPos + Vector(0,0,1),
|
||||
maxs = HullMax,
|
||||
mins = HullMin,
|
||||
filter = FilterPlayer
|
||||
} ).Hit
|
||||
|
||||
if HitVehicle then continue end
|
||||
|
||||
ply:SetPos( EndPos )
|
||||
ply:SetEyeAngles( (Pod:GetPos() - EndPos):Angle() )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local tr = util.TraceHull( {
|
||||
start = PodPos,
|
||||
endpos = PodPos - Vector(0,0,PodDistance + HullMax.z),
|
||||
maxs = Vector(HullMax.x,HullMax.y,0),
|
||||
mins = HullMin,
|
||||
filter = FilterAll
|
||||
} )
|
||||
|
||||
local exitpoint = tr.HitPos
|
||||
|
||||
if not tr.Hit and util.IsInWorld( exitpoint ) then
|
||||
ply:SetPos( exitpoint )
|
||||
ply:SetEyeAngles( (PodPos - exitpoint):Angle() )
|
||||
else
|
||||
local exitpoint = util.TraceHull( {
|
||||
start = PodPos,
|
||||
endpos = PodPos + Vector(0,0,PodDistance),
|
||||
maxs = HullMax,
|
||||
mins = HullMin,
|
||||
filter = FilterAll
|
||||
} ).HitPos
|
||||
|
||||
if util.IsInWorld( exitpoint ) then
|
||||
ply:SetPos( exitpoint )
|
||||
ply:SetEyeAngles( (PodPos - exitpoint):Angle() )
|
||||
else
|
||||
ply:SetPos( PodPos )
|
||||
end
|
||||
end
|
||||
end
|
||||
end )
|
||||
68
lua/lvs_framework/autorun/sv_switcher.lua
Normal file
68
lua/lvs_framework/autorun/sv_switcher.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
hook.Add( "PlayerButtonDown", "!!!lvsSeatSwitcherButtonDown", function( ply, button )
|
||||
local vehicle = ply:lvsGetVehicle()
|
||||
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
local CurPod = ply:GetVehicle()
|
||||
|
||||
if button == KEY_1 then
|
||||
if ply == vehicle:GetDriver() then
|
||||
if vehicle:GetlvsLockedStatus() then
|
||||
vehicle:UnLock()
|
||||
else
|
||||
vehicle:Lock()
|
||||
end
|
||||
else
|
||||
if IsValid( vehicle:GetDriver() ) or vehicle:GetAI() then return end
|
||||
|
||||
if hook.Run( "LVS.CanPlayerDrive", ply, vehicle ) == false then
|
||||
hook.Run( "LVS.OnPlayerCannotDrive", ply, vehicle )
|
||||
return
|
||||
end
|
||||
|
||||
ply:ExitVehicle()
|
||||
|
||||
local DriverSeat = vehicle:GetDriverSeat()
|
||||
|
||||
if not IsValid( DriverSeat ) then return end
|
||||
|
||||
if hook.Run( "LVS.OnPlayerRequestSeatSwitch", ply, vehicle, CurPod, DriverSeat ) == false then return end
|
||||
|
||||
timer.Simple( 0, function()
|
||||
if not IsValid( vehicle ) or not IsValid( ply ) then return end
|
||||
if IsValid( vehicle:GetDriver() ) or not IsValid( DriverSeat ) or vehicle:GetAI() then return end
|
||||
|
||||
ply:EnterVehicle( DriverSeat )
|
||||
vehicle:AlignView( ply )
|
||||
vehicle:OnSwitchSeat( ply, CurPod, DriverSeat )
|
||||
end)
|
||||
end
|
||||
else
|
||||
for _, Pod in pairs( vehicle:GetPassengerSeats() ) do
|
||||
if not IsValid( Pod ) or Pod:GetNWInt( "pPodIndex", 3 ) ~= LVS.pSwitchKeys[ button ] or IsValid( Pod:GetDriver() ) then continue end
|
||||
|
||||
if hook.Run( "LVS.OnPlayerRequestSeatSwitch", ply, vehicle, CurPod, Pod ) == false then continue end
|
||||
|
||||
ply:ExitVehicle()
|
||||
|
||||
timer.Simple( 0, function()
|
||||
if not IsValid( Pod ) or not IsValid( ply ) then return end
|
||||
if IsValid( Pod:GetDriver() ) then return end
|
||||
|
||||
ply:EnterVehicle( Pod )
|
||||
vehicle:AlignView( ply, true )
|
||||
vehicle:OnSwitchSeat( ply, CurPod, Pod )
|
||||
end)
|
||||
end
|
||||
end
|
||||
end )
|
||||
109
lua/lvs_framework/init.lua
Normal file
109
lua/lvs_framework/init.lua
Normal file
@@ -0,0 +1,109 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local StartTime = SysTime()
|
||||
|
||||
if SERVER then
|
||||
AddCSLuaFile("includes/circles/circles.lua")
|
||||
end
|
||||
|
||||
local function FileIsEmpty( filename )
|
||||
if file.Size( filename, "LUA" ) <= 1 then -- this is suspicous
|
||||
local data = file.Read( filename, "LUA" )
|
||||
|
||||
if data and string.len( data ) <= 1 then -- confirm its empty
|
||||
|
||||
print("[LVS] - refusing to load '"..filename.."'! File is Empty!" )
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
for _, filename in pairs( file.Find("lvs_framework/autorun/*.lua", "LUA") ) do
|
||||
if FileIsEmpty( "lvs_framework/autorun/"..filename ) then continue end
|
||||
|
||||
if string.StartWith( filename, "sv_") then -- sv_ prefix only load serverside
|
||||
if SERVER then
|
||||
include("lvs_framework/autorun/"..filename)
|
||||
end
|
||||
|
||||
continue
|
||||
end
|
||||
|
||||
if string.StartWith( filename, "cl_") then -- cl_ prefix only load clientside
|
||||
if SERVER then
|
||||
AddCSLuaFile("lvs_framework/autorun/"..filename)
|
||||
else
|
||||
include("lvs_framework/autorun/"..filename)
|
||||
end
|
||||
|
||||
continue
|
||||
end
|
||||
|
||||
-- everything else is shared
|
||||
if SERVER then
|
||||
AddCSLuaFile("lvs_framework/autorun/"..filename)
|
||||
end
|
||||
include("lvs_framework/autorun/"..filename)
|
||||
end
|
||||
|
||||
hook.Run( "LVS:Initialize" )
|
||||
|
||||
print("[LVS] - initialized ["..math.Round((SysTime() - StartTime) * 1000,2).."ms]")
|
||||
|
||||
if CLIENT then
|
||||
hook.Add( "InitPostEntity", "!!!lvscheckupdates", function()
|
||||
timer.Simple(20, function()
|
||||
LVS.CheckUpdates()
|
||||
|
||||
local convar = GetConVar( "no_error_hitboxes" )
|
||||
|
||||
if not convar then return end
|
||||
|
||||
convar:SetBool( false )
|
||||
end)
|
||||
end )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
resource.AddWorkshop("2912816023")
|
||||
|
||||
function LVS:FixVelocity()
|
||||
local tbl = physenv.GetPerformanceSettings()
|
||||
|
||||
if tbl.MaxVelocity < 4000 then
|
||||
local OldVel = tbl.MaxVelocity
|
||||
|
||||
tbl.MaxVelocity = 4000
|
||||
physenv.SetPerformanceSettings(tbl)
|
||||
|
||||
print("[LVS] Low MaxVelocity detected! Increasing! "..OldVel.." => 4000")
|
||||
end
|
||||
|
||||
if tbl.MaxAngularVelocity < 7272 then
|
||||
local OldAngVel = tbl.MaxAngularVelocity
|
||||
|
||||
tbl.MaxAngularVelocity = 7272
|
||||
physenv.SetPerformanceSettings(tbl)
|
||||
|
||||
print("[LVS] Low MaxAngularVelocity detected! Increasing! "..OldAngVel.." => 7272")
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add( "InitPostEntity", "!!!lvscheckupdates", function()
|
||||
timer.Simple(20, function()
|
||||
LVS.CheckUpdates()
|
||||
end)
|
||||
end )
|
||||
Reference in New Issue
Block a user