Skip to content
Open
4 changes: 3 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@ This page lists all the individual contributions to the project by their author.
- Return warhead
- `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses
- **NaotoYuuki** - Vertical & meteor trajectory projectile prototypes
- **handama** - AI script action to `16005 Jump Back To Previous Script`
- **handama**:
- AI script action to `16005 Jump Back To Previous Script`
- Fix AI team recruitment inconsistency causing underfilled teams
- **TaranDahl (航味麻酱)**:
- Skirmish AI "sell all buildings and set all technos to hunt" behavior dehardcode
- Skirmish AI "gather when MCV deploy" behavior dehardcode
Expand Down
1 change: 1 addition & 0 deletions docs/AI-Scripting-and-Mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This page describes all AI scripting and mapping related additions and changes i
- Teams spawned by trigger action 7,80,107 can use IFV and opentopped logic normally.
- If a pre-placed building has a `NaturalParticleSystem`, it used to always be created when the game starts. This has been removed.
- Superweapons used by AI for script actions `56 Chronoshift to Building`, `57 Chronoshift to a Target Type` and `10104 Chronoshift to Enemy Base` can now be explicitly set via `[General] -> AIChronoSphereSW` & `AIChronoWarpSW` respectively. If `AIChronoSphereSW` is set but `AIChronoWarpSW` is not, game will check former's `SW.PostDependent` for a second superweapon to use. Otherwise if not set, last superweapon listed in `[SuperWeaponTypes]` with `Type=ChronoSphere` or `Type=ChronoWarp` will be used, respectively.
- Fixed AI team recruitment inconsistency causing underfilled teams.

### Increased Overlay Limit

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ Vanilla fixes:
- `ElectricAssault` weapons can now auto acquire allies' overpowerable defenses (by Ollerus)
- Fixed the issue that the time for units in the area guard mission to reacquire targets after eliminating the target is significantly longer than that in other missions (by TaranDahl)
- Purely visual animations and particles excluded from sync checks (by Starkku)
- Fixed AI team recruitment inconsistency causing underfilled teams (by handama)
Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
37 changes: 36 additions & 1 deletion src/Ext/Techno/Body.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Body.h"
#include "Body.h"

#include <JumpjetLocomotionClass.h>

Expand Down Expand Up @@ -884,6 +884,41 @@ void TechnoExt::ClickedApproachObject(FootClass* pThis, ObjectClass* pObject)
event.AddEvent();
}

bool TechnoExt::CanBeRecruitedFix(FootClass* pThis, HouseClass* pHouse)
{
if (pThis->Team != nullptr ||
!pThis->IsAlive ||
pThis->Health <= 0 ||
pThis->InLimbo ||
pThis->Owner != pHouse)
{
return false;
}

if (!(pThis->RecruitableA && pThis->RecruitableB))
{
return false;
}

const Mission mission = pThis->GetCurrentMission();
if (!MissionClass::IsRecruitableMission(mission))
{
return false;
}

if (pThis->ShouldEnterAbsorber ||
pThis->ShouldEnterOccupiable ||
pThis->ShouldGarrisonStructure ||
pThis->DrainTarget != nullptr ||
pThis->BunkerLinkedItem ||
pThis->LocomotorSource != nullptr)
{
return false;
}

return true;
}

bool TechnoExt::EjectRandomly(FootClass* pEjectee, const CoordStruct& coords, int distance, bool select)
{
std::vector<CoordStruct> usableCoords;
Expand Down
3 changes: 2 additions & 1 deletion src/Ext/Techno/Body.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include <Ext/TechnoType/Body.h>
#include <Utilities/Container.h>
Expand Down Expand Up @@ -310,6 +310,7 @@ class TechnoExt
static bool SimpleDeployerAllowedToDeploy(UnitClass* pThis, bool defaultValue, bool alwaysCheckLandTypes);
static void ShowPromoteAnim(TechnoClass* pThis);
static void ClickedApproachObject(FootClass* pThis, ObjectClass* pObject);
static bool CanBeRecruitedFix(FootClass* pThis, HouseClass* pHouse);

static bool EjectRandomly(FootClass* pEjectee, const CoordStruct& coords, int distance, bool select);
static bool EjectSurvivor(FootClass* pSurvivor, CoordStruct coords, bool select);
Expand Down
12 changes: 12 additions & 0 deletions src/Ext/Techno/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,18 @@ DEFINE_HOOK(0x4D4B43, FootClass_Mission_Capture, 0x6)
return LosesDestination;
}

DEFINE_HOOK(0x4DA230, FootClass_CanBeRecruited, 0x5)
{
enum { SkipGameCode = 0x4DA294 };

GET(FootClass*, pThis, ECX);
GET_STACK(HouseClass*, pHouse, 0x4);

R->AL(TechnoExt::CanBeRecruitedFix(pThis, pHouse));

return SkipGameCode;
}

#pragma region DynamicSight

DEFINE_HOOK(0x41AE00, AircraftClass_See_DynamicSight, 0x6)
Expand Down
Loading