Skip to content

Commit

Permalink
Fix unarmed infantries execute capture mission and trigger EnteredBy …
Browse files Browse the repository at this point in the history
…event when waypointing with an engineer/agent into a building (Phobos-developers#1214)
  • Loading branch information
chaserli authored Mar 7, 2024
1 parent 610a9bc commit 01c560a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ This page lists all the individual contributions to the project by their author.
- Teleport and Tunnel loco visual tilt fix
- Skip units' turret rotation and jumpjets' wobbling under EMP
- Droppod properties dehardcode
- Waypoint entering building together with engineer/agent bug fix
- Misc code refactor & maintenance, CN doc fixes, bugfixes
- **FlyStar**
- Campaign load screen PCX support
Expand Down
11 changes: 1 addition & 10 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed units with Teleport or Tunnel locomotor being unable to be visually flipped like other locomotors do.
- Aircraft docking on buildings now respect `[AudioVisual]`->`PoseDir` as the default setting and do not always land facing north or in case of pre-placed buildings, the building's direction.
- Spawned aircraft now align with the spawner's facing when landing.
- Fixed the bug that waypointing unarmed infantries with agent/engineer/occupier to a spyable/capturable/occupiable building triggers EnteredBy event by executing capture mission.

## Fixes / interactions with other extensions

Expand Down Expand Up @@ -1029,16 +1030,6 @@ In `rulesmd.ini`:
CrateOnlyOnLand=no ; boolean
```

## Flashing Technos on selecting

Selecting technos, controlled by player, now may show a flash effect by setting `SelectionFlashDuration` parameter. Set `SelectionFlashDuration=0` to disable it.

In `rulesmd.ini`:
```ini
[AudioVisual]
SelectionFlashDuration=0 ; integer, number of frames
```

## DropPod

DropPod properties can now be customized on a per-InfantryType basis.
Expand Down
10 changes: 10 additions & 0 deletions docs/User-Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ ShowTimer=yes
ShowTimer.Priority=0 ; integer
```

### Flashing Technos on selecting

Selecting technos, controlled by player, now may show a flash effect by setting `SelectionFlashDuration` parameter. Set `SelectionFlashDuration=0` to disable it.

In `rulesmd.ini`:
```ini
[AudioVisual]
SelectionFlashDuration=0 ; integer, number of frames
```

## Hotkey Commands

### `[ ]` Display Damage Numbers
Expand Down
2 changes: 1 addition & 1 deletion docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ You can use the migration utility (can be found on [Phobos supplementaries repo]
- `Grinding.DisplayRefund` is changed to `DisplayIncome`, `Grinding.DisplayRefund.Houses` is changed to `DisplayIncome.Houses`, `Grinding.DisplayRefund.Offset` is changed to `DisplayIncome.Offset`
- `[JumpjetControls]`->`AllowLayerDeviation` and `JumpjetAllowLayerDeviation` have been deprecated as the animation layering issues have been properly fixed by default now.
- `[JumpjetControls]->TurnToTarget` and `JumpjetTurnToTarget` are obsolete. Jumpjet units who fire `OmniFire=no` weapons **always** turn to targets as other units do.
- `OmniFire.TurnToTarget` is recommended for jumpjet units' omnifiring weapons for facing turning.
- Buildings delivered by trigger action 125 will now **always** play buildup anim as long as it exists. `[ParamTypes]->53` is deprecated.
- `Shadow` for debris & meteor animations is changed to `ExtraShadow`.

Expand Down Expand Up @@ -417,6 +416,7 @@ Vanilla fixes:
- Fixed teleport and drill units being unable to be visually flipped (by Trsdy)
- Aircraft docking on buildings now respect `[AudioVisual]`->`PoseDir` as the default setting and do not always land facing north or in case of pre-placed buildings, the building's direction (by Starkku)
- Spawned aircraft now align with the spawner's facing when landing (by Starkku)
- Fixed infantries attempted to entering buildings when waypointing together with engineer/agent/occupier/etc (by Trsdy)
Phobos fixes:
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)
Expand Down
22 changes: 22 additions & 0 deletions src/Ext/Building/Hooks.Grinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ DEFINE_HOOK(0x4D4CD3, FootClass_Mission_Eaten_Grinding, 0x6)
return 0;
}

DEFINE_HOOK(0x4D4B43, FootClass_Mission_Capture_ForbidUnintended, 0x6)
{
GET(InfantryClass*, pThis, EDI);
enum { LosesDestination = 0x4D4BD1 };

auto pBld = specific_cast<BuildingClass*>(pThis->Destination);
if (!pThis || !pBld || pThis->Target)//try less agressive first, only when no target, see if it doesn't fix something
return 0;

if (!(pBld->Type->Capturable && pThis->Type->Engineer) // can't capture
&& !(pBld->Type->Spyable && pThis->Type->Infiltrate) // can't infiltrate
&& !(pBld->Type->CanBeOccupied && (pThis->Type->Occupier || pThis->Type->Assaulter)) // can't occupy
&& !(pThis->Type->C4 || pThis->HasAbility(Ability::C4)) // can't C4, what else?
)// If you can't do any of these why are you here?
{
pThis->SetDestination(nullptr, false);
return LosesDestination;
}

return 0;
}

DEFINE_HOOK(0x51F0AF, InfantryClass_WhatAction_Grinding, 0x0)
{
enum { Skip = 0x51F05E, ReturnValue = 0x51F17E };
Expand Down

0 comments on commit 01c560a

Please sign in to comment.