From 8108b3b953b169282dafaa00e5e4327a767e2a16 Mon Sep 17 00:00:00 2001 From: Aaron Veden Date: Tue, 31 Jul 2018 21:52:44 -0700 Subject: [PATCH] needs testing --- Upgrade.lua | 6 +- libs/Constants.lua | 24 +++++- libs/NEBaseUtils.lua | 185 ++++++++++++++++++++++++++++--------------- 3 files changed, 147 insertions(+), 68 deletions(-) diff --git a/Upgrade.lua b/Upgrade.lua index 340d534..344f88e 100755 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -217,10 +217,10 @@ function upgrade.attempt(natives) game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.22") global.version = constants.VERSION_57 end - if (global.version < constants.VERSION_66) then + if (global.version < constants.VERSION_67) then - game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.31") - global.version = constants.VERSION_66 + game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.32") + global.version = constants.VERSION_67 end return starting ~= global.version, natives diff --git a/libs/Constants.lua b/libs/Constants.lua index 3d62270..5172759 100755 --- a/libs/Constants.lua +++ b/libs/Constants.lua @@ -21,7 +21,7 @@ constants.VERSION_41 = 41 constants.VERSION_44 = 44 constants.VERSION_51 = 51 constants.VERSION_57 = 57 -constants.VERSION_66 = 66 +constants.VERSION_67 = 67 -- misc @@ -148,6 +148,11 @@ constants.BASE_ALIGNMENT_DEADZONE = 20 constants.BASE_ALIGNMENT_NE = 21 constants.BASE_ALIGNMENT_BOBS = 22 constants.BASE_ALIGNMENT_SPAWNER = 23 +constants.BASE_ALIGNMENT_NE_BLUE = 24 +constants.BASE_ALIGNMENT_NE_RED = 25 +constants.BASE_ALIGNMENT_NE_YELLOW = 26 +constants.BASE_ALIGNMENT_NE_GREEN = 27 +constants.BASE_ALIGNMENT_NE_PINK = 28 -- constants.BASE_ALIGNMENT_BURROW = 3 constants.BASE_PROCESS_INTERVAL = constants.TICKS_A_SECOND * 2 @@ -212,6 +217,22 @@ end if constants.ENABLED_NE_UNITS then constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE] = 0.1 + + if settings.startup["NE_Blue_Spawners"].value then + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_BLUE] = 0.1 + end + if settings.startup["NE_Red_Spawners"].value then + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_RED] = 0.1 + end + if settings.startup["NE_Pink_Spawners"].value then + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_PINK] = 0.1 + end + if settings.startup["NE_Green_Spawners"].value then + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_GREEN] = 0.1 + end + if settings.startup["NE_Yellow_Spawners"].value then + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_YELLOW] = 0.1 + end end -- ai retreat @@ -478,7 +499,6 @@ constants.ENERGY_THIEF_WORM_VARIATIONS = wormVariations constants.ENERGY_THIEF_UNIT_TIERS = unitTiers constants.ENERGY_THIEF_UNIT_VARIATIONS = unitVariations - constants.LASER_NEST_TIERS = nestTiers constants.LASER_NEST_VARIATIONS = nestVariations constants.LASER_WORM_TIERS = wormTiers diff --git a/libs/NEBaseUtils.lua b/libs/NEBaseUtils.lua index 50f46a8..179bd10 100755 --- a/libs/NEBaseUtils.lua +++ b/libs/NEBaseUtils.lua @@ -10,6 +10,12 @@ local EVOLUTION_INCREMENTS = constants.EVOLUTION_INCREMENTS local BASE_ALIGNMENT_NE = constants.BASE_ALIGNMENT_NE local ENABLED_BOBS_UNITS = constants.ENABLED_BOBS_UNITS +local BASE_ALIGNMENT_NE_BLUE = constants.BASE_ALIGNMENT_NE_BLUE +local BASE_ALIGNMENT_NE_RED = constants.BASE_ALIGNMENT_NE_RED +local BASE_ALIGNMENT_NE_PINK = constants.BASE_ALIGNMENT_NE_PINK +local BASE_ALIGNMENT_NE_GREEN = constants.BASE_ALIGNMENT_NE_GREEN +local BASE_ALIGNMENT_NE_YELLOW = constants.BASE_ALIGNMENT_NE_YELLOW + -- imported functions local mFloor = math.floor @@ -34,25 +40,75 @@ end function ne.processNEUnitClass(natives, surface) local position = { x = 0, y = 0 } + local factionSet = {} + + local entity = surface.create_entity({ + name = "biter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "spitter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + + if settings.startup["NE_Blue_Spawners"].value then local entity = surface.create_entity({ name = "ne-spawner-blue", position = position }) fileEntity(BASE_ALIGNMENT_NE_BLUE, entity, natives.evolutionTableUnitSpawner, 0.0) + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_BLUE entity.destroy() end if settings.startup["NE_Red_Spawners"].value then - local entity = surface.create_entity({ + local entity = surface.create_entity({ name = "ne-spawner-red", position = position }) fileEntity(BASE_ALIGNMENT_NE_RED, entity, natives.evolutionTableUnitSpawner, 0.0) + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_RED + entity.destroy() + end + + if settings.startup["NE_Green_Spawners"].value then + local entity = surface.create_entity({ + name = "ne-spawner-green", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE_GREEN, entity, natives.evolutionTableUnitSpawner, 0.0) + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_GREEN entity.destroy() end + + if settings.startup["NE_Yellow_Spawners"].value then + local entity = surface.create_entity({ + name = "ne-spawner-yellow", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE_YELLOW, entity, natives.evolutionTableUnitSpawner, 0.0) + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_YELLOW + entity.destroy() + end + + if settings.startup["NE_Pink_Spawners"].value then + local entity = surface.create_entity({ + name = "ne-spawner-pink", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE_PINK, entity, natives.evolutionTableUnitSpawner, 0.0) + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_PINK + entity.destroy() + end + factionSet[#factionSet+1] = BASE_ALIGNMENT_NE + if ENABLED_BOBS_UNITS then entity = surface.create_entity({ name = "bob-biter-spawner", @@ -66,79 +122,82 @@ function ne.processNEUnitClass(natives, surface) position = position }) fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) - entity.destroy() + entity.destroy() - entity = surface.create_entity({ - name = "bob-big-fire-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + for _,alignment in ipairs(factionSet) do + entity = surface.create_entity({ + name = "bob-big-fire-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "bob-big-poison-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "bob-big-poison-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "bob-big-piercing-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "bob-big-piercing-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "bob-big-electric-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "bob-big-electric-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "bob-giant-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "bob-giant-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "bob-behemoth-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() - - entity = surface.create_entity({ - name = "bob-big-explosive-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "bob-behemoth-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() + entity = surface.create_entity({ + name = "bob-big-explosive-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() + end end - entity = surface.create_entity({ - name = "small-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + for _,alignment in ipairs(factionSet) do + entity = surface.create_entity({ + name = "small-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "medium-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "medium-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() - entity = surface.create_entity({ - name = "big-worm-turret", - position = position - }) - fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) - entity.destroy() + entity = surface.create_entity({ + name = "big-worm-turret", + position = position + }) + fileEntity(alignment, entity, natives.evolutionTableWorm) + entity.destroy() + end end return ne