Skip to content

Commit abb4cc5

Browse files
[Vanilla Enhancement] Customize particle system of parasite logic (#2103)
In `rulesmd.ini`: ```ini [SOMEWARHEAD] ; WarheadType Parasite.ParticleSystem= ; ParticleSystemType, default to [CombatDamage] -> DefaultSparkSystem Parasite.DisableParticleSystem=false ; boolean ``` --------- Co-authored-by: Noble_Fish <1065703286@qq.com>
1 parent 9362854 commit abb4cc5

6 files changed

Lines changed: 36 additions & 4 deletions

File tree

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ This page lists all the individual contributions to the project by their author.
499499
- Add amount limit of `LimboKill`
500500
- Spawns particle when spawns tiberium by terrain
501501
- Allow draw SuperWeapon timer as percentage
502+
- Customize particle system of parasite logic
502503
- **Apollo** - Translucent SHP drawing patches
503504
- **ststl**:
504505
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,11 +2457,13 @@ DecloakDamagedTargets=true ; boolean
24572457
In `rulesmd.ini`:
24582458
```ini
24592459
[AudioVisual]
2460-
Parasite.GrappleAnim= ; animation
2460+
Parasite.GrappleAnim=SQDG ; AnimationType
24612461

2462-
[SOMEWARHEAD] ; WarheadType
2463-
Parasite.CullingTarget=infantry ; List of Affected Target Enumeration (none|aircraft|infantry|units|all)
2464-
Parasite.GrappleAnim= ; animation
2462+
[SOMEWARHEAD] ; WarheadType
2463+
Parasite.ParticleSystem= ; ParticleSystemType, default to [CombatDamage] -> DefaultSparkSystem
2464+
Parasite.DisableParticleSystem=false ; boolean
2465+
Parasite.CullingTarget=infantry ; List of Affected Target Enumeration (none|aircraft|infantry|units|all)
2466+
Parasite.GrappleAnim= ; AnimationType, default to [AudioVisual] -> Parasite.GrappleAnim
24652467
```
24662468

24672469
### Dehardcode the `ZAdjust` of warhead anim

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ New:
542542
- Spawns particle when spawns tiberium by terrain (by NetsuNegi)
543543
- Allow jumpjet climbing ignore building height (by TaranDahl)
544544
- Allow draw SuperWeapon timer as percentage (by NetsuNegi)
545+
- Customize particle system of parasite logic (by NetsuNegi)
545546
546547
Vanilla fixes:
547548
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

src/Ext/Techno/Hooks.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,26 @@ DEFINE_HOOK(0x62A0AA, ParasiteClass_AI_CullingTarget, 0x5)
795795
return EnumFunctions::IsTechnoEligible(pThis->Victim, pWHExt->Parasite_CullingTarget) ? ExecuteCulling : CannotCulling;
796796
}
797797

798+
DEFINE_HOOK(0x62A0D3, ParasiteClass_AI_ParticleSystem, 0x5)
799+
{
800+
enum { SkipGameCode = 0x62A108 };
801+
802+
//GET(ParasiteClass*, pThis, ESI);
803+
GET_STACK(WarheadTypeClass*, pWarhead, STACK_OFFSET(0x4C, -0x2C));
804+
const auto pWHExt = WarheadTypeExt::ExtMap.Find(pWarhead);
805+
806+
if (pWHExt->Parasite_DisableParticleSystem)
807+
return SkipGameCode;
808+
809+
if (const auto pParticleSysType = pWHExt->Parasite_ParticleSystem.Get(RulesClass::Instance->DefaultSparkSystem))
810+
{
811+
REF_STACK(CoordStruct, coords, STACK_OFFSET(0x4C, -0x18));
812+
GameCreate<ParticleSystemClass>(pParticleSysType, coords, nullptr, nullptr, CoordStruct::Empty, nullptr);
813+
}
814+
815+
return SkipGameCode;
816+
}
817+
798818
DEFINE_HOOK(0x6298CC, ParasiteClass_AI_GrippleAnim, 0x5)
799819
{
800820
enum { SkipGameCode = 0x6298D6 };

src/Ext/WarheadType/Body.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
254254
this->DetonateOnAllMapObjects_AffectTypes.Read(exINI, pSection, "DetonateOnAllMapObjects.AffectTypes");
255255
this->DetonateOnAllMapObjects_IgnoreTypes.Read(exINI, pSection, "DetonateOnAllMapObjects.IgnoreTypes");
256256

257+
this->Parasite_ParticleSystem.Read(exINI, pSection, "Parasite.ParticleSystem");
258+
this->Parasite_DisableParticleSystem.Read(exINI, pSection, "Parasite.DisableParticleSystem");
257259
this->Parasite_CullingTarget.Read(exINI, pSection, "Parasite.CullingTarget");
258260
this->Parasite_GrappleAnim.Read(exINI, pSection, "Parasite.GrappleAnim");
259261

@@ -603,6 +605,8 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm)
603605
.Process(this->DamageSourceHealthMultiplier)
604606
.Process(this->DamageTargetHealthMultiplier)
605607

608+
.Process(this->Parasite_ParticleSystem)
609+
.Process(this->Parasite_DisableParticleSystem)
606610
.Process(this->Parasite_CullingTarget)
607611
.Process(this->Parasite_GrappleAnim)
608612

src/Ext/WarheadType/Body.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ class WarheadTypeExt
152152
Valueable<bool> InflictLocomotor;
153153
Valueable<bool> RemoveInflictedLocomotor;
154154

155+
Nullable<ParticleSystemTypeClass*> Parasite_ParticleSystem;
156+
Valueable<bool> Parasite_DisableParticleSystem;
155157
Valueable<AffectedTarget> Parasite_CullingTarget;
156158
NullableIdx<AnimTypeClass> Parasite_GrappleAnim;
157159

@@ -392,6 +394,8 @@ class WarheadTypeExt
392394
, InflictLocomotor { false }
393395
, RemoveInflictedLocomotor { false }
394396

397+
, Parasite_ParticleSystem {}
398+
, Parasite_DisableParticleSystem { false }
395399
, Parasite_CullingTarget { AffectedTarget::Infantry }
396400
, Parasite_GrappleAnim {}
397401

0 commit comments

Comments
 (0)