mirror of
https://github.com/SpaxscE/simfphys_base.git
synced 2025-03-04 03:13:26 -05:00
fix wheels not transmissing damage
This commit is contained in:
parent
6b8a50025c
commit
7e98e1a472
@ -84,9 +84,16 @@ end
|
||||
function ENT:ExplodeVehicle()
|
||||
if not IsValid( self ) then return end
|
||||
if self.destroyed then return end
|
||||
|
||||
|
||||
self.destroyed = true
|
||||
|
||||
local Attacker = self.LastAttacker
|
||||
|
||||
if IsValid( Attacker ) and Attacker:IsPlayer() and LVS then
|
||||
net.Start( "lvs_killmarker" )
|
||||
net.Send( Attacker )
|
||||
end
|
||||
|
||||
local ply = self.EntityOwner
|
||||
local skin = self:GetSkin()
|
||||
local Col = self:GetColor()
|
||||
@ -237,25 +244,46 @@ end
|
||||
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
if not self:IsInitialized() then return end
|
||||
|
||||
|
||||
if hook.Run( "simfphysOnTakeDamage", self, dmginfo ) then return end
|
||||
|
||||
|
||||
local Damage = dmginfo:GetDamage()
|
||||
local DamagePos = dmginfo:GetDamagePosition()
|
||||
local Type = dmginfo:GetDamageType()
|
||||
local Driver = self:GetDriver()
|
||||
|
||||
|
||||
self.LastAttacker = dmginfo:GetAttacker()
|
||||
self.LastInflictor = dmginfo:GetInflictor()
|
||||
|
||||
|
||||
if simfphys.DamageEnabled then
|
||||
net.Start( "simfphys_spritedamage" )
|
||||
net.WriteEntity( self )
|
||||
net.WriteVector( self:WorldToLocal( DamagePos ) )
|
||||
net.WriteBool( false )
|
||||
net.Broadcast()
|
||||
|
||||
|
||||
if LVS and Type == DMG_AIRBOAT then
|
||||
Type = DMG_DIRECT
|
||||
Damage = Damage * 5
|
||||
end
|
||||
|
||||
local oldHP = self:GetCurHealth()
|
||||
|
||||
self:ApplyDamage( Damage, Type )
|
||||
|
||||
local newHP = self:GetCurHealth()
|
||||
|
||||
if not LVS then return end
|
||||
|
||||
if oldHP ~= newHP then
|
||||
local IsFireDamage = dmginfo:IsDamageType( DMG_BURN )
|
||||
|
||||
if IsValid( self.LastAttacker ) and self.LastAttacker:IsPlayer() and not IsFireDamage then
|
||||
net.Start( "lvs_hitmarker" )
|
||||
net.WriteBool( CriticalHit )
|
||||
net.Send( self.LastAttacker )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -447,19 +447,23 @@ if SERVER then
|
||||
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
self:TakePhysicsDamage( dmginfo )
|
||||
|
||||
|
||||
if self:GetDamaged() or not simfphys.DamageEnabled then return end
|
||||
|
||||
|
||||
local Damage = dmginfo:GetDamage()
|
||||
local DamagePos = dmginfo:GetDamagePosition()
|
||||
local Type = dmginfo:GetDamageType()
|
||||
local BaseEnt = self:GetBaseEnt()
|
||||
|
||||
|
||||
if TYPE == DMG_BLAST then return end -- no tirepopping on explosions
|
||||
|
||||
|
||||
if IsValid(BaseEnt) then
|
||||
if BaseEnt:GetBulletProofTires() then return end
|
||||
|
||||
if BaseEnt:GetBulletProofTires() then
|
||||
BaseEnt:OnTakeDamage( dmginfo )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if Damage > 1 then
|
||||
if not self.PreBreak then
|
||||
self.PreBreak = CreateSound(self, "ambient/gas/cannister_loop.wav")
|
||||
|
Loading…
Reference in New Issue
Block a user