Skip to content
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 CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 defining for AutoDeath on whether it can trigger when in Limbo state or as a passenger
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
12 changes: 12 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1978,12 +1978,20 @@ 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.
- `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
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
Expand All @@ -2004,6 +2012,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.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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)
Expand Down
7 changes: 4 additions & 3 deletions src/Ext/House/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,16 @@ 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) && !(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);

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)
Expand All @@ -233,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;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Ext/Techno/Body.Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,14 @@ 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();

if (pThis->Transporter && !pTypeExt->AutoDeath_AllowPassenger)
return false;

// Self-destruction must be enabled
const auto howToDie = pTypeExt->AutoDeath_Behavior.Get();

Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,8 @@ 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_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");
Expand Down Expand Up @@ -1552,6 +1554,8 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Ammo_DeployUnlockMaximumAmount)

.Process(this->AutoDeath_Behavior)
.Process(this->AutoDeath_AllowLimboed)
.Process(this->AutoDeath_AllowPassenger)
.Process(this->AutoDeath_VanishAnimation)
.Process(this->AutoDeath_OnAmmoDepletion)
.Process(this->AutoDeath_OnOwnerChange)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class TechnoTypeExt
Valueable<int> Ammo_DeployUnlockMaximumAmount;

Nullable<AutoDeathBehavior> AutoDeath_Behavior;
Valueable<bool> AutoDeath_AllowLimboed;
Valueable<bool> AutoDeath_AllowPassenger;
ValueableVector<AnimTypeClass*> AutoDeath_VanishAnimation;
Valueable<bool> AutoDeath_OnAmmoDepletion;
Valueable<bool> AutoDeath_OnOwnerChange;
Expand Down Expand Up @@ -647,6 +649,8 @@ class TechnoTypeExt
, Ammo_DeployUnlockMaximumAmount { -1 }

, AutoDeath_Behavior { }
, AutoDeath_AllowLimboed { true }
, AutoDeath_AllowPassenger { true }
, AutoDeath_VanishAnimation {}
, AutoDeath_OnAmmoDepletion { false }
, AutoDeath_OnOwnerChange { false }
Expand Down
Loading