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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ This page lists all the individual contributions to the project by their author.
- Fix the bug where a building with `Factory=BuildingType` owned by the AI did not play `ProductionAnim` when placing a produced building
- Fix the bug that buildings with passengers cannot unload via the Deploy hotkey or command bar button
- Fix the bug that Ares tunnel-type buildings cannot unload via the Deploy hotkey or command bar button
- Customize whether mind-controlled Insignificant technos can be auto-targeted
- **Ollerus**:
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
10 changes: 10 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,16 @@ LeptonMindControlOffset=70 ; integer, in leptons
MindControlRingOffset=140 ; integer, in leptons
```

### Customize whether mind-controlled Insignificant technos can be auto-targeted

- In vanilla Red Alert 2, non-building technos with `Insignificant=yes` can never be acquired as auto targets, even when mind-controlled. In vanilla Yuri's Revenge, such technos become targetable once they are mind-controlled. Now you can customize it.

In `rulesmd.ini`:
```ini
[CombatDamage]
AutoTarget.InsignificantWhenMindControlled=true ; boolean
```

### Customizing effect of level lighting on air units

- It is now possible to customize how air units are affected by level lighting, separately for AircraftTypes and infantry/vehicles with Jumpjet `Locomotor`.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ HideShakeEffects=false ; boolean
#### New:
- [Customized transport plane for teams](AI-Scripting-and-Mapping.md#customized-transport-plane-for-teams) (by FlyStar)
- [Modify ammo on impact](New-or-Enhanced-Logics.md#modify-ammo-on-impact) (by FS-21)
- [Customize whether mind-controlled Insignificant technos can be auto-targeted](Fixed-or-Improved-Logics.md#customize-whether-mind-controlled-Insignificant-technos-can-be-auto-targeted) (by Noble_Fish)

#### Vanilla fixes:
- Fixed the bug where a building with `Factory=BuildingType` owned by the AI did not play `ProductionAnim` when placing a produced building (by Noble_Fish)
Expand Down
5 changes: 4 additions & 1 deletion src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->ReadyToNextMission_MovingCheck.Read(exINI, GameStrings::General, "ReadyToNextMission.MovingCheck");

this->Warhead_PreventScatter.Read(exINI, GameStrings::CombatDamage, "Warhead.PreventScatter");

this->ProjectileRange_ApplyModifiers.Read(exINI, GameStrings::CombatDamage, "ProjectileRange.ApplyModifiers");

this->KeepAlive_Infantry.Read(exINI, GameStrings::General, "KeepAlive.Infantry");
Expand All @@ -622,6 +622,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->KeepAlive_Buildings.Read(exINI, GameStrings::General, "KeepAlive.Buildings");
this->KeepAlive_Defenses.Read(exINI, GameStrings::General, "KeepAlive.Defenses");

this->AutoTarget_InsignificantWhenMindControlled.Read(exINI, GameStrings::CombatDamage, "AutoTarget.InsignificantWhenMindControlled");

// Section AITargetTypes
int itemsCount = pINI->GetKeyCount("AITargetTypes");
for (int i = 0; i < itemsCount; ++i)
Expand Down Expand Up @@ -1106,6 +1108,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->KeepAlive_Aircraft)
.Process(this->KeepAlive_Buildings)
.Process(this->KeepAlive_Defenses)
.Process(this->AutoTarget_InsignificantWhenMindControlled)
;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ class RulesExt
Valueable<bool> KeepAlive_Aircraft;
Valueable<bool> KeepAlive_Buildings;
Valueable<bool> KeepAlive_Defenses;
Valueable<bool> AutoTarget_InsignificantWhenMindControlled;

ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
, Storage_TiberiumIndex { -1 }
Expand Down Expand Up @@ -1025,6 +1026,8 @@ class RulesExt
, KeepAlive_Aircraft { false }
, KeepAlive_Buildings { true }
, KeepAlive_Defenses { true }

, AutoTarget_InsignificantWhenMindControlled { true }
{ }

virtual ~ExtData() = default;
Expand Down
15 changes: 15 additions & 0 deletions src/Ext/Techno/Hooks.Targeting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ DEFINE_HOOK(0x6F7CE2, TechnoClass_CanAutoTargetObject_IronCurtain, 0x6)
return 0;
}

DEFINE_HOOK(0x6F8364, TechnoClass_CanAutoTargetObject_InsignificantWhenMindControlled, 0x6)
{
enum { SkipMindControlChecks = 0x6F838E };

GET(TechnoClass*, pTarget, ESI);

if (!RulesExt::Global()->AutoTarget_InsignificantWhenMindControlled
&& pTarget->GetTechnoType()->Insignificant)
{
return SkipMindControlChecks;
}

return 0;
}

// WW adds an optimization that: If the techno get a target in 1/4 or 1/2 of their targeting range, then it will not checking other targets.
DEFINE_HOOK(0x6F9AF4, TechnoClass_SelectAutoTarget_DisableStupid, 0x6)
{
Expand Down
Loading