add sborka
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/cl_attachable_playermodels.lua")
|
||||
|
||||
function ENT:DrawDriver()
|
||||
local pod = self:GetDriverSeat()
|
||||
|
||||
if not IsValid( pod ) then self:RemovePlayerModel( "driver" ) return end
|
||||
|
||||
local plyL = LocalPlayer()
|
||||
local ply = pod:GetDriver()
|
||||
|
||||
if not IsValid( ply ) or (ply == plyL and not pod:GetThirdPersonMode()) then self:RemovePlayerModel( "driver" ) return end
|
||||
|
||||
local ID = self:LookupAttachment( "seat1" )
|
||||
local Att = self:GetAttachment( ID )
|
||||
|
||||
if not Att then self:RemovePlayerModel( "driver" ) return end
|
||||
|
||||
local Pos,Ang = LocalToWorld( Vector(10,-5,0), Angle(0,20,-90), Att.Pos, Att.Ang )
|
||||
|
||||
local model = self:CreatePlayerModel( ply, "driver" )
|
||||
|
||||
model:SetSequence( "sit" )
|
||||
model:SetRenderOrigin( Pos )
|
||||
model:SetRenderAngles( Ang )
|
||||
model:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:DrawGunner()
|
||||
local pod = self:GetGunnerSeat()
|
||||
|
||||
if not IsValid( pod ) then self:RemovePlayerModel( "passenger" ) return end
|
||||
|
||||
local plyL = LocalPlayer()
|
||||
local ply = pod:GetDriver()
|
||||
|
||||
if not IsValid( ply ) or (ply == plyL and not pod:GetThirdPersonMode()) then self:RemovePlayerModel( "passenger" ) return end
|
||||
|
||||
local ID = self:LookupAttachment( "seat2" )
|
||||
local Att = self:GetAttachment( ID )
|
||||
|
||||
if not Att then self:RemovePlayerModel( "passenger" ) return end
|
||||
|
||||
local Pos,Ang = LocalToWorld( Vector(10,-5,0), Angle(0,20,-90), Att.Pos, Att.Ang )
|
||||
|
||||
local model = self:CreatePlayerModel( ply, "passenger" )
|
||||
|
||||
model:SetSequence( "sit" )
|
||||
model:SetRenderOrigin( Pos )
|
||||
model:SetRenderAngles( Ang )
|
||||
model:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:PreDraw()
|
||||
self:DrawDriver()
|
||||
self:DrawGunner()
|
||||
|
||||
return true
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
include("shared.lua")
|
||||
include("sh_turret.lua")
|
||||
include("cl_tankview.lua")
|
||||
include("cl_attached_playermodels.lua")
|
||||
|
||||
function ENT:OnFrame()
|
||||
local Heat1 = 0
|
||||
if self:GetSelectedWeapon() == 2 then
|
||||
Heat1 = self:QuickLerp( "cannon_heat", self:GetNWHeat(), 10 )
|
||||
else
|
||||
Heat1 = self:QuickLerp( "cannon_heat", 0, 0.25 )
|
||||
end
|
||||
local name = "spaehwagen_cannonglow_"..self:EntIndex()
|
||||
if not self.TurretGlow1 then
|
||||
self.TurretGlow1 = self:CreateSubMaterial( 3, name )
|
||||
|
||||
return
|
||||
end
|
||||
if self._oldGunHeat1 ~= Heat1 then
|
||||
self._oldGunHeat1 = Heat1
|
||||
|
||||
self.TurretGlow1:SetFloat("$detailblendfactor", Heat1 ^ 7 )
|
||||
|
||||
self:SetSubMaterial(3, "!"..name)
|
||||
end
|
||||
|
||||
|
||||
local Heat2 = 0
|
||||
if self:GetSelectedWeapon() == 1 then
|
||||
Heat2 = self:QuickLerp( "mg_heat", self:GetNWHeat(), 10 )
|
||||
else
|
||||
Heat2 = self:QuickLerp( "mg_heat", 0, 0.25 )
|
||||
end
|
||||
local name = "spaehwagen_mgglow_"..self:EntIndex()
|
||||
if not self.TurretGlow2 then
|
||||
self.TurretGlow2 = self:CreateSubMaterial( 2, name )
|
||||
|
||||
return
|
||||
end
|
||||
if self._oldGunHeat2 ~= Heat2 then
|
||||
self._oldGunHeat2 = Heat2
|
||||
|
||||
self.TurretGlow2:SetFloat("$detailblendfactor", Heat2 ^ 7 )
|
||||
|
||||
self:SetSubMaterial(2, "!"..name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/cl_tankview.lua")
|
||||
|
||||
function ENT:TankViewOverride( ply, pos, angles, fov, pod )
|
||||
if ply == self:GetDriver() and not pod:GetThirdPersonMode() then
|
||||
local ID = self:LookupAttachment( "seat1" )
|
||||
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
pos = Muzzle.Pos - Muzzle.Ang:Right() * 25
|
||||
end
|
||||
end
|
||||
|
||||
return pos, angles, fov
|
||||
end
|
||||
|
||||
function ENT:CalcViewPassenger( ply, pos, angles, fov, pod )
|
||||
if pod == self:GetGunnerSeat() and not pod:GetThirdPersonMode() then
|
||||
local ID = self:LookupAttachment( "seat2" )
|
||||
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
pos = Muzzle.Pos - Muzzle.Ang:Right() * 25
|
||||
end
|
||||
end
|
||||
|
||||
return LVS:CalcView( self, ply, pos, angles, fov, pod )
|
||||
end
|
||||
@@ -0,0 +1,100 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
AddCSLuaFile( "cl_tankview.lua" )
|
||||
AddCSLuaFile( "cl_attached_playermodels.lua" )
|
||||
AddCSLuaFile( "sh_turret.lua" )
|
||||
include("shared.lua")
|
||||
include("sh_turret.lua")
|
||||
|
||||
function ENT:OnSpawn( PObj )
|
||||
local DriverSeat = self:AddDriverSeat( Vector(0,-15,30), Angle(0,0,0) )
|
||||
DriverSeat.HidePlayer = true
|
||||
|
||||
local GunnerSeat = self:AddPassengerSeat( Vector(0,-15,30), Angle(0,0,0) )
|
||||
GunnerSeat.HidePlayer = true
|
||||
self:SetGunnerSeat( GunnerSeat )
|
||||
|
||||
local ID = self:LookupAttachment( "muzzle_mg" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurretMG = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/sherman/mg_loop.wav", "lvs/vehicles/sherman/mg_loop_interior.wav" )
|
||||
self.SNDTurretMG:SetSoundLevel( 95 )
|
||||
self.SNDTurretMG:SetParent( self, ID )
|
||||
|
||||
|
||||
local ID = self:LookupAttachment( "muzzle_turret" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurret = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/222/cannon_fire.wav", "lvs/vehicles/222/cannon_fire_interior.wav" )
|
||||
self.SNDTurret:SetSoundLevel( 95 )
|
||||
self.SNDTurret:SetParent( self, ID )
|
||||
|
||||
|
||||
self:AddEngine( Vector(0,-60,51), Angle(0,-90,0) )
|
||||
self:AddFuelTank( Vector(0,-63,25), Angle(0,0,0), 600, LVS.FUELTYPE_PETROL )
|
||||
|
||||
local WheelModel = "models/diggercars/222/222_wheel.mdl"
|
||||
|
||||
local FrontAxle = self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,90,0),
|
||||
SteerType = LVS.WHEEL_STEER_FRONT,
|
||||
SteerAngle = 22,
|
||||
TorqueFactor = 0.4,
|
||||
BrakeFactor = 1,
|
||||
},
|
||||
Wheels = {
|
||||
self:AddWheel( {
|
||||
pos = Vector(-35,70,18),
|
||||
mdl = WheelModel,
|
||||
mdl_ang = Angle(0,-90,0),
|
||||
} ),
|
||||
|
||||
self:AddWheel( {
|
||||
pos = Vector(35,70,18),
|
||||
mdl = WheelModel,
|
||||
mdl_ang = Angle(0,90,0),
|
||||
} ),
|
||||
},
|
||||
Suspension = {
|
||||
Height = 10,
|
||||
MaxTravel = 7,
|
||||
ControlArmLength = 25,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 2000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
|
||||
local RearAxle = self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,90,0),
|
||||
SteerType = LVS.WHEEL_STEER_REAR,
|
||||
SteerAngle = 8,
|
||||
TorqueFactor = 0.6,
|
||||
BrakeFactor = 1,
|
||||
UseHandbrake = true,
|
||||
},
|
||||
Wheels = {
|
||||
self:AddWheel( {
|
||||
pos = Vector(-35,-45,14),
|
||||
mdl = WheelModel,
|
||||
mdl_ang = Angle(0,-90,0),
|
||||
} ),
|
||||
|
||||
self:AddWheel( {
|
||||
pos = Vector(35,-45,14),
|
||||
mdl = WheelModel,
|
||||
mdl_ang = Angle(0,90,0),
|
||||
} ),
|
||||
},
|
||||
Suspension = {
|
||||
Height = 10,
|
||||
MaxTravel = 7,
|
||||
ControlArmLength = 25,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 2000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
|
||||
self:AddTrailerHitch( Vector(0,-85,25), LVS.HITCHTYPE_MALE )
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/sh_turret.lua")
|
||||
|
||||
ENT.TurretAimRate = 50
|
||||
|
||||
ENT.TurretRotationSound = "vehicles/tank_turret_loop1.wav"
|
||||
|
||||
ENT.TurretPitchPoseParameterName = "turret_pitch"
|
||||
ENT.TurretPitchMin = -20
|
||||
ENT.TurretPitchMax = 40
|
||||
ENT.TurretPitchMul = -1
|
||||
ENT.TurretPitchOffset = 0
|
||||
|
||||
ENT.TurretYawPoseParameterName = "turret_yaw"
|
||||
ENT.TurretYawMul = -1
|
||||
ENT.TurretYawOffset = 90
|
||||
@@ -0,0 +1,301 @@
|
||||
|
||||
ENT.Base = "lvs_base_wheeldrive"
|
||||
|
||||
ENT.PrintName = "Panzerspaehwagen"
|
||||
ENT.Author = "Luna"
|
||||
ENT.Information = "Luna's Vehicle Script"
|
||||
ENT.Category = "[LVS] - Cars"
|
||||
|
||||
ENT.VehicleCategory = "Cars"
|
||||
ENT.VehicleSubCategory = "Armored"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.MDL = "models/diggercars/222/222.mdl"
|
||||
|
||||
ENT.AITEAM = 1
|
||||
|
||||
ENT.MaxHealth = 750
|
||||
ENT.MaxHealthEngine = 400
|
||||
ENT.MaxHealthFuelTank = 100
|
||||
|
||||
--damage system
|
||||
ENT.DSArmorIgnoreForce = 1200
|
||||
ENT.CannonArmorPenetration = 3900
|
||||
|
||||
|
||||
ENT.MaxVelocity = 1000
|
||||
|
||||
ENT.EngineCurve = 0.2
|
||||
ENT.EngineTorque = 200
|
||||
|
||||
ENT.TransGears = 5
|
||||
ENT.TransGearsReverse = 5
|
||||
|
||||
ENT.FastSteerAngleClamp = 5
|
||||
ENT.FastSteerDeactivationDriftAngle = 12
|
||||
|
||||
ENT.PhysicsWeightScale = 1.5
|
||||
ENT.PhysicsDampingForward = true
|
||||
ENT.PhysicsDampingReverse = true
|
||||
|
||||
ENT.lvsShowInSpawner = true
|
||||
|
||||
ENT.EngineSounds = {
|
||||
{
|
||||
sound = "lvs/vehicles/222/eng_idle_loop.wav",
|
||||
Volume = 0.5,
|
||||
Pitch = 85,
|
||||
PitchMul = 25,
|
||||
SoundLevel = 75,
|
||||
SoundType = LVS.SOUNDTYPE_IDLE_ONLY,
|
||||
},
|
||||
{
|
||||
sound = "lvs/vehicles/222/eng_loop.wav",
|
||||
Volume = 1,
|
||||
Pitch = 70,
|
||||
PitchMul = 100,
|
||||
SoundLevel = 75,
|
||||
UseDoppler = true,
|
||||
},
|
||||
}
|
||||
|
||||
ENT.Lights = {
|
||||
{
|
||||
Trigger = "main",
|
||||
SubMaterialID = 1,
|
||||
Sprites = {
|
||||
[1] = {
|
||||
pos = Vector(-21.76,92.74,44.5),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
},
|
||||
[2] = {
|
||||
pos = Vector(21.76,92.74,44.5),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
},
|
||||
},
|
||||
ProjectedTextures = {
|
||||
[1] = {
|
||||
pos = Vector(-21.76,92.74,44.5),
|
||||
ang = Angle(0,90,0),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
shadows = true,
|
||||
},
|
||||
[2] = {
|
||||
pos = Vector(21.76,92.74,44.5),
|
||||
ang = Angle(0,90,0),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
shadows = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Trigger = "high",
|
||||
Sprites = {
|
||||
[1] = {
|
||||
pos = Vector(-21.76,92.74,44.5),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
},
|
||||
[2] = {
|
||||
pos = Vector(21.76,92.74,44.5),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
},
|
||||
},
|
||||
ProjectedTextures = {
|
||||
[1] = {
|
||||
pos = Vector(-21.76,92.74,44.5),
|
||||
ang = Angle(0,90,0),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
shadows = true,
|
||||
},
|
||||
[2] = {
|
||||
pos = Vector(21.76,92.74,44.5),
|
||||
ang = Angle(0,90,0),
|
||||
colorB = 200,
|
||||
colorA = 150,
|
||||
shadows = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function ENT:OnSetupDataTables()
|
||||
self:AddDT( "Entity", "GunnerSeat" )
|
||||
end
|
||||
|
||||
function ENT:InitWeapons()
|
||||
local COLOR_WHITE = Color(255,255,255,255)
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/mg.png")
|
||||
weapon.Ammo = 1000
|
||||
weapon.Delay = 0.1
|
||||
weapon.HeatRateUp = 0.2
|
||||
weapon.HeatRateDown = 0.25
|
||||
weapon.Attack = function( ent )
|
||||
local ID = ent:LookupAttachment( "muzzle_mg" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return end
|
||||
|
||||
local bullet = {}
|
||||
bullet.Src = Muzzle.Pos
|
||||
bullet.Dir = Muzzle.Ang:Forward()
|
||||
bullet.Spread = Vector(0.01,0.01,0.01)
|
||||
bullet.TracerName = "lvs_tracer_yellow_small"
|
||||
bullet.Force = 10
|
||||
bullet.EnableBallistics = true
|
||||
bullet.HullSize = 0
|
||||
bullet.Damage = 25
|
||||
bullet.Velocity = 15000
|
||||
bullet.Attacker = ent:GetDriver()
|
||||
ent:LVSFireBullet( bullet )
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( bullet.Src )
|
||||
effectdata:SetNormal( bullet.Dir )
|
||||
effectdata:SetEntity( ent )
|
||||
util.Effect( "lvs_muzzle", effectdata )
|
||||
|
||||
ent:TakeAmmo( 1 )
|
||||
end
|
||||
weapon.StartAttack = function( ent )
|
||||
if not IsValid( ent.SNDTurretMG ) then return end
|
||||
ent.SNDTurretMG:Play()
|
||||
end
|
||||
weapon.FinishAttack = function( ent )
|
||||
if not IsValid( ent.SNDTurretMG ) then return end
|
||||
ent.SNDTurretMG:Stop()
|
||||
end
|
||||
weapon.OnOverheat = function( ent ) ent:EmitSound("lvs/overheat.wav") end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local ID = ent:LookupAttachment( "muzzle_mg" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
local traceTurret = util.TraceLine( {
|
||||
start = Muzzle.Pos,
|
||||
endpos = Muzzle.Pos + Muzzle.Ang:Forward() * 50000,
|
||||
filter = ent:GetCrosshairFilterEnts()
|
||||
} )
|
||||
|
||||
local MuzzlePos2D = traceTurret.HitPos:ToScreen()
|
||||
|
||||
ent:PaintCrosshairCenter( MuzzlePos2D, COLOR_WHITE )
|
||||
ent:LVSPaintHitMarker( MuzzlePos2D )
|
||||
end
|
||||
end
|
||||
weapon.OnOverheat = function( ent )
|
||||
ent:EmitSound("lvs/overheat.wav")
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/bullet_ap.png")
|
||||
weapon.Ammo = 250
|
||||
weapon.Delay = 0.25
|
||||
weapon.HeatRateUp = 0.2
|
||||
weapon.HeatRateDown = 0.2
|
||||
weapon.Attack = function( ent )
|
||||
local ID = ent:LookupAttachment( "muzzle_turret" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return end
|
||||
|
||||
local bullet = {}
|
||||
bullet.Src = Muzzle.Pos
|
||||
bullet.Dir = Muzzle.Ang:Forward()
|
||||
bullet.Spread = Vector(0.01,0.01,0.01)
|
||||
bullet.TracerName = "lvs_tracer_autocannon"
|
||||
bullet.Force = ent.CannonArmorPenetration
|
||||
bullet.EnableBallistics = true
|
||||
bullet.HullSize = 0
|
||||
bullet.Damage = 100
|
||||
bullet.Velocity = 14000
|
||||
bullet.Attacker = ent:GetDriver()
|
||||
ent:LVSFireBullet( bullet )
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( bullet.Src )
|
||||
effectdata:SetNormal( bullet.Dir )
|
||||
effectdata:SetEntity( ent )
|
||||
util.Effect( "lvs_muzzle", effectdata )
|
||||
|
||||
ent:PlayAnimation( "turret_fire" )
|
||||
|
||||
local PhysObj = ent:GetPhysicsObject()
|
||||
if IsValid( PhysObj ) then
|
||||
PhysObj:ApplyForceOffset( -bullet.Dir * 10000, bullet.Src )
|
||||
end
|
||||
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
if not IsValid( ent.SNDTurret ) then return end
|
||||
|
||||
ent.SNDTurret:PlayOnce( 100 + math.cos( CurTime() + ent:EntIndex() * 1337 ) * 5 + math.Rand(-1,1), 1 )
|
||||
end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local ID = ent:LookupAttachment( "muzzle_turret" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
local traceTurret = util.TraceLine( {
|
||||
start = Muzzle.Pos,
|
||||
endpos = Muzzle.Pos + Muzzle.Ang:Forward() * 50000,
|
||||
filter = ent:GetCrosshairFilterEnts()
|
||||
} )
|
||||
|
||||
local MuzzlePos2D = traceTurret.HitPos:ToScreen()
|
||||
|
||||
ent:PaintCrosshairOuter( MuzzlePos2D, COLOR_WHITE )
|
||||
ent:LVSPaintHitMarker( MuzzlePos2D )
|
||||
end
|
||||
end
|
||||
weapon.OnOverheat = function( ent )
|
||||
ent:EmitSound("lvs/vehicles/222/cannon_overheat.wav")
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/tank_noturret.png")
|
||||
weapon.Ammo = -1
|
||||
weapon.Delay = 0
|
||||
weapon.HeatRateUp = 0
|
||||
weapon.HeatRateDown = 0
|
||||
weapon.OnSelect = function( ent )
|
||||
if ent.SetTurretEnabled then
|
||||
ent:SetTurretEnabled( false )
|
||||
end
|
||||
end
|
||||
weapon.OnDeselect = function( ent )
|
||||
if ent.SetTurretEnabled then
|
||||
ent:SetTurretEnabled( true )
|
||||
end
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
end
|
||||
|
||||
|
||||
ENT.ExhaustPositions = {
|
||||
{
|
||||
pos = Vector(-20.98,-56.09,17.55),
|
||||
ang = Angle(90,0,0),
|
||||
},
|
||||
{
|
||||
pos = Vector(20.98,-56.09,17.55),
|
||||
ang = Angle(90,0,0),
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user