Skip to content

Commit 256ce49

Browse files
committed
feature(Team): Evaluate generic script properties for difficulty and timing
1 parent 2a8f5bb commit 256ce49

File tree

1 file changed

+23
-0
lines changed
  • GeneralsMD/Code/GameEngine/Source/Common/RTS

1 file changed

+23
-0
lines changed

GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,29 @@ void Team::updateGenericScripts()
25342534
continue;
25352535
}
25362536

2537+
#if !RETAIL_COMPATIBLE_SCRIPTING
2538+
// TheSuperHackers @feature Mauller/TanSo 30/03/2026 Evaluate all script properties on generic scripts
2539+
Player* currentPlayer = getControllingPlayer();
2540+
GameDifficulty difficulty = TheScriptEngine->getGlobalDifficulty();
2541+
if (currentPlayer) {
2542+
difficulty = currentPlayer->getPlayerDifficulty();
2543+
}
2544+
switch (difficulty) {
2545+
case DIFFICULTY_EASY: if (!script->isEasy()) continue; break;
2546+
case DIFFICULTY_NORMAL: if (!script->isNormal()) continue; break;
2547+
case DIFFICULTY_HARD: if (!script->isHard()) continue; break;
2548+
}
2549+
2550+
if (TheGameLogic->getFrame() < script->getFrameToEvaluate()) {
2551+
continue;
2552+
}
2553+
2554+
Int delaySeconds = script->getDelayEvalSeconds();
2555+
if (delaySeconds > 0) {
2556+
script->setFrameToEvaluate(TheGameLogic->getFrame() + delaySeconds * LOGICFRAMES_PER_SECOND);
2557+
}
2558+
#endif
2559+
25372560
if (TheScriptEngine->evaluateConditions(script, this)) {
25382561
if (script->isOneShot()) {
25392562
script->setActive(false);

0 commit comments

Comments
 (0)