Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable collisions with dead units consistently #6543

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Nov 18, 2024

Issue

This bit of code runs for all units and causes them to wait while dead before being destroyed, making them block damage when they shouldn't:

fa/lua/sim/Unit.lua

Lines 1982 to 1994 in 9948335

DestroyUnit = function(self, overkillRatio)
self:CreateWreckage(overkillRatio or self.overkillRatio)
-- wait at least 1 tick before destroying unit
WaitSeconds(math.max(0.1, self.DeathThreadDestructionWaitTime))
-- do not play sound after sinking
if not self.Sinking then
self:PlayUnitSound('Destroyed')
end
self:Destroy()
end,

This code does the same, but makes up a much more significant portion of the wait time (0-0.5 seconds vs 0.1)

fa/lua/sim/Unit.lua

Lines 1921 to 1924 in 9948335

DeathThread = function(self, overkillRatio, instigator)
local isNaval = EntityCategoryContains(categories.NAVAL, self)
local shallSink = self:ShallSink()
WaitSeconds(utilities.GetRandomFloat(self.DestructionExplosionWaitDelayMin, self.DestructionExplosionWaitDelayMax))

For a practical example, spawn a line of hives and an enemy monkeylord. The monkeylord's laser will be blocked while the dead hive is going through its explosion FX.

Description of the proposed changes

  • add DisallowCollisions = true to OnKilled as that is the entry point for all the issues that arise with collisions after death (DeathThreadDestructionWaitTime, sinking, and death animations)
    • remove the statement in the sinking and death animation cases as it is no longer necessary

Testing done on the proposed changes

  • Monkeylord can laser through a line of hives without getting blocked
  • Monkeylord can kill a cruiser, then kill another cruiser spawned 1 ogrid behind the dead one (the sinking cruiser's hitbox remains on the surface)
  • Monkeylord can kill a monkeylord and the laser immediately goes through to a target behind the monkeylord in the death animation

Additional context

This does not apply to air units because they overwrite OnKilled.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game labels Nov 18, 2024
@lL1l1 lL1l1 marked this pull request as ready for review November 18, 2024 03:49
@lL1l1 lL1l1 added this to the Development I of 2025 milestone Nov 21, 2024
@clyfordv clyfordv self-assigned this Nov 26, 2024
Copy link
Contributor

@clyfordv clyfordv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes work as advertised. Looks better IMO, definitely a bit of buff to continuous heavy beam weapons.

@lL1l1 lL1l1 added the area: balance related to units balance, but not as a suggestion label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: balance related to units balance, but not as a suggestion area: sim Area that is affected by the Simulation of the Game type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants