Skip to content
Permalink
Browse files

Merge pull request #499 from GoogleFrog/decloakLosOption_maintenance

decloakRequiresLineOfSight for maintenance
  • Loading branch information
gajop committed Mar 23, 2020
2 parents 9ee29da + cb7c1f2 commit 4f8e7f9240de8398a62440f17e608eca486d1818
Showing with 6 additions and 2 deletions.
  1. +2 −0 rts/Sim/Misc/ModInfo.cpp
  2. +3 −1 rts/Sim/Misc/ModInfo.h
  3. +1 −1 rts/Sim/Units/Unit.cpp
@@ -85,6 +85,7 @@ void CModInfo::ResetState()

requireSonarUnderWater = true;
alwaysVisibleOverridesCloaked = false;
decloakRequiresLineOfSight = false;
separateJammers = true;
}
{
@@ -252,6 +253,7 @@ void CModInfo::Init(const std::string& modFileName)

requireSonarUnderWater = sensors.GetBool("requireSonarUnderWater", requireSonarUnderWater);
alwaysVisibleOverridesCloaked = sensors.GetBool("alwaysVisibleOverridesCloaked", alwaysVisibleOverridesCloaked);
decloakRequiresLineOfSight = sensors.GetBool("decloakRequiresLineOfSight", decloakRequiresLineOfSight);
separateJammers = sensors.GetBool("separateJammers", separateJammers);

// losMipLevel is used as index to readMap->mipHeightmaps,
@@ -136,8 +136,10 @@ class CModInfo

/// when underwater, units are not in LOS unless also in sonar
bool requireSonarUnderWater;
///
/// when unit->alwaysVisible is true, it is visible even when cloaked
bool alwaysVisibleOverridesCloaked;
/// ignore enemies when checking decloak if they are further than their spherical sight range
bool decloakRequiresLineOfSight;
/// should _all_ allyteams share the same jammermap
bool separateJammers;

@@ -2396,7 +2396,7 @@ bool CUnit::GetNewCloakState(bool stunCheck) {
const CUnit* closestEnemy = this;

if (!stunCheck)
closestEnemy = CGameHelper::GetClosestEnemyUnitNoLosTest(this, midPos, decloakDistance, allyteam, unitDef->decloakSpherical, false);
closestEnemy = CGameHelper::GetClosestEnemyUnitNoLosTest(this, midPos, decloakDistance, allyteam, unitDef->decloakSpherical, modInfo.decloakRequiresLineOfSight);

return (eventHandler.AllowUnitCloak(this, closestEnemy));
}

0 comments on commit 4f8e7f9

Please sign in to comment.
You can’t perform that action at this time.