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
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ 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
- **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
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the issue where non-repairer units needed sensors to attack cloaked friendly units.
- Fixed the issue that rockets do not consider the destination altitude during climbing.
- Fixed the bug that if object has been removed from LogicClass in Update(), next object will be skip.
- Fixed an issue where miners affected by `Passengers/DeployFire` were unable to unload minerals.

## 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 @@ -2191,6 +2191,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
2 changes: 2 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ New:
- Weapons now support `AttackFriendlies` and `AttackCursorOnFriendlies` (by FlyStar)
- Attack non-threatening structures extensions (by FlyStar)
- Customize size for mind controlled unit (by NetsuNegi)
- 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 @@ -531,6 +532,7 @@ Vanilla fixes:
- Fixed cursor from being hardcoded to update/render 60 times a second no matter how fast the game is rendering. Now the Cursor will update and render much more frequently (by Fridge)
- Fixed an issue that the AI would set anger towards friendly houses, causing it to act stupidly (by TaranDahl)
- 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 an issue where miners affected by `Passengers/DeployFire` were unable to unload minerals (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 @@ -838,23 +838,6 @@ DEFINE_HOOK(0x730D1F, DeployCommandClass_Execute_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 @@ -1389,6 +1389,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 @@ -1816,6 +1820,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 @@ -457,6 +457,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 @@ -867,6 +872,11 @@ class TechnoTypeExt
, TurretResponse {}

, AttackFriendlies { false,false }

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

virtual ~ExtData() = default;
Expand Down
79 changes: 79 additions & 0 deletions src/Ext/Unit/Hooks.Unload.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#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(0x73D6E6, UnitClass_Unload_Subterranean, 0x6)
{
enum { ReturnFromFunction = 0x73DFB0, SkipPassengers = 0x73DCD3, DeployFireAfter = 0x73D672 };

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;

// Miners should not be hindered by other deployment actions while unloading minerals.
if ((pType->Harvester || pType->Weeder)
&& (pThis->HasAnyLink() || pThis->Unloading))
{
return DeployFireAfter;
}

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

return 0;
}

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;
}