Skip to content

Fix AutoDeath not triggering after type replacement that bypasses ConvertToType - #2359

Open
DeathFishAtEase wants to merge 1 commit into
Phobos-developers:developfrom
DeathFishAtEase:fix2353
Open

Fix AutoDeath not triggering after type replacement that bypasses ConvertToType#2359
DeathFishAtEase wants to merge 1 commit into
Phobos-developers:developfrom
DeathFishAtEase:fix2353

Conversation

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator

What kind of change is this?

  • New feature, vanilla bugfix or enhancement of a released feature - changelog, docs and credits entries are needed.
  • Improvement to a new (unreleased) feature - docs and credits entries are needed; no changelog entry (Skip Changelog).
  • Bugfix to a new (unreleased) feature - credits entry is needed; no changelog or docs entries (Skip Changelog, Skip Docs).
  • Bugfix to an old (released) feature - changelog and credits entries are needed; no docs entry (Skip Docs).
  • Completely minor change (e.g. a typo fix) - no entries are needed (Skip Changelog, Skip Docs, Skip Credits).

Description

Resolve #2353

Type replacement that bypasses ConvertToType (e.g. visceroid merge) leaves TechnoExt::TypeExtData stale, so AutoDeath never fires. Resync the extension once per object via UpdateTypeData + RegisterAutoDeath in CheckDeathConditions.

@DeathFishAtEase DeathFishAtEase self-assigned this Aug 21, 2026
@DeathFishAtEase DeathFishAtEase added Skip Docs PR does not need a documentation entry ❓Phobos bug Something isn't working properly Needs testing ⚙️T1 T1 maintainer review is sufficient labels Aug 21, 2026
@github-actions

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@TaranDahl

Copy link
Copy Markdown
Contributor

Why not change those type replacements to use ConvertToType?

@Coronia

Coronia commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

if there're still cases that bypass type conversion then maybe we should just revert #2300 since it's not just about AutoDeath. Though this will bring a noticeable lag source which I think it's not worthy for a case that's rarely used

ideal solution will be patching these cases to let them execute UpdateTypeExtData only once when they're converted, but maybe it's inconvenient to rewrite it for some cases. IDK what would be the best option here

@DeathFishAtEase

DeathFishAtEase commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

TaranDahl 2026-08-21 19:20 (UTC+8)

Why not change those type replacements to use ConvertToType?

I didn't choose this solution initially because I wasn't sure whether ConvertToType fully includes the functionality of LargeVisceroid beyond the "two into one" aspect.

For such customization features that are only used for specific settings, I don't favor rewriting them into a more generic form - we can certainly extract the main logic and create a copy under a general framework - but for these features themselves, if some characteristics are broken (even if they are not commendable from many perspectives), it might not necessarily be good (for example, ConvertToType recalculates HP, while synthesizing a LargeVisceroid is a plain pDest->Health = pLargeType->Strength;): those mods that faithfully replicate Tiberian Sun will come to complain about our changes.

Coronia 2026-08-21 19:22 (UTC+8)

since it's not just about AutoDeath.

I think all similar scenarios have been affected.

@Rhosalth7, could you try whether ScriptAction#44 and ScriptAction#45 also have the same issue, and whether they are also normal in DevBuild#48 but problematic in v0.5-alpha?

@Rhosalth7

Copy link
Copy Markdown

TaranDahl 2026-08-21 19:20 (UTC+8)

Why not change those type replacements to use ConvertToType?

I didn't choose this solution initially because I wasn't sure whether ConvertToType fully includes the functionality of LargeVisceroid beyond the "two into one" aspect.

For such customization features that are only used for specific settings, I don't favor rewriting them into a more generic form - we can certainly extract the main logic and create a copy under a general framework - but for these features themselves, if some characteristics are broken (even if they are not commendable from many perspectives), it might not necessarily be good (for example, ConvertToType recalculates HP, while synthesizing a LargeVisceroid is a plain pDest->Health = pLargeType->Strength;): those mods that faithfully replicate Tiberian Sun will come to complain about our changes.

Coronia 2026-08-21 19:22 (UTC+8)

since it's not just about AutoDeath.

I think all similar scenarios have been affected.

@Rhosalth7, could you try whether ScriptAction#44 and ScriptAction#45 also have the same issue, and whether they are also normal in DevBuild#48 but problematic in v0.5-alpha?

The script actions work fine with the trucka and truckb from what i noticed

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator Author

I mean that replacing a unit without the auto death attribute with a unit that has the auto death attribute through these two scripts might also not execute auto death.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs testing ❓Phobos bug Something isn't working properly Skip Docs PR does not need a documentation entry ⚙️T1 T1 maintainer review is sufficient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoDeath.Behavior logic doesn't fire when used with visceroid logic issue

4 participants