From 147003b5b370252a3435d817cdbb044c2b2de96b Mon Sep 17 00:00:00 2001 From: Benjamin Amos Date: Tue, 20 Feb 2024 20:24:40 +0000 Subject: [PATCH] Prevent saving during the tutorial --- engine/src/main/java/org/destinationsol/game/SolGame.java | 2 +- engine/src/main/java/org/destinationsol/game/StarPort.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/src/main/java/org/destinationsol/game/SolGame.java b/engine/src/main/java/org/destinationsol/game/SolGame.java index 9cf9518f6..56fe69f94 100644 --- a/engine/src/main/java/org/destinationsol/game/SolGame.java +++ b/engine/src/main/java/org/destinationsol/game/SolGame.java @@ -256,7 +256,7 @@ public void startGame(String shipName, boolean isNewGame, EntitySystemManager en Timer.schedule(new Timer.Task() { @Override public void run() { - if (!hero.isTranscendent()) { + if (!hero.isTranscendent() && !isTutorial()) { saveShip(); // Console.getInstance().println("Game saved"); } diff --git a/engine/src/main/java/org/destinationsol/game/StarPort.java b/engine/src/main/java/org/destinationsol/game/StarPort.java index 021c05412..f1ab22a76 100644 --- a/engine/src/main/java/org/destinationsol/game/StarPort.java +++ b/engine/src/main/java/org/destinationsol/game/StarPort.java @@ -124,7 +124,7 @@ public void update(SolGame game) { if (ship != null && ship.getMoney() >= FARE && ship.getPosition().dst(position) < .05f * SIZE) { ship.setMoney(ship.getMoney() - FARE); Transcendent transcendent = new Transcendent(ship, fromPlanet, toPlanet, game); - if (transcendent.getShip().getPilot().isPlayer()) { + if (transcendent.getShip().getPilot().isPlayer() && !game.isTutorial()) { SaveManager.saveWorld(game.getWorldConfig()); game.getHero().setTranscendent(transcendent); } @@ -402,7 +402,7 @@ public void update(SolGame game) { ship.setPos(position); ship.setVelocity(new Vector2()); SolShip ship = this.ship.toObject(game); - if (ship.getPilot().isPlayer()) { + if (ship.getPilot().isPlayer() && !game.isTutorial()) { game.getHero().setSolShip(ship, game); SaveManager.saveWorld(game.getWorldConfig()); }