Skip to content
Permalink
Browse files

Added the modrule decloakRequiresLineOfSight.

This controls whether sight distance is used as a filter on proximity cloak checks, allowing for cheap implementations of the behaviour desired by FLOZi for s44 and myself for ZK.
Added a missing comment for alwaysVisibleOverridesCloaked.

See:
 * https://springrts.com/mantis/view.php?id=6306
 * ca1557c
 * https://springrts.com/mantis/view.php?id=6374
  • Loading branch information
GoogleFrog committed Mar 21, 2020
1 parent a942be9 commit 5ddef55bba01427292d729731ba24877cf4c7482
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 5ddef55

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