Skip to content
Permalink
Browse files

Merge pull request #498 from GoogleFrog/decloakLosOption

Added the modrule decloakRequiresLineOfSight
  • Loading branch information
gajop committed Mar 23, 2020
2 parents a942be9 + 5ddef55 commit cb54625dc9c261b0074376e5820ca274f3862034
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;

@@ -2395,7 +2395,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 cb54625

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