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 @@ -510,6 +510,7 @@ This page lists all the individual contributions to the project by their author.
- Fix the issue that `PassengerDeletion` dont consider passenger's passenger, parasite and hijacker
- Fix the issue that power output of building on tooltip won't consider power enhancer
- Fix the bug that the upgrade building's power-enhancing effect depends only on its parent building and is not related to the upgrade building itself
- Customize which parasite can remove by warhead
- **Apollo** - Translucent SHP drawing patches
- **ststl**:
- Customizable `ShowTimer` priority of superweapons
Expand Down
8 changes: 6 additions & 2 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2644,11 +2644,15 @@ Due to the nature of some superweapon types, not all superweapons are suitable f
### Parasite removal

- By default if unit takes negative damage from a Warhead (before `Verses` are calculated), any parasites infecting it are removed and deleted. This behaviour can now be customized to disable the removal for negative damage, or enable it for any arbitrary warhead.
- `RemoveParasite.Allow` can be used to define which parasites can be removed.
- `RemoveParasite.Disallow` can be used to define which parasites cannot be removed.

In `rulesmd.ini`:
```ini
[SOMEWARHEAD] ; WarheadType
RemoveParasite= ; boolean
[SOMEWARHEAD] ; WarheadType
RemoveParasite= ; boolean
RemoveParasite.Allow= ; List of TechnoTypes
RemoveParasite.Disallow= ; List of TechnoTypes
```

### Penetrates damage on transporter
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ New:
- [Custom hover vehicles shutdown drowning death](New-or-Enhanced-Logics.md#custom-hover-vehicles-shutdown-drowning-death) (by FlyStar)
- [SHP turret vehicles support the use of `*tur.shp` files](New-or-Enhanced-Logics.md#independent-shp-vehicle-turret-files) (by FlyStar)
- [Implement `CurleyShuffle` for AircraftTypes](Fixed-or-Improved-Logics.md#implement-curleyshuffle-for-aircrafttypes) (ported from Vinifera by Noble_Fish)
- Customize which parasite can remove by warhead (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
3 changes: 3 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/CREDITS.po
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,9 @@ msgid ""
"itself"
msgstr "修复了加载物建筑的电厂增幅效果仅取决于其基底建筑而非加载物建筑自身的 Bug"

msgid "Customize which parasite can remove by warhead"
msgstr "自定义哪些寄生者可被弹头移除"

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

Expand Down
12 changes: 12 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 @@ -5600,6 +5600,18 @@ msgstr ""
"默认情况下如果单位从弹头收到负伤害(在 `Verses` "
"前计算)任何寄生单位都会被移除和删除。现在可以自定义此行为以禁用负伤害的移除效果或为任意弹头启用它。"

msgid ""
"`RemoveParasite.Allow` can be used to define which parasites can be "
"removed."
msgstr ""
"`RemoveParasite.Allow` 定义哪些寄生者可以被移除。"

msgid ""
"`RemoveParasite.Disallow` can be used to define which parasites cannot be"
" removed."
msgstr ""
"`RemoveParasite.Disallow` 定义哪些寄生者不能被移除。"

msgid "Penetrates damage on transporter"
msgstr "对运输工具的穿透伤害"

Expand Down
3 changes: 3 additions & 0 deletions docs/locale/zh_CN/LC_MESSAGES/Whats-New.po
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,9 @@ msgstr ""
"[实现战机微观 `CurleyShuffle` 设置](Fixed-or-Improved-Logics.md#implement-"
"curleyshuffle-for-aircrafttypes)(由 Noble_Fish 移植自 Vinifera)"

msgid "Customize which parasite can remove by warhead (by NetsuNegi)"
msgstr "自定义哪些寄生者可被弹头移除(by NetsuNegi)"

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

Expand Down
4 changes: 4 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->RemoveDisguise.Read(exINI, pSection, "RemoveDisguise");
this->RemoveMindControl.Read(exINI, pSection, "RemoveMindControl");
this->RemoveParasite.Read(exINI, pSection, "RemoveParasite");
this->RemoveParasite_Allow.Read(exINI, pSection, "RemoveParasite.Allow");
this->RemoveParasite_Disallow.Read(exINI, pSection, "RemoveParasite.Disallow");
this->DecloakDamagedTargets.Read(exINI, pSection, "DecloakDamagedTargets");
this->ShakeIsLocal.Read(exINI, pSection, "ShakeIsLocal");
this->ApplyModifiersOnNegativeDamage.Read(exINI, pSection, "ApplyModifiersOnNegativeDamage");
Expand Down Expand Up @@ -521,6 +523,8 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm)
.Process(this->RemoveDisguise)
.Process(this->RemoveMindControl)
.Process(this->RemoveParasite)
.Process(this->RemoveParasite_Allow)
.Process(this->RemoveParasite_Disallow)
.Process(this->DecloakDamagedTargets)
.Process(this->ShakeIsLocal)
.Process(this->ApplyModifiersOnNegativeDamage)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class WarheadTypeExt
Valueable<bool> RemoveDisguise;
Valueable<bool> RemoveMindControl;
Nullable<bool> RemoveParasite;
ValueableVector<TechnoTypeClass*> RemoveParasite_Allow;
ValueableVector<TechnoTypeClass*> RemoveParasite_Disallow;
Valueable<bool> DecloakDamagedTargets;
Valueable<bool> ShakeIsLocal;
Valueable<bool> ApplyModifiersOnNegativeDamage;
Expand Down Expand Up @@ -286,6 +288,8 @@ class WarheadTypeExt
, RemoveDisguise { false }
, RemoveMindControl { false }
, RemoveParasite {}
, RemoveParasite_Allow {}
, RemoveParasite_Disallow {}
, DecloakDamagedTargets { true }
, ShakeIsLocal { false }
, ApplyModifiersOnNegativeDamage { false }
Expand Down
9 changes: 8 additions & 1 deletion src/Ext/WarheadType/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,18 @@ DEFINE_HOOK(0x4D73DE, FootClass_ReceiveDamage_RemoveParasite, 0x5)
GET(WarheadTypeClass*, pWarhead, EBP);
GET(const int*, damage, EDI);

auto const pTypeExt = WarheadTypeExt::ExtMap.Find(pWarhead);
const auto pTypeExt = WarheadTypeExt::ExtMap.Find(pWarhead);

if (!pTypeExt->RemoveParasite.Get(*damage < 0))
return Skip;

GET(FootClass*, pParasite, EDX);
const auto pParasiteType = pParasite->GetTechnoType();

if (pTypeExt->RemoveParasite_Disallow.Contains(pParasiteType)
|| (!pTypeExt->RemoveParasite_Allow.empty() && !pTypeExt->RemoveParasite_Allow.Contains(pParasiteType)))
return Skip;

return Continue;
}

Expand Down
Loading