From 403f2c7953652f0da2aa8cdfd9fcc821e4348ca7 Mon Sep 17 00:00:00 2001 From: anulax1225 Date: Mon, 18 Dec 2023 13:32:02 +0100 Subject: [PATCH] Planet nrm --- js/api/planet.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/js/api/planet.js b/js/api/planet.js index 5587d30..b08c47c 100644 --- a/js/api/planet.js +++ b/js/api/planet.js @@ -1,3 +1,30 @@ +class Position { + constructor(x, y) { + this.x = x; + this.y = y; + } + + get_canvas_pos(w, h) { + return new Position(x - w/2, y - h/2) + } +} + export class Planet { + constructor(waypoint) { + this.symbol = waypoint.symbol; + this.type = waypoint.type; + this.system = waypoint.systemSymbol; + this.position = new Position(x, y); + this.moons = waypoint.orbitals; + this.orbits = waypoint.orbits; + this.faction = waypoint.faction; + this.traits = waypoint.traits; + this.dangers = waypoint.modifiers; + this.discovery = waypoint.char; + this.is_under_construction = waypoint.isUnderConstruction; + } +} + +export class PlanetBuilder { } \ No newline at end of file