From 424b7a6d9d766b27d31bb6d0edc142e689a9287a Mon Sep 17 00:00:00 2001 From: Aaron Veden Date: Sun, 12 Dec 2021 11:31:14 -0800 Subject: [PATCH] removed setCommandForces function from global table --- Upgrade.lua | 50 +++++++++++++++++++++++++------------------------- control.lua | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Upgrade.lua b/Upgrade.lua index d847f0c..db8b3ef 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -356,34 +356,34 @@ local function addCommandSet(queriesAndCommands) unit_count = 1, unit_search_distance = CHUNK_SIZE } +end - queriesAndCommands.setCommandForces = function (npcForces, enemyForces) - for force in pairs(queriesAndCommands.playerForces) do - queriesAndCommands.playerForces[force] = nil - end - for force in pairs(queriesAndCommands.npcForces) do - queriesAndCommands.npcForces[force] = nil - end - for force in pairs(queriesAndCommands.enemyForces) do - queriesAndCommands.enemyForces[force] = nil - end - for force in pairs(queriesAndCommands.nonPlayerForces) do - queriesAndCommands.nonPlayerForces[force] = nil - end - for _,force in pairs(game.forces) do - if not npcForces[force.name] and not enemyForces[force.name] then - queriesAndCommands.playerForces[#queriesAndCommands.playerForces+1] = force.name - end - end - for force in pairs(enemyForces) do - queriesAndCommands.enemyForces[#queriesAndCommands.enemyForces+1] = force - queriesAndCommands.nonPlayerForces[#queriesAndCommands.nonPlayerForces+1] = force - end - for force in pairs(npcForces) do - queriesAndCommands.npcForces[#queriesAndCommands.npcForces+1] = force - queriesAndCommands.nonPlayerForces[#queriesAndCommands.nonPlayerForces+1] = force +function upgrade.setCommandForces(universe, npcForces, enemyForces) + for force in pairs(universe.playerForces) do + universe.playerForces[force] = nil + end + for force in pairs(universe.npcForces) do + universe.npcForces[force] = nil + end + for force in pairs(universe.enemyForces) do + universe.enemyForces[force] = nil + end + for force in pairs(universe.nonPlayerForces) do + universe.nonPlayerForces[force] = nil + end + for _,force in pairs(game.forces) do + if not npcForces[force.name] and not enemyForces[force.name] then + universe.playerForces[#universe.playerForces+1] = force.name end end + for force in pairs(enemyForces) do + universe.enemyForces[#universe.enemyForces+1] = force + universe.nonPlayerForces[#universe.nonPlayerForces+1] = force + end + for force in pairs(npcForces) do + universe.npcForces[#universe.npcForces+1] = force + universe.nonPlayerForces[#universe.nonPlayerForces+1] = force + end end function upgrade.attempt(universe) diff --git a/control.lua b/control.lua index 0ee329d..5b584ca 100644 --- a/control.lua +++ b/control.lua @@ -278,7 +278,7 @@ local function onConfigChanged() npcForces["AbandonedRuins:enemy"] = true end - universe.setCommandForces(npcForces, enemyForces) + upgrade.setCommandForces(universe, npcForces, enemyForces) if not universe.maps then universe.maps = {}