From a95d8870fbcd313bd080ff3a73266066fe5a1ed8 Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Jul 2026 18:45:11 +0800 Subject: [PATCH 1/8] initial --- CREDITS.md | 1 + docs/New-or-Enhanced-Logics.md | 2 ++ docs/Whats-New.md | 1 + src/Ext/House/Hooks.cpp | 32 ++++++++++++++++++-------------- src/Ext/Techno/Body.Update.cpp | 3 +++ src/Ext/TechnoType/Body.cpp | 2 ++ src/Ext/TechnoType/Body.h | 2 ++ 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 2adb1c7ce4..3c018256c7 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -695,6 +695,7 @@ This page lists all the individual contributions to the project by their author. - Customize the step limit of the credits indicator - Disable the credits indicator smooth transition - Add `selling`, `undeploying` and `harvesting` conditions to `DiscardOn` + - Add a definition flag for whether AutoDeath can trigger in Limbo state - **Ollerus**: - Build limit group enhancement - Customizable rocker amplitude diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index ec9ae2bdcc..9b10f06311 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1978,12 +1978,14 @@ Both `InitialStrength` and `InitialStrength.Cloning` never surpass the type's `S - `vanish`: The object will be directly removed from the game peacefully instead of actually getting killed. - `sell`: If the object is a **building** with buildup, it will be sold instead of destroyed. - If this option is not set, the self-destruction logic will not be enabled. `AutoDeath.VanishAnimation` can be set to animation to play at object's location if `vanish` behaviour is chosen. If more than one animation is listed, a random one is selected. +- `AutoDeath.AllowLimboed` can be used to define whether AutoDeath is triggered when the unit is in limbo state, such as when it is a passenger. - This logic also supports buildings delivered by [LimboDelivery](#limbodelivery). However in this case, all `AutoDeath.Behavior` values produce identical result where the building is simply deleted. In `rulesmd.ini`: ```ini [SOMETECHNO] ; TechnoType AutoDeath.Behavior= ; enumeration (kill | vanish | sell), default not set +AutoDeath.AllowLimboed=true ; boolean AutoDeath.VanishAnimation= ; List of AnimationTypes AutoDeath.OnAmmoDepletion=false ; boolean AutoDeath.OnOwnerChange=false ; boolean diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 2c98a36155..5e2785e715 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -606,6 +606,7 @@ HideShakeEffects=false ; boolean - [Customize the step limit of the credits indicator](User-Interface.md#customize-the-step-limit-of-the-credits-indicator) (by Noble_Fish) - [Disable the credits indicator smooth transition](User-Interface.md#disable-the-credits-indicator-smooth-transition) (by Noble_Fish) - Add `selling`, `undeploying` and `harvesting` conditions to `DiscardOn` (by Noble_Fish) +- Add a definition flag for whether AutoDeath can trigger in Limbo state (by Noble_Fish) #### Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index 1a0ea72a7a..fb70d38b93 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -217,24 +217,28 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if (pTypeExt->AutoDeath_Behavior.isset()) { - const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange); - const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange); - - if (humanToComputer && computerToHuman) - { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); - return 0; - } - else if (humanToComputer || computerToHuman) + const bool isInLimbo = !pThis->IsInLogic && pThis->IsAlive; + if (!(isInLimbo && !pTypeExt->AutoDeath_AllowLimboed)) { - const bool I_am_human = pThis->Owner->IsControlledByHuman(); + const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange); + const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange); - if (I_am_human != pNewOwner->IsControlledByHuman()) + if (humanToComputer && computerToHuman) { - if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); + return 0x701881; + } + else if (humanToComputer || computerToHuman) + { + const bool I_am_human = pThis->Owner->IsControlledByHuman(); + + if (I_am_human != pNewOwner->IsControlledByHuman()) { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); - return 0; + if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) + { + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); + return 0x701881; + } } } } diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index 1cb770f357..dac1591d81 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -282,6 +282,9 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo) if (!pTypeExt->AutoDeath_Behavior.isset()) return false; + if (isInLimbo && !pTypeExt->AutoDeath_AllowLimboed) + return false; + auto const pThis = this->OwnerObject(); // Self-destruction must be enabled diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index d77b610154..ea18fe1857 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -792,6 +792,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->Ammo_DeployUnlockMaximumAmount.Read(exINI, pSection, "Ammo.DeployUnlockMaximumAmount"); this->AutoDeath_Behavior.Read(exINI, pSection, "AutoDeath.Behavior"); + this->AutoDeath_AllowLimboed.Read(exINI, pSection, "AutoDeath.AllowLimboed"); this->AutoDeath_VanishAnimation.Read(exINI, pSection, "AutoDeath.VanishAnimation"); this->AutoDeath_OnAmmoDepletion.Read(exINI, pSection, "AutoDeath.OnAmmoDepletion"); this->AutoDeath_OnOwnerChange.Read(exINI, pSection, "AutoDeath.OnOwnerChange"); @@ -1552,6 +1553,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->Ammo_DeployUnlockMaximumAmount) .Process(this->AutoDeath_Behavior) + .Process(this->AutoDeath_AllowLimboed) .Process(this->AutoDeath_VanishAnimation) .Process(this->AutoDeath_OnAmmoDepletion) .Process(this->AutoDeath_OnOwnerChange) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index 3237832272..f230e2a9d4 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -91,6 +91,7 @@ class TechnoTypeExt Valueable Ammo_DeployUnlockMaximumAmount; Nullable AutoDeath_Behavior; + Valueable AutoDeath_AllowLimboed; ValueableVector AutoDeath_VanishAnimation; Valueable AutoDeath_OnAmmoDepletion; Valueable AutoDeath_OnOwnerChange; @@ -647,6 +648,7 @@ class TechnoTypeExt , Ammo_DeployUnlockMaximumAmount { -1 } , AutoDeath_Behavior { } + , AutoDeath_AllowLimboed { true } , AutoDeath_VanishAnimation {} , AutoDeath_OnAmmoDepletion { false } , AutoDeath_OnOwnerChange { false } From 2ee1e3a0fceee96aec893683490a4bddc41deacd Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Jul 2026 21:00:28 +0800 Subject: [PATCH 2/8] update --- src/Ext/House/Hooks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index fb70d38b93..248c0d7be6 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -226,7 +226,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if (humanToComputer && computerToHuman) { TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0x701881; + return 0; } else if (humanToComputer || computerToHuman) { @@ -237,7 +237,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) { TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0x701881; + return 0; } } } From dbdfead7f3c46ed36dabeb89f7a29aa20479349f Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Jul 2026 21:19:59 +0800 Subject: [PATCH 3/8] update --- src/Ext/House/Hooks.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index 248c0d7be6..c58330cf6e 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -214,31 +214,28 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) auto const pExt = TechnoExt::ExtMap.Find(pThis); auto const pTypeExt = pExt->TypeExtData; + const bool isInLimbo = !pThis->IsInLogic && pThis->IsAlive; - if (pTypeExt->AutoDeath_Behavior.isset()) + if (pTypeExt->AutoDeath_Behavior.isset() && !(isInLimbo && !pTypeExt->AutoDeath_AllowLimboed)) { - const bool isInLimbo = !pThis->IsInLogic && pThis->IsAlive; - if (!(isInLimbo && !pTypeExt->AutoDeath_AllowLimboed)) + const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange); + const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange); + + if (humanToComputer && computerToHuman) + { + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); + return 0; + } + else if (humanToComputer || computerToHuman) { - const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange); - const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange); + const bool I_am_human = pThis->Owner->IsControlledByHuman(); - if (humanToComputer && computerToHuman) + if (I_am_human != pNewOwner->IsControlledByHuman()) { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0; - } - else if (humanToComputer || computerToHuman) - { - const bool I_am_human = pThis->Owner->IsControlledByHuman(); - - if (I_am_human != pNewOwner->IsControlledByHuman()) + if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) { - if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) - { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0; - } + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); + return 0; } } } From 506b21f6117f5645366f864729eab8f46c945eb0 Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Mon, 6 Jul 2026 22:14:55 +0800 Subject: [PATCH 4/8] update --- src/Ext/House/Hooks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index c58330cf6e..ff2f95297e 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -223,7 +223,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if (humanToComputer && computerToHuman) { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); return 0; } else if (humanToComputer || computerToHuman) @@ -234,7 +234,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) { if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive); + TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); return 0; } } From 72636ef01006cb010da1950c60a265369e580951 Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Tue, 7 Jul 2026 00:29:24 +0800 Subject: [PATCH 5/8] add passengrs check The technos in OpenTopped transport units do not have their InLimbo set to true --- CREDITS.md | 2 +- docs/New-or-Enhanced-Logics.md | 7 ++++++- docs/Whats-New.md | 2 +- src/Ext/House/Hooks.cpp | 2 +- src/Ext/Techno/Body.Update.cpp | 3 +++ src/Ext/TechnoType/Body.cpp | 2 ++ src/Ext/TechnoType/Body.h | 2 ++ 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 3c018256c7..fe1acf4011 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -695,7 +695,7 @@ This page lists all the individual contributions to the project by their author. - Customize the step limit of the credits indicator - Disable the credits indicator smooth transition - Add `selling`, `undeploying` and `harvesting` conditions to `DiscardOn` - - Add a definition flag for whether AutoDeath can trigger in Limbo state + - Add a defining for AutoDeath on whether it can trigger when in Limbo state or as a passenger - **Ollerus**: - Build limit group enhancement - Customizable rocker amplitude diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 9b10f06311..88554881cc 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1978,9 +1978,14 @@ Both `InitialStrength` and `InitialStrength.Cloning` never surpass the type's `S - `vanish`: The object will be directly removed from the game peacefully instead of actually getting killed. - `sell`: If the object is a **building** with buildup, it will be sold instead of destroyed. - If this option is not set, the self-destruction logic will not be enabled. `AutoDeath.VanishAnimation` can be set to animation to play at object's location if `vanish` behaviour is chosen. If more than one animation is listed, a random one is selected. -- `AutoDeath.AllowLimboed` can be used to define whether AutoDeath is triggered when the unit is in limbo state, such as when it is a passenger. +- `AutoDeath.AllowLimboed` can be used to define whether AutoDeath is triggered when the unit is in limbo state. +- `AutoDeath.AllowPassenger` can be used to define whether the unit triggers AutoDeath when it is a passenger. - This logic also supports buildings delivered by [LimboDelivery](#limbodelivery). However in this case, all `AutoDeath.Behavior` values produce identical result where the building is simply deleted. +```{hint} +If the unit is a passenger in a transport with `OpenTopped=false`, then self-destruction will only be triggered when both `AutoDeath.AllowLimboed` and `AutoDeath.AllowPassenger` are `true`. +``` + In `rulesmd.ini`: ```ini [SOMETECHNO] ; TechnoType diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 5e2785e715..a69f6b4da5 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -606,7 +606,7 @@ HideShakeEffects=false ; boolean - [Customize the step limit of the credits indicator](User-Interface.md#customize-the-step-limit-of-the-credits-indicator) (by Noble_Fish) - [Disable the credits indicator smooth transition](User-Interface.md#disable-the-credits-indicator-smooth-transition) (by Noble_Fish) - Add `selling`, `undeploying` and `harvesting` conditions to `DiscardOn` (by Noble_Fish) -- Add a definition flag for whether AutoDeath can trigger in Limbo state (by Noble_Fish) +- Add a defining for AutoDeath on whether it can trigger when in Limbo state or as a passenger (by Noble_Fish) #### Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index ff2f95297e..309b2c1817 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -216,7 +216,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) auto const pTypeExt = pExt->TypeExtData; const bool isInLimbo = !pThis->IsInLogic && pThis->IsAlive; - if (pTypeExt->AutoDeath_Behavior.isset() && !(isInLimbo && !pTypeExt->AutoDeath_AllowLimboed)) + if (pTypeExt->AutoDeath_Behavior.isset() && !(isInLimbo && !pTypeExt->AutoDeath_AllowLimboed) && !(pThis->Transporter && !pTypeExt->AutoDeath_AllowPassenger)) { const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange); const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange); diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index dac1591d81..18a32d8a52 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -287,6 +287,9 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo) auto const pThis = this->OwnerObject(); + if (pThis->Transporter && !pTypeExt->AutoDeath_AllowPassenger) + return false; + // Self-destruction must be enabled const auto howToDie = pTypeExt->AutoDeath_Behavior.Get(); diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index ea18fe1857..781a616daf 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -793,6 +793,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->AutoDeath_Behavior.Read(exINI, pSection, "AutoDeath.Behavior"); this->AutoDeath_AllowLimboed.Read(exINI, pSection, "AutoDeath.AllowLimboed"); + this->AutoDeath_AllowPassenger.Read(exINI, pSection, "AutoDeath.AllowPassenger"); this->AutoDeath_VanishAnimation.Read(exINI, pSection, "AutoDeath.VanishAnimation"); this->AutoDeath_OnAmmoDepletion.Read(exINI, pSection, "AutoDeath.OnAmmoDepletion"); this->AutoDeath_OnOwnerChange.Read(exINI, pSection, "AutoDeath.OnOwnerChange"); @@ -1554,6 +1555,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->AutoDeath_Behavior) .Process(this->AutoDeath_AllowLimboed) + .Process(this->AutoDeath_AllowPassenger) .Process(this->AutoDeath_VanishAnimation) .Process(this->AutoDeath_OnAmmoDepletion) .Process(this->AutoDeath_OnOwnerChange) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index f230e2a9d4..c04b4ddbee 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -92,6 +92,7 @@ class TechnoTypeExt Nullable AutoDeath_Behavior; Valueable AutoDeath_AllowLimboed; + Valueable AutoDeath_AllowPassenger; ValueableVector AutoDeath_VanishAnimation; Valueable AutoDeath_OnAmmoDepletion; Valueable AutoDeath_OnOwnerChange; @@ -649,6 +650,7 @@ class TechnoTypeExt , AutoDeath_Behavior { } , AutoDeath_AllowLimboed { true } + , AutoDeath_AllowPassenger { true } , AutoDeath_VanishAnimation {} , AutoDeath_OnAmmoDepletion { false } , AutoDeath_OnOwnerChange { false } From 8a9378f993ac591458b9599b9ac27a6d20b985ff Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Tue, 7 Jul 2026 15:58:49 +0800 Subject: [PATCH 6/8] [doc] Add a note for the scenario of `OpenTopped=false`... --- docs/New-or-Enhanced-Logics.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index 88554881cc..a1dbf8d994 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -2011,6 +2011,10 @@ AutoDeath.TechnosExist.Houses=owner ; Affected House Enumeration (non Please notice that if the object is a unit which carries passengers, they will not be released even with the `kill` option **if you are not using Ares 3.0+**. ``` +```{note} +Currently, the scenario where the unit is a passenger in a transport with `OpenTopped=false` can only trigger AutoDeath when the owner changes. This may change in future. +``` + ### Low priority for deploy - You can now set lower priority for TechnoType deploying which means it will be excluded from deploy command if selected together with other units. This will not affect the cursor action which requires no other objects to be selected in the first place. From 59fe978dfe4b73acf26ee9beeefb465e0ecb4997 Mon Sep 17 00:00:00 2001 From: Noble_Fish <1065703286@qq.com> Date: Tue, 7 Jul 2026 18:34:47 +0800 Subject: [PATCH 7/8] update doc --- docs/New-or-Enhanced-Logics.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index a1dbf8d994..2cb462d903 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1991,6 +1991,7 @@ In `rulesmd.ini`: [SOMETECHNO] ; TechnoType AutoDeath.Behavior= ; enumeration (kill | vanish | sell), default not set AutoDeath.AllowLimboed=true ; boolean +AutoDeath.AllowPassenger=true ; boolean AutoDeath.VanishAnimation= ; List of AnimationTypes AutoDeath.OnAmmoDepletion=false ; boolean AutoDeath.OnOwnerChange=false ; boolean From af39b392c41212f6091a424d5dace11a0bdf86ed Mon Sep 17 00:00:00 2001 From: Coronia <2217891145@qq.com> Date: Wed, 8 Jul 2026 18:16:55 +0800 Subject: [PATCH 8/8] make AutoDeath.OwnerChange happen 1 frame later to avoid coupling --- src/Ext/House/Hooks.cpp | 8 ++------ src/Ext/Techno/Body.Update.cpp | 7 +++++++ src/Ext/Techno/Body.cpp | 1 + src/Ext/Techno/Body.h | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Ext/House/Hooks.cpp b/src/Ext/House/Hooks.cpp index 309b2c1817..f3926a2efd 100644 --- a/src/Ext/House/Hooks.cpp +++ b/src/Ext/House/Hooks.cpp @@ -223,8 +223,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if (humanToComputer && computerToHuman) { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0; + pExt->ShouldBeDead = true; } else if (humanToComputer || computerToHuman) { @@ -233,10 +232,7 @@ DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6) if (I_am_human != pNewOwner->IsControlledByHuman()) { if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman)) - { - TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); - return 0; - } + pExt->ShouldBeDead = true; } } } diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index 18a32d8a52..9f6ffaa484 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -293,6 +293,13 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo) // Self-destruction must be enabled const auto howToDie = pTypeExt->AutoDeath_Behavior.Get(); + // You're already dead + if (this->ShouldBeDead) + { + TechnoExt::KillSelf(pThis, howToDie, pTypeExt->AutoDeath_VanishAnimation, isInLimbo); + return true; + } + // Death if no ammo if (pTypeExt->OwnerObject()->Ammo > 0 && pThis->Ammo <= 0 && pTypeExt->AutoDeath_OnAmmoDepletion) { diff --git a/src/Ext/Techno/Body.cpp b/src/Ext/Techno/Body.cpp index 8746ebcee6..f030202523 100644 --- a/src/Ext/Techno/Body.cpp +++ b/src/Ext/Techno/Body.cpp @@ -1342,6 +1342,7 @@ void TechnoExt::ExtData::Serialize(T& Stm) .Process(this->HoverShutdown) .Process(this->LastTargetCrd) .Process(this->LastTargetCrdClearTimer) + .Process(this->ShouldBeDead) ; } diff --git a/src/Ext/Techno/Body.h b/src/Ext/Techno/Body.h index bb31ec98a5..1ece802eb3 100644 --- a/src/Ext/Techno/Body.h +++ b/src/Ext/Techno/Body.h @@ -108,6 +108,7 @@ class TechnoExt bool HasDeployConverted; bool HasUndeployConverted; + bool ShouldBeDead; ExtData(TechnoClass* OwnerObject) : Extension(OwnerObject) , TypeExtData { nullptr } @@ -182,6 +183,7 @@ class TechnoExt , LastTargetCrdClearTimer {} , HasDeployConverted { false } , HasUndeployConverted { false } + , ShouldBeDead { false } { } void OnEarlyUpdate();