Skip to content

Commit

Permalink
display the reveal animation only when the area really wasn't visited…
Browse files Browse the repository at this point in the history
… before

If the flag is not present in the ig.vars then the area is assumed to be
visited.
  • Loading branch information
dmitmel committed Mar 18, 2021
1 parent 7ede71d commit cc327f3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions prestart.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ ig.module('game.feature.world-map-overhaul')
_addAreas() {
let visitedAreas = [];
for (let [id, area] of Object.entries(sc.map.areas)) {
let visited =
let visited = Boolean(
(!area.condition || new ig.VarCondition(area.condition).evaluate()) &&
sc.map.getVisitedArea(id);
sc.map.getVisitedArea(id),
);
if (visited) {
visitedAreas.push([id, area]);
}
Expand Down Expand Up @@ -160,9 +161,12 @@ ig.module('game.feature.world-map-overhaul')
this.parent();
this.id = id;

let revealVarName = `menu.circuit.start.${id}`;
let showRevealAnimation = !ig.vars.get(revealVarName);
ig.vars.set(revealVarName, true);
let visitedVarName = `menu.circuit.start.${id}`;
let visitedVarValue = ig.vars.get(visitedVarName);
if (visitedVarValue == null) visitedVarValue = visited;
ig.vars.set(visitedVarName, visited);

let showRevealAnimation = visited && !visitedVarValue;

let size = Vec2.createC(ig.system.width, ig.system.height);
this.setSize(size.x, size.y);
Expand Down

0 comments on commit cc327f3

Please sign in to comment.