Skip to content

Commit 27f0e1b

Browse files
Recipient-specific message and EVA on superweapon activation (Phobos-developers#2196)
Adds recipient-specific message and EVA tags for superweapons: ```ini [SOMESW] ; SuperWeaponType Message.Activated.Owner= ; CSF entry key Message.Activated.Allies= ; CSF entry key Message.Activated.Enemies= ; CSF entry key EVA.Activated.Owner= ; EVA entry EVA.Activated.Allies= ; EVA entry EVA.Activated.Enemies= ; EVA entry ``` - Superweapons can now display messages and play EVA voices for specific recipient groups when activated. - `Message.Activated.Owner` and `EVA.Activated.Owner` are shown / played only for the player who activates the superweapon. - `Message.Activated.Allies` and `EVA.Activated.Allies` are shown / played only for allies of the player who activates the superweapon, excluding the activating player. - `Message.Activated.Enemies` and `EVA.Activated.Enemies` are shown / played only for enemies of the player who activates the superweapon. - Unlike `Message.Activated` and `EVA.Activated`, these are not broadcast to all players. --------- Co-authored-by: Noble_Fish <1065703286@qq.com> Co-authored-by: Noble Fish <89088785+DeathFishAtEase@users.noreply.github.com>
1 parent f668633 commit 27f0e1b

6 files changed

Lines changed: 91 additions & 0 deletions

File tree

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ This page lists all the individual contributions to the project by their author.
822822
- **Flactine**
823823
- Add target filtering options to attacheffect system
824824
- Add veterancy-based target filtering for weapons and warheads
825+
- Recipient-specific message and EVA on superweapon activation
825826
- **tyuah8**:
826827
- Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix
827828
- Destroyed unit leaves sensors bugfix

docs/New-or-Enhanced-Logics.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,26 @@ EMPulse.SuspendOthers=false ; boolean
12121212
`Type=EMPulse` superweapon and any associated keys are [Ares features](https://ares-developers.github.io/Ares-docs/new/superweapons/types/empulse.html).
12131213
```
12141214

1215+
### Recipient-specific message and EVA on superweapon activation
1216+
1217+
- Superweapons can now display messages and play EVA voices for specific recipient groups when activated.
1218+
- `Message.Activated.Owner` and `EVA.Activated.Owner` are shown / played only for the player who activates the superweapon.
1219+
- `Message.Activated.Allies` and `EVA.Activated.Allies` are shown / played only for allies of the player who activates the superweapon, excluding the activating player.
1220+
- `Message.Activated.Enemies` and `EVA.Activated.Enemies` are shown / played only for enemies of the player who activates the superweapon.
1221+
- Unlike `Message.Activated` and `EVA.Activated`, these are not broadcast to all players.
1222+
1223+
In `rulesmd.ini`:
1224+
```ini
1225+
[SOMESW] ; SuperWeaponType
1226+
Message.Activated.Owner= ; CSF entry key
1227+
Message.Activated.Allies= ; CSF entry key
1228+
Message.Activated.Enemies= ; CSF entry key
1229+
1230+
EVA.Activated.Owner= ; EVA entry
1231+
EVA.Activated.Allies= ; EVA entry
1232+
EVA.Activated.Enemies= ; EVA entry
1233+
```
1234+
12151235
### LimboDelivery
12161236

12171237
- Superweapons can now deliver off-map buildings that act as if they were on the field.

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ HideShakeEffects=false ; boolean
599599
- [Tank Bunker foundation and state update delay improvements](Fixed-or-Improved-Logics.md#tank-bunker-improvements) (by Starkku)
600600
- [Custom cruise missiles](New-or-Enhanced-Logics.md#custom-cruise-missiles) (by Noble_Fish)
601601
- [Allow chat box in singleplayer](User-Interface.md#allow-chat-box-in-singleplayer) (by TaranDahl)
602+
- [Firer-only message and EVA on superweapon activated](New-or-Enhanced-Logics.md#recipient-specific-message-and-eva-on-superweapon-activation) (by Flactine)
602603
603604
#### Vanilla fixes:
604605
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

src/Ext/SWType/Body.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
100100
.Process(this->SW_Link_RollChances)
101101
.Process(this->Message_LinkedSWAcquired)
102102
.Process(this->EVA_LinkedSWAcquired)
103+
.Process(this->Message_Activated_Owner)
104+
.Process(this->Message_Activated_Allies)
105+
.Process(this->Message_Activated_Enemies)
106+
.Process(this->EVA_Activated_Owner)
107+
.Process(this->EVA_Activated_Allies)
108+
.Process(this->EVA_Activated_Enemies)
103109
;
104110
}
105111

@@ -236,6 +242,13 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
236242
this->EVA_LinkedSWAcquired.Read(exINI, pSection, "EVA.LinkedSWAcquired");
237243
this->SW_Link_RollChances.Read(exINI, pSection, "SW.Link.RollChances");
238244

245+
this->Message_Activated_Owner.Read(exINI, pSection, "Message.Activated.Owner");
246+
this->Message_Activated_Allies.Read(exINI, pSection, "Message.Activated.Allies");
247+
this->Message_Activated_Enemies.Read(exINI, pSection, "Message.Activated.Enemies");
248+
this->EVA_Activated_Owner.Read(exINI, pSection, "EVA.Activated.Owner");
249+
this->EVA_Activated_Allies.Read(exINI, pSection, "EVA.Activated.Allies");
250+
this->EVA_Activated_Enemies.Read(exINI, pSection, "EVA.Activated.Enemies");
251+
239252
// SW.Link.RandomWeights
240253
for (size_t i = 0; ; ++i)
241254
{

src/Ext/SWType/Body.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ class SWTypeExt
112112
ValueableVector<float> SW_Link_RollChances;
113113
Valueable<CSFText> Message_LinkedSWAcquired;
114114
NullableIdx<VoxClass> EVA_LinkedSWAcquired;
115+
Valueable<CSFText> Message_Activated_Owner;
116+
Valueable<CSFText> Message_Activated_Allies;
117+
Valueable<CSFText> Message_Activated_Enemies;
118+
ValueableIdx<VoxClass> EVA_Activated_Owner;
119+
ValueableIdx<VoxClass> EVA_Activated_Allies;
120+
ValueableIdx<VoxClass> EVA_Activated_Enemies;
115121

116122
ExtData(SuperWeaponTypeClass* OwnerObject) : Extension<SuperWeaponTypeClass>(OwnerObject)
117123
, TypeID { "" }
@@ -195,6 +201,12 @@ class SWTypeExt
195201
, SW_Link_RandomWeightsData {}
196202
, Message_LinkedSWAcquired {}
197203
, EVA_LinkedSWAcquired {}
204+
, Message_Activated_Owner {}
205+
, Message_Activated_Allies {}
206+
, Message_Activated_Enemies {}
207+
, EVA_Activated_Owner { -1 }
208+
, EVA_Activated_Allies { -1 }
209+
, EVA_Activated_Enemies { -1 }
198210
{ }
199211

200212
// Ares 0.A functions
@@ -221,6 +233,9 @@ class SWTypeExt
221233

222234
void ApplyLinkedSW(SuperClass* pSW);
223235

236+
void ApplyActivatedMessage(SuperClass* pSW) const;
237+
void ApplyActivatedEva(SuperClass* pSW) const;
238+
224239
virtual void LoadFromINIFile(CCINIClass* pINI) override;
225240
virtual void Initialize() override;
226241

src/Ext/SWType/FireSuperWeapon.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ void SWTypeExt::FireSuperWeaponExt(SuperClass* pSW, const CellStruct& cell)
3737
if (static_cast<int>(pType->Type) == 28 && !pTypeExt->EMPulse_TargetSelf) // Ares' Type=EMPulse SW
3838
pTypeExt->HandleEMPulseLaunch(pSW, cell);
3939

40+
pTypeExt->ApplyActivatedMessage(pSW);
41+
42+
pTypeExt->ApplyActivatedEva(pSW);
43+
4044
auto& sw_ext = HouseExt::ExtMap.Find(pHouse)->SuperExts[pType->ArrayIndex];
4145
sw_ext.ShotCount++;
4246

@@ -483,3 +487,40 @@ void SWTypeExt::ExtData::ApplyLinkedSW(SuperClass* pSW)
483487
MessageListClass::Instance.PrintMessage(this->Message_LinkedSWAcquired.Get(), RulesClass::Instance->MessageDelay, HouseClass::CurrentPlayer->ColorSchemeIndex, true);
484488
}
485489
}
490+
491+
void SWTypeExt::ExtData::ApplyActivatedMessage(SuperClass* pSW) const
492+
{
493+
const auto pHouse = pSW->Owner;
494+
495+
const auto pMessage = pHouse->IsControlledByCurrentPlayer()
496+
? &this->Message_Activated_Owner
497+
: (pHouse->IsAlliedWith(HouseClass::CurrentPlayer)
498+
? &this->Message_Activated_Allies
499+
: &this->Message_Activated_Enemies);
500+
501+
if (pMessage->Get().empty())
502+
return;
503+
504+
MessageListClass::Instance.PrintMessage(
505+
pMessage->Get(),
506+
RulesClass::Instance->MessageDelay,
507+
pHouse->ColorSchemeIndex,
508+
true
509+
);
510+
}
511+
512+
void SWTypeExt::ExtData::ApplyActivatedEva(SuperClass* pSW) const
513+
{
514+
const auto pHouse = pSW->Owner;
515+
516+
const auto pEva = pHouse->IsControlledByCurrentPlayer()
517+
? &this->EVA_Activated_Owner
518+
: (pHouse->IsAlliedWith(HouseClass::CurrentPlayer)
519+
? &this->EVA_Activated_Allies
520+
: &this->EVA_Activated_Enemies);
521+
522+
if (pEva->Get() == -1)
523+
return;
524+
525+
VoxClass::PlayIndex(pEva->Get(), -1, -1);
526+
}

0 commit comments

Comments
 (0)