Skip to content

Commit

Permalink
Allow death weapons to knock over trees (FAForever#5033)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored Jun 11, 2023
1 parent cd9c034 commit 7d07626
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/defaultunits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,7 @@ AirUnit = ClassUnit(MobileUnit) {
elseif self.DeathCrashDamage > 0 then -- It was completely absorbed by a shield!
local deathWep = self.deathWep -- Use a local copy for speed and easy reading
DamageArea(self, self:GetPosition(), deathWep.DamageRadius, self.DeathCrashDamage, deathWep.DamageType, deathWep.DamageFriendly)
DamageArea(self, self:GetPosition(), deathWep.DamageRadius, 1, 'TreeForce', false)
end

if with == 'Water' then
Expand Down
1 change: 1 addition & 0 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,7 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent) {
DeathWeaponDamageThread = function(self, damageRadius, damage, damageType, damageFriendly)
WaitSeconds(0.1)
DamageArea(self, self:GetPosition(), damageRadius or 1, damage or 1, damageType or 'Normal', damageFriendly or false)
DamageArea(self, self:GetPosition(), damageRadius or 1, 1, 'TreeForce', false)
end,

---@param self Unit
Expand Down
4 changes: 3 additions & 1 deletion units/UAA0310/UAA0310_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ UAA0310 = ClassUnit(AirTransport) {

OnAnimTerrainCollision = function(self, bone, x, y, z)
local blueprint = self.Blueprint
DamageArea(self, { x, y, z }, 5, 1000, 'Default', true, false)
local position = { x, y, z }
DamageArea(self, position, 5, 1000, 'Default', true, false)
DamageArea(self, position, 5, 1, 'TreeForce', false)
explosion.CreateDefaultHitExplosionAtBone(self, bone, 5.0)
explosion.CreateDebrisProjectiles(self, explosion.GetAverageBoundingXYZRadius(self),
{ blueprint.SizeX, blueprint.SizeY, blueprint.SizeZ })
Expand Down
4 changes: 3 additions & 1 deletion units/XSA0402/XSA0402_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ XSA0402 = ClassUnit(SAirUnit) {
end,

OnAnimTerrainCollision = function(self, bone,x,y,z)
DamageArea(self, {x,y,z}, 5, 1000, 'Default', true, false)
local position = {x, y, z}
DamageArea(self, position, 5, 1000, 'Default', true, false)
DamageArea(self, position, 5, 1, 'TreeForce', false)
explosion.CreateDefaultHitExplosionAtBone( self, bone, 5.0 )
explosion.CreateDebrisProjectiles(self, explosion.GetAverageBoundingXYZRadius(self), {self:GetUnitSizes()})
end,
Expand Down

0 comments on commit 7d07626

Please sign in to comment.