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

Check if instigator is destroyed in Fatboy DeathThread #6629

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/fix.6629.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6629) Fix a rare error that would cause the Fatboy to not finish dying.
5 changes: 4 additions & 1 deletion units/UEL0401/UEL0401_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ local EffectUtil = import("/lua/effectutilities.lua")
local ExternalFactoryComponent = import("/lua/defaultcomponents.lua").ExternalFactoryComponent
local DefaultExplosions = import("/lua/defaultexplosions.lua")

local IsDestroyed = IsDestroyed

---@class UEL0401 : TMobileFactoryUnit, ExternalFactoryComponent
---@field UnitBeingBuilt Unit | nil
---@field AttachmentSliderManip moho.SlideManipulator
Expand Down Expand Up @@ -258,7 +260,8 @@ UEL0401 = ClassUnit(TMobileFactoryUnit, ExternalFactoryComponent) {
local explosionBones = {}
local explosionBoneCount = table.getn(self.ExplosionBones)

if instigator then
-- Since this is a thread, it is delayed by 1 tick so the instigator may be destroyed
if not IsDestroyed(instigator) then
-- if there is an instigator, favor exploding bits that are near the instigator
local ix, iy, iz = instigator:GetPositionXYZ()
for k, bone in self.ExplosionBones do
Expand Down
Loading