From bb914aae6c78bb835b2c0146e838060f24082652 Mon Sep 17 00:00:00 2001 From: Makaci Michael Gabriel Date: Thu, 14 Mar 2024 14:03:25 +0100 Subject: [PATCH] Display planet --- js/controllers/systems.js | 15 +++++++++++++++ js/skama_code | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/js/controllers/systems.js b/js/controllers/systems.js index 07c2bfd..4873880 100644 --- a/js/controllers/systems.js +++ b/js/controllers/systems.js @@ -15,6 +15,15 @@ export default (temp_engine) => { const size = getSize(); canvas.resize(size.width, size.height); }); + + //display planets + SystemBuilder.get(getAgentSystem(), (system) => { + system.list_all_planets((planets) => { + planets.forEach(planet => { + canvas.obj_from_img('../../assets/planets/planetproto.png', planet.position); + }); + }); + }); }); temp_engine.render("templates/systems/systems.html"); @@ -26,3 +35,9 @@ function getSize() { height: window.innerHeight, }; } + +function getAgentSystem(){ + const hq = My.agent.hq; + const systemName = hq.split('-'); + return systemName[0] + '-' + systemName[1]; +} diff --git a/js/skama_code b/js/skama_code index c4c3b56..a4a407b 160000 --- a/js/skama_code +++ b/js/skama_code @@ -1 +1 @@ -Subproject commit c4c3b567023641de51661e81ccb7939484b7dce2 +Subproject commit a4a407bbfd8ce319e14bba69af9bb19aa40d781f