From 84f8bb8711143210306dcbf3f382f9e1f50301ce Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 11 Nov 2024 20:19:53 +0000 Subject: [PATCH] Stored last location player was on when transiting - Fixed map transits not sending player to correct infil point Limitation - only keeps track of one transit --- .../src/models/eft/match/IEndLocalRaidRequestData.ts | 2 ++ project/src/services/LocationLifecycleService.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/project/src/models/eft/match/IEndLocalRaidRequestData.ts b/project/src/models/eft/match/IEndLocalRaidRequestData.ts index 679dbeeb..e1a99321 100644 --- a/project/src/models/eft/match/IEndLocalRaidRequestData.ts +++ b/project/src/models/eft/match/IEndLocalRaidRequestData.ts @@ -36,6 +36,8 @@ export interface ILocationTransit { raidMode: string; side: string; dayTime: string; + /** The location player last visited */ + sptLastVisitedLocation: string; } export interface ITransitProfile { diff --git a/project/src/services/LocationLifecycleService.ts b/project/src/services/LocationLifecycleService.ts index 98e37bd8..6d31f765 100644 --- a/project/src/services/LocationLifecycleService.ts +++ b/project/src/services/LocationLifecycleService.ts @@ -114,7 +114,7 @@ export class LocationLifecycleService { // Only has value when transitioning into map from previous one if (request.transition) { - // TODO - why doesnt the raid after transit have any transition data? + // TODO - why doesnt the raid after transit have any transit data? result.transition = request.transition; } @@ -126,9 +126,11 @@ export class LocationLifecycleService { result.transition.isLocationTransition = true; result.transition.transitionRaidId = transitionData.transitionRaidId; result.transition.transitionCount += 1; - result.transition.visitedLocations.push(transitionData.location); // TODO - check doesnt exist before adding to prevent dupes - // Complete, clean up + // Used by client to determine infil location) - client adds the map player is transiting to later + result.transition.visitedLocations.push(transitionData.sptLastVisitedLocation); + + // Complete, clean up as no longer needed this.applicationContext.clearValues(ContextVariableType.TRANSIT_INFO); } @@ -351,6 +353,9 @@ export class LocationLifecycleService { // Player is moving between maps if (isTransfer) { + // Manually store the map player just left + request.locationTransit.sptLastVisitedLocation = locationName; + // TODO - Persist each players last visited location history over multiple transits, e.g using InMemoryCacheService, need to take care to not let data get stored forever // Store transfer data for later use in `startLocalRaid()` when next raid starts this.applicationContext.addValue(ContextVariableType.TRANSIT_INFO, request.locationTransit); }