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 @@ -317,6 +317,7 @@ This page lists all the individual contributions to the project by their author.
- Iron Curtain effects customization on infantries and organic units
- Use `CustomPalette` for animations with `Tiled=yes`
- Unlimited `AlternateFLH` entries
- Customizing whether passengers are kicked out when an aircraft fires
- **TwinkleStar**
- Custom slaves free sound
- Jumpjet crash rotation control
Expand Down
10 changes: 10 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,16 @@ ROF.RandomDelay=0,2 ; integer - single or comma-sep. range (game frames)
ROF.RandomDelay= ; integer - single or comma-sep. range (game frames)
```

### Customizing whether passengers are kicked out when an aircraft fires

- You can now customize whether aircraft will forcefully eject passengers (vanilla behavior) or fire its weapon when attempting to fire.

In `rulesmd.ini`
```ini
[SOMEWEAPON]
KickOutPassengers=true ; boolean
```

### Single-color lasers

![image](_static/images/issinglecolor.gif)
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ New:
- Allow customizing Aircraft weapon strafing regardless of `ROT` and `Strafing.Shots` values beyond 5 (by Trsdy)
- Allow strafing weapons to deduct ammo per shot instead of per strafing run (by Starkku)
- Allow `CloakVisible=true` laser trails optinally be seen only if unit is detected (by Starkku)
- Customizing whether passengers are kicked out when an aircraft fires (by ststl)

Vanilla fixes:
- Allow AI to repair structures built from base nodes/trigger action 125/SW delivery in single player missions (by Trsdy)
Expand Down
21 changes: 21 additions & 0 deletions src/Ext/Aircraft/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Ext/Aircraft/Body.h>
#include <Ext/Techno/Body.h>
#include <Ext/Anim/Body.h>
#include <Ext/Techno/Body.h>
#include <Ext/WeaponType/Body.h>
#include <Utilities/Macro.h>

Expand Down Expand Up @@ -308,3 +309,23 @@ DEFINE_HOOK(0x4CF68D, FlyLocomotionClass_DrawMatrix_OnAirport, 0x5)

return 0;
}

DEFINE_HOOK(0x415EEE, AircraftClass_Fire_KickOutPassengers, 0x6)
{
enum { SkipKickOutPassengers = 0x415F08 };

GET(AircraftClass*, pThis, EDI);
GET_BASE(int, weaponIdx, 0xC);

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

if (!pWeapon)
return 0;

auto const pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeapon);

if (pWeaponExt->KickOutPassengers)
return 0;

return SkipKickOutPassengers;
}
16 changes: 8 additions & 8 deletions src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ TechnoExt::ExtData::~ExtData()

bool TechnoExt::IsActive(TechnoClass* pThis)
{
return
pThis &&
!pThis->TemporalTargetingMe &&
!pThis->BeingWarpedOut &&
!pThis->IsUnderEMP() &&
pThis->IsAlive &&
pThis->Health > 0 &&
!pThis->InLimbo;
return pThis
&& pThis->IsAlive
&& pThis->Health > 0
&& !pThis->InLimbo
&& !pThis->TemporalTargetingMe
&& !pThis->BeingWarpedOut
&& !pThis->IsUnderEMP()
;
}

bool TechnoExt::IsHarvesting(TechnoClass* pThis)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WeaponType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->AttachEffect_DisallowedMinCounts.Read(exINI, pSection, "AttachEffect.DisallowedMinCounts");
this->AttachEffect_DisallowedMaxCounts.Read(exINI, pSection, "AttachEffect.DisallowedMaxCounts");
this->AttachEffect_IgnoreFromSameSource.Read(exINI, pSection, "AttachEffect.IgnoreFromSameSource");
this->KickOutPassengers.Read(exINI, pSection, "KickOutPassengers");
}

template <typename T>
Expand Down Expand Up @@ -141,6 +142,7 @@ void WeaponTypeExt::ExtData::Serialize(T& Stm)
.Process(this->AttachEffect_DisallowedMinCounts)
.Process(this->AttachEffect_DisallowedMaxCounts)
.Process(this->AttachEffect_IgnoreFromSameSource)
.Process(this->KickOutPassengers)
;
};

Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WeaponType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class WeaponTypeExt
ValueableVector<int> AttachEffect_DisallowedMinCounts;
ValueableVector<int> AttachEffect_DisallowedMaxCounts;
Valueable<bool> AttachEffect_IgnoreFromSameSource;
Valueable<bool> KickOutPassengers;

ExtData(WeaponTypeClass* OwnerObject) : Extension<WeaponTypeClass>(OwnerObject)
, DiskLaser_Radius { DiskLaserClass::Radius }
Expand Down Expand Up @@ -89,6 +90,7 @@ class WeaponTypeExt
, AttachEffect_DisallowedMinCounts {}
, AttachEffect_DisallowedMaxCounts {}
, AttachEffect_IgnoreFromSameSource { false }
, KickOutPassengers { true }
{ }

int GetBurstDelay(int burstIndex) const;
Expand Down