Improved check for disabling train extracts in Scav raids (!170)
Made the following changes for determining if train extracts should be disabled in Scav raids: * When determining at what time the train will leave, include the extraction time and the delay between the train extract activating and it becoming available to board * Fixed the variable used for determining if the extract should be disabled * Ensure `MinTime` and `MaxTime` for extracts are never negative Also, trains are hard, and my brain hurts. Co-authored-by: dwesterwick <dwesterwick@yahoo.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/170 Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com> Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
7bf5f822ee
commit
1994832281
@ -205,28 +205,48 @@ export class RaidTimeAdjustmentService
|
||||
MaxTime: null,
|
||||
Chance: null
|
||||
}
|
||||
|
||||
// At what minute we simulate the player joining the raid
|
||||
const simulatedRaidEntryTimeMinutes = mapBase.EscapeTimeLimit - newRaidTimeMinutes;
|
||||
|
||||
// How many seconds have elapsed in the raid when the player joins
|
||||
const reductionSeconds = simulatedRaidEntryTimeMinutes * 60;
|
||||
|
||||
// Delay between the train extract activating and it becoming available to board
|
||||
//
|
||||
// Test method for determining this value:
|
||||
// 1) Set MinTime, MaxTime, and Count for the train extract all to 120
|
||||
// 2) Load into Reserve or Lighthouse as a PMC (both have the same result)
|
||||
// 3) Board the train when it arrives
|
||||
// 4) Check the raid time on the Raid Ended Screen (it should always be the same)
|
||||
//
|
||||
// trainArrivalDelaySeconds = [raid time on raid-ended screen] - MaxTime - Count - ExfiltrationTime
|
||||
// Example: Raid Time = 5:33 = 333 seconds
|
||||
// trainArrivalDelaySeconds = 333 - 120 - 120 - 5 = 88
|
||||
//
|
||||
// I added 2 seconds just to be safe...
|
||||
//
|
||||
const trainArrivalDelaySeconds = 90;
|
||||
|
||||
// Determine the earliest possible time in the raid when the train would leave
|
||||
const earliestPossibleDepartureMinutes = (exit.MinTime + exit.Count + exit.ExfiltrationTime + trainArrivalDelaySeconds) / 60;
|
||||
|
||||
// If raid is after last moment train can leave, assume train has already left, disable extract
|
||||
const latestPossibleDepartureMinutes = (exit.MaxTime + exit.Count) / 60;
|
||||
if (newRaidTimeMinutes < latestPossibleDepartureMinutes)
|
||||
const mostPossibleTimeRemainingAfterDeparture = mapBase.EscapeTimeLimit - earliestPossibleDepartureMinutes;
|
||||
if (newRaidTimeMinutes < mostPossibleTimeRemainingAfterDeparture)
|
||||
{
|
||||
exitChange.Chance = 0;
|
||||
|
||||
this.logger.debug(`Train Exit: ${exit.Name} disabled as new raid time ${newRaidTimeMinutes} minutes is below ${latestPossibleDepartureMinutes} minutes`);
|
||||
|
||||
this.logger.debug(`Train Exit: ${exit.Name} disabled as new raid time ${newRaidTimeMinutes} minutes is below ${mostPossibleTimeRemainingAfterDeparture} minutes`);
|
||||
|
||||
result.push(exitChange);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// What minute we simulate the player joining a raid at
|
||||
const simulatedRaidEntryTimeMinutes = mapBase.EscapeTimeLimit - newRaidTimeMinutes;
|
||||
|
||||
// How many seconds to reduce extract arrival times by, negative values seem to make extract turn red in game
|
||||
const reductionSeconds = simulatedRaidEntryTimeMinutes * 60;
|
||||
|
||||
exitChange.MinTime = exit.MinTime - reductionSeconds;
|
||||
exitChange.MaxTime = exit.MaxTime - reductionSeconds;
|
||||
|
||||
// Reduce extract arrival times. Negative values seem to make extract turn red in game.
|
||||
exitChange.MinTime = Math.max(exit.MinTime - reductionSeconds, 0);
|
||||
exitChange.MaxTime = Math.max(exit.MaxTime - reductionSeconds, 0);
|
||||
|
||||
this.logger.debug(`Train appears between: ${exitChange.MinTime} and ${exitChange.MaxTime} seconds raid time`);
|
||||
|
||||
@ -237,4 +257,4 @@ export class RaidTimeAdjustmentService
|
||||
? result
|
||||
: null ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user