-
-
Notifications
You must be signed in to change notification settings - Fork 27
Fix Deadline Immortality (Revised) #694
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
base: develop
Are you sure you want to change the base?
Conversation
Destroy all Deadlines with the death of the last Countdown
| local NUtils = import('/lua/nomadsutils.lua') | ||
|
|
||
| --- Tech 3 Stationary Artillery | ||
| ---@class XNB2302 : NStructureUnit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please re-add the annotations.
| --Destroy all orbital on Countdown's death | ||
| local units = self:GetAIBrain():GetListOfUnits(categories.EXPERIMENTAL, false, false) | ||
| local toRemove = {} | ||
| for i, unit in ipairs(units) do | ||
| local name = unit:GetBlueprint().General.UnitName | ||
|
|
||
| --abort if another Countdown still exists | ||
| if unit:GetUnitId() == "xnb2302" and unit:GetEntityId() ~= self:GetEntityId() then return end | ||
| if unit:GetUnitId() == "xno2302" then | ||
| toRemove[i] = unit | ||
| end | ||
| end | ||
|
|
||
| for _, unit in pairs(toRemove) do | ||
| unit:Kill() | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You can use the unit's blueprint id (which is lowercase) as a category
- FAF adds
Unit.Brainas a quicker replacement forUnit:GetAIBrain() - FAF adds
Unit.Deadto check death status. For this station, it will be set to true in theOnKilledyou called earlier. For other stations, we have to check it just in case multiple stations die at the same time and a different station exists as a unit but is in its death animation (the entity ID check doesn't work for that case).
| --Destroy all orbital on Countdown's death | |
| local units = self:GetAIBrain():GetListOfUnits(categories.EXPERIMENTAL, false, false) | |
| local toRemove = {} | |
| for i, unit in ipairs(units) do | |
| local name = unit:GetBlueprint().General.UnitName | |
| --abort if another Countdown still exists | |
| if unit:GetUnitId() == "xnb2302" and unit:GetEntityId() ~= self:GetEntityId() then return end | |
| if unit:GetUnitId() == "xno2302" then | |
| toRemove[i] = unit | |
| end | |
| end | |
| for _, unit in pairs(toRemove) do | |
| unit:Kill() | |
| end | |
| -- If no other Countdowns exist, kill all Deadline satellites | |
| local brain = self.Brain | |
| local stations = brain:GetListOfUnits(categories.xnb2302, false, true) | |
| for _, station in stations do | |
| if not station.Dead then | |
| return | |
| end | |
| end | |
| local satellites = brain:GetListOfUnits(categories.xno2302, false, true) | |
| for _, satellite in satellites do | |
| satellite:Kill() | |
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The satellites cost a lot, so maybe it can be more fun to disable their weapons, movement, and selectability once all stations are dead. You would also have to handle re-enabling all satellites once a station is rebuilt.
satellite:SetAllWeaponsEnabled(false)
satellite:SetUnSelectable(true)
satellite:SetImmobile(true)
##what
This fixes the orbital unit's inability to be destroyed.
Currently, Deadline is indestructible upon being built. This is in contrast to how the other satellite artillery from UEF functions where it can be taken down by destroying the central command building.
##why
It makes it impossible for games started in 'Annihilation' gamemode (which requires every enemy unit to be destroyed) to end.
##how
All Deadlines are destroyed in the OnKilled event of Countdown as long as there are no other Countdowns.