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
3 changes: 3 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ This page lists all the individual contributions to the project by their author.
- Map Action 511, 609, 610
- Weapons now support `AttackFriendlies` and `AttackCursorOnFriendlies`
- Attack non-threatening structures extensions
- Vehicle Deployment Enhancement
- Fixed an issue where miners affected by `Passengers/DeployFire` were unable to unload minerals
- Fixed an issue where mining vehicles could not move after leaving a tank bunker
- **NetsuNegi**:
- Forbidding parallel AI queues by type
- Jumpjet crash speed fix when crashing onto building
Expand Down
1 change: 1 addition & 0 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<ClCompile Include="src\Ext\EBolt\Body.cpp" />
<ClCompile Include="src\Ext\EBolt\Hooks.cpp" />
<ClCompile Include="src\Ext\Unit\Hooks.SimpleDeployer.cpp" />
<ClCompile Include="src\Ext\Unit\Hooks.Unload.cpp" />
<ClCompile Include="src\New\Entity\Ares\RadarJammerClass.cpp" />
<ClCompile Include="src\New\Type\Affiliated\CreateUnitTypeClass.cpp" />
<ClCompile Include="src\Blowfish\blowfish.cpp" />
Expand Down
2 changes: 2 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed an issue that the AI would look for the first house in the array as an enemy instead of the nearest one when there were no enemies.
- Fixed the issue that weapon selection don't check if secondary's warhead has `IsLocomotor=yes`.
- Fixed the issue that warhead with `IsLocomotor=yes` can be used to vehicles who is in tank bunker.
- Fixed an issue where miners affected by `Passengers/DeployFire` were unable to unload minerals.
- Fixed an issue where mining vehicles could not move after leaving a tank bunker.

## Fixes / interactions with other extensions

