diff --git a/CREDITS.md b/CREDITS.md index c36e26aa80..85b7c3c91a 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -758,6 +758,7 @@ This page lists all the individual contributions to the project by their author. - **Flactine** - Add target filtering options to attacheffect system - Add veterancy-based target filtering for weapons and warheads + - Firer-only message and EVA on superweapon activation - **tyuah8**: - Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix - Destroyed unit leaves sensors bugfix diff --git a/docs/New-or-Enhanced-Logics.md b/docs/New-or-Enhanced-Logics.md index d6d4f24f32..692713969e 100644 --- a/docs/New-or-Enhanced-Logics.md +++ b/docs/New-or-Enhanced-Logics.md @@ -1153,6 +1153,17 @@ EMPulse.SuspendOthers=false ; boolean `Type=EMPulse` superweapon and any associated keys are [Ares features](https://ares-developers.github.io/Ares-docs/new/superweapons/types/empulse.html). ``` +### Firer-only message and EVA on superweapon activated + +- Unlike `Message.Activated` and `EVA.Activated`, this message and EVA are played only for the player who fires the superweapon, instead of being broadcast to all players. + +In `rulesmd.ini`: +```ini +[SOMESW] ; SuperWeaponType +Message.Activated.Firer= ; CSF entry key +EVA.Activated.Firer= ; EVA entry +``` + ### LimboDelivery - Superweapons can now deliver off-map buildings that act as if they were on the field. diff --git a/docs/Whats-New.md b/docs/Whats-New.md index ae735b5c1a..8de21b1a8a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -573,6 +573,7 @@ New: - [Allow replacing vanilla repairing with togglable auto repairing](User-Interface.md#allow-replacing-vanilla-repairing-with-togglable-auto-repairing) (by TaranDahl) - Use `OpenTopped.AllowFiringIfAttackedByLocomotor` to control whether the passengers of a non-building transport unit can fire when the unit is being attacked by a weapon whose warhead has `IsLocomotor=true` (by Noble_Fish) - Framework for dynamic sight (by TaranDahl) +- [Firer-only message and EVA on superweapon activated](New-or-Enhanced-Logics.md#firer-only-eva-on-superweapon-activated) (by Flactine) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/SWType/Body.cpp b/src/Ext/SWType/Body.cpp index a8eeedbd50..abcfc83687 100644 --- a/src/Ext/SWType/Body.cpp +++ b/src/Ext/SWType/Body.cpp @@ -95,6 +95,8 @@ void SWTypeExt::ExtData::Serialize(T& Stm) .Process(this->SW_Link_RollChances) .Process(this->Message_LinkedSWAcquired) .Process(this->EVA_LinkedSWAcquired) + .Process(this->Message_Activated_Firer) + .Process(this->EVA_Activated_Firer) ; } @@ -224,6 +226,8 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->SW_Link_Reset.Read(exINI, pSection, "SW.Link.Reset"); this->Message_LinkedSWAcquired.Read(exINI, pSection, "Message.LinkedSWAcquired"); this->EVA_LinkedSWAcquired.Read(exINI, pSection, "EVA.LinkedSWAcquired"); + this->Message_Activated_Firer.Read(exINI, pSection, "Message.Activated.Firer"); + this->EVA_Activated_Firer.Read(exINI, pSection, "EVA.Activated.Firer"); this->SW_Link_RollChances.Read(exINI, pSection, "SW.Link.RollChances"); // SW.Link.RandomWeights diff --git a/src/Ext/SWType/Body.h b/src/Ext/SWType/Body.h index b36568dc4d..1764d5217f 100644 --- a/src/Ext/SWType/Body.h +++ b/src/Ext/SWType/Body.h @@ -107,6 +107,8 @@ class SWTypeExt ValueableVector SW_Link_RollChances; Valueable Message_LinkedSWAcquired; NullableIdx EVA_LinkedSWAcquired; + Valueable Message_Activated_Firer; + NullableIdx EVA_Activated_Firer; ExtData(SuperWeaponTypeClass* OwnerObject) : Extension(OwnerObject) , TypeID { "" } @@ -185,6 +187,8 @@ class SWTypeExt , SW_Link_RandomWeightsData {} , Message_LinkedSWAcquired {} , EVA_LinkedSWAcquired {} + , Message_Activated_Firer {} + , EVA_Activated_Firer {} { } // Ares 0.A functions @@ -211,6 +215,9 @@ class SWTypeExt void ApplyLinkedSW(SuperClass* pSW); + void ApplyActivatedFirerMessage(SuperClass* pSW) const; + void ApplyActivatedFirerEva(SuperClass* pSW) const; + virtual void LoadFromINIFile(CCINIClass* pINI) override; virtual void Initialize() override; diff --git a/src/Ext/SWType/FireSuperWeapon.cpp b/src/Ext/SWType/FireSuperWeapon.cpp index 442d0f6a9d..668fdd19c6 100644 --- a/src/Ext/SWType/FireSuperWeapon.cpp +++ b/src/Ext/SWType/FireSuperWeapon.cpp @@ -37,6 +37,12 @@ void SWTypeExt::FireSuperWeaponExt(SuperClass* pSW, const CellStruct& cell) if (static_cast(pType->Type) == 28 && !pTypeExt->EMPulse_TargetSelf) // Ares' Type=EMPulse SW pTypeExt->HandleEMPulseLaunch(pSW, cell); + if (!pTypeExt->Message_Activated_Firer.Get().empty()) + pTypeExt->ApplyActivatedFirerMessage(pSW); + + if (pTypeExt->EVA_Activated_Firer.isset()) + pTypeExt->ApplyActivatedFirerEva(pSW); + auto& sw_ext = HouseExt::ExtMap.Find(pHouse)->SuperExts[pType->ArrayIndex]; sw_ext.ShotCount++; @@ -483,3 +489,21 @@ void SWTypeExt::ExtData::ApplyLinkedSW(SuperClass* pSW) MessageListClass::Instance.PrintMessage(this->Message_LinkedSWAcquired.Get(), RulesClass::Instance->MessageDelay, HouseClass::CurrentPlayer->ColorSchemeIndex, true); } } + +void SWTypeExt::ExtData::ApplyActivatedFirerMessage(SuperClass* pSW) const +{ + const auto pHouse = pSW->Owner; + if (!pHouse->IsControlledByCurrentPlayer()) + return; + + MessageListClass::Instance.PrintMessage(this->Message_Activated_Firer.Get(), RulesClass::Instance->MessageDelay, HouseClass::CurrentPlayer->ColorSchemeIndex, true); +} + +void SWTypeExt::ExtData::ApplyActivatedFirerEva(SuperClass* pSW) const +{ + const auto pHouse = pSW->Owner; + if (!pHouse->IsControlledByCurrentPlayer()) + return; + + VoxClass::PlayIndex(this->EVA_Activated_Firer.Get(), -1, -1); +}