add sborka
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
include("shared.lua")
|
||||
include("sh_tracks.lua")
|
||||
include("sh_turret.lua")
|
||||
include("cl_optics.lua")
|
||||
include("cl_tankview.lua")
|
||||
|
||||
local switch = Material("lvs/weapons/change_ammo.png")
|
||||
local AP = Material("lvs/weapons/bullet_ap.png")
|
||||
local HE = Material("lvs/weapons/tank_cannon.png")
|
||||
function ENT:DrawWeaponIcon( PodID, ID, x, y, width, height, IsSelected, IconColor )
|
||||
local Icon = self:GetUseHighExplosive() and HE or AP
|
||||
|
||||
surface.SetMaterial( Icon )
|
||||
surface.DrawTexturedRect( x, y, width, height )
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not IsValid( ply ) or self:GetSelectedWeapon() ~= 2 then return end
|
||||
|
||||
surface.SetMaterial( switch )
|
||||
surface.DrawTexturedRect( x + width + 5, y + 7, 24, 24 )
|
||||
|
||||
local buttonCode = ply:lvsGetControls()[ "CAR_SWAP_AMMO" ]
|
||||
|
||||
if not buttonCode then return end
|
||||
|
||||
local KeyName = input.GetKeyName( buttonCode )
|
||||
|
||||
if not KeyName then return end
|
||||
|
||||
draw.DrawText( KeyName, "DermaDefault", x + width + 17, y + height * 0.5 + 7, Color(0,0,0,IconColor.a), TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
|
||||
function ENT:OnEngineActiveChanged( Active )
|
||||
if Active then
|
||||
self:EmitSound( "lvs/vehicles/tiger/engine_start.wav", 75, 100, LVS.EngineVolume )
|
||||
else
|
||||
self:EmitSound( "lvs/vehicles/tiger/engine_stop.wav", 75, 100, LVS.EngineVolume )
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
ENT.OpticsFov = 30
|
||||
ENT.OpticsEnable = true
|
||||
ENT.OpticsZoomOnly = true
|
||||
ENT.OpticsFirstPerson = true
|
||||
ENT.OpticsThirdPerson = false
|
||||
ENT.OpticsPodIndex = {
|
||||
[1] = true,
|
||||
}
|
||||
|
||||
ENT.OpticsCrosshairMaterial = Material( "lvs/circle_filled.png" )
|
||||
ENT.OpticsCrosshairColor = Color(0,0,0,150)
|
||||
ENT.OpticsCrosshairSize = 4
|
||||
|
||||
ENT.OpticsProjectileSize = 7.5
|
||||
|
||||
local OldTargetOffset = 0
|
||||
local RotationOffset = 0
|
||||
local circle = Material( "lvs/circle_hollow.png" )
|
||||
local tri1 = Material( "lvs/triangle1.png" )
|
||||
local tri2 = Material( "lvs/triangle2.png" )
|
||||
local pointer = Material( "gui/point.png" )
|
||||
local scope = Material( "lvs/scope_viewblocked.png" )
|
||||
|
||||
function ENT:PaintOpticsCrosshair( Pos2D )
|
||||
surface.SetDrawColor( 255, 255, 255, 5 )
|
||||
surface.SetMaterial( tri1 )
|
||||
surface.DrawTexturedRect( Pos2D.x - 17, Pos2D.y - 1, 32, 32 )
|
||||
surface.SetDrawColor( 0, 0, 0, 255 )
|
||||
surface.DrawTexturedRect( Pos2D.x - 16, Pos2D.y, 32, 32 )
|
||||
|
||||
for i = -3, 3, 1 do
|
||||
if i == 0 then continue end
|
||||
|
||||
surface.SetMaterial( tri2 )
|
||||
surface.SetDrawColor( 255, 255, 255, 5 )
|
||||
surface.DrawTexturedRect( Pos2D.x - 11 + i * 32, Pos2D.y - 1, 20, 20 )
|
||||
surface.SetDrawColor( 0, 0, 0, 255 )
|
||||
surface.DrawTexturedRect( Pos2D.x - 10 + i * 32, Pos2D.y, 20, 20 )
|
||||
end
|
||||
|
||||
local ScrH = ScrH()
|
||||
|
||||
local Y = Pos2D.y + 64
|
||||
local height = ScrH - Y
|
||||
|
||||
surface.SetDrawColor( 0, 0, 0, 100 )
|
||||
surface.DrawRect( Pos2D.x - 2, Y, 4, height )
|
||||
end
|
||||
|
||||
function ENT:PaintOptics( Pos2D, Col, PodIndex, Type )
|
||||
|
||||
if Type == 1 then
|
||||
self:DrawRotatedText( "MG", Pos2D.x + 30, Pos2D.y + 30, "LVS_FONT_PANEL", Color(0,0,0,220), 0)
|
||||
else
|
||||
self:DrawRotatedText( Type == 3 and "HE" or "AP", Pos2D.x + 30, Pos2D.y + 30, "LVS_FONT_PANEL", Color(0,0,0,220), 0)
|
||||
end
|
||||
|
||||
local size = self.OpticsCrosshairSize
|
||||
|
||||
surface.SetMaterial( self.OpticsCrosshairMaterial )
|
||||
surface.SetDrawColor( self.OpticsCrosshairColor )
|
||||
surface.DrawTexturedRect( Pos2D.x - size * 0.5, Pos2D.y - size * 0.5, size, size )
|
||||
|
||||
local ScrW = ScrW()
|
||||
local ScrH = ScrH()
|
||||
|
||||
surface.SetDrawColor( 0, 0, 0, 200 )
|
||||
|
||||
local TargetOffset = self:GetSelectedWeapon() == 1 and 150 or 0
|
||||
|
||||
if OldTargetOffset ~= TargetOffset then
|
||||
OldTargetOffset = TargetOffset
|
||||
surface.PlaySound( "lvs/optics.wav" )
|
||||
end
|
||||
|
||||
RotationOffset = RotationOffset + (TargetOffset + math.max( self:GetTurretCompensation() / 15, -130 ) - RotationOffset) * RealFrameTime() * 8
|
||||
|
||||
local R = ScrH * 0.5 - 64
|
||||
local R0 = R + 30
|
||||
local R1 = R - 8
|
||||
local R2 = R - 23
|
||||
local R3 = R - 30
|
||||
local R4 = R - 18
|
||||
|
||||
for i = 0, 40 do
|
||||
local ang = -90 + (180 / 40) * i + RotationOffset
|
||||
|
||||
local x = math.cos( math.rad( ang ) )
|
||||
local y = math.sin( math.rad( ang ) )
|
||||
|
||||
if i == 2 then
|
||||
self:DrawRotatedText( self.OpticsProjectileSize, Pos2D.x + x * R0, Pos2D.y + y * R0, "LVS_FONT", Color(0,0,0,200), 90 + ang)
|
||||
end
|
||||
if i == 3 then
|
||||
self:DrawRotatedText( "cm", Pos2D.x + x * R0, Pos2D.y + y * R0, "LVS_FONT", Color(0,0,0,200), 90 + ang)
|
||||
end
|
||||
if i == 5 then
|
||||
self:DrawRotatedText( "Pzgr", Pos2D.x + x * R0, Pos2D.y + y * R0, "LVS_FONT", Color(0,0,0,200), 90 + ang)
|
||||
end
|
||||
|
||||
surface.SetMaterial( circle )
|
||||
surface.DrawTexturedRectRotated( Pos2D.x + x * R, Pos2D.y + y * R, 16, 16, 0 )
|
||||
|
||||
surface.DrawLine( Pos2D.x + x * R1, Pos2D.y + y * R1, Pos2D.x + x * R2, Pos2D.y + y * R2 )
|
||||
|
||||
self:DrawRotatedText( i, Pos2D.x + x * R3, Pos2D.y + y * R3, "LVS_FONT_PANEL", Color(0,0,0,255), ang + 90)
|
||||
|
||||
if i == 40 then continue end
|
||||
|
||||
local ang = - 90 + (180 / 40) * (i + 0.5) + RotationOffset
|
||||
|
||||
local x = math.cos( math.rad( ang ) )
|
||||
local y = math.sin( math.rad( ang ) )
|
||||
|
||||
surface.DrawLine( Pos2D.x + x * R1, Pos2D.y + y * R1, Pos2D.x + x * R4, Pos2D.y + y * R4 )
|
||||
end
|
||||
|
||||
for i = 0, 13 do
|
||||
local ang = 120 + (120 / 13) * i + RotationOffset
|
||||
|
||||
local x = math.cos( math.rad( ang ) )
|
||||
local y = math.sin( math.rad( ang ) )
|
||||
|
||||
if i == 1 then
|
||||
self:DrawRotatedText( "MG", Pos2D.x + x * R0, Pos2D.y + y * R0, "LVS_FONT", Color(0,0,0,200), 90 + ang)
|
||||
end
|
||||
|
||||
surface.SetMaterial( circle )
|
||||
surface.DrawTexturedRectRotated( Pos2D.x + x * R, Pos2D.y + y * R, 16, 16, 0 )
|
||||
|
||||
surface.DrawLine( Pos2D.x + x * R1, Pos2D.y + y * R1, Pos2D.x + x * R2, Pos2D.y + y * R2 )
|
||||
|
||||
self:DrawRotatedText( i, Pos2D.x + x * R3, Pos2D.y + y * R3, "LVS_FONT_PANEL", Color(0,0,0,255), ang + 90)
|
||||
end
|
||||
|
||||
surface.SetDrawColor( 0, 0, 0, 100 )
|
||||
surface.SetMaterial( pointer )
|
||||
surface.DrawTexturedRect( Pos2D.x - 16, 0, 32, 64 )
|
||||
|
||||
local diameter = ScrH + 64
|
||||
local radius = diameter * 0.5
|
||||
|
||||
surface.SetMaterial( scope )
|
||||
surface.SetDrawColor( 0, 0, 0, 255 )
|
||||
surface.DrawTexturedRect( Pos2D.x - radius, Pos2D.y - radius, diameter, diameter )
|
||||
|
||||
-- black bar left + right
|
||||
surface.DrawRect( 0, 0, Pos2D.x - radius, ScrH )
|
||||
surface.DrawRect( Pos2D.x + radius, 0, Pos2D.x - radius, ScrH )
|
||||
end
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
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 vieworigin, found = self:GetTurretViewOrigin()
|
||||
|
||||
if found then pos = vieworigin end
|
||||
end
|
||||
|
||||
return pos, angles, fov
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
AddCSLuaFile( "sh_tracks.lua" )
|
||||
AddCSLuaFile( "sh_turret.lua" )
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
AddCSLuaFile( "cl_optics.lua" )
|
||||
AddCSLuaFile( "cl_tankview.lua" )
|
||||
include("shared.lua")
|
||||
include("sh_tracks.lua")
|
||||
include("sh_turret.lua")
|
||||
|
||||
function ENT:OnSpawn( PObj )
|
||||
local ID = self:LookupAttachment( "muzzle_machinegun" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurretMGf = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/sherman/mg_loop.wav", "lvs/vehicles/sherman/mg_loop_interior.wav" )
|
||||
self.SNDTurretMGf:SetSoundLevel( 95 )
|
||||
self.SNDTurretMGf:SetParent( self, ID )
|
||||
|
||||
local ID = self:LookupAttachment( "muzzle" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurret = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos ), "lvs/vehicles/tiger/cannon_fire.wav", "lvs/vehicles/tiger/cannon_fire.wav" )
|
||||
self.SNDTurret:SetSoundLevel( 95 )
|
||||
self.SNDTurret:SetParent( self, ID )
|
||||
|
||||
local ID = self:LookupAttachment( "muzzle" )
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
self.SNDTurretMG = self:AddSoundEmitter( self:WorldToLocal( Muzzle.Pos - Muzzle.Ang:Up() * 140 - Muzzle.Ang:Forward() * 15 ), "lvs/vehicles/sherman/mg_loop.wav", "lvs/vehicles/sherman/mg_loop_interior.wav" )
|
||||
self.SNDTurretMG:SetSoundLevel( 95 )
|
||||
self.SNDTurretMG:SetParent( self, ID )
|
||||
|
||||
local DriverSeat = self:AddDriverSeat( Vector(0,0,60), Angle(0,-90,0) )
|
||||
DriverSeat.HidePlayer = true
|
||||
|
||||
local GunnerSeat = self:AddPassengerSeat( Vector(103,-24,41), Angle(0,-90,0) )
|
||||
GunnerSeat.HidePlayer = true
|
||||
self:SetGunnerSeat( GunnerSeat )
|
||||
|
||||
self:AddEngine( Vector(-79.66,0,72.21), Angle(0,180,0) )
|
||||
self:AddFuelTank( Vector(-80,0,60), Angle(0,0,0), 600, LVS.FUELTYPE_PETROL, Vector(-12,-50,-12),Vector(12,50,0) )
|
||||
|
||||
-- turret
|
||||
local TurretArmor = self:AddArmor( Vector(0,0,88), Angle(0,0,0), Vector(-52,-52,-18), Vector(52,52,18), 4000, self.TurretArmor )
|
||||
TurretArmor:SetLabel( "Turret" )
|
||||
self:SetTurretArmor( TurretArmor )
|
||||
|
||||
-- front upper plate
|
||||
self:AddArmor( Vector(105,0,62), Angle(0,0,0), Vector(-8,-65,-12), Vector(8,65,12), 4000, self.FrontArmor )
|
||||
|
||||
-- front mid plate
|
||||
self:AddArmor( Vector(122,0,49), Angle(8,0,0), Vector(-10,-37,-1), Vector(10,37,1), 1200, self.RearArmor )
|
||||
|
||||
-- front lower plate
|
||||
self:AddArmor( Vector(127,0,35), Angle(-67,0,0), Vector(-15,-37,-1), Vector(15,37,1), 4000, self.FrontArmor )
|
||||
|
||||
-- front bottom plate
|
||||
self:AddArmor( Vector(111,0,18), Angle(-22,0,0), Vector(-11,-37,-1), Vector(11,37,1), 1200, self.RearArmor )
|
||||
|
||||
--left up
|
||||
self:AddArmor( Vector(-8,64,56), Angle(0,0,0), Vector(-105,-1,-18), Vector(105,1,18), 1600, self.SideArmor )
|
||||
--right up
|
||||
self:AddArmor( Vector(-8,-64,56), Angle(0,0,0), Vector(-105,-1,-18), Vector(105,1,18), 1600, self.SideArmor )
|
||||
|
||||
--left down
|
||||
self:AddArmor( Vector(12,37,35), Angle(0,0,0), Vector(-120,-1,-22), Vector(120,1,22), 1200, self.RearArmor )
|
||||
--right down
|
||||
self:AddArmor( Vector(12,-37,35), Angle(0,0,0), Vector(-120,-1,-22), Vector(120,1,22), 1200, self.RearArmor )
|
||||
|
||||
-- rear
|
||||
self:AddArmor( Vector(-105,0,42), Angle(0,0,0), Vector(-8,-65,-29), Vector(8,65,29), 1600, self.SideArmor )
|
||||
|
||||
--top
|
||||
self:AddArmor( Vector(0,0,69), Angle(0,0,0), Vector(-97,-63,-1), Vector(97,63,1), 500, self.RoofArmor )
|
||||
--bottom
|
||||
self:AddArmor( Vector(2,0,14), Angle(0,0,0), Vector(-99,-36,-1), Vector(99,36,1), 500, self.RoofArmor )
|
||||
|
||||
-- hole
|
||||
self:AddArmor( Vector(82,0,52), Angle(0,0,0), Vector(-15,-63,-2), Vector(15,63,2), 500, self.RoofArmor )
|
||||
|
||||
-- ammo rack weakspot
|
||||
self:AddAmmoRack( Vector(0,50,55), Vector(0,0,65), Angle(0,0,0), Vector(-54,-12,-6), Vector(54,12,6) )
|
||||
self:AddAmmoRack( Vector(0,-50,55), Vector(0,0,65), Angle(0,0,0), Vector(-54,-12,-6), Vector(54,12,6) )
|
||||
self:AddAmmoRack( Vector(0,30,30), Vector(0,0,65), Angle(0,0,0), Vector(-30,-6,-12), Vector(30,6,12) )
|
||||
self:AddAmmoRack( Vector(0,-30,30), Vector(0,0,65), Angle(0,0,0), Vector(-30,-6,-12), Vector(30,6,12) )
|
||||
|
||||
-- trailer hitch
|
||||
self:AddTrailerHitch( Vector(-112,0,22), LVS.HITCHTYPE_MALE )
|
||||
end
|
||||
@@ -0,0 +1,189 @@
|
||||
|
||||
if SERVER then
|
||||
ENT.PivotSteerEnable = true
|
||||
ENT.PivotSteerByBrake = false
|
||||
ENT.PivotSteerWheelRPM = 25
|
||||
|
||||
ENT.TrackGibs = {
|
||||
["left"] = {
|
||||
{
|
||||
mdl = "models/blu/tanks/tiger_tracks_ragdoll.mdl",
|
||||
pos = Vector(0,54.7,0),
|
||||
ang = Angle(-90,-90,0),
|
||||
},
|
||||
},
|
||||
["right"] = {
|
||||
{
|
||||
mdl = "models/blu/tanks/tiger_tracks_ragdoll.mdl",
|
||||
pos = Vector(0,-54.7,0),
|
||||
ang = Angle(-90,-90,0),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function ENT:OnLeftTrackRepaired()
|
||||
self:SetBodygroup(3,0)
|
||||
end
|
||||
|
||||
function ENT:OnLeftTrackDestroyed()
|
||||
self:SetBodygroup(3,1)
|
||||
end
|
||||
|
||||
function ENT:OnRightTrackRepaired()
|
||||
self:SetBodygroup(4,0)
|
||||
end
|
||||
|
||||
function ENT:OnRightTrackDestroyed()
|
||||
self:SetBodygroup(4,1)
|
||||
end
|
||||
|
||||
function ENT:TracksCreate( PObj )
|
||||
self:CreateTrackPhysics( "models/blu/tanks/tiger_tracks_col.mdl" )
|
||||
|
||||
local WheelModel = "models/props_vehicles/tire001b_truck.mdl"
|
||||
|
||||
local L1 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(115,55,45), mdl = WheelModel } )
|
||||
local L2 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(75,55,25), mdl = WheelModel } )
|
||||
local L3 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(35,55,35), mdl = WheelModel } )
|
||||
local L4 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(-5,55,35), mdl = WheelModel } )
|
||||
local L5 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(-45,55,35), mdl = WheelModel } )
|
||||
local L6 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_LEFT, pos = Vector(-85,55,35), mdl = WheelModel } )
|
||||
local LeftWheelChain = self:CreateWheelChain( {L1, L2, L3, L4, L5, L6} )
|
||||
self:SetTrackDriveWheelLeft( L4 )
|
||||
|
||||
local R1 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(115,-55,45), mdl = WheelModel } )
|
||||
local R2 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(75,-55,25), mdl = WheelModel } )
|
||||
local R3 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(35,-55,35), mdl = WheelModel } )
|
||||
local R4 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(-5,-55,35), mdl = WheelModel } )
|
||||
local R5 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(-45,-55,35), mdl = WheelModel } )
|
||||
local R6 = self:AddWheel( { hide = true, wheeltype = LVS.WHEELTYPE_RIGHT, pos = Vector(-85,-55,35), mdl = WheelModel} )
|
||||
local RightWheelChain = self:CreateWheelChain( {R1, R2, R3, R4, R5, R6} )
|
||||
self:SetTrackDriveWheelRight( R4 )
|
||||
|
||||
local LeftTracksArmor = self:AddArmor( Vector(11,55,8), Angle(0,0,0), Vector(-123,-17,-42), Vector(123,17,42), 700, self.FrontArmor )
|
||||
self:SetTrackArmorLeft( LeftTracksArmor, LeftWheelChain )
|
||||
|
||||
local RightTracksArmor = self:AddArmor( Vector(11,-55,8), Angle(0,0,0), Vector(-123,-17,-42), Vector(123,17,42), 700, self.FrontArmor )
|
||||
self:SetTrackArmorRight( RightTracksArmor, RightWheelChain )
|
||||
|
||||
self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,0,0),
|
||||
SteerType = LVS.WHEEL_STEER_FRONT,
|
||||
SteerAngle = 30,
|
||||
TorqueFactor = 0,
|
||||
BrakeFactor = 1,
|
||||
UseHandbrake = true,
|
||||
},
|
||||
Wheels = { R1, L1, R2, L2 },
|
||||
Suspension = {
|
||||
Height = 20,
|
||||
MaxTravel = 15,
|
||||
ControlArmLength = 150,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 1000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
|
||||
self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,0,0),
|
||||
SteerType = LVS.WHEEL_STEER_NONE,
|
||||
TorqueFactor = 1,
|
||||
BrakeFactor = 1,
|
||||
UseHandbrake = true,
|
||||
},
|
||||
Wheels = { R3, L3, L4, R4 },
|
||||
Suspension = {
|
||||
Height = 20,
|
||||
MaxTravel = 15,
|
||||
ControlArmLength = 150,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 1000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
|
||||
self:DefineAxle( {
|
||||
Axle = {
|
||||
ForwardAngle = Angle(0,0,0),
|
||||
SteerType = LVS.WHEEL_STEER_REAR,
|
||||
SteerAngle = 30,
|
||||
TorqueFactor = 0,
|
||||
BrakeFactor = 1,
|
||||
UseHandbrake = true,
|
||||
},
|
||||
Wheels = { R5, L5, R6, L6 },
|
||||
Suspension = {
|
||||
Height = 20,
|
||||
MaxTravel = 15,
|
||||
ControlArmLength = 150,
|
||||
SpringConstant = 20000,
|
||||
SpringDamping = 1000,
|
||||
SpringRelativeDamping = 2000,
|
||||
},
|
||||
} )
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
ENT.TrackSystemEnable = true
|
||||
|
||||
ENT.TrackScrollTexture = "models/blu/tiger/track"
|
||||
ENT.ScrollTextureData = {
|
||||
["$bumpmap"] = "models/blu/tiger/track_nm",
|
||||
["$phong"] = "1",
|
||||
["$phongboost"] = "0.02",
|
||||
["$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 = 1
|
||||
ENT.TrackLeftSubMaterialMul = Vector(0,-0.075,0)
|
||||
|
||||
ENT.TrackRightSubMaterialID = 2
|
||||
ENT.TrackRightSubMaterialMul = Vector(0,-0.075,0)
|
||||
|
||||
ENT.TrackPoseParameterLeft = "spin_wheels_left"
|
||||
ENT.TrackPoseParameterLeftMul = -1.252
|
||||
|
||||
ENT.TrackPoseParameterRight = "spin_wheels_right"
|
||||
ENT.TrackPoseParameterRightMul = -1.252
|
||||
|
||||
ENT.TrackSounds = "lvs/vehicles/tiger/tracks_loop.wav"
|
||||
ENT.TrackHull = Vector(20,20,20)
|
||||
ENT.TrackData = {}
|
||||
for i = 1, 8 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 = 40,
|
||||
traceLength = 100,
|
||||
},
|
||||
PoseParameter = {
|
||||
name = "suspension_"..LeftRight.."_"..i,
|
||||
rangeMultiplier = 1,
|
||||
lerpSpeed = 25,
|
||||
}
|
||||
}
|
||||
table.insert( ENT.TrackData, data )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/sh_turret.lua")
|
||||
include("entities/lvs_tank_wheeldrive/modules/sh_turret_ballistics.lua")
|
||||
|
||||
ENT.TurretBallisticsProjectileVelocity = ENT.ProjectileVelocityCoaxial
|
||||
ENT.TurretBallisticsMuzzleAttachment = "muzzle_coax"
|
||||
ENT.TurretBallisticsViewAttachment = "sight"
|
||||
|
||||
ENT.TurretAimRate = 15
|
||||
|
||||
ENT.TurretRotationSound = "vehicles/tank_turret_loop1.wav"
|
||||
|
||||
ENT.TurretPitchPoseParameterName = "turret_pitch"
|
||||
ENT.TurretPitchMin = -15
|
||||
ENT.TurretPitchMax = 15
|
||||
ENT.TurretPitchMul = 1
|
||||
ENT.TurretPitchOffset = 0
|
||||
|
||||
ENT.TurretYawPoseParameterName = "turret_yaw"
|
||||
ENT.TurretYawMul = 1
|
||||
ENT.TurretYawOffset = 0
|
||||
@@ -0,0 +1,522 @@
|
||||
|
||||
ENT.Base = "lvs_tank_wheeldrive"
|
||||
|
||||
ENT.PrintName = "Panzer VI Tiger"
|
||||
ENT.Author = "Luna"
|
||||
ENT.Information = "Luna's Vehicle Script"
|
||||
ENT.Category = "[LVS] - Cars"
|
||||
|
||||
ENT.VehicleCategory = "Tanks"
|
||||
ENT.VehicleSubCategory = "Heavy"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.MDL = "models/blu/tanks/tiger_lvs.mdl"
|
||||
ENT.MDL_DESTROYED = "models/blu/tanks/tiger_lvs_gib_1.mdl"
|
||||
|
||||
ENT.GibModels = {
|
||||
"models/blu/tanks/tiger_lvs_gib_2.mdl",
|
||||
"models/blu/tanks/tiger_lvs_gib_3.mdl",
|
||||
"models/blu/tanks/tiger_lvs_gib_4.mdl",
|
||||
}
|
||||
|
||||
ENT.AITEAM = 1
|
||||
|
||||
ENT.MaxHealth = 1500
|
||||
|
||||
--damage system
|
||||
ENT.DSArmorIgnoreForce = 4000
|
||||
ENT.CannonArmorPenetration = 14500
|
||||
ENT.FrontArmor = 6000
|
||||
ENT.SideArmor = 4000
|
||||
ENT.TurretArmor = 6000
|
||||
ENT.RearArmor = 2000
|
||||
ENT.RoofArmor = 100
|
||||
|
||||
|
||||
-- ballistics
|
||||
ENT.ProjectileVelocityCoaxial = 15000
|
||||
ENT.ProjectileVelocityHighExplosive = 13000
|
||||
ENT.ProjectileVelocityArmorPiercing = 16000
|
||||
|
||||
ENT.SteerSpeed = 1
|
||||
ENT.SteerReturnSpeed = 2
|
||||
|
||||
ENT.PhysicsWeightScale = 2
|
||||
ENT.PhysicsDampingSpeed = 1000
|
||||
ENT.PhysicsInertia = Vector(6000,6000,1500)
|
||||
|
||||
ENT.MaxVelocity = 450
|
||||
ENT.MaxVelocityReverse = 150
|
||||
|
||||
ENT.EngineCurve = 0.1
|
||||
ENT.EngineTorque = 200
|
||||
|
||||
ENT.TransMinGearHoldTime = 0.1
|
||||
ENT.TransShiftSpeed = 0
|
||||
|
||||
ENT.TransGears = 3
|
||||
ENT.TransGearsReverse = 1
|
||||
|
||||
ENT.MouseSteerAngle = 45
|
||||
|
||||
ENT.lvsShowInSpawner = true
|
||||
|
||||
ENT.EngineSounds = {
|
||||
{
|
||||
sound = "lvs/vehicles/tiger/eng_idle_loop.wav",
|
||||
Volume = 1,
|
||||
Pitch = 70,
|
||||
PitchMul = 30,
|
||||
SoundLevel = 75,
|
||||
SoundType = LVS.SOUNDTYPE_IDLE_ONLY,
|
||||
},
|
||||
{
|
||||
sound = "lvs/vehicles/tiger/eng_loop.wav",
|
||||
Volume = 1,
|
||||
Pitch = 30,
|
||||
PitchMul = 100,
|
||||
SoundLevel = 85,
|
||||
SoundType = LVS.SOUNDTYPE_NONE,
|
||||
UseDoppler = true,
|
||||
},
|
||||
}
|
||||
|
||||
ENT.ExhaustPositions = {
|
||||
{
|
||||
pos = Vector(-116.7,-16.67,68.88),
|
||||
ang = Angle(-90,0,0),
|
||||
},
|
||||
{
|
||||
pos = Vector(-116.7,16.67,68.88),
|
||||
ang = Angle(-90,0,0),
|
||||
},
|
||||
}
|
||||
|
||||
function ENT:OnSetupDataTables()
|
||||
self:AddDT( "Entity", "GunnerSeat" )
|
||||
self:AddDT( "Bool", "UseHighExplosive" )
|
||||
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_coax" )
|
||||
|
||||
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 = ent.ProjectileVelocityCoaxial
|
||||
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_coax" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if Muzzle then
|
||||
local Start = Muzzle.Pos
|
||||
|
||||
local traceTurret = util.TraceLine( {
|
||||
start = Start,
|
||||
endpos = Start + Muzzle.Ang:Forward() * 50000,
|
||||
filter = ent:GetCrosshairFilterEnts()
|
||||
} )
|
||||
|
||||
local MuzzlePos2D = traceTurret.HitPos:ToScreen()
|
||||
|
||||
ent:PaintCrosshairCenter( MuzzlePos2D, COLOR_WHITE )
|
||||
ent:LVSPaintHitMarker( MuzzlePos2D )
|
||||
end
|
||||
end
|
||||
weapon.OnSelect = function( ent )
|
||||
ent:TurretUpdateBallistics( ent.ProjectileVelocityCoaxial, "muzzle_coax" )
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = true
|
||||
weapon.Ammo = 30
|
||||
weapon.Delay = 3.2
|
||||
weapon.HeatRateUp = 1
|
||||
weapon.HeatRateDown = 0.33
|
||||
weapon.OnThink = function( ent )
|
||||
if ent:GetSelectedWeapon() ~= 2 then return end
|
||||
|
||||
local ply = ent:GetDriver()
|
||||
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local SwitchType = ply:lvsKeyDown( "CAR_SWAP_AMMO" )
|
||||
|
||||
if ent._oldSwitchType ~= SwitchType then
|
||||
ent._oldSwitchType = SwitchType
|
||||
|
||||
if SwitchType then
|
||||
ent:SetUseHighExplosive( not ent:GetUseHighExplosive() )
|
||||
ent:EmitSound("lvs/vehicles/tiger/cannon_unload.wav", 75, 100, 1, CHAN_WEAPON )
|
||||
ent:SetHeat( 1 )
|
||||
ent:SetOverheated( true )
|
||||
|
||||
if ent:GetUseHighExplosive() then
|
||||
ent:TurretUpdateBallistics( ent.ProjectileVelocityHighExplosive )
|
||||
else
|
||||
ent:TurretUpdateBallistics( ent.ProjectileVelocityArmorPiercing )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
weapon.Attack = function( ent )
|
||||
local ID = ent:LookupAttachment( "muzzle" )
|
||||
|
||||
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,0,0)
|
||||
bullet.EnableBallistics = true
|
||||
|
||||
if ent:GetUseHighExplosive() then
|
||||
bullet.Force = 500
|
||||
bullet.HullSize = 15
|
||||
bullet.Damage = 250
|
||||
bullet.SplashDamage = 1000
|
||||
bullet.SplashDamageRadius = 250
|
||||
bullet.SplashDamageEffect = "lvs_bullet_impact_explosive"
|
||||
bullet.SplashDamageType = DMG_BLAST
|
||||
bullet.Velocity = ent.ProjectileVelocityHighExplosive
|
||||
else
|
||||
bullet.Force = ent.CannonArmorPenetration
|
||||
bullet.HullSize = 0
|
||||
bullet.Damage = 1250
|
||||
bullet.Velocity = ent.ProjectileVelocityArmorPiercing
|
||||
end
|
||||
|
||||
bullet.TracerName = "lvs_tracer_cannon"
|
||||
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 )
|
||||
|
||||
local PhysObj = ent:GetPhysicsObject()
|
||||
if IsValid( PhysObj ) then
|
||||
PhysObj:ApplyForceOffset( -bullet.Dir * 150000, bullet.Src )
|
||||
end
|
||||
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
ent:PlayAnimation("shot")
|
||||
|
||||
if not IsValid( ent.SNDTurret ) then return end
|
||||
|
||||
ent.SNDTurret:PlayOnce( 100 + math.cos( CurTime() + ent:EntIndex() * 1337 ) * 5 + math.Rand(-1,1), 1 )
|
||||
|
||||
ent:EmitSound("lvs/vehicles/tiger/cannon_reload.wav", 75, 100, 1, CHAN_WEAPON )
|
||||
end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local ID = ent:LookupAttachment( "muzzle" )
|
||||
|
||||
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()
|
||||
|
||||
if ent:GetUseHighExplosive() then
|
||||
ent:PaintCrosshairSquare( MuzzlePos2D, COLOR_WHITE )
|
||||
else
|
||||
ent:PaintCrosshairOuter( MuzzlePos2D, COLOR_WHITE )
|
||||
end
|
||||
|
||||
ent:LVSPaintHitMarker( MuzzlePos2D )
|
||||
end
|
||||
end
|
||||
weapon.OnSelect = function( ent )
|
||||
if ent:GetUseHighExplosive() then
|
||||
ent:TurretUpdateBallistics( ent.ProjectileVelocityHighExplosive, "muzzle" )
|
||||
else
|
||||
ent:TurretUpdateBallistics( ent.ProjectileVelocityArmorPiercing, "muzzle" )
|
||||
end
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/smoke_launcher.png")
|
||||
weapon.Ammo = 3
|
||||
weapon.Delay = 1
|
||||
weapon.HeatRateUp = 1
|
||||
weapon.HeatRateDown = 0.05
|
||||
weapon.Attack = function( ent )
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
local ID1 = ent:LookupAttachment( "muzzle_smoke_right" )
|
||||
local ID2 = ent:LookupAttachment( "muzzle_smoke_left" )
|
||||
|
||||
local Muzzle1 = ent:GetAttachment( ID1 )
|
||||
local Muzzle2 = ent:GetAttachment( ID2 )
|
||||
|
||||
if not Muzzle1 or not Muzzle2 then return end
|
||||
|
||||
local Up = self:GetUp()
|
||||
|
||||
ent:EmitSound("lvs/smokegrenade.wav")
|
||||
|
||||
local Ang1 = Muzzle1.Ang
|
||||
Ang1:RotateAroundAxis( Up, -5 )
|
||||
local grenade = ents.Create( "lvs_item_smoke" )
|
||||
grenade:SetPos( Muzzle1.Pos )
|
||||
grenade:SetAngles( Ang1 )
|
||||
grenade:Spawn()
|
||||
grenade:Activate()
|
||||
grenade:GetPhysicsObject():SetVelocity( Ang1:Forward() * 1000 )
|
||||
|
||||
local Ang2 = Muzzle2.Ang
|
||||
Ang2:RotateAroundAxis( Up, 5 )
|
||||
local grenade = ents.Create( "lvs_item_smoke" )
|
||||
grenade:SetPos( Muzzle2.Pos )
|
||||
grenade:SetAngles( Ang2 )
|
||||
grenade:Spawn()
|
||||
grenade:Activate()
|
||||
grenade:GetPhysicsObject():SetVelocity( Ang2:Forward() * 1000 )
|
||||
|
||||
local Ang3 = Muzzle1.Ang
|
||||
Ang3:RotateAroundAxis( Up, -15 )
|
||||
local grenade = ents.Create( "lvs_item_smoke" )
|
||||
grenade:SetPos( Muzzle1.Pos )
|
||||
grenade:SetAngles( Ang3 )
|
||||
grenade:Spawn()
|
||||
grenade:Activate()
|
||||
grenade:GetPhysicsObject():SetVelocity( Ang3:Forward() * 1000 )
|
||||
|
||||
|
||||
local Ang4 = Muzzle2.Ang
|
||||
Ang4:RotateAroundAxis( Up, 15 )
|
||||
local grenade = ents.Create( "lvs_item_smoke" )
|
||||
grenade:SetPos( Muzzle2.Pos )
|
||||
grenade:SetAngles( Ang4 )
|
||||
grenade:Spawn()
|
||||
grenade:Activate()
|
||||
grenade:GetPhysicsObject():SetVelocity( Ang4:Forward() * 1000 )
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
|
||||
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/grenade_launcher.png")
|
||||
weapon.Ammo = 1
|
||||
weapon.Delay = 1
|
||||
weapon.HeatRateUp = 1
|
||||
weapon.HeatRateDown = 1
|
||||
weapon.Attack = function( ent )
|
||||
ent:TakeAmmo( 1 )
|
||||
|
||||
ent:EmitSound("lvs/smokegrenade.wav")
|
||||
|
||||
local nades = {
|
||||
[1] = {
|
||||
pos = Vector(82.52,61.27,74.75),
|
||||
ang = Angle(-60,45,0),
|
||||
},
|
||||
[2] = {
|
||||
pos = Vector(82.52,-61.27,74.75),
|
||||
ang = Angle(-60,-45,0),
|
||||
},
|
||||
[3] = {
|
||||
pos = Vector(-46.24,61.77,75.63),
|
||||
ang = Angle(-60,90,0),
|
||||
},
|
||||
[4] = {
|
||||
pos = Vector(-46.24,-61.77,75.63),
|
||||
ang = Angle(-60,-90,0),
|
||||
},
|
||||
}
|
||||
|
||||
for _, data in pairs( nades ) do
|
||||
timer.Simple( math.Rand(0,0.2), function()
|
||||
if not IsValid( ent ) then return end
|
||||
|
||||
local pos = ent:LocalToWorld( data.pos )
|
||||
local ang = ent:LocalToWorldAngles( data.ang )
|
||||
|
||||
local grenade = ents.Create( "lvs_item_explosive" )
|
||||
grenade:SetPos( pos )
|
||||
grenade:SetAngles( ang )
|
||||
grenade:Spawn()
|
||||
grenade:Activate()
|
||||
grenade:SetAttacker( ent:GetDriver() )
|
||||
grenade:GetPhysicsObject():SetVelocity( ang:Forward() * 300 )
|
||||
end )
|
||||
end
|
||||
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 )
|
||||
|
||||
self:AddGunnerWeapons()
|
||||
end
|
||||
|
||||
function ENT:GunnerInRange( Dir )
|
||||
return self:AngleBetweenNormal( self:GetForward(), Dir ) < 60
|
||||
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( "muzzle_machinegun" )
|
||||
|
||||
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 )
|
||||
|
||||
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
|
||||
|
||||
local Angles = base:WorldToLocalAngles( ent:GetAimVector():Angle() )
|
||||
Angles:Normalize()
|
||||
|
||||
base:SetPoseParameter("machinegun_yaw", -Angles.y )
|
||||
base:SetPoseParameter("machinegun_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
|
||||
self:AddWeapon( weapon, 2 )
|
||||
end
|
||||
Reference in New Issue
Block a user