Skip to content
Open
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 @@ -724,6 +724,7 @@ This page lists all the individual contributions to the project by their author.
- `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses
- Allow `AuxBuilding` and Ares' `SW.Aux/NegBuildings` to count building upgrades
- Dynamic team delays
- Customize whether or not passenger can fire out when the transport is moving
- **NaotoYuuki** - Vertical & meteor trajectory projectile prototypes
- **handama**:
- AI script action to `16005 Jump Back To Previous Script`
Expand Down
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed voxel projectile and animation lighting issues.
- Fixed the bug that techno will get stuck if change owner in tunnel.
- Restored the original Tiberian Sun behavior of playing the `[AudioVisual] -> DeploySound=` sound effect when clicking the sidebar to execute `Deploy`.
- Whether or not a passenger's weapon can fire out from an `OpenTopped=yes` transport will now respect the weapon's `FireWhileMoving` setting.

## Fixes / interactions with other extensions

Expand Down
5 changes: 5 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1648,12 +1648,15 @@ DrainMoneyDisplay.OnTarget.UseDisplayIncome= ; boolean
- `OpenTopped.ShareTransportTarget` controls whether or not the current target of the transport itself is passed to the passengers as well.
- You can also customize range bonus and damage multiplier for passenger inside the transport with `OpenTransport.RangeBonus/DamageMultiplier`, which works independently from transport's `OpenTopped.RangeBonus/DamageMultiplier`.
- `OpenTopped.DecloakToFire` can customize if a transport has to uncloak to have passengers fireout if transport is also OpenTopped.
- `OpenTopped/OpenTransport.FireWhileMoving` can be used to customize whether or not passengers can fire out when the transport is moving, for transport and passenger respectively. Both of them and the weapon's `FireWhileMoving` toggle need to be set to true to allow firing out when moving.

In `rulesmd.ini`:
```ini
[General]
OpenTopped.AllowFiringIfAttackedByLocomotor=true ; boolean
OpenTopped.DecloakToFire=true ; boolean
OpenTopped.FireWhileMoving=true ; boolean
OpenTransport.FireWhileMoving=true ; boolean

[SOMETECHNO] ; TechnoType, transport with OpenTopped=yes
OpenTopped.RangeBonus= ; integer, default to [CombatDamage] -> OpenToppedRangeBonus
Expand All @@ -1664,10 +1667,12 @@ OpenTopped.AllowFiringIfDeactivated=true ; boolean
OpenTopped.AllowFiringIfAttackedByLocomotor= ; boolean, defaults to [General] -> OpenTopped.AllowFiringIfAttackedByLocomotor
OpenTopped.ShareTransportTarget=true ; boolean
OpenTopped.DecloakToFire= ; boolean, defaults to [General] -> OpenTopped.DecloakToFire
OpenTopped.FireWhileMoving= ; boolean, defaults to [General] -> OpenTopped.FireWhileMoving

