feat: return-to-door system for map exits
When entering an interior (e.g. lab from town), the game saves the player's current position as a return point. When exiting, if the exit has no explicit targetX/targetY, the system pops the stored return point and warps back to that exact position. This means interior exits just need targetMap — the player always returns to the specific door they entered from, not a hardcoded position. Falls back to the destination map's spawn if no return point is stored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,10 @@ export const worldState = {
|
||||
solvedPuzzles: [], // array of puzzleIds that have been solved
|
||||
activePuzzle: null, // { puzzleId, requiredOutputs, doorX, doorY } or null when no puzzle active
|
||||
|
||||
// Return points — remembers where the player entered each map from
|
||||
// Stack of { fromMap, fromX, fromY } — push on enter, pop on exit
|
||||
returnPoints: [],
|
||||
|
||||
// Game flags
|
||||
flags: {
|
||||
// Examples:
|
||||
|
||||
Reference in New Issue
Block a user