add sborka

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

View File

@@ -0,0 +1,67 @@
include("shared.lua")
function ENT:UpdatePoseParameters( steer, speed_kmh, engine_rpm, throttle, brake, handbrake, clutch, gear, temperature, fuel, oil, ammeter )
self:SetPoseParameter( "vehicle_steer", steer ) -- keep default behavior
--[[ add your gauges:
self:SetPoseParameter( "tacho_gauge", engine_rpm / 8000 )
self:SetPoseParameter( "temp_gauge", temperature )
self:SetPoseParameter( "fuel_gauge", fuel )
self:SetPoseParameter( "oil_gauge", oil )
self:SetPoseParameter( "alt_gauge", ammeter )
self:SetPoseParameter( "vehicle_gauge", speed_kmh / 240 )
self:SetPoseParameter( "throttle_pedal", throttle )
self:SetPoseParameter( "brake_pedal", brake )
self:SetPoseParameter( "handbrake_pedal", handbrake )
self:SetPoseParameter( "clutch_pedal", clutch )
]]
-- no need to call invalidatebonecache. Its called automatically after this function.
end
--[[
function ENT:OnSpawn()
end
-- use this instead of ENT:OnRemove
function ENT:OnRemoved()
end
-- use this instead of ENT:Think()
function ENT:OnFrame()
end
function ENT:LVSPreHudPaint( X, Y, ply )
return true -- return false to prevent original hud paint from running
end
-- called when the engine is turned on or off
function ENT:OnEngineActiveChanged( Active )
if Active then
self:EmitSound( "lvs/vehicles/generic/engine_start1.wav", 75, 100, LVS.EngineVolume )
else
self:EmitSound( "vehicles/jetski/jetski_off.wav", 75, 100, LVS.EngineVolume )
end
end
-- called when either an ai is activated/deactivated or when a player is sitting/exiting the driver seat
function ENT:OnActiveChanged( Active )
end
function ENT:CalcViewOverride( ply, pos, angles, fov, pod )
return pos, angles, fov
end
function ENT:CalcViewDirectInput( ply, pos, angles, fov, pod )
return LVS:CalcView( self, ply, pos, angles, fov, pod )
end
function ENT:CalcViewMouseAim( ply, pos, angles, fov, pod )
return LVS:CalcView( self, ply, pos, angles, fov, pod )
end
function ENT:CalcViewPassenger( ply, pos, angles, fov, pod )
return LVS:CalcView( self, ply, pos, angles, fov, pod )
end
]]

View File

