From b9fb54fbbc3e924c5c81de9e19dd5bf925705d9f Mon Sep 17 00:00:00 2001 From: Aaron Veden Date: Sun, 28 Jan 2018 22:40:21 -0800 Subject: [PATCH] fix for load dependencies --- Upgrade.lua | 6 +++--- changelog.txt | 6 ++++++ data-updates.lua | 7 +++++-- info.json | 2 +- libs/BaseUtils.lua | 8 +++++--- libs/Constants.lua | 8 +++++--- prototypes/utils/BiterUtils.lua | 34 +++++++++++++++++++++++++-------- 7 files changed, 51 insertions(+), 20 deletions(-) diff --git a/Upgrade.lua b/Upgrade.lua index ca8c4d1..fe9e550 100755 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -191,10 +191,10 @@ function upgrade.attempt(natives) game.surfaces[1].print("Rampant - Version 0.16.9") global.version = constants.VERSION_44 end - if (global.version < constants.VERSION_47) then + if (global.version < constants.VERSION_48) then - game.surfaces[1].print("Rampant - Version 0.16.12") - global.version = constants.VERSION_47 + game.surfaces[1].print("Rampant - Version 0.16.13") + global.version = constants.VERSION_48 end return starting ~= global.version, natives diff --git a/changelog.txt b/changelog.txt index 1a0c649..1486569 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.16.13 +Date: 1. 28. 2018 + Bugfixes: + - Fixed load error for mod dependencies (https://github.com/veden/Rampant/issues/15) + --------------------------------------------------------------------------------------------------- Version: 0.16.12 Date: 1. 28. 2018 diff --git a/data-updates.lua b/data-updates.lua index d99f2e7..a1a05be 100755 --- a/data-updates.lua +++ b/data-updates.lua @@ -13,11 +13,14 @@ end if settings.startup["rampant-useDumbProjectiles"].value then vanillaUpdates.useDumbProjectiles() - if settings.startup["bobmods-enemies-enableartifacts"].value then + local option = settings.startup["bobmods-enemies-enableartifacts"] + if option and option.value then require("prototypes/utils/AttackBobs") bobsUpdates.useDumbProjectiles() end - if settings.startup["NE_Difficulty"].value then + + option = settings.startup["NE_Difficulty"] + if option and option.value then require("prototypes/utils/AttackNE") NEUpdates.useDumbProjectiles() if settings.startup["rampant-useNEUnitLaunchers"].value then diff --git a/info.json b/info.json index 57d5c34..a38cdc5 100755 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name" : "Rampant", "factorio_version" : "0.16", - "version" : "0.16.12", + "version" : "0.16.13", "title" : "Rampant", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", diff --git a/libs/BaseUtils.lua b/libs/BaseUtils.lua index 3c9202c..b438185 100755 --- a/libs/BaseUtils.lua +++ b/libs/BaseUtils.lua @@ -406,7 +406,7 @@ function baseUtils.rebuildNativeTables(natives, surface, rg) natives.evolutionTableUnitSpawner = {} natives.evolutionTableWorm = {} natives.evolutionTableAlignment = {} - + -- todo fill out alignment evolution levels for alignment,evo in pairs(BASE_ALIGNMENT_EVOLUTION_BASELINE) do fileAlignment(alignment, @@ -414,11 +414,13 @@ function baseUtils.rebuildNativeTables(natives, surface, rg) natives.evolutionTableAlignment) end - if ENABLED_NE_UNITS then + local option = settings.startup["NE_Difficulty"] + if option and option.value and ENABLED_NE_UNITS then processNEUnitClass(natives, surface) end - if ENABLED_BOBS_UNITS then + local option = settings.startup["bobmods-enemies-enableartifacts"] + if option and option.value and ENABLED_BOBS_UNITS then processBobsUnitClass(natives, surface) end diff --git a/libs/Constants.lua b/libs/Constants.lua index 1699b73..cb2716d 100755 --- a/libs/Constants.lua +++ b/libs/Constants.lua @@ -19,7 +19,7 @@ constants.VERSION_33 = 33 constants.VERSION_38 = 38 constants.VERSION_41 = 41 constants.VERSION_44 = 44 -constants.VERSION_47 = 47 +constants.VERSION_48 = 48 -- misc @@ -189,13 +189,15 @@ constants.BASE_ALIGNMENT_EVOLUTION_BASELINE = { constants.ENABLED_NE_UNITS = settings.startup["rampant-enableBobsUnits"].value constants.ENABLED_BOBS_UNITS = settings.startup["rampant-enableNEUnits"].value -if settings.startup["bobmods-enemies-enableartifacts"].value and constants.ENABLED_BOBS_UNITS then +local option = settings.startup["bobmods-enemies-enableartifacts"] +if option and option.value and constants.ENABLED_BOBS_UNITS then -- local t = constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] -- t[#t+1] = constants.BASE_ALIGNMENT_BOBS constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_BOBS] = 0.1 end -if settings.startup["NE_Difficulty"].value and constants.ENABLED_NE_UNITS then +option = settings.startup["NE_Difficulty"] +if option and option.value and constants.ENABLED_NE_UNITS then -- local t = constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] -- t[#t+1] = constants.BASE_ALIGNMENT_NE constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE] = 0.1 diff --git a/prototypes/utils/BiterUtils.lua b/prototypes/utils/BiterUtils.lua index 1450ee6..3111004 100755 --- a/prototypes/utils/BiterUtils.lua +++ b/prototypes/utils/BiterUtils.lua @@ -458,9 +458,16 @@ end function biterFunctions.makeWormAlienLootTable(name) local biterLoot - local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value - local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value + local a = settings.startup["bobmods-enemies-enableartifacts"] + local b = settings.startup["NE_Alien_Artifacts"] + local artifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablesmallartifacts"] + b = settings.startup["NE_Alien_Artifacts"] + local smallArtifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablenewartifacts"] + local newArtifacts = a and a.value + if newArtifacts and name then biterLoot = { [1] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 1, probability = 0.5 }, @@ -494,9 +501,15 @@ end function biterFunctions.makeSpawnerAlienLootTable(name) local biterLoot - local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value - local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value - + local a = settings.startup["bobmods-enemies-enableartifacts"] + local b = settings.startup["NE_Alien_Artifacts"] + local artifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablesmallartifacts"] + b = settings.startup["NE_Alien_Artifacts"] + local smallArtifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablenewartifacts"] + local newArtifacts = a and a.value + if newArtifacts and name then biterLoot = { [1] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 1, probability = 0.5 }, @@ -530,9 +543,14 @@ end function biterFunctions.makeUnitAlienLootTable(name) local biterLoot - local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value - local smallArtifacts = settings.startup["bobmods-enemies-enablesmallartifacts"].value or settings.startup["NE_Alien_Artifacts"].value - local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value + local a = settings.startup["bobmods-enemies-enableartifacts"] + local b = settings.startup["NE_Alien_Artifacts"] + local artifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablesmallartifacts"] + b = settings.startup["NE_Alien_Artifacts"] + local smallArtifacts = (a and a.value) or (b and b.value) + a = settings.startup["bobmods-enemies-enablenewartifacts"] + local newArtifacts = a and a.value if smallArtifacts and newArtifacts and name then biterLoot = {