Expand Down
18 changes: 18 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,24 @@ WaterImage.ConditionRed= ; VehicleType entry
Note that the VehicleTypes had to be defined under [VehicleTypes] and use same image type (SHP/VXL) for vanilla/damaged states.
```

### Deployment Enhancement

- When a vehicle has `Passengers` and possesses `DeployFire/IsSimpleDeployer/DeploysInto`, it can perform custom deployment actions beyond merely releasing passengers.
- `Unload.SkipPassengers` enables vehicles to bypass the passenger release process and perform other deployment actions.
- `Unload.NoPassengers` enables vehicles to perform other deployment actions after losing all passengers.
- Mining vehicles that have not yet unloaded minerals can now perform other deployment operations.
- `Unload.SkipHarvester` allows mining vehicles to perform other deployment actions when not unloading minerals.
- `Unload.NoTiberiums` allows mining vehicles to perform other deployment actions when no minerals are present.

In `rulesmd.ini`:
```ini
[SOMEVEHICLE] ; VehicleType
Unload.SkipPassengers=false ; boolean
Unload.NoPassengers=false ; boolean
Unload.SkipHarvester=false ; boolean
Unload.NoTiberiums=false ; boolean
```

### Jumpjet Tilts While Moving

![image](_static/images/jumpjet-tilt.gif)
Expand Down
3 changes: 3 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ New:
- [Attack non-threatening structures extensions](New-or-Enhanced-Logics.md#attack-non-threatening-structures-techno) (by FlyStar)
- [Customize size for mind controlled unit](New-or-Enhanced-Logics.md#mind-control-enhancement) (by NetsuNegi)
- [Deploy priority filtering](New-or-Enhanced-Logics.md#low-priority-for-deploy) (by Starkku)
- Vehicle Deployment Enhancement (by FlyStar)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down Expand Up @@ -568,6 +569,8 @@ Vanilla fixes:
- Fixed an issue that the AI would look for the first house in the array as an enemy instead of the nearest one when there were no enemies (by TaranDahl)
- Fixed the issue that weapon selection don't check if secondary's warhead has `IsLocomotor=yes` (by NetsuNegi)
- Fixed the issue that warhead with `IsLocomotor=yes` can be used to vehicles who is in tank bunker (by NetsuNegi)
- Fixed an issue where miners affected by `Passengers/DeployFire` were unable to unload minerals (by FlyStar)
- Fixed an issue where mining vehicles could not move after leaving a tank bunker (by FlyStar)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
17 changes: 0 additions & 17 deletions src/Ext/Techno/Hooks.Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,23 +866,6 @@ DEFINE_HOOK(0x730D1F, ProcessDeployCommand_VoiceDeploy, 0x5)

#pragma endregion


// Prevent subterranean units from deploying while underground.
DEFINE_HOOK(0x73D6E6, UnitClass_Unload_Subterranean, 0x6)
{
enum { ReturnFromFunction = 0x73DFB0 };

GET(UnitClass*, pThis, ESI);

if (auto const pLoco = locomotion_cast<TunnelLocomotionClass*>(pThis->Locomotor))
{
if (pLoco->State != TunnelLocomotionClass::State::Idle)
return ReturnFromFunction;
}

return 0;
}

#pragma region Events

DEFINE_HOOK(0x4C7512, EventClass_Execute_StopCommand, 0x6)
Expand Down
9 changes: 9 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,10 @@ void TechnoTypeExt::ExtData::LoadFromINIByWhatAmI(INI_EX& exINI, const char* pSe
this->FireUp.Read(exArtINI, pArtSection, "FireUp");
this->FireUp_ResetInRetarget.Read(exArtINI, pArtSection, "FireUp.ResetInRetarget");
this->TurretResponse.Read(exINI, pSection, "TurretResponse");
this->Unload_SkipPassengers.Read(exINI, pSection, "Unload.SkipPassengers");
this->Unload_NoPassengers.Read(exINI, pSection, "Unload.NoPassengers");
this->Unload_SkipHarvester.Read(exINI, pSection, "Unload.SkipHarvester");
this->Unload_NoTiberiums.Read(exINI, pSection, "Unload.NoTiberiums");
//this->SecondaryFire.Read(exArtINI, pArtSection, "SecondaryFire");
break;
}
Expand Down Expand Up @@ -1818,6 +1822,11 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->TurretResponse)

.Process(this->AttackFriendlies)

.Process(this->Unload_SkipPassengers)
.Process(this->Unload_NoPassengers)
.Process(this->Unload_SkipHarvester)
.Process(this->Unload_NoTiberiums)
;
}
void TechnoTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm)
Expand Down
10 changes: 10 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ class TechnoTypeExt

Vector2D<bool> AttackFriendlies;

Valueable<bool> Unload_SkipPassengers;
Valueable<bool> Unload_NoPassengers;
Valueable<bool> Unload_SkipHarvester;
Valueable<bool> Unload_NoTiberiums;

ExtData(TechnoTypeClass* OwnerObject) : Extension<TechnoTypeClass>(OwnerObject)
, HealthBar_Hide { false }
, HealthBar_HidePips { false }
Expand Down Expand Up @@ -869,6 +874,11 @@ class TechnoTypeExt
, TurretResponse {}

, AttackFriendlies { false,false }

, Unload_SkipPassengers { false }
, Unload_NoPassengers { false }
, Unload_SkipHarvester { false }
, Unload_NoTiberiums { false }
{ }

virtual ~ExtData() = default;
Expand Down
95 changes: 95 additions & 0 deletions src/Ext/Unit/Hooks.Unload.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include <Helpers/Macro.h>
#include <TunnelLocomotionClass.h>

#include <Ext/TechnoType/Body.h>

namespace UnitUnloadTemp
{
TechnoTypeExt::ExtData* TypeExtData = nullptr;
}

// Prevent subterranean units from deploying while underground.
DEFINE_HOOK(0x73D63B, UnitClass_Mi_Unload_Subterranean, 0x6)
{
enum { ReturnFromFunction = 0x73DFB0, SkipHarvester = 0x73D694, SkipPassengers = 0x73DCD3, Harvester = 0x73DEE7, Continue = 0x73D6EC };

GET(UnitClass* const, pThis, ESI);

if (auto const pLoco = locomotion_cast<TunnelLocomotionClass*>(pThis->Locomotor))
{
if (pLoco->State != TunnelLocomotionClass::State::Idle)
return ReturnFromFunction;
}

auto const pType = pThis->Type;
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
UnitUnloadTemp::TypeExtData = pTypeExt;

// It should be the highest priority.
if (pThis->BunkerLinkedItem)
{
if (auto const pBuilding = pThis->GetCell()->GetBuilding())
pBuilding->EmptyBunker();

// It can fix the issue where mining carts cannot move.
R->EAX(pType);
return SkipHarvester;
}

// Miners should not be hindered by other deployment actions while unloading minerals.
if (pType->Harvester || pType->Weeder)
{
const bool hasAnyLink = pThis->HasAnyLink();

if (hasAnyLink || pThis->Unloading)
{
R->AL(hasAnyLink);
return Harvester;
}
}

R->EAX(pType);

if (pTypeExt->Unload_SkipPassengers)
{
return SkipPassengers;
}
else if (pTypeExt->Unload_NoPassengers
&& pThis->Passengers.NumPassengers <= 0 && pThis->MissionStatus == 0)
{
return SkipPassengers;
}

return Continue;
}

DEFINE_HOOK(0x73DEEB, UnitClass_Mi_Unload_SkipHarvester, 0x5)
{
GET(UnitClass* const, pThis, ESI);
enum { SkipHarvester = 0x73D694 };

auto const pTypeExt = UnitUnloadTemp::TypeExtData;

if (!pThis->Unloading
&& (pTypeExt->Unload_SkipHarvester || (pTypeExt->Unload_NoTiberiums && pThis->Tiberium.GetTotalValue() == 0)))
{
R->EAX(pThis->Type);
return SkipHarvester;
}

return 0;
}

DEFINE_HOOK(0x740015, UnitClass_MouseOverObject_SkipPassengers, 0x6)
{
enum { SkipPassengers = 0x7400F0 };

GET(UnitClass* const, pThis, ESI);
GET(UnitTypeClass* const, pType, EAX);

auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType);

return pTypeExt->Unload_SkipPassengers
|| (pTypeExt->Unload_NoPassengers && pThis->Passengers.NumPassengers <= 0)
? SkipPassengers : 0;
}