Skip to content

Commit 6ce2f4e

Browse files
authored
[Vanilla Fix]Fixed the bug that vehicle fall on infantries will make all cell content has been removed (#1926)
- Fixed the bug that vehicle fall on infantries will make all cell content has been removed. - 修复了载具落到步兵上时会导致格子内全部物体被移除的bug。
1 parent d2c359c commit 6ce2f4e

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ This page lists all the individual contributions to the project by their author.
453453
- Fix the bug that techno unit will draw with ironcurtain and airstrike color and intensity who disguised as terrain or overlay
454454
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles
455455
- Allow setting whether `AlternateFLH` applies to vehicle passengers in the transport unit
456+
- Fix the bug that vehicle fall on infantries will make all cell content has been removed
456457
- **Apollo** - Translucent SHP drawing patches
457458
- **ststl**:
458459
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
269269
- Fixed an issue that the techno with weapon with `AA=yes` and `AG=no` would not auto targeting units that are falling, such as paratroopers.
270270
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles.
271271
- Reactivate unused trigger events 2, 53, and 54.
272+
- Fixed the bug that vehicle fall on infantries will make all cell content has been removed.
272273

273274
## Fixes / interactions with other extensions
274275

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ Vanilla fixes:
487487
- Fixed an issue that the techno with weapon with `AA=yes` and `AG=no` would not auto targeting units that are falling, such as paratroopers (by TaranDahl)
488488
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles (by NetsuNegi & FlyStar)
489489
- Reactivate unused trigger events 2, 53, and 54 (by FlyStar)
490+
- Fixed the bug that vehicle fall on infantries will make all cell content has been removed (by NetsuNegi)
490491
491492
Phobos fixes:
492493
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)

src/Misc/Hooks.BugFixes.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,3 +2753,63 @@ DEFINE_HOOK(0x44242A, BuildingClass_ReceiveDamage_SetLATime, 0x8)
27532753
}
27542754

27552755
#pragma endregion
2756+
2757+
DEFINE_HOOK(0x54CC9C, JumpjetLocomotionClass_ProcessCrashing_DropFix, 0x5)
2758+
{
2759+
enum { SkipGameCode = 0x54CDC3, SkipGameCode2 = 0x54CFB7 };
2760+
2761+
GET(ObjectClass* const, pObject, ESI);
2762+
GET(JumpjetLocomotionClass*, pLoco, EDI);
2763+
const auto pLinkedTo = pLoco->LinkedTo;
2764+
bool fallOnSomething = false;
2765+
2766+
for (NextObject object(pObject); object; ++object)
2767+
{
2768+
if (*object == pLinkedTo)
2769+
continue;
2770+
2771+
const auto whatAmObject = object->WhatAmI();
2772+
2773+
if (whatAmObject == UnitClass::AbsID || whatAmObject == BuildingClass::AbsID || whatAmObject == AircraftClass::AbsID)
2774+
{
2775+
fallOnSomething = true;
2776+
continue;
2777+
}
2778+
2779+
if (whatAmObject == InfantryClass::AbsID)
2780+
{
2781+
const auto pInfantry = static_cast<InfantryClass*>(*object);
2782+
2783+
VocClass::PlayAt(object->GetType()->CrushSound, object->Location);
2784+
2785+
if (const auto pManipulater = pLinkedTo->BeingManipulatedBy)
2786+
pInfantry->RegisterDestruction(pManipulater);
2787+
else if (const auto pSourceHouse = pLinkedTo->ChronoWarpedByHouse)
2788+
pInfantry->RegisterKill(pSourceHouse);
2789+
else
2790+
pInfantry->RegisterDestruction(pLinkedTo);
2791+
2792+
pInfantry->Mark(MarkType::Up);
2793+
pInfantry->Limbo();
2794+
pInfantry->UnInit();
2795+
continue;
2796+
}
2797+
2798+
if (whatAmObject == TerrainClass::AbsID)
2799+
{
2800+
const auto pTerrain = static_cast<TerrainClass*>(*object);
2801+
2802+
if (pTerrain->Type->Immune)
2803+
continue;
2804+
}
2805+
2806+
if (const auto pManipulater = pLinkedTo->BeingManipulatedBy)
2807+
object->ReceiveDamage(&object->Health, 0, RulesClass::Instance->CrushWarhead, pManipulater, true, false, pManipulater->Owner);
2808+
else if (const auto pSourceHouse = pLinkedTo->ChronoWarpedByHouse)
2809+
object->ReceiveDamage(&object->Health, 0, RulesClass::Instance->CrushWarhead, pLinkedTo, true, false, pSourceHouse);
2810+
else
2811+
object->ReceiveDamage(&object->Health, 0, RulesClass::Instance->CrushWarhead, pLinkedTo, true, false, pLinkedTo->Owner);
2812+
}
2813+
2814+
return fallOnSomething ? SkipGameCode2 : SkipGameCode;
2815+
}

0 commit comments

Comments
 (0)