[SOMETECHNO] ; TechnoType, passenger
OpenTransport.RangeBonus=0 ; integer
OpenTransport.DamageMultiplier=1.0 ; floating point value
OpenTransport.FireWhileMoving= ; boolean, defaults to [General] -> OpenTransport.FireWhileMoving
```

```{note}
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ HideShakeEffects=false ; boolean
- [Customize the step limit of the credits indicator](User-Interface.md#customize-the-step-limit-of-the-credits-indicator) (by Noble_Fish)
- [Disable the credits indicator smooth transition](User-Interface.md#disable-the-credits-indicator-smooth-transition) (by Noble_Fish)
- Add `selling`, `undeploying` and `harvesting` conditions to `DiscardOn` (by Noble_Fish)
- Customize whether or not passenger can fire out when the transport is moving (by Ollerus)

#### 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 src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->FallingDownTargetingFix.Read(exINI, GameStrings::General, "FallingDownTargetingFix");
this->AIAirTargetingFix.Read(exINI, GameStrings::General, "AIAirTargetingFix");
this->OpenTopped_DecloakToFire.Read(exINI, GameStrings::General, "OpenTopped.DecloakToFire");
this->OpenTopped_FireWhileMoving.Read(exINI, GameStrings::General, "OpenTopped.FireWhileMoving");
this->OpenTopped_AllowFiringIfAttackedByLocomotor.Read(exINI, GameStrings::General, "OpenTopped.AllowFiringIfAttackedByLocomotor");
this->OpenTransport_FireWhileMoving.Read(exINI, GameStrings::General, "OpenTransport.FireWhileMoving");

this->SortCameoByName.Read(exINI, GameStrings::General, "SortCameoByName");

Expand Down Expand Up @@ -748,7 +750,9 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->FallingDownTargetingFix)
.Process(this->AIAirTargetingFix)
.Process(this->OpenTopped_DecloakToFire)
.Process(this->OpenTopped_FireWhileMoving)
.Process(this->OpenTopped_AllowFiringIfAttackedByLocomotor)
.Process(this->OpenTransport_FireWhileMoving)
.Process(this->SortCameoByName)
.Process(this->MergeBuildingDamage)
.Process(this->BuildingRadioLink_SyncOwner)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ class RulesExt
Valueable<bool> FallingDownTargetingFix;
Valueable<bool> AIAirTargetingFix;
Valueable<bool> OpenTopped_DecloakToFire;
Valueable<bool> OpenTopped_FireWhileMoving;
Valueable<bool> OpenTopped_AllowFiringIfAttackedByLocomotor;
Valueable<bool> OpenTransport_FireWhileMoving;

Valueable<bool> SortCameoByName;

Expand Down Expand Up @@ -629,7 +631,9 @@ class RulesExt
, FallingDownTargetingFix { false }
, AIAirTargetingFix { false }
, OpenTopped_DecloakToFire { false }
, OpenTopped_FireWhileMoving { true }
, OpenTopped_AllowFiringIfAttackedByLocomotor { true }
, OpenTransport_FireWhileMoving { true }

, SortCameoByName { false }

Expand Down
24 changes: 18 additions & 6 deletions src/Ext/Techno/Hooks.Firing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Ext/Bullet/Body.h>
#include <Ext/WarheadType/Body.h>
#include <Ext/WeaponType/Body.h>
#include <JumpjetLocomotionClass.h>

#pragma region TechnoClass_SelectWeapon

Expand Down Expand Up @@ -436,17 +437,28 @@ DEFINE_HOOK(0x6FC5C7, TechnoClass_CanFire_OpenTopped, 0x6)
if (pTransport->Deactivated && !pTypeExt->OpenTopped_AllowFiringIfDeactivated)
return Illegal;

if (pTransport->Transporter)
return Illegal;

auto const pWeapon = pThis->GetWeapon(weaponIndex)->WeaponType;

if (pTypeExt->OpenTopped_CheckTransportDisableWeapons && TechnoExt::HasWeaponsDisabled(pTransport) && pWeapon)
return OutOfRange;

if (const auto pTransportFoot = abstract_cast<FootClass*>(pTransport))
{
if (pTransportFoot->IsAttackedByLocomotor && !pTypeExt->OpenTopped_AllowFiringIfAttackedByLocomotor.Get(RulesExt::Global()->OpenTopped_AllowFiringIfAttackedByLocomotor))
return Illegal;
}

if (pTransport->Transporter)
return Illegal;

if (pTypeExt->OpenTopped_CheckTransportDisableWeapons && TechnoExt::HasWeaponsDisabled(pTransport) && pThis->GetWeapon(weaponIndex)->WeaponType)
return OutOfRange;
if (!pTypeExt->OpenTopped_FireWhileMoving.Get(RulesExt::Global()->OpenTopped_FireWhileMoving)
|| !TechnoExt::ExtMap.Find(pThis)->TypeExtData->OpenTransport_FireWhileMoving.Get(RulesExt::Global()->OpenTransport_FireWhileMoving)
|| (pWeapon && !pWeapon->FireWhileMoving))
{
const auto pLoco = pTransportFoot->Locomotor;
if (locomotion_cast<JumpjetLocomotionClass*>(pLoco) ? pLoco->Is_Moving_Now() : pLoco->Is_Really_Moving_Now())
return Illegal;
}
}

return Continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,10 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->OpenTopped_UseTransportRangeModifiers.Read(exINI, pSection, "OpenTopped.UseTransportRangeModifiers");
this->OpenTopped_CheckTransportDisableWeapons.Read(exINI, pSection, "OpenTopped.CheckTransportDisableWeapons");
this->OpenTopped_DecloakToFire.Read(exINI, pSection, "OpenTopped.DecloakToFire");
this->OpenTopped_FireWhileMoving.Read(exINI, pSection, "OpenTopped.FireWhileMoving");
this->OpenTransport_RangeBonus.Read(exINI, pSection, "OpenTransport.RangeBonus");
this->OpenTransport_DamageMultiplier.Read(exINI, pSection, "OpenTransport.DamageMultiplier");
this->OpenTransport_FireWhileMoving.Read(exINI, pSection, "OpenTransport.FireWhileMoving");

if (exINI.ReadString(pSection, "AutoFire") > 0)
{
Expand Down Expand Up @@ -1627,8 +1629,10 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->OpenTopped_UseTransportRangeModifiers)
.Process(this->OpenTopped_CheckTransportDisableWeapons)
.Process(this->OpenTopped_DecloakToFire)
.Process(this->OpenTopped_FireWhileMoving)
.Process(this->OpenTransport_RangeBonus)
.Process(this->OpenTransport_DamageMultiplier)
.Process(this->OpenTransport_FireWhileMoving)

.Process(this->AutoTargetOwnPosition)
.Process(this->AutoTargetOwnPosition_Self)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ class TechnoTypeExt
Valueable<bool> OpenTopped_UseTransportRangeModifiers;
Valueable<bool> OpenTopped_CheckTransportDisableWeapons;
Nullable<bool> OpenTopped_DecloakToFire;
Nullable<bool> OpenTopped_FireWhileMoving;
Valueable<int> OpenTransport_RangeBonus;
Valueable<float> OpenTransport_DamageMultiplier;
Nullable<bool> OpenTransport_FireWhileMoving;

Valueable<bool> AutoTargetOwnPosition;
Valueable<bool> AutoTargetOwnPosition_Self;
Expand Down Expand Up @@ -617,8 +619,10 @@ class TechnoTypeExt
, OpenTopped_UseTransportRangeModifiers { false }
, OpenTopped_CheckTransportDisableWeapons { false }
, OpenTopped_DecloakToFire {}
, OpenTopped_FireWhileMoving {}
, OpenTransport_RangeBonus { 0 }
, OpenTransport_DamageMultiplier { 1.0f }
, OpenTransport_FireWhileMoving {}

, AutoTargetOwnPosition { false }
, AutoTargetOwnPosition_Self { false }
Expand Down
Loading