Skip to content

Commit 3412541

Browse files
authored
[Dehardcode] Allow miners do area guard (#1641)
### Allow miners do area guard - In vanilla, when miners enter area guard mission, they immediately switch to harvest mission. Now you can make them perform area guard mission normally like other technos. - We made it work only for miners controlled by the player, because this will prevent AI's miners from going work. In `rulesmd.ini`: ```ini [SOMEVEHICLE] ; VehicleType Harvester.CanGuardArea=no ; boolean ```
1 parent 268b08f commit 3412541

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

CREDITS.md

+1
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ This page lists all the individual contributions to the project by their author.
498498
- Fix an issue where AI would select unreachable buildings and get stuck when looking for buildings like tank bunkers, bio reactors, etc
499499
- Prone speed customization
500500
- RadarInvisible for non-enemy house
501+
- Allow miners do area guard
501502
- **tyuah8**:
502503
- Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix
503504
- Destroyed unit leaves sensors bugfix

docs/Fixed-or-Improved-Logics.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,17 @@ MinimapColor= ; integer - Red,Green,Blue
13341334

13351335
## Vehicles
13361336

1337+
### Allow miners do area guard
1338+
1339+
- In vanilla, when miners enter area guard mission, they immediately switch to harvest mission. Now you can make them perform area guard mission normally like other technos.
1340+
- We made it work only for miners controlled by the player, because this will prevent AI's miners from going work.
1341+
1342+
In `rulesmd.ini`:
1343+
```ini
1344+
[SOMEVEHICLE] ; VehicleType
1345+
Harvester.CanGuardArea=no ; boolean
1346+
```
1347+
13371348
### Bunker entering check dehardcode
13381349

13391350
- In vanilla, vehicles entering tank bunkers are subject to a series of hardcoding restrictions, including having to have turrets, having to have weapons, and not having Hover speed types. Now you can skip these restrictions.
@@ -1350,7 +1361,6 @@ BunkerableAnyway=false ; boolean
13501361
Skipping checks with this feature doesn't mean that vehicles and tank bunkers will interact correctly. Following the simple checks performed by the provider of this feature, bunkerability is mainly determined by Locomotor. The details about locomotors' bunkerability can be found on [ModEnc](https://modenc.renegadeprojects.com/Bunkerable).
13511362
```
13521363

1353-
13541364
### Customizing crushing tilt and slowdown
13551365

13561366
- Vehicles with `Crusher=true` and `OmniCrusher=true` / `MovementZone=CrusherAll` were hardcoded to tilt when crushing vehicles / walls respectively. This now obeys `TiltsWhenCrushes` but can be customized individually for these two scenarios using `TiltsWhenCrusher.Vehicles` and `TiltsWhenCrusher.Overlays`, which both default to `TiltsWhenCrushes`.

docs/Whats-New.md

+1
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ New:
370370
- Customize airstrike targets (by NetsuNegi)
371371
- Aggressive attack move mission (by CrimRecya)
372372
- Amphibious access vehicle (by CrimRecya)
373+
- Allow miners do area guard (by TaranDahl)
373374
374375
Vanilla fixes:
375376
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

src/Ext/TechnoType/Body.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
549549
this->Overload_ParticleSys.Read(exINI, pSection, "Overload.ParticleSys");
550550
this->Overload_ParticleSysCount.Read(exINI, pSection, "Overload.ParticleSysCount");
551551

552+
this->Harvester_CanGuardArea.Read(exINI, pSection, "Harvester.CanGuardArea");
553+
552554
// Ares 0.2
553555
this->RadarJamRadius.Read(exINI, pSection, "RadarJamRadius");
554556

@@ -1016,6 +1018,8 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
10161018
.Process(this->Overload_DeathSound)
10171019
.Process(this->Overload_ParticleSys)
10181020
.Process(this->Overload_ParticleSysCount)
1021+
1022+
.Process(this->Harvester_CanGuardArea)
10191023
;
10201024
}
10211025
void TechnoTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm)

src/Ext/TechnoType/Body.h

+4
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ class TechnoTypeExt
343343
NullableIdx<VocClass> Overload_DeathSound;
344344
Nullable<ParticleSystemTypeClass*> Overload_ParticleSys;
345345
Valueable<int> Overload_ParticleSysCount;
346+
347+
Valueable<bool> Harvester_CanGuardArea;
346348

347349
ExtData(TechnoTypeClass* OwnerObject) : Extension<TechnoTypeClass>(OwnerObject)
348350
, HealthBar_Hide { false }
@@ -641,6 +643,8 @@ class TechnoTypeExt
641643
, Overload_DeathSound {}
642644
, Overload_ParticleSys {}
643645
, Overload_ParticleSysCount { 5 }
646+
647+
, Harvester_CanGuardArea { false }
644648
{ }
645649

646650
virtual ~ExtData() = default;

src/Ext/Unit/Hooks.Harvester.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <UnitClass.h>
2+
#include <HouseClass.h>
23

34
#include <Ext/TechnoType/Body.h>
45

@@ -19,3 +20,14 @@ DEFINE_HOOK(0x73E411, UnitClass_Mission_Unload_DumpAmount, 0x7)
1920

2021
return SkipGameCode;
2122
}
23+
24+
DEFINE_HOOK(0x4D6D34, FootClass_MissionAreaGuard_Miner, 0x5)
25+
{
26+
enum { GoGuardArea = 0x4D6D69 };
27+
28+
GET(FootClass*, pThis, ESI);
29+
30+
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->GetTechnoType());
31+
32+
return pTypeExt->Harvester_CanGuardArea && pThis->Owner->IsControlledByHuman() ? GoGuardArea : 0;
33+
}

0 commit comments

Comments
 (0)