add sborka
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
|
||||
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( "seat" )
|
||||
local Att = self:GetAttachment( ID )
|
||||
|
||||
if not Att then self:RemovePlayerModel( "driver" ) return end
|
||||
|
||||
local Pos,Ang = LocalToWorld( Vector(0,0,0), Angle(180,-20,-90), Att.Pos, Att.Ang )
|
||||
|
||||
local model = self:CreatePlayerModel( ply, "driver" )
|
||||
|
||||
model:SetSequence( "drive_airboat" )
|
||||
model:SetRenderOrigin( Pos )
|
||||
model:SetRenderAngles( Ang )
|
||||
model:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:PreDraw()
|
||||
self:DrawDriver()
|
||||
|
||||
return true
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
include("shared.lua")
|
||||
include("cl_tankview.lua")
|
||||
include("sh_turret.lua")
|
||||
include("cl_attached_playermodels.lua")
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
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 ID1 = self:LookupAttachment( "seat" )
|
||||
local ID2 = self:LookupAttachment( "muzzle" )
|
||||
|
||||
local Att1 = self:GetAttachment( ID1 )
|
||||
local Att2 = self:GetAttachment( ID2 )
|
||||
|
||||
if Att1 and Att2 then
|
||||
local dir = Att2.Ang:Right()
|
||||
pos = Att1.Pos - Att1.Ang:Right() * 27 + dir * 1.5
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return pos, angles, fov
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
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,0,18), Angle(0,-90,0) )
|
||||
DriverSeat.HidePlayer = true
|
||||
|
||||
local ID = self:LookupAttachment( "muzzle" )
|
||||
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 )
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/sh_turret.lua")
|
||||
|
||||
ENT.TurretFakeBarrel = true
|
||||
ENT.TurretFakeBarrelRotationCenter = Vector(0,0,40)
|
||||
|
||||
ENT.TurretAimRate = 80
|
||||
|
||||
ENT.TurretRotationSound = "common/null.wav"
|
||||
|
||||
ENT.TurretPitchPoseParameterName = "cannon_pitch"
|
||||
ENT.TurretPitchMin = -30
|
||||
ENT.TurretPitchMax = 90
|
||||
ENT.TurretPitchMul = 1
|
||||
ENT.TurretPitchOffset = 0
|
||||
|
||||
ENT.TurretYawPoseParameterName = "cannon_yaw"
|
||||
ENT.TurretYawMul = -1
|
||||
ENT.TurretYawOffset = 180
|
||||
|
||||
function ENT:TurretInRange()
|
||||
local ID = self:LookupAttachment( "muzzle" )
|
||||
|
||||
local Muzzle = self:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return true end
|
||||
|
||||
local Dir1 = Muzzle.Ang:Forward()
|
||||
local Dir2 = self:GetAimVector()
|
||||
|
||||
return self:AngleBetweenNormal( Dir1, Dir2 ) < 5
|
||||
end
|
||||
@@ -0,0 +1,106 @@
|
||||
|
||||
ENT.Base = "lvs_base_wheeldrive_trailer"
|
||||
|
||||
ENT.PrintName = "FlaK 38"
|
||||
ENT.Author = "Luna"
|
||||
ENT.Information = "Luna's Vehicle Script"
|
||||
ENT.Category = "[LVS]"
|
||||
|
||||
ENT.VehicleCategory = "Artillery"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.MDL = "models/blu/flak38.mdl"
|
||||
|
||||
ENT.GibModels = {
|
||||
"models/blu/flak_db.mdl",
|
||||
"models/blu/flak_d1.mdl",
|
||||
"models/blu/flak_d2.mdl",
|
||||
"models/blu/flak_d3.mdl",
|
||||
"models/blu/flak_d4.mdl",
|
||||
"models/blu/flak_d5.mdl",
|
||||
"models/blu/flak_d6.mdl",
|
||||
}
|
||||
|
||||
ENT.lvsShowInSpawner = false
|
||||
|
||||
ENT.AITEAM = 1
|
||||
|
||||
ENT.PhysicsWeightScale = 1
|
||||
ENT.PhysicsMass = 450
|
||||
ENT.PhysicsInertia = Vector(475,452,162)
|
||||
ENT.PhysicsDampingSpeed = 4000
|
||||
ENT.PhysicsDampingForward = false
|
||||
ENT.PhysicsDampingReverse = false
|
||||
|
||||
ENT.MaxHealth = 400
|
||||
|
||||
function ENT:InitWeapons()
|
||||
local weapon = {}
|
||||
weapon.Icon = Material("lvs/weapons/flak_he.png")
|
||||
weapon.Ammo = 1500
|
||||
weapon.Delay = 0.25
|
||||
weapon.HeatRateUp = 0.25
|
||||
weapon.HeatRateDown = 0.5
|
||||
weapon.Attack = function( ent )
|
||||
|
||||
if not ent:TurretInRange() then
|
||||
return true
|
||||
end
|
||||
|
||||
local ID = ent:LookupAttachment( "muzzle" )
|
||||
|
||||
local Muzzle = ent:GetAttachment( ID )
|
||||
|
||||
if not Muzzle then return end
|
||||
|
||||
local Pos = Muzzle.Pos
|
||||
local Dir = (ent:GetEyeTrace().HitPos - Pos):GetNormalized()
|
||||
|
||||
local bullet = {}
|
||||
bullet.Src = Pos
|
||||
bullet.Dir = Dir
|
||||
bullet.Spread = Vector(0,0,0)
|
||||
bullet.TracerName = "lvs_tracer_autocannon"
|
||||
bullet.Force = 3900
|
||||
bullet.HullSize = 50 * math.max( Dir.z, 0 )
|
||||
bullet.Damage = 40
|
||||
bullet.EnableBallistics = true
|
||||
bullet.SplashDamage = 20
|
||||
bullet.SplashDamageRadius = 100
|
||||
bullet.SplashDamageEffect = "lvs_defence_explosion"
|
||||
bullet.SplashDamageType = DMG_SONIC
|
||||
bullet.Velocity = 50000
|
||||
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( "fire" )
|
||||
|
||||
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.OnOverheat = function( ent )
|
||||
ent:EmitSound("lvs/vehicles/222/cannon_overheat.wav")
|
||||
end
|
||||
weapon.HudPaint = function( ent, X, Y, ply )
|
||||
local Pos2D = ent:GetEyeTrace().HitPos:ToScreen()
|
||||
|
||||
local Col = ent:TurretInRange() and Color(255,255,255,255) or Color(255,0,0,255)
|
||||
|
||||
ent:PaintCrosshairCenter( Pos2D, Col )
|
||||
ent:PaintCrosshairSquare( Pos2D, Col )
|
||||
ent:LVSPaintHitMarker( Pos2D )
|
||||
end
|
||||
self:AddWeapon( weapon )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user