@@ -0,0 +1,348 @@
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_init.lua" )
include("shared.lua")
--[[
ENT.WaterLevelPreventStart = 1 -- at this water level engine can not start
ENT.WaterLevelAutoStop = 2 -- at this water level (on collision) the engine will stop
ENT.WaterLevelDestroyAI = 2 -- at this water level (on collision) the AI will self destruct
]]
--ENT.PivotSteerEnable = false -- uncomment and set to "true" to enable pivot steering (tank steering on the spot)
--ENT.PivotSteerWheelRPM = 40 -- how fast the wheels rotate during pivot steer
-- use this instead of ENT:Initialize()
function ENT:OnSpawn( PObj )
--[[ basics ]]
self:AddDriverSeat( Vector(-10,0,-15), Angle(0,-90,0) ) -- self:AddDriverSeat( Position, Angle ) -- add a driver seat (max 1)
-- Pod.ExitPos = Vector(0,0,100) -- change exit position
-- Pod.HidePlayer = true -- should the player in this pod be invisible?
-- local Pod = self:AddPassengerSeat( Position, Angle ) -- add a passenger seat (no limit)
-- Pod.ExitPos = Vector(0,0,100) -- change exit position
-- Pod.HidePlayer = true -- should the player in this pod be invisible?
--[[ engine sound / effects ]]
self:AddEngine( Vector(0,0,0) ) -- add a engine. This is used for sounds and effects and is required to get accurate RPM for the gauges.
--local Engine = self:AddEngine( vector_pos, angle_ang, mins, maxs )
--Engine:SetDoorHandler( DoorHandler ) -- link it to a doorhandler as requirement for the repair tool
--[[ fuel system ]]
-- self:AddFuelTank( pos, ang, tanksize, fueltype, mins, maxs ) -- adds a fuel tank.
--[[
fueltypes:
LVS.FUELTYPE_PETROL
LVS.FUELTYPE_DIESEL
LVS.FUELTYPE_ELECTRIC
tanksize is how many seconds@fullthrottle you can drive. Not in liter.
]]
--Example:
self:AddFuelTank( Vector(0,0,0), Angle(0,0,0), 600, LVS.FUELTYPE_PETROL )
--[[ damage system ]]
--[[
-- The fuel tank internally registers a critical hitpoint that catches the vehicle on fire when damaged. You can use this same system to create your own damage behaviors like this:
self:AddDS( {
pos = Vector(0,0,0),
ang = Angle(0,0,0),
mins = Vector(-40,-20,-30),
maxs = Vector(40,20,30),
Callback = function( tbl, ent, dmginfo )
--dmginfo:ScaleDamage( 15 ) -- this would scale damage *15 when this critical hitpoint has been hit
end
} )
-- you can also add armor spots using this method. If the bullet trace hits this box first, it will not hit the critical hit point:
self:AddDSArmor( {
pos = Vector(-70,0,35),
ang = Angle(0,0,0),
mins = Vector(-10,-40,-30),
maxs = Vector(10,40,30),
Callback = function( tbl, ent, dmginfo )
-- armor also has a callback. You can set damage to 0 here for example:
dmginfo:ScaleDamage( 0 )
end
} )
NOTE: !!DS parts are inactive while the vehicle has shield!!
-- in addition to DS-parts LVS-Cars has a inbuild Armor system:
self:AddArmor( pos, ang, mins, maxs, health, num_force_ignore )
-- num_force_ignore is the bullet force. Value here gets added to general immunity variable ENT.DSArmorIgnoreForce (see shared.lua)
]]
--[[ sound emitters ]]
-- self.SoundEmitter = self:AddSoundEmitter( Position, string_path_exterior_sound, string_path_interior_sound ) -- add a sound emitter
-- self.SoundEmitter:SetSoundLevel( 95 ) -- set sound level (95 is good for weapons)
-- self.SoundEmitter:Play() -- start looping sound (use this in weapon start attack for example)
-- self.SoundEmitter:Stop() -- stop looping sound (use this in weapon stop attack for example)
-- self.SoundEmitter:PlayOnce( pitch, volume ) -- or play a non-looped sound in weapon attack (do not use looped sound files with this, they will never stop)
--[[ items ]]
--self:AddTurboCharger() -- equip a turbo charger?
--self:AddSuperCharger() -- equip a super charger?
--[[ wheels ]]
--[[
-- add a wheel:
local WheelEntity1 = self:AddWheel( {
-- radius = 12, -- (leave this commented-out to let the system figure this out by itself)
-- width = 3, -- tire witdh used for skidmarks
pos = Vector(0,0,0),
mdl = "path/to/model.mdl",
mdl_ang = Angle(0,0,0), -- use this to match model orientation with wheel rotation
MaxHealth = 100, -- changes max health of wheel
DSArmorIgnoreForce = 0, -- changes the damage force that is needed to damage this wheel
--camber = 0, -- camber alignment
--caster = 0, -- caster alignment
--toe = 0, -- toe alignment
--hide = false, -- hide this wheel?, NOTE: if developer convar is set to 1 this will have no effect for debugging purposes.
-- wheeltype = LVS.WHEELTYPE_NONE -- this is only used when ENT.PivotSteerEnable is set to true. It can be either LVS.WHEELTYPE_LEFT or LVS.WHEELTYPE_RIGHT depending on which direction you want it to spin
} ),
!!NOTE!!
adding a wheel will not make the vehicle functional. It requires to be linked to an axle using self:DefineAxle()
]]
--[[ axles ]]
--[[
local Axle = self:DefineAxle( {
Axle = {
ForwardAngle = Angle(0,0,0), -- angle which is considered "forward" with this axle. Use this to fix misaligned body props.
SteerType = STEER_TYPE,
-- STEER_TYPE:
-- LVS.WHEEL_STEER_NONE -- non steering wheel
-- LVS.WHEEL_STEER_FRONT -- a wheel that turns left when left key is pressed
-- LVS.WHEEL_STEER_REAR -- ..turns right when left key is pressed
SteerAngle = 30, -- max steer angle, unused in steer type LVS.WHEEL_STEER_NONE
TorqueFactor = 0.3, -- TorqueFactor is how much torque is applied to this axle. 1 = all power, 0 = no power. Ideally all Axis combined equal 1.
--So if you make front wheels have TorqueFactor 0.3 you set rear axle to 0.7
--If Front Axle 0 set Rear Axle 1 ect.. you get the idea
BrakeFactor = 1, -- how strong the brakes on this axle are. Just leave it at 1
--UseHandbrake = true, -- is this axle using the handbrake?
},
Wheels = {WheelEntity1, WheelEntity2, ... ect }, -- link wheels to this axle. Can be any amount in any order
Suspension = {
Height = 6, -- suspension height. Ideally less than MaxTravel so the suspension doesnt always bump into its limiter. If it sags into the limiter you need more SpringConstant
MaxTravel = 7, -- limits the suspension travel.
ControlArmLength = 25, -- changes the size of the control arm. (changes the arc in which the axle is rotating)
SpringConstant = 20000, -- the strength of the spring. Max value is 50000 everything above has no effect. This is the reason you should NOT use realistic mass but instead change INERTIA ONLY to simulate heavier vehicles.
SpringDamping = 2000, -- damping of the spring, same as what you set in your elastic tool.
SpringRelativeDamping = 2000, -- relative damping of the spring, same as what you set in your elastic tool. If you dont know what it does just set it to the same as SpringDamping
},
} )
]]
-- example:
local WheelModel = "models/props_vehicles/tire001c_car.mdl"
local WheelFrontLeft = self:AddWheel( { pos = Vector(60,30,-15), mdl = WheelModel } )
local WheelFrontRight = self:AddWheel( { pos = Vector(60,-30,-15), mdl = WheelModel } )
local WheelRearLeft = self:AddWheel( {pos = Vector(-60,30,-15), mdl = WheelModel} )
local WheelRearRight = self:AddWheel( {pos = Vector(-60,-30,-15), mdl = WheelModel} )
local SuspensionSettings = {
Height = 6,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
}
local FrontAxle = self:DefineAxle( {
Axle = {
ForwardAngle = Angle(0,0,0),
SteerType = LVS.WHEEL_STEER_FRONT,
SteerAngle = 30,
TorqueFactor = 0.3,
BrakeFactor = 1,
},
Wheels = { WheelFrontLeft, WheelFrontRight },
Suspension = SuspensionSettings,
} )
local RearAxle = self:DefineAxle( {
Axle = {
ForwardAngle = Angle(0,0,0),
SteerType = LVS.WHEEL_STEER_NONE,
TorqueFactor = 0.7,
BrakeFactor = 1,
UseHandbrake = true,
},
Wheels = { WheelRearLeft, WheelRearRight },
Suspension = SuspensionSettings,
} )
-- example 2 (rear axle only). If this looks cleaner to you:
--[[
local RearAxle = self:DefineAxle( {
Axle = {
ForwardAngle = Angle(0,0,0),
SteerType = LVS.WHEEL_STEER_NONE,
TorqueFactor = 0.7,
BrakeFactor = 1,
UseHandbrake = true,
},
Wheels = {
self:AddWheel( {
pos = Vector(-60,30,-15),
mdl = "models/props_vehicles/tire001c_car.mdl",
mdl_ang = Angle(0,0,0),
} ),
self:AddWheel( {
pos = Vector(-60,-30,-15),
mdl = "models/props_vehicles/tire001c_car.mdl",
mdl_ang = Angle(0,0,0),
} ),
},
Suspension = {
Height = 6,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
},
)
]]
-- example 3, prop_vehicle_jeep rigged model method using
--[[
local FrontRadius = 15
local RearRadius = 15
local FL, FR, RL, RR, ForwardAngle = self:AddWheelsUsingRig( FrontRadius, RearRadius )
local FrontAxle = self:DefineAxle( {
Axle = {
ForwardAngle = ForwardAngle,
SteerType = LVS.WHEEL_STEER_FRONT,
SteerAngle = 30,
TorqueFactor = 0,
BrakeFactor = 1,
},
Wheels = {FL,FR},
Suspension = {
Height = 10,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
},
} )
local RearAxle = self:DefineAxle( {
Axle = {
ForwardAngle = ForwardAngle,
SteerType = LVS.WHEEL_STEER_NONE,
TorqueFactor = 1,
BrakeFactor = 1,
UseHandbrake = true,
},
Wheels = {RL,RR},
Suspension = {
Height = 15,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
},
} )
]]
-- example 4, rigged wheels with visible prop wheels:
--[[
local data = {
mdl_fr = "models/diggercars/dodge_charger/wh.mdl",
mdl_ang_fr = Angle(0,0,0),
mdl_fl = "models/diggercars/dodge_charger/wh.mdl",
mdl_ang_fl = Angle(0,180,0),
mdl_rl = "models/diggercars/dodge_charger/wh.mdl",
mdl_ang_rl = Angle(0,0,0),
mdl_rr = "models/diggercars/dodge_charger/wh.mdl",
mdl_ang_rr = Angle(0,180,0),
}
local FrontRadius = 15
local RearRadius = 15
local FL, FR, RL, RR, ForwardAngle = self:AddWheelsUsingRig( FrontRadius, RearRadius, data )
local FrontAxle = self:DefineAxle( {
Axle = {
ForwardAngle = ForwardAngle,
SteerType = LVS.WHEEL_STEER_FRONT,
SteerAngle = 30,
TorqueFactor = 0,
BrakeFactor = 1,
},
Wheels = {FL,FR},
Suspension = {
Height = 10,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
},
} )
local RearAxle = self:DefineAxle( {
Axle = {
ForwardAngle = ForwardAngle,
SteerType = LVS.WHEEL_STEER_NONE,
TorqueFactor = 1,
BrakeFactor = 1,
UseHandbrake = true,
},
Wheels = {RL,RR},
Suspension = {
Height = 15,
MaxTravel = 7,
ControlArmLength = 25,
SpringConstant = 20000,
SpringDamping = 2000,
SpringRelativeDamping = 2000,
},
} )
]]
end
--[[
function ENT:OnSuperCharged( enabled )
-- called when supercharger is equipped/unequipped
end
function ENT:OnTurboCharged( enabled )
-- called when turbocharger is equipped/unequipped
end
]]

View File

@@ -0,0 +1,362 @@
ENT.Base = "lvs_base_wheeldrive"
ENT.PrintName = "template script"
ENT.Author = "*your name*"
ENT.Information = ""
ENT.Category = "[LVS] *your category*"
ENT.Spawnable = false -- set to "true" to make it spawnable
ENT.AdminSpawnable = false
ENT.SpawnNormalOffset = 40 -- spawn normal offset, raise to prevent spawning into the ground
--ENT.SpawnNormalOffsetSpawner = 0 -- offset for ai vehicle spawner
ENT.MDL = "models/props_interiors/Furniture_Couch02a.mdl"
--ENT.MDL_DESTROYED = "models/props_interiors/Furniture_Couch02a.mdl"
--[[
ENT.GibModels = {
"models/gibs/manhack_gib01.mdl",
"models/gibs/manhack_gib02.mdl",
"models/gibs/manhack_gib03.mdl",
"models/gibs/manhack_gib04.mdl",
"models/props_c17/canisterchunk01a.mdl",
"models/props_c17/canisterchunk01d.mdl",
"models/props_c17/oildrumchunk01a.mdl",
"models/props_c17/oildrumchunk01b.mdl",
"models/props_c17/oildrumchunk01c.mdl",
"models/props_c17/oildrumchunk01d.mdl",
"models/props_c17/oildrumchunk01e.mdl",
}
]]
ENT.AITEAM = 1
--[[
TEAMS:
0 = FRIENDLY TO EVERYONE
1 = FRIENDLY TO TEAM 1 and 0
2 = FRIENDLY TO TEAM 2 and 0
3 = HOSTILE TO EVERYONE
]]
ENT.MaxHealth = 400 -- max health
--ENT.MaxHealthEngine = 100 -- max health engine
--ENT.MaxHealthFuelTank = 100 -- max health fuel tank
--ENT.DSArmorDamageReduction = 0.1 -- damage reduction multiplier. Damage is clamped to a minimum of 1 tho
--ENT.DSArmorDamageReductionType = DMG_BULLET + DMG_CLUB -- which damage type to damage reduce
--ENT.DSArmorIgnoreDamageType = DMG_SONIC -- ignore this damage type completely
--ENT.DSArmorIgnoreForce = 1000 -- add general immunity against small firearms, 1000 = 10mm armor thickness
--ENT.DSArmorBulletPenetrationAdd = 250 -- changes how far bullets can cheat through the body to hit critical hitpoints and armor
--[[
PLEASE READ:
Ideally you only need change:
ENT.MaxVelocity -- to change top speed
ENT.EngineTorque -- to change acceleration speed
ENT.EngineIdleRPM -- optional: only used for rpm gauge. This will NOT change engine sound.
ENT.EngineMaxRPM -- optional: only used for rpm gauge. This will NOT change engine sound.
ENT.TransGears -- in a sane range based on maxvelocity. Dont set 10 gears for a car that only does 10kmh this will sound like garbage. Ideally use a total of 3 - 6 gears
I recommend keeping everything else at default settings.
(leave them commented-out or remove them from this script)
]]
ENT.MaxVelocity = 1400 -- max velocity in forward direction in gmod-units/second
--ENT.MaxVelocityReverse = 700 -- max velocity in reverse
--ENT.EngineCurve = 0.65 -- value goes from 0 to 1. Get into a car and type "developer 1" into the console to see the current engine curve
--ENT.EngineCurveBoostLow = 1 -- first gear torque boost multiplier
ENT.EngineTorque = 150
ENT.EngineIdleRPM = 1000
ENT.EngineMaxRPM = 6000
--ENT.ThrottleRate = 3.5 -- modify the throttle update rate, see it as the speed with which you push the pedal
--ENT.ForceLinearMultiplier = 1 -- multiply all linear forces (such as downforce, wheel side force, ect)
--ENT.ForceAngleMultiplier = 0.5 -- multiply all angular forces such turn stability / inertia. Exception: Wheel/Engine torque. Those remain unchanged.
ENT.TransGears = 4 -- amount of gears in forward direction. NOTE: the engine sound system calculates the gear ratios based on topspeed and amount of gears. This can not be changed.
--ENT.TransGearsReverse = 1 -- amount of gears in reverse direction
--ENT.TransMinGearHoldTime = 1 -- minimum time the vehicle should stay in a gear before allowing it to shift again.
--ENT.TransShiftSpeed = 0.3 -- in seconds. How fast the transmission handles a shift. The transmission mimics a manual shift by applying clutch, letting off throttle, releasing clutch and applying throttle again even tho it is automatic.
--ENT.TransWobble = 40 -- basically how much "play" is in the drivedrain.
--ENT.TransWobbleTime = 1.5 -- in seconds. How long after a shift or after applying throttle the engine will wobble up and down in rpm
--ENT.TransWobbleFrequencyMultiplier = 1 -- changes the frequency of the wobble
--ENT.TransShiftSound = "lvs/vehicles/generic/gear_shift.wav" change gear shift sound
--ENT.SteerSpeed = 3 -- steer speed
--ENT.SteerReturnSpeed = 10 -- steer return speed to neutral steer
--ENT.FastSteerActiveVelocity = 500 -- at which velocity the steering will clamp the steer angle
--ENT.FastSteerAngleClamp = 10 -- to which the steering angle is clamped to when speed is above ENT.FastSteerActiveVelocity
--ENT.FastSteerDeactivationDriftAngle = 7 -- allowed drift angle until ENT.FastSteerActiveVelocity is ignored and the steering becomes unclamped
--ENT.SteerAssistDeadZoneAngle = 1 -- changes how much drift the counter steer system allows before interfering. 1 = 1° of drift without interfering
--ENT.SteerAssistMaxAngle = 15 -- max steering angle the counter steer system is allowed to help the player
--ENT.SteerAssistExponent = 1.5 -- an exponent to the counter steering curve. Just leave it at 1.5
--ENT.SteerAssistMultiplier = 3 -- how "quick" the counter steer system is steering
--ENT.MouseSteerAngle = 20 -- smaller value = more direct steer bigger value = smoother steer, just leave it at 20
--ENT.MouseSteerExponent = 2 -- just leave it at 2. Fixes wobble.
--ENT.PhysicsWeightScale = 1 -- this is the value you need to change in order to make a vehicle feel heavier. Just leave it at 1 unless you really need to change it
--ENT.PhysicsMass = 1000 -- do not mess with this unless you can balance everything yourself again.
--ENT.PhysicsInertia = Vector(1500,1500,750) -- do not mess with this unless you can balance everything yourself again.
--ENT.PhysicsDampingSpeed = 4000 -- do not mess with this unless you can balance everything yourself again.
--ENT.PhysicsDampingForward = true -- internal physics damping to reduce wobble. Just keep it enabled in forward direction.
--ENT.PhysicsDampingReverse = false -- disabling this in reverse allows for a reverse 180° turn. If you want to go fast in reverse you should set this to true in order to get good stability
--ENT.WheelPhysicsMass = 100 -- do not mess with this unless you can balance everything yourself again.
--ENT.WheelPhysicsInertia = Vector(10,8,10) -- do not mess with this unless you can balance everything yourself again.
--ENT.WheelPhysicsTireHeight = 4 -- changes the tire height. If tire is blown the wheel sink this amount into the ground. Set to 0 to disable tire damage
--[[
-- physics friction lookup table. The default used one is 10, jeeptire
ENT.WheelPhysicsMaterials = {
[0] = "friction_00", -- 0
[1] = "friction_10", -- 0.1
[2] = "friction_25", -- 0.25
[3] = "popcan", -- 0.3
[4] = "glassbottle", -- 0.4
[5] = "glass", -- 0.5
[6] = "snow", -- 0.6
[7] = "roller", -- 0.7
[8] = "rubber", -- 0.8
[9] = "slime", -- 0.9
[10] = "jeeptire", -- 1.337 -- i don't believe friction in havok can go above 1, however other settings such as bouncyness and elasticity are affected by it as it seems. We use jeeptire as default even tho it technically isn't the "best" choice, but rather the most common one
[11] = "jalopytire", -- 1.337
[12] = "phx_tire_normal", -- 3
}
]]
--ENT.AutoReverseVelocity = 50 -- below this velocity the transmission is allowed to automatically shift into reverse when holding the brake button
--ENT.WheelBrakeLockupRPM = 20 -- below this wheel rpm it will engage the auto brake when the throttle is 0
--ENT.WheelBrakeForce = 400 -- how strong the brakes are. Just leave at 400. Allows for good braking while still allowing some turning. It has some build in ABS but it isnt perfect because even tho velocities say it isnt sliding the wheel will still visually slide in source...
--ENT.WheelSideForce = 800 -- basically a sideways cheatforce that gives you better stability in turns. You shouldn't have to edit this.
--ENT.WheelDownForce = 500 -- wheels use jeeptire as physprop. To this a downward force is applied to increase traction. You shouldn't have to edit this.
--ENT.AllowSuperCharger = true -- allow this vehicle to equip a supercharger?
--ENT.SuperChargerVolume = 1 -- change superchager sound volume
--ENT.SuperChargerSound = "lvs/vehicles/generic/supercharger_loop.wav" -- change supercharger sound file
--ENT.AllowTurbo = true -- allow this vehilce to equip a turbocharger?
--ENT.TurboVolume = 1 -- change turbocharger sound volume
--ENT.TurboSound = "lvs/vehicles/generic/turbo_loop.wav" -- change turbo sound file
--ENT.TurboBlowOff = {"lvs/vehicles/generic/turbo_blowoff1.wav","lvs/vehicles/generic/turbo_blowoff1.wav"} -- change blowoff sound. If you only have one file you can just pass it as a string instead of a table.
--ENT.DeleteOnExplode = false -- remove the vehicle when it explodes?
--ENT.lvsAllowEngineTool = true -- alow the engine tool to be used on this vehicle?
--ENT.lvsShowInSpawner = false -- show this vehicle in vehicle spawner entity?
--[[
--ENT.RandomColor = {} -- table with colors to set on spawn
-- accepts colors and skin+color combo:
-- example variant1:
ENT.RandomColor = {
Color(255,255,255),
Color(255,255,255),
Color(255,255,255),
Color(255,255,255),
Color(255,255,255),
Color(255,255,255),
}
-- example variant2:
ENT.RandomColor = {
{
Skin = 1,
Color = Color(255,255,255),
BodyGroups = {
[1] = 3, -- set bodygroup 1 to 3
[5] = 7, -- set bodygroup 5 to 7
},
},
{
Skin = 2,
Color = Color(255,255,255),
},
{
Skin = 3,
Color = Color(255,255,255),
},
{
Skin = 4,
Color = Color(255,255,255),
},
{
Skin = 5,
Color = Color(255,255,255),
},
{
Skin = 6,
Color = Color(255,255,255),
Wheels = { -- can also color wheels in this variant
Skin = 0,
Color = Color(255,255,0),
},
},
}
]]
--ENT.HornSound = "lvs/horn2.wav" add a horn sound
--ENT.HornSoundInterior = "lvs/horn2.wav" -- leave it commented out, that way it uses the same as ENT.HornSound
--ENT.HornPos = Vector(40,0,35) -- horn sound position
--[[weapons]]
function ENT:InitWeapons()
-- add a weapon:
local weapon = {}
weapon.Icon = Material("lvs/weapons/bullet.png")
-- overheat system:
weapon.Ammo = 1000
weapon.Delay = 0.1
weapon.HeatRateUp = 0.2
weapon.HeatRateDown = 0.25
-- clip system example:
--[[
weapon.Clip = 20
weapon.Ammo = 60
weapon.Delay = 0.1
weapon.ReloadSpeed = 2
weapon.OnReload = function( ent )
ent:EmitSound("lvs/vehicles/sherman/cannon_reload.wav" )
end
]]
weapon.Attack = function( ent )
-- "ent" can be either the weapon handler or the vehicle(which has a integrated weapon handler)
-- "ent" is where ent:SetHeat, ent:GetHeat, ent:GetAmmo ect functions are called on.
-- for seat 1 (which is the driver), ent is equal to self (the vehicle), passenger seats usually return the weapon handler and not self.
-- if you want to be 100% sure to get the actual vehicle, just call ent:GetVehicle() it will always return the base vehicle.
local bullet = {}
bullet.Src = ent:LocalToWorld( Vector(25,0,30) )
bullet.Dir = ent:GetForward()
bullet.Spread = Vector( 0.015, 0.015, 0 )
bullet.TracerName = "lvs_tracer_orange"
bullet.Force = 10 -- this divided by 100 = penetration in mm
--bullet.Force1km = 5 -- bullet force at 1km
--bullet.EnableBallistics = true -- enable ballistics?
bullet.HullSize = 15
bullet.Damage = 10
bullet.Velocity = 30000
bullet.SplashDamage = 100
bullet.SplashDamageRadius = 25
--bullet.SplashDamageEffect = "lvs_bullet_impact"
--bullet.SplashDamageType = DMG_SONIC
--bullet.SplashDamageForce = 500
bullet.Attacker = ent:GetDriver()
bullet.Callback = function(att, tr, dmginfo) end
ent:LVSFireBullet( bullet )
ent:TakeAmmo( 1 )
end
weapon.StartAttack = function( ent ) end
weapon.FinishAttack = function( ent ) end
weapon.OnSelect = function( ent ) end
weapon.OnDeselect = function( ent ) end
weapon.OnThink = function( ent, active ) end
weapon.OnOverheat = function( ent ) ent:EmitSound("lvs/overheat.wav") end
weapon.OnRemove = function( ent ) end
--[[
weapon.CalcView = function( ent, ply, pos, angles, fov, pod )
-- build view yourself:
local view = {}
view.origin = pos
view.angles = angles
view.fov = fov
view.drawviewer = false
return view
--or use inbuild camera system:
--if pod:GetThirdPersonMode() then
-- pos = pos + ent:GetUp() * 100 -- move camera 100 units up in third person
--end
--return LVS:CalcView( ent, ply, pos, angles, fov, pod )
end
]]
--[[
weapon.HudPaint = function( ent, X, Y, ply )
-- hud paint that is only active when the weapon is selected
-- draw stuff like crosshair here
end
]]
--self:AddWeapon( weapon ) -- add weapon to driver seat. Uncomment to make it useable.
--self:AddWeapon( weapon, 2 ) -- this would register to weapon to seat 2
--self:AddWeapon( weapon, 3 ) -- seat 3.. ect
--[[
-- or use presets (defined in "lvs_base\lua\lvs_framework\autorun\lvs_defaultweapons.lua"):
self.PosLMG = Vector(25,0,30) -- this is used internally as variable in LMG script
self.DirLMG = 0 -- this is used internally as variable in LMG script
self:AddWeapon( LVS:GetWeaponPreset( "LMG" ) )
]]
end
--[[ engine sounds ]]
-- valid SoundType's are:
-- LVS.SOUNDTYPE_IDLE_ONLY -- only plays in idle
-- LVS.SOUNDTYPE_NONE -- plays all the time except in idle
-- LVS.SOUNDTYPE_REV_UP -- plays when revving up
-- LVS.SOUNDTYPE_REV_DOWN -- plays when revving down
-- LVS.SOUNDTYPE_ALL -- plays all the time
ENT.EngineSounds = {
{
sound = "vehicles/apc/apc_idle1.wav",
Volume = 1,
Pitch = 85,
PitchMul = 25,
SoundLevel = 75,
SoundType = LVS.SOUNDTYPE_IDLE_ONLY,
},
{
sound = "vehicles/airboat/fan_motor_fullthrottle_loop1.wav",
--sound_int = "path/to/interior/sound.wav",
Volume = 1, -- adjust volume
Pitch = 50, -- start pitch value
PitchMul = 100, -- value that gets added to Pitch at max engine rpm
SoundLevel = 75, -- if too quiet, adjust soundlevel.
SoundType = LVS.SOUNDTYPE_NONE,
UseDoppler = true, -- use doppler system?
},
}
--[[ exhaust ]]
--[[
ENT.ExhaustPositions = {
{
pos = Vector(-100.04,14.72,4.84),
ang = Angle(0,180,0),
},
{
pos = Vector(-100.04,-14.72,4.84),
ang = Angle(0,180,0),
}
}
]]
--[[ lights ]]
ENT.Lights = {}
-- see: https://raw.githubusercontent.com/SpaxscE/lvs_cars/main/zzz_ENT_lights_info.lua
-- or https://discord.com/channels/1036581288653627412/1140195565368508427/1140195750207291403