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

Make air staging detach units when killed #6665

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/snippets/balance.6665.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6665) Air staging now detaches aircraft when killed or ctrl-k'd (to work around an engine bug where aircraft get stuck inside air staging).
2 changes: 1 addition & 1 deletion engine/Sim/Entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ end
function Entity:IsValidBone(bone, allowNil)
end

---@overload fun():
---@overload fun()
---@param instigator Unit
---@param damageType DamageType
---@param excessDamageRatio number
Expand Down
18 changes: 17 additions & 1 deletion lua/sim/units/AirStagingPlatformUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,20 @@
local StructureUnit = import("/lua/sim/units/structureunit.lua").StructureUnit

---@class AirStagingPlatformUnit : StructureUnit
AirStagingPlatformUnit = ClassUnit(StructureUnit) {}
AirStagingPlatformUnit = ClassUnit(StructureUnit) {
--- Detach units from air staging on death to allow working around an engine bug
--- where units get stuck in the air staging.
---@param self AirStagingPlatformUnit
---@param instigator Unit
---@param damageType DamageType
---@param excessDamageRatio number
Kill = function(self, instigator, damageType, excessDamageRatio)
self:TransportDetachAllUnits(false)
-- `Kill` can only be called with 4 args or 1 arg
if instigator then
StructureUnit.Kill(self, instigator, damageType, excessDamageRatio)
else
StructureUnit.Kill(self)
end
end,
}
Loading