From 27b977c2a24c10770abde40083b0b89648e76076 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:26:38 -0800 Subject: [PATCH 1/3] Disable collisions with dead units consistently --- lua/sim/Unit.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/sim/Unit.lua b/lua/sim/Unit.lua index a77a1a191c..3dead777c8 100644 --- a/lua/sim/Unit.lua +++ b/lua/sim/Unit.lua @@ -1474,6 +1474,9 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni -- this flag is used to skip the need of `IsDestroyed` self.Dead = true + -- don't allow projectiles/beams to collide since we are dead + self.DisallowCollisions = true + local layer = self.Layer local bp = self.Blueprint local army = self.Army @@ -1500,7 +1503,6 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni local FractionThreshold = bp.General.FractionThreshold or 0.5 if self.PlayDeathAnimation and self:GetFractionComplete() > FractionThreshold then self:ForkThread(self.PlayAnimationThread, 'AnimationDeath') - self.DisallowCollisions = true end self:DoUnitCallbacks('OnKilled') @@ -1942,8 +1944,6 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni end if shallSink then - self.DisallowCollisions = true - -- Bubbles and stuff coming off the sinking wreck. self:ForkThread(self.SinkDestructionEffects) From 9948335f0fe0699dead4f1e0070f08ebcfdd9fcc Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:26:55 -0800 Subject: [PATCH 2/3] Update comments --- lua/sim/Unit.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/sim/Unit.lua b/lua/sim/Unit.lua index 3dead777c8..6d2eb1a226 100644 --- a/lua/sim/Unit.lua +++ b/lua/sim/Unit.lua @@ -156,7 +156,7 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni FxDamage2 = {EffectTemplate.DamageFireSmoke01, EffectTemplate.DamageSparks01}, FxDamage3 = {EffectTemplate.DamageFire01, EffectTemplate.DamageSparks01}, - -- Disables all collisions. This will be true for all units being constructed as upgrades + -- Disables all collisions. This will be true for all units being constructed as upgrades and dead units DisallowCollisions = false, -- Destruction parameters @@ -1574,7 +1574,7 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni ---@param firingWeapon Weapon The weapon that the projectile originates from ---@return boolean OnCollisionCheck = function(self, other, firingWeapon) - -- bail out immediately + -- dead unit or unit that is an upgrade if self.DisallowCollisions then return false end @@ -1595,8 +1595,7 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni ---@param firingWeapon Weapon The weapon the beam originates from that we're checking the collision with ---@return boolean OnCollisionCheckWeapon = function(self, firingWeapon) - - -- bail out immediately + -- dead unit or unit that is an upgrade if self.DisallowCollisions then return false end From ac5e5109f829f18528e0b2d05da70f5f69e953fd Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:49:16 -0800 Subject: [PATCH 3/3] Create fix.6543.md --- changelog/snippets/fix.6543.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/snippets/fix.6543.md diff --git a/changelog/snippets/fix.6543.md b/changelog/snippets/fix.6543.md new file mode 100644 index 0000000000..f58d07f048 --- /dev/null +++ b/changelog/snippets/fix.6543.md @@ -0,0 +1 @@ +- (#6543) Fix dead units having collision with projectiles and beams for 0.1-0.6 seconds after death.