From f105002847ffe3b5c89d02bb1f792b3ca372a417 Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Sun, 17 Oct 2021 20:02:22 -0400 Subject: [PATCH] Reduce repetitive code sections Iteratively define general actions instead of defining each individually. Remove anonymous function that automatically runs, placing code into main section of file so that it still automatically runs. (untested - I don't have a local copy set up yet to test these changes on) --- src/Bladeburner/GeneralActions.tsx | 45 +++++++++--------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/src/Bladeburner/GeneralActions.tsx b/src/Bladeburner/GeneralActions.tsx index 89c1f02e5..fa4728f85 100644 --- a/src/Bladeburner/GeneralActions.tsx +++ b/src/Bladeburner/GeneralActions.tsx @@ -3,35 +3,16 @@ import { IMap } from "../types"; export const GeneralActions: IMap = {}; -(function () { - // General Actions - let actionName; - actionName = "Training"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); - - actionName = "Field Analysis"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); - - actionName = "Recruitment"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); - - actionName = "Diplomacy"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); - - actionName = "Hyperbolic Regeneration Chamber"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); - actionName = "Incite Violence"; - GeneralActions[actionName] = new Action({ - name: actionName, - }); -})(); +let actionNames : Array = [ + "Training", + "Field Analysis", + "Recruitment", + "Diplomacy", + "Hyperbolic Regeneration Chamber", + "Incite Violence" +]; +for (let actionName of actionNames){ + GeneralActions[actionName] = new Action({ + name: actionName, + }); +}