Skip to content

Commit

Permalink
Merge pull request #41 from StyledStrike/tweak-damage-values
Browse files Browse the repository at this point in the history
Tweak damage values and engine damage scaling
  • Loading branch information
StyledStrike authored Jan 3, 2025
2 parents e152623 + 0eea1ee commit dde21eb
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 36 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ A pack of content and entity classes to add cars, motorcycles, planes, helicopte

| Command | Description
| --------------------------------- | ------
| `glide_damage_multiplier_bullet` `<number>` | Damage multiplier for bullets hitting Glide vehicles
| `glide_damage_multiplier_blast` `<number>` | Damage multiplier for explosions hitting Glide vehicles
| `glide_damage_multiplier_collision` `<number>` | Damage multiplier taken by Glide vehicles after colliding against other things
| `glide_bullet_damage_multiplier` `<number>` | Damage multiplier for bullets hitting Glide vehicles
| `glide_blast_damage_multiplier` `<number>` | Damage multiplier for explosions hitting Glide vehicles
| `glide_physics_damage_multiplier` `<number>` | Damage multiplier taken by Glide vehicles after colliding against other things

### Sandbox limits

Expand Down
6 changes: 3 additions & 3 deletions lua/autorun/sh_glide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ end

if SERVER then
-- Damage multiplier convars
CreateConVar( "glide_damage_multiplier_bullet", "0.75", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier for bullets hitting Glide vehicles.", 0, 10 )
CreateConVar( "glide_damage_multiplier_blast", "5", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier for explosions hitting Glide vehicles.", 0, 10 )
CreateConVar( "glide_damage_multiplier_collision", "1", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier taken by Glide vehicles after colliding against other things.", 0, 10 )
CreateConVar( "glide_bullet_damage_multiplier", "1", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier for bullets hitting Glide vehicles.", 0, 10 )
CreateConVar( "glide_blast_damage_multiplier", "1", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier for explosions hitting Glide vehicles.", 0, 10 )
CreateConVar( "glide_physics_damage_multiplier", "1", FCVAR_ARCHIVE + FCVAR_NOTIFY, "Damage multiplier taken by Glide vehicles after colliding against other things.", 0, 10 )
end

-- Sandbox limits
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/base_glide/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function ENT:Think()
local inflictor = IsValid( self.lastDamageInflictor ) and self.lastDamageInflictor or self

local dmg = DamageInfo()
dmg:SetDamage( 10 * dt )
dmg:SetDamage( self.MaxChassisHealth * self.ChassisFireDamageMultiplier * dt )
dmg:SetAttacker( attacker )
dmg:SetInflictor( inflictor )
dmg:SetDamageType( 0 )
Expand Down
11 changes: 7 additions & 4 deletions lua/entities/base_glide/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,19 @@ if SERVER then
ENT.SpawnAngleOffset = Angle( 0, 90, 0 )

-- Multiply damage taken by these values
ENT.BulletDamageMultiplier = 0.75
ENT.BlastDamageMultiplier = 1
ENT.CollisionDamageMultiplier = 1
ENT.BulletDamageMultiplier = 1.5
ENT.BlastDamageMultiplier = 5
ENT.CollisionDamageMultiplier = 0.5

-- How much of the chassis damage is also applied to the engine?
ENT.EngineDamageMultiplier = 0.001
ENT.EngineDamageMultiplier = 1.2

-- How much of the blast damage force should be applied to the vehicle?
ENT.BlastForceMultiplier = 0.01

-- Damage multiplier for engine fire
ENT.ChassisFireDamageMultiplier = 0.01

-- Given a dot product between the vehicle's forward direction
-- and the direction to a lock-on target, how large must that dot product be
-- for the target to be considered on the vehicle's "field of view"?
Expand Down
10 changes: 5 additions & 5 deletions lua/entities/base_glide/sv_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ end

local IsValid = IsValid

local cvarBullet = GetConVar( "glide_damage_multiplier_bullet" )
local cvarBlast = GetConVar( "glide_damage_multiplier_blast" )
local cvarBullet = GetConVar( "glide_bullet_damage_multiplier" )
local cvarBlast = GetConVar( "glide_blast_damage_multiplier" )

function ENT:OnTakeDamage( dmginfo )
if self.hasExploded then return end
Expand All @@ -116,13 +116,13 @@ function ENT:OnTakeDamage( dmginfo )
health = health - amount

self:SetChassisHealth( health )
self:TakeEngineDamage( amount * self.EngineDamageMultiplier )
self:TakeEngineDamage( ( amount / self.MaxChassisHealth ) * self.EngineDamageMultiplier )
self:UpdateHealthOutputs()

self.lastDamageAttacker = dmginfo:GetAttacker()
self.lastDamageInflictor = dmginfo:GetInflictor()

if health < 250 and self:WaterLevel() < 3 then
if health / self.MaxChassisHealth < 0.18 and self:WaterLevel() < 3 then
self:SetIsEngineOnFire( true )
end

Expand All @@ -138,7 +138,7 @@ local Clamp = math.Clamp
local RandomInt = math.random
local PlaySoundSet = Glide.PlaySoundSet

local cvarCollision = GetConVar( "glide_damage_multiplier_collision" )
local cvarCollision = GetConVar( "glide_physics_damage_multiplier" )

function ENT:PhysicsCollide( data )
if data.TheirSurfaceProps == 76 then -- default_silent
Expand Down
5 changes: 2 additions & 3 deletions lua/entities/base_glide_aircraft/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ ENT.AdminOnly = false
ENT.AutomaticFrameAdvance = true
ENT.VJTag_ID_Aircraft = true

-- Increase default max. chassis health
ENT.MaxChassisHealth = 1200

DEFINE_BASECLASS( "base_glide" )

--- Override this base class function.
Expand Down Expand Up @@ -59,6 +56,8 @@ if SERVER then
ENT.ExplosionRadius = 700
ENT.SuspensionHeavySound = "Glide.Suspension.CompressBike"

ENT.CollisionDamageMultiplier = 4

-- Damaged engine sound
ENT.DamagedEngineSound = "Glide.Damaged.GearGrind"
ENT.DamagedEngineVolume = 0.4
Expand Down
5 changes: 0 additions & 5 deletions lua/entities/base_glide_car/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ ENT.Editable = true
-- Change vehicle type
ENT.VehicleType = Glide.VEHICLE_TYPE.CAR

-- Decrease default max. chassis health
ENT.MaxChassisHealth = 900

-- Should we prevent players from editing these NW variables?
ENT.UneditableNWVars = {}

Expand Down Expand Up @@ -188,9 +185,7 @@ if CLIENT then
end

if SERVER then
ENT.EngineDamageMultiplier = 0.0016
ENT.CollisionParticleSize = 0.9
ENT.CollisionDamageMultiplier = 0.5
ENT.AngularDrag = Vector( -0.5, -0.5, -4 ) -- Roll, pitch, yaw

-- How long does it take for the vehicle to start up?
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/base_glide_heli/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if CLIENT then
end

if SERVER then
ENT.CollisionDamageMultiplier = 2
ENT.CollisionDamageMultiplier = 3
ENT.AngularDrag = Vector( -10, -18, -10 ) -- Roll, pitch, yaw

-- How far can the rotor's blades hit things
Expand Down
1 change: 0 additions & 1 deletion lua/entities/base_glide_plane/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ if CLIENT then
end

if SERVER then
ENT.CollisionDamageMultiplier = 4.5
ENT.AngularDrag = Vector( -2, -2, -10 ) -- Roll, pitch, yaw
ENT.DamagedEngineSound = "Glide.Damaged.AircraftEngineBreakdown"
ENT.DamagedEngineVolume = 1.0
Expand Down
4 changes: 3 additions & 1 deletion lua/entities/base_glide_tank/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ function ENT:OnWeaponFire( weapon )
local dir = aimPos - projectilePos
dir:Normalize()

Glide.FireProjectile( projectilePos, dir:Angle(), self:GetDriver(), self )
local projectile = Glide.FireProjectile( projectilePos, dir:Angle(), self:GetDriver(), self )
projectile.damage = self.TurretDamage

self:EmitSound( self.TurretFireSound, 100, math.random( 95, 105 ), self.TurretFireVolume )

local eff = EffectData()
Expand Down
11 changes: 5 additions & 6 deletions lua/entities/base_glide_tank/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ENT.AutomaticFrameAdvance = true
-- Change vehicle type
ENT.VehicleType = Glide.VEHICLE_TYPE.TANK

-- Increase default max. chassis health
ENT.MaxChassisHealth = 3000
-- Tweak max. chassis health
ENT.MaxChassisHealth = 6000

-- Turrets are predictable, so their properties
-- should be set both on SERVER and CLIENT.
Expand Down Expand Up @@ -111,11 +111,9 @@ if SERVER then
ENT.IsHeavyVehicle = true
ENT.ChassisMass = 20000

ENT.BulletDamageMultiplier = 0.25
ENT.BlastDamageMultiplier = 1
ENT.CollisionDamageMultiplier = 0.8
ENT.EngineDamageMultiplier = 0.00035
ENT.BlastDamageMultiplier = 3
ENT.BlastForceMultiplier = 0.005
ENT.CollisionDamageMultiplier = 3

ENT.SuspensionHeavySound = "Glide.Suspension.CompressTruck"
ENT.SuspensionDownSound = "Glide.Suspension.Stress"
Expand All @@ -131,6 +129,7 @@ if SERVER then
ENT.TurretFireSound = ")glide/tanks/acf_fire4.mp3"
ENT.TurretFireVolume = 0.8
ENT.TurretRecoilForce = 50
ENT.TurretDamage = 550

-- How much torque to distribute among all wheels?
ENT.EngineTorque = 40000
Expand Down
3 changes: 2 additions & 1 deletion lua/entities/gtav_insurgent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENT.PrintName = "Insurgent Pick-up"

ENT.GlideCategory = "Default"
ENT.ChassisModel = "models/gta5/vehicles/insurgent/chassis.mdl"
ENT.MaxChassisHealth = 1500
ENT.MaxChassisHealth = 2000

DEFINE_BASECLASS( "base_glide_car" )

Expand Down Expand Up @@ -172,6 +172,7 @@ end
if SERVER then
ENT.SpawnPositionOffset = Vector( 0, 0, 45 )
ENT.ChassisMass = 2000

ENT.FallOnCollision = true
ENT.BurnoutForce = 30
ENT.AirControlForce = Vector( 0.3, 0.2, 0.2 )
Expand Down
3 changes: 1 addition & 2 deletions lua/entities/gtav_strikeforce.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENT.PrintName = "B-11 Strikeforce"

ENT.GlideCategory = "Default"
ENT.ChassisModel = "models/gta5/vehicles/strikeforce/chassis.mdl"
ENT.MaxChassisHealth = 1500
ENT.MaxChassisHealth = 1800

ENT.PropOffset = Vector( 114, 0, 3 )

Expand Down Expand Up @@ -166,7 +166,6 @@ end
if SERVER then
ENT.ChassisMass = 1500
ENT.SpawnPositionOffset = Vector( 0, 0, 40 )
ENT.CollisionDamageMultiplier = 5

ENT.ExplosionGibs = {
"models/gta5/vehicles/strikeforce/gibs/chassis.mdl",
Expand Down

0 comments on commit dde21eb

Please sign in to comment.