add sborka
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
include("shared.lua")
|
||||
include("sh_tracks.lua")
|
||||
include("cl_tankview.lua")
|
||||
|
||||
function ENT:OnSpawn()
|
||||
self:CreateBonePoseParameter( "hatch1", 59, Angle(0,0,0), Angle(0,60,0), Vector(0,0,0), Vector(0,0,0) )
|
||||
self:CreateBonePoseParameter( "hatch2", 60, Angle(0,0,0), Angle(0,60,0), Vector(0,0,0), Vector(0,0,0) )
|
||||
end
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/cl_tankview.lua")
|
||||
|
||||
function ENT:TankViewOverride( ply, pos, angles, fov, pod )
|
||||
if pod == self:GetFrontGunnerSeat() and not pod:GetThirdPersonMode() then
|
||||
local ID = self:LookupAttachment( "f_eye" )
|
||||
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
pos = Muzzle.Pos
|
||||
end
|
||||
end
|
||||
|
||||
if pod == self:GetRearGunnerSeat() and not pod:GetThirdPersonMode() then
|
||||
local ID = self:LookupAttachment( "r_eye" )
|
||||
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
pos = Muzzle.Pos
|
||||
end
|
||||
end
|
||||
|
||||
return pos, angles, fov
|
||||
end
|
||||
@@ -0,0 +1,97 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
AddCSLuaFile( "sh_tracks.lua" )
|
||||
AddCSLuaFile( "cl_tankview.lua" )
|
||||
include("shared.lua")
|
||||
include("sh_tracks.lua")
|
||||
|
||||
-- since this is based on a tank we need to reset these to default var values:
|
||||
ENT.DSArmorDamageReductionType = DMG_BULLET + DMG_CLUB
|
||||
ENT.DSArmorIgnoreDamageType = DMG_SONIC
|
||||
|
||||
|
||||
function ENT:OnSpawn( PObj )
|
||||
|
||||
local ID = self:LookupAttachment( "f_muzzle" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurretMGf = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/sdkfz250/mg_loop.wav" )
|
||||
self.SNDTurretMGf:SetSoundLevel( 95 )
|
||||
self.SNDTurretMGf:SetParent( self, ID )
|
||||
|
||||
local ID = self:LookupAttachment( "r_muzzle" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurretMGt = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/sdkfz250/mg_loop.wav" )
|
||||
self.SNDTurretMGt:SetSoundLevel( 95 )
|
||||
self.SNDTurretMGt:SetParent( self, ID )
|
||||
|
||||
local DriverSeat = self:AddDriverSeat( Vector(-10,16,15), Angle(0,-90,0) )
|
||||
local GunnerSeat = self:AddPassengerSeat( Vector(-30,0,25), Angle(0,-90,0) )
|
||||
local TopGunnerSeat = self:AddPassengerSeat( Vector(-35,0,23), Angle(0,90,0) )
|
||||
local PassengerSeat = self:AddPassengerSeat( Vector(0,-16,22), Angle(0,-90,10) )
|
||||
local PassengerSeat = self:AddPassengerSeat( Vector(-43,-14,24), Angle(0,-90,10) )
|
||||
local PassengerSeat = self:AddPassengerSeat( Vector(-50,14,32), Angle(0,180,0) )
|
||||
local PassengerSeat = self:AddPassengerSeat( Vector(-35,14,32), Angle(0,180,0) )
|
||||
local PassengerSeat = self:AddPassengerSeat( Vector(-20,14,32), Angle(0,180,0) )
|
||||
|
||||
self:SetFrontGunnerSeat( GunnerSeat )
|
||||
self:SetRearGunnerSeat( TopGunnerSeat )
|
||||
|
||||
local DoorHandler = self:AddDoorHandler( "trunk", Vector(-81.17,11.74,44.44), Angle(19,0,0), Vector(-1,-15,-15), Vector(1,15,15), Vector(-30,-15,-15), Vector(1,15,15) )
|
||||
DoorHandler:SetSoundOpen( "lvs/vehicles/generic/car_hood_open.wav" )
|
||||
DoorHandler:SetSoundClose( "lvs/vehicles/generic/car_hood_close.wav" )
|
||||
DoorHandler:LinkToSeat( DriverSeat )
|
||||
|
||||
local DoorHandler = self:AddDoorHandler( "hatch", Vector(53.89,0.17,47.28), Angle(-80,0,0), Vector(-1,-15,-15), Vector(1,15,15), Vector(-30,-15,-15), Vector(1,15,15) )
|
||||
DoorHandler:SetSoundOpen( "lvs/vehicles/generic/car_hood_open.wav" )
|
||||
DoorHandler:SetSoundClose( "lvs/vehicles/generic/car_hood_close.wav" )
|
||||
|
||||
local Engine = self:AddEngine( Vector(50,0,45) )
|
||||
Engine:SetDoorHandler( DoorHandler )
|
||||
|
||||
local DoorHandler = self:AddDoorHandler( "!hatch1", Vector(9.55,13.84,55.75), Angle(0,0,0), Vector(-3,-10,-3), Vector(3,10,3), Vector(-3,-10,-3), Vector(3,10,3) )
|
||||
DoorHandler:SetSoundOpen( "lvs/vehicles/generic/car_hood_open.wav" )
|
||||
DoorHandler:SetSoundClose( "lvs/vehicles/generic/car_hood_close.wav" )
|
||||
|
||||
local DoorHandler = self:AddDoorHandler( "!hatch2", Vector(9.55,-13.84,55.75), Angle(0,0,0), Vector(-3,-10,-3), Vector(3,10,3), Vector(-3,-10,-3), Vector(3,10,3) )
|
||||
DoorHandler:SetSoundOpen( "lvs/vehicles/generic/car_hood_open.wav" )
|
||||
DoorHandler:SetSoundClose( "lvs/vehicles/generic/car_hood_close.wav" )
|
||||
|
||||
self:AddFuelTank( Vector(55,0,18), Angle(0,0,0), 600, LVS.FUELTYPE_DIESEL )
|
||||
|
||||
self.SNDTurretMG = self:AddSoundEmitter( Vector(-63,0,85), "lvs/vehicles/halftrack/mc_loop.wav" )
|
||||
self.SNDTurretMG:SetSoundLevel( 95 )
|
||||
|
||||
local WheelModel = "models/diggercars/sdkfz250/250_wheel.mdl"
|
||||
|
||||
local FLWheel = self:AddWheel( { pos = Vector(67,32,16.5), mdl = WheelModel, mdl_ang = Angle(0,0,0), width = 2 } )
|
||||
local FRWheel = self:AddWheel( { pos = Vector(67,-32,16.5), mdl = WheelModel, mdl_ang = Angle(0,180,0), width = 2} )
|
||||
|
||||
self:CreateRigControler( "fl", FLWheel, 10, 17.7 )
|
||||
self:CreateRigControler( "fr", FRWheel, 10, 17.7 )
|
||||
|
||||
local FrontAxle = self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,0,0),
|
||||
SteerType = LVS.WHEEL_STEER_FRONT,
|
||||
SteerAngle = 30,
|
||||
TorqueFactor = 0.5,
|
||||
BrakeFactor = 1,
|
||||
},
|
||||
Wheels = { FLWheel, FRWheel },
|
||||
Suspension = {
|
||||
Height = 10,
|
||||
MaxTravel = 7,
|
||||
ControlArmLength = 25,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 2000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
self:AddTrailerHitch( Vector(-92.9,-0.04,23.19), LVS.HITCHTYPE_MALE )
|
||||
end
|
||||
|
||||
function ENT:OnEngineActiveChanged( Active )
|
||||
if Active then
|
||||
self:EmitSound( "lvs/vehicles/sdkfz250/engine_start.wav" )
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
if SERVER then
|
||||
function ENT:OnLeftTrackRepaired()
|
||||
self:SetBodygroup(1,0)
|
||||
end
|
||||
|
||||
function ENT:OnLeftTrackDestroyed()
|
||||
self:SetBodygroup(1,1)
|
||||
end
|
||||
|
||||
function ENT:OnRightTrackRepaired()
|
||||
self:SetBodygroup(2,0)
|
||||
end
|
||||
|
||||
function ENT:OnRightTrackDestroyed()
|
||||
self:SetBodygroup(2,1)
|
||||
end
|
||||
|
||||
function ENT:TracksCreate( PObj )
|
||||
local WheelModel = "models/diggercars/sdkfz250/250_wheel.mdl"
|
||||
|
||||
local L1 = self:AddWheel( { hide = true, pos = Vector(-0,32,20), mdl = WheelModel } )
|
||||
local L2 = self:AddWheel( { hide = true, pos = Vector(-30,32,20), mdl = WheelModel } )
|
||||
local L3 = self:AddWheel( { hide = true, pos = Vector(-60,32,20), mdl = WheelModel } )
|
||||
local LeftWheelChain = self:CreateWheelChain( {L1, L2, L3} )
|
||||
self:SetTrackDriveWheelLeft( L1 )
|
||||
|
||||
local R1 = self:AddWheel( { hide = true, pos = Vector(-0,-32,20), mdl = WheelModel, mdl_ang = Angle(0,180,0) } )
|
||||
local R2 = self:AddWheel( { hide = true, pos = Vector(-30,-32,20), mdl = WheelModel, mdl_ang = Angle(0,180,0) } )
|
||||
local R3 = self:AddWheel( { hide = true, pos = Vector(-60,-32,20), mdl = WheelModel, mdl_ang = Angle(0,180,0) } )
|
||||
local RightWheelChain = self:CreateWheelChain( {R1, R2, R3} )
|
||||
self:SetTrackDriveWheelRight( R1 )
|
||||
|
||||
local LeftTracksArmor = self:AddArmor( Vector(-25,30,20), Angle(0,0,0), Vector(-50,-10,-15), Vector(50,10,15), 200, 0 )
|
||||
self:SetTrackArmorLeft( LeftTracksArmor, LeftWheelChain )
|
||||
|
||||
local RightTracksArmor = self:AddArmor( Vector(-25,-30,20), Angle(0,0,0), Vector(-50,-10,-15), Vector(50,10,15), 200, 0 )
|
||||
self:SetTrackArmorRight( RightTracksArmor, RightWheelChain )
|
||||
|
||||
self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,0,0),
|
||||
SteerType = LVS.WHEEL_STEER_NONE,
|
||||
TorqueFactor = 0.5,
|
||||
BrakeFactor = 1,
|
||||
UseHandbrake = true,
|
||||
},
|
||||
Wheels = { R1, L1, L2, R2, R3, L3 },
|
||||
Suspension = {
|
||||
Height = 10,
|
||||
MaxTravel = 7,
|
||||
ControlArmLength = 25,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 2000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
end
|
||||
else
|
||||
ENT.TrackSystemEnable = true
|
||||
|
||||
ENT.TrackScrollTexture = "models/diggercars/sdkfz250/tracks"
|
||||
ENT.ScrollTextureData = {
|
||||
["$bumpmap"] = "models/diggercars/shared/skin_nm",
|
||||
["$phong"] = "1",
|
||||
["$phongboost"] = "0.04",
|
||||
["$phongexponent"] = "3",
|
||||
["$phongfresnelranges"] = "[1 1 1]",
|
||||
["$translate"] = "[0.0 0.0 0.0]",
|
||||
["$colorfix"] = "{255 255 255}",
|
||||
["Proxies"] = {
|
||||
["TextureTransform"] = {
|
||||
["translateVar"] = "$translate",
|
||||
["centerVar"] = "$center",
|
||||
["resultVar"] = "$basetexturetransform",
|
||||
},
|
||||
["Equals"] = {
|
||||
["srcVar1"] = "$colorfix",
|
||||
["resultVar"] = "$color",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENT.TrackLeftSubMaterialID = 4
|
||||
ENT.TrackLeftSubMaterialMul = Vector(0,0.0325,0)
|
||||
|
||||
ENT.TrackRightSubMaterialID = 5
|
||||
ENT.TrackRightSubMaterialMul = Vector(0,0.0325,0)
|
||||
|
||||
ENT.TrackPoseParameterLeft = "spin_wheels_left"
|
||||
ENT.TrackPoseParameterLeftMul = -1.8
|
||||
|
||||
ENT.TrackPoseParameterRight = "spin_wheels_right"
|
||||
ENT.TrackPoseParameterRightMul = -1.8
|
||||
|
||||
ENT.TrackSounds = "lvs/vehicles/halftrack/tracks_loop.wav"
|
||||
ENT.TrackHull = Vector(5,5,5)
|
||||
ENT.TrackData = {}
|
||||
|
||||
for i = 1, 4 do
|
||||
for n = 0, 1 do
|
||||
local LR = n == 0 and "l" or "r"
|
||||
local LeftRight = n == 0 and "left" or "right"
|
||||
local data = {
|
||||
Attachment = {
|
||||
name = "vehicle_suspension_"..LR.."_"..i,
|
||||
toGroundDistance = 29,
|
||||
traceLength = 150,
|
||||
},
|
||||
PoseParameter = {
|
||||
name = "suspension_"..LeftRight.."_"..i,
|
||||
rangeMultiplier = -1.25,
|
||||
lerpSpeed = 25,
|
||||
}
|
||||
}
|
||||
table.insert( ENT.TrackData, data )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,397 @@
|
||||
|
||||
ENT.Base = "lvs_tank_wheeldrive"
|
||||
|
||||
ENT.PrintName = "Schuetzenpanzerwagen"
|
||||
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/sdkfz250/2501.mdl"
|
||||
ENT.MDL_DESTROYED = "models/diggercars/sdkfz250/250_dead.mdl"
|
||||
|
||||
ENT.AITEAM = 1
|
||||
|
||||
ENT.DSArmorIgnoreForce = 1000
|
||||
|
||||
ENT.MaxHealth = 650
|
||||
ENT.MaxHealthEngine = 400
|
||||
ENT.MaxHealthFuelTank = 100
|
||||
|
||||
--damage system
|
||||
ENT.CannonArmorPenetration = 2700
|
||||
|
||||
ENT.MaxVelocity = 700
|
||||
ENT.MaxVelocityReverse = 250
|
||||
|
||||
ENT.EngineCurve = 0.7
|
||||
ENT.EngineTorque = 100
|
||||
|
||||
ENT.PhysicsWeightScale = 1.5
|
||||
ENT.PhysicsInertia = Vector(2500,2500,850)
|
||||
|
||||
ENT.TransGears = 3
|
||||
ENT.TransGearsReverse = 1
|
||||
|
||||
ENT.lvsShowInSpawner = true
|
||||
|
||||
ENT.HornSound = "lvs/horn1.wav"
|
||||
ENT.HornPos = Vector(70,0,40)
|
||||
|
||||
ENT.EngineSounds = {
|
||||
{
|
||||
sound = "lvs/vehicles/sdkfz250/eng_idle_loop.wav",
|
||||
Volume = 0.5,
|
||||
Pitch = 85,
|
||||
PitchMul = 25,
|
||||
SoundLevel = 75,
|
||||
SoundType = LVS.SOUNDTYPE_IDLE_ONLY,
|
||||
},
|
||||
{
|
||||
sound = "lvs/vehicles/sdkfz250/eng_loop.wav",
|
||||
Volume = 1,
|
||||
Pitch = 20,
|
||||
PitchMul = 100,
|
||||
SoundLevel = 85,
|
||||
SoundType = LVS.SOUNDTYPE_REV_UP,
|
||||
UseDoppler = true,
|
||||
},
|
||||
{
|
||||
sound = "lvs/vehicles/sdkfz250/eng_revdown_loop.wav",
|
||||
Volume = 1,
|
||||
Pitch = 20,
|
||||
PitchMul = 100,
|
||||
SoundLevel = 75,
|
||||
SoundType = LVS.SOUNDTYPE_REV_DOWN,
|
||||
UseDoppler = true,
|
||||
},
|
||||
}
|
||||
|
||||
ENT.ExhaustPositions = {
|
||||
{
|
||||
pos = Vector(35.31,39.22,26.35),
|
||||
ang = Angle(0,90,0),
|
||||
},
|
||||
}
|
||||
|
||||
function ENT:OnSetupDataTables()
|
||||
self:AddDT( "Entity", "FrontGunnerSeat" )
|
||||
self:AddDT( "Entity", "RearGunnerSeat" )
|
||||
self:AddDT( "Bool", "UseHighExplosive" )
|
||||
end
|
||||
|
||||
function ENT:InitWeapons()
|
||||
self:AddGunnerWeapons()
|
||||
self:AddTopGunnerWeapons()
|
||||
end
|
||||
|
||||
|
||||
function ENT:GunnerInRange( Dir )
|
||||
return self:AngleBetweenNormal( self:GetForward(), Dir ) < 35
|
||||
end
|
||||
|
||||
function ENT:AddGunnerWeapons()
|
||||
local COLOR_RED = Color(255,0,0,255)
|
||||
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 base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
if not base:GunnerInRange( ent:GetAimVector() ) then
|
||||
|
||||
if not IsValid( base.SNDTurretMGf ) then return true end
|
||||
|
||||
base.SNDTurretMGf:Stop()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local ID = base:LookupAttachment( "f_muzzle" )
|
||||
|
||||
local Muzzle = base:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return end
|
||||
|
||||
local bullet = {}
|
||||
bullet.Src = Muzzle.Pos
|
||||
bullet.Dir = (ent:GetEyeTrace().HitPos - bullet.Src):GetNormalized()
|
||||
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( Muzzle.Ang:Forward() )
|
||||
effectdata:SetEntity( ent )
|
||||
util.Effect( "lvs_muzzle", effectdata )
|
||||
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
base:PlayAnimation( "shot_f" )
|
||||
|
||||
if not IsValid( base.SNDTurretMGf ) then return end
|
||||
|
||||
base.SNDTurretMGf:Play()
|
||||
end
|
||||
weapon.StartAttack = function( ent )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) or not IsValid( base.SNDTurretMGf ) then return end
|
||||
|
||||
base.SNDTurretMGf:Play()
|
||||
end
|
||||
weapon.FinishAttack = function( ent )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) or not IsValid( base.SNDTurretMGf ) then return end
|
||||
|
||||
base.SNDTurretMGf:Stop()
|
||||
end
|
||||
weapon.OnThink = function( ent, active )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
if not ent:GetAI() and not IsValid( ent:GetDriver() ) then
|
||||
base:SetPoseParameter("f_pitch", 15 )
|
||||
base:SetPoseParameter("f_yaw", 0 )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local Angles = base:WorldToLocalAngles( ent:GetAimVector():Angle() )
|
||||
Angles:Normalize()
|
||||
|
||||
base:SetPoseParameter("f_yaw", -Angles.y )
|
||||
base:SetPoseParameter("f_pitch", -Angles.p )
|
||||
end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
local Pos2D = ent:GetEyeTrace().HitPos:ToScreen()
|
||||
|
||||
local Col = base:GunnerInRange( ent:GetAimVector() ) and COLOR_WHITE or COLOR_RED
|
||||
|
||||
base:PaintCrosshairCenter( Pos2D, Col )
|
||||
base:LVSPaintHitMarker( Pos2D )
|
||||
end
|
||||
weapon.OnOverheat = function( ent )
|
||||
ent:EmitSound("lvs/overheat.wav")
|
||||
end
|
||||
self:AddWeapon( weapon, 2 )
|
||||
end
|
||||
|
||||
function ENT:TopGunnerInRange( ent )
|
||||
local AimPos = ent:GetEyeTrace().HitPos
|
||||
local AimAng = (AimPos - self:LocalToWorld( Vector(-72.27,0.06,66.07) )):Angle()
|
||||
|
||||
local _, Ang = WorldToLocal( AimPos, AimAng, Vector(-72.27,0,66), self:LocalToWorldAngles( Angle(0,180,0) ) )
|
||||
|
||||
return math.abs( Ang.y ) < 35 and Ang.p < 10 and Ang.p > -80
|
||||
end
|
||||
|
||||
function ENT:AddTopGunnerWeapons()
|
||||
local COLOR_RED = Color(255,0,0,255)
|
||||
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 base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
if not base:TopGunnerInRange( ent ) then
|
||||
|
||||
if not IsValid( base.SNDTurretMGt ) then return true end
|
||||
|
||||
base.SNDTurretMGt:Stop()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local ID = base:LookupAttachment( "r_muzzle" )
|
||||
|
||||
local Muzzle = base:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return end
|
||||
|
||||
local bullet = {}
|
||||
bullet.Src = Muzzle.Pos
|
||||
bullet.Dir = (ent:GetEyeTrace().HitPos - bullet.Src):GetNormalized()
|
||||
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( Muzzle.Ang:Forward() )
|
||||
effectdata:SetEntity( ent )
|
||||
util.Effect( "lvs_muzzle", effectdata )
|
||||
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
base:PlayAnimation( "shot_r" )
|
||||
|
||||
if not IsValid( base.SNDTurretMGt ) then return end
|
||||
|
||||
base.SNDTurretMGt:Play()
|
||||
end
|
||||
weapon.StartAttack = function( ent )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) or not IsValid( base.SNDTurretMGt ) then return end
|
||||
|
||||
base.SNDTurretMGt:Play()
|
||||
end
|
||||
weapon.FinishAttack = function( ent )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) or not IsValid( base.SNDTurretMGt ) then return end
|
||||
|
||||
base.SNDTurretMGt:Stop()
|
||||
end
|
||||
weapon.OnThink = function( ent, active )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
if not ent:GetAI() and not IsValid( ent:GetDriver() ) then
|
||||
base:SetPoseParameter("r_pitch", 80 )
|
||||
base:SetPoseParameter("r_yaw", 0 )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local AimPos = ent:GetEyeTrace().HitPos
|
||||
local AimAng = (AimPos - base:LocalToWorld( Vector(-72.27,0.06,66.07) )):Angle()
|
||||
|
||||
local Pos, Ang = WorldToLocal( AimPos, AimAng, Vector(-72.27,0,66), base:LocalToWorldAngles( Angle(0,180,0) ) )
|
||||
|
||||
base:SetPoseParameter("r_pitch", -Ang.p )
|
||||
base:SetPoseParameter("r_yaw", -Ang.y )
|
||||
end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local base = ent:GetVehicle()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
local Pos2D = ent:GetEyeTrace().HitPos:ToScreen()
|
||||
|
||||
local Col = base:TopGunnerInRange( ent ) and COLOR_WHITE or COLOR_RED
|
||||
|
||||
base:PaintCrosshairCenter( Pos2D, Col )
|
||||
base:LVSPaintHitMarker( Pos2D )
|
||||
end
|
||||
weapon.OnOverheat = function( ent )
|
||||
ent:EmitSound("lvs/overheat.wav")
|
||||
end
|
||||
self:AddWeapon( weapon, 3 )
|
||||
end
|
||||
|
||||
|
||||
function ENT:CalcMainActivityPassenger( ply )
|
||||
local FrontGunnerSeat = self:GetFrontGunnerSeat()
|
||||
local RearGunnerSeat = self:GetRearGunnerSeat()
|
||||
|
||||
if not IsValid( FrontGunnerSeat ) or not IsValid( RearGunnerSeat ) then return end
|
||||
|
||||
if FrontGunnerSeat:GetDriver() ~= ply and RearGunnerSeat:GetDriver() ~= ply then return end
|
||||
|
||||
if ply.m_bWasNoclipping then
|
||||
ply.m_bWasNoclipping = nil
|
||||
ply:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
|
||||
|
||||
if CLIENT then
|
||||
ply:SetIK( true )
|
||||
end
|
||||
end
|
||||
|
||||
ply.CalcIdeal = ACT_STAND
|
||||
ply.CalcSeqOverride = ply:LookupSequence( "cwalk_revolver" )
|
||||
|
||||
return ply.CalcIdeal, ply.CalcSeqOverride
|
||||
end
|
||||
|
||||
function ENT:UpdateAnimation( ply, velocity, maxseqgroundspeed )
|
||||
ply:SetPlaybackRate( 1 )
|
||||
|
||||
if CLIENT then
|
||||
local FrontGunnerSeat = self:GetFrontGunnerSeat()
|
||||
local RearGunnerSeat = self:GetRearGunnerSeat()
|
||||
|
||||
if ply == self:GetDriver() then
|
||||
ply:SetPoseParameter( "vehicle_steer", self:GetSteer() / self:GetMaxSteerAngle() )
|
||||
ply:InvalidateBoneCache()
|
||||
end
|
||||
|
||||
if IsValid( FrontGunnerSeat ) and FrontGunnerSeat:GetDriver() == ply then
|
||||
local Pitch = math.Remap( self:GetPoseParameter( "f_pitch" ),0,1,-15,15)
|
||||
local Yaw = math.Remap( self:GetPoseParameter( "f_yaw" ),0,1,-35,35)
|
||||
|
||||
ply:SetPoseParameter( "aim_pitch", Pitch * 1.5 )
|
||||
ply:SetPoseParameter( "aim_yaw", Yaw * 1.5 )
|
||||
|
||||
ply:SetPoseParameter( "head_pitch", -Pitch * 2 )
|
||||
ply:SetPoseParameter( "head_yaw", -Yaw * 3 )
|
||||
|
||||
ply:SetPoseParameter( "move_x", 0 )
|
||||
ply:SetPoseParameter( "move_y", 0 )
|
||||
|
||||
ply:InvalidateBoneCache()
|
||||
end
|
||||
|
||||
if IsValid( RearGunnerSeat ) and RearGunnerSeat:GetDriver() == ply then
|
||||
local Pitch = math.Remap( self:GetPoseParameter( "r_pitch" ),0,1,-15,15)
|
||||
local Yaw = math.Remap( self:GetPoseParameter( "r_yaw" ),0,1,-35,35)
|
||||
|
||||
ply:SetPoseParameter( "aim_pitch", Pitch * 3 - 10 )
|
||||
ply:SetPoseParameter( "aim_yaw", Yaw * 1.5 )
|
||||
|
||||
ply:SetPoseParameter( "head_pitch", -Pitch * 2 )
|
||||
ply:SetPoseParameter( "head_yaw", -Yaw * 3 )
|
||||
|
||||
ply:SetPoseParameter( "move_x", 0 )
|
||||
ply:SetPoseParameter( "move_y", 0 )
|
||||
|
||||
ply:InvalidateBoneCache()
|
||||
end
|
||||
|
||||
GAMEMODE:GrabEarAnimation( ply )
|
||||
GAMEMODE:MouthMoveAnimation( ply )
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user