Skip to content
Merged
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 @@ -563,6 +563,7 @@ This page lists all the individual contributions to the project by their author.
- Customize crash spin multiplier
- Customize reveal radius of `RevealToAll`
- Fix the bug that technos do not reset their link with the linked building when deactivated
- Customize whether warhead can prevent crew escape from techno
- **Apollo** - Translucent SHP drawing patches
- **ststl**:
- Customizable `ShowTimer` priority of superweapons
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 2 files
+1 −0 BuildingClass.h
+1 −1 TechnoClass.h
10 changes: 10 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -3291,6 +3291,16 @@ UnlimboDetonate.KeepSelected=true ; boolean
`UnlimboDetonate` cannot be used in conjunction with `Parasite`.
```

### Customize whether warhead can prevent crew escape from techno

In `rulesmd.ini`:
```ini
[SOMEWARHEAD] ; WarheadType
PreventCrew=false ; boolean
PreventPassengerEscape=false ; boolean
PreventOccupantEscape=false ; boolean
```

## Weapons

### Allow Laser drawing position update
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ HideShakeEffects=false ; boolean
- SkipMapSelect Enhancement (by FlyStar)
- [Allow the unit to stop immediately if the target enters the range during ApproachTarget](Fixed-or-Improved-Logics.md#stop-immediately-if-the-target-enters-the-range-during-approachtarget) (by TaranDahl)
- [Allow the unit to keep pursuing the target during ApproachTarget](Fixed-or-Improved-Logics.md#keep-pursuing-the-target-during-approachtarget) (by TaranDahl)
- [Customize whether warhead can prevent crew escape from techno](New-or-Enhanced-Logics.md#customize-whether-warhead-can-prevent-crew-escape-from-techno) (by NetsuNegi)

#### Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
4 changes: 4 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/CREDITS.po
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,10 @@ msgid ""
" when deactivated"
msgstr "修复了单位失灵时不会重置其与相链接建筑链接状态的 Bug"

msgid ""
"Customize whether warhead can prevent crew escape from techno"
msgstr "自定义弹头是否阻止生还者逃出"

msgid "**Apollo** - Translucent SHP drawing patches"
msgstr "**Apollo** - 半透明 SHP 绘制补丁"

Expand Down
4 changes: 4 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po
Original file line number Diff line number Diff line change
Expand Up @@ -6515,6 +6515,10 @@ msgstr "`UnlimboDetonate.KeepSelected` 允许单位进出 Limbo 状态前保留
msgid "`UnlimboDetonate` cannot be used in conjunction with `Parasite`."
msgstr "`UnlimboDetonate` 不能与 `Parasite` 共用。"

msgid ""
"Customize whether warhead can prevent crew escape from techno"
msgstr "自定义弹头是否阻止生还者逃出"

msgid "Weapons"
msgstr "武器"

Expand Down
5 changes: 5 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/Whats-New.po
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,11 @@ msgstr ""
"[`600` 配置掉落箱子行为](AI-Scripting-and-Mapping.md#configure-drop-crate)(by "
"FS-21)"

msgid ""
"[Customize whether warhead can prevent crew escape from techno](New-or-Enhanced-Logics.md#customize-whether-warhead-can-prevent-crew-escape-from-techno) (by NetsuNegi)"
msgstr ""
"[自定义弹头是否阻止生还者逃出](New-or-Enhanced-Logics.md#customize-whether-warhead-can-prevent-crew-escape-from-techno)(by NetsuNegi)"

msgid "Vanilla fixes:"
msgstr "原版问题修复:"

Expand Down
1 change: 1 addition & 0 deletions src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,7 @@ void TechnoExt::Serialize(T& Stm)
.Process(this->LastTargetCrd)
.Process(this->LastTargetCrdClearTimer)
.Process(this->ShouldBeDead)
.Process(this->PreventCrew)
;
}

Expand Down
27 changes: 26 additions & 1 deletion src/Ext/Techno/Hooks.ReceiveDamage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,39 @@ DEFINE_HOOK(0x702603, TechnoClass_ReceiveDamage_Explodes, 0x6)
DEFINE_HOOK(0x702672, TechnoClass_ReceiveDamage_RevengeWeapon, 0x5)
{
GET(TechnoClass*, pThis, ESI);
GET_STACK(TechnoClass*, pSource, STACK_OFFSET(0xC4, 0x10));
GET_STACK(WarheadTypeClass*, pWarhead, STACK_OFFSET(0xC4, 0xC));
GET_STACK(TechnoClass*, pSource, STACK_OFFSET(0xC4, 0x10));

TechnoExt::ApplyKillWeapon(pThis, pSource, pWarhead);

if (pSource)
TechnoExt::ApplyRevengeWeapon(pThis, pSource, pWarhead);

const auto pWHExt = WarheadTypeExt::Fetch(pWarhead);

if (pWHExt->PreventCrew)
TechnoExt::Fetch(pThis)->PreventCrew = true;

if (pWHExt->PreventPassengerEscape)
pThis->KillPassengers(pSource);

return 0;
}

DEFINE_HOOK(0x442635, BuildingClass_ReceiveDamage_PreventOccupantEscape, 0x6)
{
enum { SkipClearOccupants = 0x442640 };

GET_STACK(WarheadTypeClass*, pWarhead, STACK_OFFSET(0x9C, 0xC));

if (WarheadTypeExt::Fetch(pWarhead)->PreventOccupantEscape)
{
GET(BuildingClass*, pThis, ESI);
GET_STACK(TechnoClass*, pSource, STACK_OFFSET(0x9C, 0x10));
pThis->KillOccupants(pSource);
return SkipClearOccupants;
}

return 0;
}

Expand Down
32 changes: 32 additions & 0 deletions src/Ext/Techno/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2382,3 +2382,35 @@ void DeactivateTemp::TechnoClassFake::_Deactivate()
}
}
DEFINE_FUNCTION_JUMP(LJMP, 0x70FC90, DeactivateTemp::TechnoClassFake::_Deactivate)

#pragma region Crew

namespace CrewTemp
{
class TechnoClassFake final : public TechnoClass
{
int _GetCrewCount() const
{
const auto pThis = static_cast<const TechnoClass*>(this);
const auto pExt = TechnoExt::Fetch(pThis);
return pExt->PreventCrew ? 0 : pThis->TechnoClass::GetCrewCount();
}
};

class BuildingClassFake final : public BuildingClass
{
int _GetCrewCount() const
{
const auto pThis = static_cast<const BuildingClass*>(this);
const auto pExt = TechnoExt::Fetch(pThis);
return pExt->PreventCrew ? 0 : pThis->BuildingClass::GetCrewCount();
}
};
}

DEFINE_FUNCTION_JUMP(VTABLE, 0x7E2574, CrewTemp::TechnoClassFake::_GetCrewCount) // AircraftClass
DEFINE_FUNCTION_JUMP(VTABLE, 0x7EB328, CrewTemp::TechnoClassFake::_GetCrewCount) // InfantryClass
DEFINE_FUNCTION_JUMP(VTABLE, 0x7F5F40, CrewTemp::TechnoClassFake::_GetCrewCount) // UnitClass
DEFINE_FUNCTION_JUMP(VTABLE, 0x7E418C, CrewTemp::BuildingClassFake::_GetCrewCount) // BuildingClass

#pragma endregion
8 changes: 8 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ void WarheadTypeExt::LoadFromINIFile(CCINIClass* const pINI)

this->Psychedelic_StackingMode.Read(exINI, pSection, "Psychedelic.StackingMode");

this->PreventCrew.Read(exINI, pSection, "PreventCrew");
this->PreventPassengerEscape.Read(exINI, pSection, "PreventPassengerEscape");
this->PreventOccupantEscape.Read(exINI, pSection, "PreventOccupantEscape");

// Convert.From & Convert.To
TypeConvertGroup::Parse(this->Convert_Pairs, exINI, pSection, AffectedHouse::All);

Expand Down Expand Up @@ -793,6 +797,10 @@ void WarheadTypeExt::Serialize(T& Stm)

.Process(this->Psychedelic_StackingMode)

.Process(this->PreventCrew)
.Process(this->PreventPassengerEscape)
.Process(this->PreventOccupantEscape)

// Ares tags
.Process(this->AffectsEnemies)
.Process(this->AffectsOwner)
Expand Down
8 changes: 8 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ class WarheadTypeExt final : public AbstractTypeExt

Nullable<StackingMode> Psychedelic_StackingMode;

Valueable<bool> PreventCrew;
Valueable<bool> PreventPassengerEscape;
Valueable<bool> PreventOccupantEscape;

// Ares tags
// http://ares-developers.github.io/Ares-docs/new/warheads/general.html
Valueable<bool> AffectsEnemies;
Expand Down Expand Up @@ -556,6 +560,10 @@ class WarheadTypeExt final : public AbstractTypeExt
, Taunt { false }

, Psychedelic_StackingMode {}

, PreventCrew { false }
, PreventPassengerEscape { false }
, PreventOccupantEscape { false }
{ }

void ApplyConvert(HouseClass* pHouse, TechnoClass* pTarget);
Expand Down
Loading