From a70c1f3ec15254486124359af4819a838e2e236e Mon Sep 17 00:00:00 2001 From: Dan Hamik Date: Wed, 27 Apr 2022 00:12:54 -0500 Subject: [PATCH] add try catch in market check --- Room.Phase1.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Room.Phase1.js b/Room.Phase1.js index a9925c2..483e6df 100644 --- a/Room.Phase1.js +++ b/Room.Phase1.js @@ -50,9 +50,14 @@ let Phase1 = { } else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}} } if(Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_TERMINAL}}).length > 0){ - if(Game.rooms[room].terminal.storage[RESOURCE_ENERGY] > 200000){ - console.log("") - require('proc.market').sellEnergy(room) + console.log("starting market check for room " + Game.rooms[room]) + try{ + let availtosell = Game.rooms[room].terminal.storage[RESOURCE_ENERGY] - 200000 + if(availtosell > 1000){ + require('proc.market').sellEnergy(room) + } + }catch{ + console.log("Failed to get energy for terminal in room " + Game.rooms[room]) } } //require('proc.market').sellEnergy(room)