Skip to content

Commit d27a43a

Browse files
authored
[Dehardcode] RadarInvisible for non-enemy house (#1607)
### RadarInvisible for non-enemy house - In vanilla, `RadarInvisible` is ignored if the techno is allied with the current player. Now you can change this behavior. In `rulesmd.ini`: ```ini [SOMETECHNO] ; TechnoType RadarInvisibleToHouse= ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all), default to enemy if `RadarInvisible=true`, none otherwise ```
1 parent 771e444 commit d27a43a

File tree

6 files changed

+49
-2
lines changed

6 files changed

+49
-2
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ This page lists all the individual contributions to the project by their author.
482482
- Fix the bug that healing weapons could not automatically acquire aerial targets
483483
- Fix an issue where AI would select unreachable buildings and get stuck when looking for buildings like tank bunkers, bio reactors, etc
484484
- Prone speed customization
485+
- RadarInvisible for non-enemy house
485486
- **tyuah8**:
486487
- Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix
487488
- Destroyed unit leaves sensors bugfix

docs/Fixed-or-Improved-Logics.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,16 @@ UnitPowerDrain=false ; boolean
10821082
Power=0 ; integer, positive means output, negative means drain
10831083
```
10841084

1085+
### RadarInvisible for non-enemy house
1086+
1087+
- In vanilla, `RadarInvisible` is ignored if the techno is allied with the current player. Now you can change this behavior.
1088+
1089+
In `rulesmd.ini`:
1090+
```ini
1091+
[SOMETECHNO] ; TechnoType
1092+
RadarInvisibleToHouse= ; Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all), default to enemy if `RadarInvisible=true`, none otherwise
1093+
```
1094+
10851095
### Re-enable obsolete [JumpjetControls]
10861096

10871097
- Re-enable obsolete `[JumpjetControls]`, the keys in it will be as the default value of jumpjet units.

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ New:
361361
- [Warhead that can not kill](New-or-Enhanced-Logics.md#warhead-that-cannot-kill) (by FS-21)
362362
- [Customize parasite culling targets](Fixed-or-Improved-Logics.md#customizing-parasite-culling-targets) (by NetsuNegi)
363363
- [Overload characteristic dehardcoded](New-or-Enhanced-Logics.md#overload-characteristic-dehardcoded) (by Otamaa)
364+
- RadarInvisible for non-enemy house (By TaranDahl)
364365
365366
Vanilla fixes:
366367
- Prevent the units with locomotors that cause problems from entering the tank bunker (by TaranDahl)

src/Ext/Techno/Hooks.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,3 +755,30 @@ DEFINE_HOOK(0x62A0AA, ParasiteClass_AI_CullingTarget, 0x5)
755755

756756
return EnumFunctions::IsTechnoEligible(pThis->Victim, pWHExt->Parasite_CullingTarget) ? ExecuteCulling : CannotCulling;
757757
}
758+
759+
#pragma region RadarDrawing
760+
761+
DEFINE_HOOK(0x655DDD, RadarClass_ProcessPoint_RadarInvisible, 0x6)
762+
{
763+
enum { Invisible = 0x655E66, GoOtherChecks = 0x655E19 };
764+
765+
GET_STACK(bool, isInShrouded, STACK_OFFSET(0x40, 0x4));
766+
GET(TechnoClass*, pTechno, EBP);
767+
768+
if (isInShrouded && !pTechno->Owner->IsControlledByCurrentPlayer())
769+
return Invisible;
770+
771+
auto pType = pTechno->GetTechnoType();
772+
773+
if (pType->RadarInvisible)
774+
{
775+
auto pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
776+
777+
if (EnumFunctions::CanTargetHouse(pTypeExt->RadarInvisibleToHouse.Get(AffectedHouse::Enemies), pTechno->Owner, HouseClass::CurrentPlayer))
778+
return Invisible;
779+
}
780+
781+
return GoOtherChecks;
782+
}
783+
784+
#pragma endregion

src/Ext/TechnoType/Body.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
528528
this->Promote_VeteranAnimation.Read(exINI, pSection, "Promote.VeteranAnimation");
529529
this->Promote_EliteAnimation.Read(exINI, pSection, "Promote.EliteAnimation");
530530

531+
this->RadarInvisibleToHouse.Read(exINI, pSection, "RadarInvisibleToHouse");
532+
531533
this->Overload_Count.Read(exINI, pSection, "Overload.Count");
532534
this->Overload_Damage.Read(exINI, pSection, "Overload.Damage");
533535
this->Overload_Frames.Read(exINI, pSection, "Overload.Frames");
@@ -982,6 +984,8 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
982984
.Process(this->Promote_VeteranAnimation)
983985
.Process(this->Promote_EliteAnimation)
984986

987+
.Process(this->RadarInvisibleToHouse)
988+
985989
.Process(this->Overload_Count)
986990
.Process(this->Overload_Damage)
987991
.Process(this->Overload_Frames)

src/Ext/TechnoType/Body.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class TechnoTypeExt
277277

278278
Valueable<int> Power;
279279

280-
Nullable<UnitTypeClass*> Image_ConditionYellow;
280+
Nullable<UnitTypeClass*> Image_ConditionYellow;
281281
Nullable<UnitTypeClass*> Image_ConditionRed;
282282
Nullable<UnitTypeClass*> WaterImage_ConditionYellow;
283283
Nullable<UnitTypeClass*> WaterImage_ConditionRed;
@@ -295,11 +295,13 @@ class TechnoTypeExt
295295
Valueable<int> SinkSpeed;
296296

297297
Nullable<double> ProneSpeed;
298-
Nullable<double> DamagedSpeed;
298+
Nullable<double> DamagedSpeed;
299299

300300
Nullable<AnimTypeClass*> Promote_VeteranAnimation;
301301
Nullable<AnimTypeClass*> Promote_EliteAnimation;
302302

303+
Nullable<AffectedHouse> RadarInvisibleToHouse;
304+
303305
struct LaserTrailDataEntry
304306
{
305307
ValueableIdx<LaserTrailTypeClass> idxType;
@@ -606,6 +608,8 @@ class TechnoTypeExt
606608
, Promote_VeteranAnimation { }
607609
, Promote_EliteAnimation { }
608610

611+
, RadarInvisibleToHouse {}
612+
609613
, Overload_Count {}
610614
, Overload_Damage {}
611615
, Overload_Frames {}

0 commit comments

Comments
 (0)