1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

fix for null group and setting options

This commit is contained in:
Aaron Veden 2018-01-27 17:02:33 -08:00
parent 6910f724d3
commit ecce636595
20 changed files with 287 additions and 140 deletions

View File

@ -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_45) then
if (global.version < constants.VERSION_46) then
game.surfaces[1].print("Rampant - Version 0.16.10")
global.version = constants.VERSION_45
game.surfaces[1].print("Rampant - Version 0.16.11")
global.version = constants.VERSION_46
end
return starting ~= global.version, natives

View File

@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 0.16.11
Date: 1. 27. 2018
Bugfixes:
- A a null check for nil'ed squad groups (https://mods.factorio.com/mod/Rampant/discussion/5a6d09cb9a95f7000b165865)
Improvements:
- Added setting options for changing tiers and variations to allow for a smaller memory footprint
---------------------------------------------------------------------------------------------------
Version: 0.16.10
Date: 1. 27. 2018

View File

@ -1,7 +1,7 @@
{
"name" : "Rampant",
"factorio_version" : "0.16",
"version" : "0.16.10",
"version" : "0.16.11",
"title" : "Rampant",
"author" : "Veden",
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",

View File

@ -8,6 +8,9 @@ local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants
local TIER_SET_10 = constants.TIER_SET_10
local TIER_SET_5 = constants.TIER_SET_5
local NEUTRAL_WORM_TIERS = constants.NEUTRAL_WORM_TIERS
local NEUTRAL_WORM_VARIATIONS = constants.NEUTRAL_WORM_VARIATIONS
local NEUTRAL_NEST_TIERS = constants.NEUTRAL_NEST_TIERS
@ -355,9 +358,10 @@ end
local function processUnitClass(biterVariation, biterTier, spitterVariation, spitterTier, wormVariation, wormTier, surface, natives, baseAlignment, baseAlignmentString)
local position = { x = 0, y = 0 }
for v=1,biterVariation do
for t=1,biterTier do
for tier=1,biterTier do
local t = ((biterTier == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
for v=1,biterVariation do
local entity = surface.create_entity({
name= baseAlignmentString .. "-biter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
@ -366,8 +370,9 @@ local function processUnitClass(biterVariation, biterTier, spitterVariation, spi
entity.destroy()
end
end
for v=1,spitterVariation do
for t=1,spitterTier do
for tier=1,spitterTier do
local t = ((spitterTier == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
for v=1,spitterVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-spitter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
@ -376,8 +381,9 @@ local function processUnitClass(biterVariation, biterTier, spitterVariation, spi
entity.destroy()
end
end
for v=1,wormVariation do
for t=1,wormTier do
for tier=1,wormTier do
local t = ((wormTier == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
for v=1,wormVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-worm-v" .. v .. "-t" .. t .. "-rampant",
position = position

View File

@ -19,7 +19,7 @@ constants.VERSION_33 = 33
constants.VERSION_38 = 38
constants.VERSION_41 = 41
constants.VERSION_44 = 44
constants.VERSION_45 = 45
constants.VERSION_46 = 46
-- misc
@ -307,82 +307,119 @@ constants.SENTINEL_IMPASSABLE_CHUNK.y = -1
-- unit spawners
local variations = settings.startup["rampant-newEnemyVariations"].value
local tiers = 10
constants.TIER_SET_5 = { 1, 3, 5, 7, 10 }
constants.TIER_SET_10 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
constants.NEUTRAL_NEST_TIERS = tiers
constants.NEUTRAL_NEST_VARIATIONS = variations
constants.NEUTRAL_WORM_TIERS = tiers
constants.NEUTRAL_WORM_VARIATIONS = variations
local nestVariations = settings.startup["rampant-newEnemyNestVariations"].value
local nestTiers = settings.startup["rampant-newEnemyNestTiers"].value
local wormVariations = settings.startup["rampant-newEnemyWormVariations"].value
local wormTiers = settings.startup["rampant-newEnemyWormTiers"].value
local unitVariations = settings.startup["rampant-newEnemyUnitVariations"].value
local unitTiers = settings.startup["rampant-newEnemyUnitTiers"].value
constants.ACID_NEST_TIERS = tiers
constants.ACID_NEST_VARIATIONS = variations
constants.ACID_WORM_TIERS = tiers
constants.ACID_WORM_VARIATIONS = variations
constants.NEUTRAL_NEST_TIERS = nestTiers
constants.NEUTRAL_NEST_VARIATIONS = nestVariations
constants.NEUTRAL_WORM_TIERS = wormTiers
constants.NEUTRAL_WORM_VARIATIONS = wormVariations
constants.NEUTRAL_UNIT_TIERS = unitTiers
constants.NEUTRAL_UNIT_VARIATIONS = unitVariations
constants.FIRE_NEST_TIERS = tiers
constants.FIRE_NEST_VARIATIONS = variations
constants.FIRE_WORM_TIERS = tiers
constants.FIRE_WORM_VARIATIONS = variations
constants.ACID_NEST_TIERS = nestTiers
constants.ACID_NEST_VARIATIONS = nestVariations
constants.ACID_WORM_TIERS = wormTiers
constants.ACID_WORM_VARIATIONS = wormVariations
constants.ACID_UNIT_TIERS = unitTiers
constants.ACID_UNIT_VARIATIONS = unitVariations
constants.PHYSICAL_NEST_TIERS = tiers
constants.PHYSICAL_NEST_VARIATIONS = variations
constants.PHYSICAL_WORM_TIERS = tiers
constants.PHYSICAL_WORM_VARIATIONS = variations
constants.FIRE_NEST_TIERS = nestTiers
constants.FIRE_NEST_VARIATIONS = nestVariations
constants.FIRE_WORM_TIERS = wormTiers
constants.FIRE_WORM_VARIATIONS = wormVariations
constants.FIRE_UNIT_TIERS = unitTiers
constants.FIRE_UNIT_VARIATIONS = unitVariations
constants.TROLL_NEST_TIERS = tiers
constants.TROLL_NEST_VARIATIONS = variations
constants.TROLL_WORM_TIERS = tiers
constants.TROLL_WORM_VARIATIONS = variations
constants.PHYSICAL_NEST_TIERS = nestTiers
constants.PHYSICAL_NEST_VARIATIONS = nestVariations
constants.PHYSICAL_WORM_TIERS = wormTiers
constants.PHYSICAL_WORM_VARIATIONS = wormVariations
constants.PHYSICAL_UNIT_TIERS = unitTiers
constants.PHYSICAL_UNIT_VARIATIONS = unitVariations
constants.FAST_NEST_TIERS = tiers
constants.FAST_NEST_VARIATIONS = variations
constants.FAST_WORM_TIERS = tiers
constants.FAST_WORM_VARIATIONS = variations
constants.TROLL_NEST_TIERS = nestTiers
constants.TROLL_NEST_VARIATIONS = nestVariations
constants.TROLL_WORM_TIERS = wormTiers
constants.TROLL_WORM_VARIATIONS = wormVariations
constants.TROLL_UNIT_TIERS = unitTiers
constants.TROLL_UNIT_VARIATIONS = unitVariations
constants.SUICIDE_NEST_TIERS = tiers
constants.SUICIDE_NEST_VARIATIONS = variations
constants.SUICIDE_WORM_TIERS = tiers
constants.SUICIDE_WORM_VARIATIONS = variations
constants.FAST_NEST_TIERS = nestTiers
constants.FAST_NEST_VARIATIONS = nestVariations
constants.FAST_WORM_TIERS = wormTiers
constants.FAST_WORM_VARIATIONS = wormVariations
constants.FAST_UNIT_TIERS = unitTiers
constants.FAST_UNIT_VARIATIONS = unitVariations
constants.WASP_NEST_TIERS = tiers
constants.WASP_NEST_VARIATIONS = variations
constants.WASP_WORM_TIERS = tiers
constants.WASP_WORM_VARIATIONS = variations
constants.SUICIDE_NEST_TIERS = nestTiers
constants.SUICIDE_NEST_VARIATIONS = nestVariations
constants.SUICIDE_WORM_TIERS = wormTiers
constants.SUICIDE_WORM_VARIATIONS = wormVariations
constants.SUICIDE_UNIT_TIERS = unitTiers
constants.SUICIDE_UNIT_VARIATIONS = unitVariations
constants.POISON_NEST_TIERS = tiers
constants.POISON_NEST_VARIATIONS = variations
constants.POISON_WORM_TIERS = tiers
constants.POISON_WORM_VARIATIONS = variations
constants.WASP_NEST_TIERS = nestTiers
constants.WASP_NEST_VARIATIONS = nestVariations
constants.WASP_WORM_TIERS = wormTiers
constants.WASP_WORM_VARIATIONS = wormVariations
constants.WASP_UNIT_TIERS = unitTiers
constants.WASP_UNIT_VARIATIONS = unitVariations
constants.DECAYING_NEST_TIERS = tiers
constants.DECAYING_NEST_VARIATIONS = variations
constants.DECAYING_WORM_TIERS = tiers
constants.DECAYING_WORM_VARIATIONS = variations
constants.POISON_NEST_TIERS = nestTiers
constants.POISON_NEST_VARIATIONS = nestVariations
constants.POISON_WORM_TIERS = wormTiers
constants.POISON_WORM_VARIATIONS = wormVariations
constants.POISON_UNIT_TIERS = unitTiers
constants.POISON_UNIT_VARIATIONS = unitVariations
constants.UNDYING_NEST_TIERS = tiers
constants.UNDYING_NEST_VARIATIONS = variations
constants.UNDYING_WORM_TIERS = tiers
constants.UNDYING_WORM_VARIATIONS = variations
constants.DECAYING_NEST_TIERS = nestTiers
constants.DECAYING_NEST_VARIATIONS = nestVariations
constants.DECAYING_WORM_TIERS = wormTiers
constants.DECAYING_WORM_VARIATIONS = wormVariations
constants.DECAYING_UNIT_TIERS = unitTiers
constants.DECAYING_UNIT_VARIATIONS = unitVariations
constants.ELECTRIC_NEST_TIERS = tiers
constants.ELECTRIC_NEST_VARIATIONS = variations
constants.ELECTRIC_WORM_TIERS = tiers
constants.ELECTRIC_WORM_VARIATIONS = variations
constants.UNDYING_NEST_TIERS = nestTiers
constants.UNDYING_NEST_VARIATIONS = nestVariations
constants.UNDYING_WORM_TIERS = wormTiers
constants.UNDYING_WORM_VARIATIONS = wormVariations
constants.UNDYING_UNIT_TIERS = unitTiers
constants.UNDYING_UNIT_VARIATIONS = unitVariations
constants.LASER_NEST_TIERS = tiers
constants.LASER_NEST_VARIATIONS = variations
constants.LASER_WORM_TIERS = tiers
constants.LASER_WORM_VARIATIONS = variations
constants.ELECTRIC_NEST_TIERS = nestTiers
constants.ELECTRIC_NEST_VARIATIONS = nestVariations
constants.ELECTRIC_WORM_TIERS = wormTiers
constants.ELECTRIC_WORM_VARIATIONS = wormVariations
constants.ELECTRIC_UNIT_TIERS = unitTiers
constants.ELECTRIC_UNIT_VARIATIONS = unitVariations
constants.INFERNO_NEST_TIERS = tiers
constants.INFERNO_NEST_VARIATIONS = variations
constants.INFERNO_WORM_TIERS = tiers
constants.INFERNO_WORM_VARIATIONS = variations
constants.LASER_NEST_TIERS = nestTiers
constants.LASER_NEST_VARIATIONS = nestVariations
constants.LASER_WORM_TIERS = wormTiers
constants.LASER_WORM_VARIATIONS = wormVariations
constants.LASER_UNIT_TIERS = unitTiers
constants.LASER_UNIT_VARIATIONS = unitVariations
constants.NUCLEAR_NEST_TIERS = tiers
constants.NUCLEAR_NEST_VARIATIONS = variations
constants.NUCLEAR_WORM_TIERS = tiers
constants.NUCLEAR_WORM_VARIATIONS = variations
constants.INFERNO_NEST_TIERS = nestTiers
constants.INFERNO_NEST_VARIATIONS = nestVariations
constants.INFERNO_WORM_TIERS = wormTiers
constants.INFERNO_WORM_VARIATIONS = wormVariations
constants.INFERNO_UNIT_TIERS = unitTiers
constants.INFERNO_UNIT_VARIATIONS = unitVariations
constants.NUCLEAR_NEST_TIERS = nestTiers
constants.NUCLEAR_NEST_VARIATIONS = nestVariations
constants.NUCLEAR_WORM_TIERS = wormTiers
constants.NUCLEAR_WORM_VARIATIONS = wormVariations
constants.NUCLEAR_UNIT_TIERS = unitTiers
constants.NUCLEAR_UNIT_VARIATIONS = unitVariations
return constants

View File

@ -155,7 +155,7 @@ function unitGroupUtils.cleanSquads(natives, map)
for i=1, squadCount do
local squad = squads[i]
local group = squad.group
if group.valid then
if group and group.valid then
local memberCount = #group.members
if (memberCount == 0) then
removeSquadFromChunk(map, squad)

View File

@ -9030,7 +9030,12 @@ rampant-enableSwarm=Enable the swarm
rampant-newEnemies=Enable new enemies
rampant-enemySeed=Enemy Random Seed
rampant-deadZoneFrequency=Enemy deadzone frequency
rampant-newEnemyVariations=Enemy Variations
rampant-newEnemyNestVariations=Nest Variations
rampant-newEnemyNestTiers=Nest Tiers
rampant-newEnemyWormVariations=Worm Variations
rampant-newEnemyWormTiers=Worm Tiers
rampant-newEnemyUnitVariations=Unit Variations
rampant-newEnemyUnitTiers=Unit Tiers
[mod-setting-description]
rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters
@ -9060,4 +9065,9 @@ rampant-attack-warning=Shows a message warning players that an attack wave is in
rampant-newEnemies=Adds news enemies that will be dispersed over the world. This increases the RAM requirements minimum 2GB to 8GB.
rampant-enemySeed=The seed that powers all of the unit generation, so change this if you want the enemy stats to change
rampant-deadZoneFrequency=The percentage of zones that start out with worms or nests
rampant-newEnemyVariations=This number corresponds to the number of variations per tier of of each unit, unit spawner, and worm types. This increases the RAM requirements minimum 2GB to 8GB. Min 1, Max 20
rampant-newEnemyNestVariations=This number corresponds to the number of variations per tier. The higher the number the smoother the enemy power curve. Min 1, Max 20
rampant-newEnemyNestTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve.
rampant-newEnemyWormVariations=This number corresponds to the number of variations per tier. The higher the number the smoother the enemy power curve. Min 1, Max 20
rampant-newEnemyWormTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve.
rampant-newEnemyUnitVariations=This number corresponds to the number of variations per tier. The higher the number the smoother the enemy power curve. Min 1, Max 20
rampant-newEnemyUnitTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve.

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local ACID_UNIT_TIERS = constants.ACID_UNIT_TIERS
local ACID_UNIT_VARIATIONS = constants.ACID_UNIT_VARIATIONS
local ACID_NEST_TIERS = constants.ACID_NEST_TIERS
local ACID_NEST_VARIATIONS = constants.ACID_NEST_VARIATIONS
@ -542,12 +545,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = 10,
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
)
@ -1161,12 +1164,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = 10,
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
)

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local ELECTRIC_UNIT_TIERS = constants.ELECTRIC_UNIT_TIERS
local ELECTRIC_UNIT_VARIATIONS = constants.ELECTRIC_UNIT_VARIATIONS
local ELECTRIC_NEST_TIERS = constants.ELECTRIC_NEST_TIERS
local ELECTRIC_NEST_VARIATIONS = constants.ELECTRIC_NEST_VARIATIONS
@ -589,12 +592,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = ELECTRIC_UNIT_VARIATIONS,
unitSpawner = ELECTRIC_NEST_VARIATIONS
},
{
unit = 10,
unit = ELECTRIC_UNIT_TIERS,
unitSpawner = ELECTRIC_NEST_TIERS
}
)

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local FAST_UNIT_TIERS = constants.FAST_UNIT_TIERS
local FAST_UNIT_VARIATIONS = constants.FAST_UNIT_VARIATIONS
local FAST_NEST_TIERS = constants.FAST_NEST_TIERS
local FAST_NEST_VARIATIONS = constants.FAST_NEST_VARIATIONS
@ -506,12 +509,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = FAST_UNIT_VARIATIONS,
unitSpawner = FAST_NEST_VARIATIONS
},
{
unit = 10,
unit = FAST_UNIT_TIERS,
unitSpawner = FAST_NEST_TIERS
}
)
@ -1020,12 +1023,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = FAST_UNIT_VARIATIONS,
unitSpawner = FAST_NEST_VARIATIONS
},
{
unit = 10,
unit = FAST_UNIT_TIERS,
unitSpawner = FAST_NEST_TIERS
}
)

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local FIRE_UNIT_TIERS = constants.FIRE_UNIT_TIERS
local FIRE_UNIT_VARIATIONS = constants.FIRE_UNIT_VARIATIONS
local FIRE_NEST_TIERS = constants.FIRE_NEST_TIERS
local FIRE_NEST_VARIATIONS = constants.FIRE_NEST_VARIATIONS
@ -569,12 +572,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = FIRE_UNIT_VARIATIONS,
unitSpawner = FIRE_NEST_VARIATIONS
},
{
unit = 10,
unit = FIRE_UNIT_TIERS,
unitSpawner = FIRE_NEST_TIERS
}
)
@ -1177,12 +1180,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = FIRE_UNIT_VARIATIONS,
unitSpawner = FIRE_NEST_VARIATIONS
},
{
unit = 10,
unit = FIRE_UNIT_TIERS,
unitSpawner = FIRE_NEST_TIERS
}
)

View File

@ -9,6 +9,9 @@ local math3d = require("math3d")
-- constants
local INFERNO_UNIT_TIERS = constants.INFERNO_UNIT_TIERS
local INFERNO_UNIT_VARIATIONS = constants.INFERNO_UNIT_VARIATIONS
local INFERNO_NEST_TIERS = constants.INFERNO_NEST_TIERS
local INFERNO_NEST_VARIATIONS = constants.INFERNO_NEST_VARIATIONS
@ -679,12 +682,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = INFERNO_UNIT_VARIATIONS,
unitSpawner = INFERNO_NEST_VARIATIONS
},
{
unit = 10,
unit = INFERNO_UNIT_TIERS,
unitSpawner = INFERNO_NEST_TIERS
}
)

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local LASER_UNIT_TIERS = constants.LASER_UNIT_TIERS
local LASER_UNIT_VARIATIONS = constants.LASER_UNIT_VARIATIONS
local LASER_NEST_TIERS = constants.LASER_NEST_TIERS
local LASER_NEST_VARIATIONS = constants.LASER_NEST_VARIATIONS
@ -543,12 +546,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = LASER_UNIT_VARIATIONS,
unitSpawner = LASER_NEST_VARIATIONS
},
{
unit = 10,
unit = LASER_UNIT_TIERS,
unitSpawner = LASER_NEST_TIERS
}
)
@ -1094,12 +1097,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = LASER_UNIT_VARIATIONS,
unitSpawner = LASER_NEST_VARIATIONS
},
{
unit = 10,
unit = LASER_UNIT_TIERS,
unitSpawner = LASER_NEST_TIERS
}
)

View File

@ -8,6 +8,9 @@ local constants = require("Constants")
-- constants
local NEUTRAL_UNIT_TIERS = constants.NEUTRAL_UNIT_TIERS
local NEUTRAL_UNIT_VARIATIONS = constants.NEUTRAL_UNIT_VARIATIONS
local NEUTRAL_NEST_TIERS = constants.NEUTRAL_NEST_TIERS
local NEUTRAL_NEST_VARIATIONS = constants.NEUTRAL_NEST_VARIATIONS
@ -484,12 +487,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = NEUTRAL_UNIT_VARIATIONS,
unitSpawner = NEUTRAL_NEST_VARIATIONS
},
{
unit = 10,
unit = NEUTRAL_UNIT_TIERS,
unitSpawner = NEUTRAL_NEST_TIERS
}
)
@ -977,12 +980,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = NEUTRAL_UNIT_VARIATIONS,
unitSpawner = NEUTRAL_NEST_VARIATIONS
},
{
unit = 10,
unit = NEUTRAL_UNIT_TIERS,
unitSpawner = NEUTRAL_NEST_TIERS
}
)

View File

@ -9,6 +9,9 @@ local constants = require("Constants")
-- constants
local NUCLEAR_UNIT_TIERS = constants.NUCLEAR_UNIT_TIERS
local NUCLEAR_UNIT_VARIATIONS = constants.NUCLEAR_UNIT_VARIATIONS
local NUCLEAR_NEST_TIERS = constants.NUCLEAR_NEST_TIERS
local NUCLEAR_NEST_VARIATIONS = constants.NUCLEAR_NEST_VARIATIONS
@ -540,12 +543,12 @@ buildUnitSpawner(
createSuicideAttack,
{
unit = 10,
unit = NUCLEAR_UNIT_VARIATIONS,
unitSpawner = NUCLEAR_NEST_VARIATIONS
},
{
unit = 10,
unit = NUCLEAR_UNIT_TIERS,
unitSpawner = NUCLEAR_NEST_TIERS
}
)

View File

@ -2,14 +2,15 @@
local physicalBall = require("utils/AttackBall")
local biterUtils = require("utils/BiterUtils")
local smokeUtils = require("utils/SmokeUtils")
local swarmUtils = require("SwarmUtils")
local colorUtils = require("utils/ColorUtils")
package.path = "../libs/?.lua;" .. package.path
local constants = require("Constants")
-- constants
local PHYSICAL_UNIT_TIERS = constants.PHYSICAL_UNIT_TIERS
local PHYSICAL_UNIT_VARIATIONS = constants.PHYSICAL_UNIT_VARIATIONS
local PHYSICAL_NEST_TIERS = constants.PHYSICAL_NEST_TIERS
local PHYSICAL_NEST_VARIATIONS = constants.PHYSICAL_NEST_VARIATIONS
@ -18,10 +19,6 @@ local PHYSICAL_WORM_VARIATIONS = constants.PHYSICAL_WORM_VARIATIONS
-- imported functions
local makeColor = colorUtils.makeColor
local makeSmokeSoft = smokeUtils.makeSmokeSoft
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local buildWorm = swarmUtils.buildWorm
local createAttackBall = physicalBall.createAttackBall
@ -491,12 +488,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = PHYSICAL_UNIT_VARIATIONS,
unitSpawner = PHYSICAL_NEST_VARIATIONS
},
{
unit = 10,
unit = PHYSICAL_UNIT_TIERS,
unitSpawner = PHYSICAL_NEST_TIERS
}
)

View File

@ -9,6 +9,9 @@ local constants = require("Constants")
-- constants
local SUICIDE_UNIT_TIERS = constants.SUICIDE_UNIT_TIERS
local SUICIDE_UNIT_VARIATIONS = constants.SUICIDE_UNIT_VARIATIONS
local SUICIDE_NEST_TIERS = constants.SUICIDE_NEST_TIERS
local SUICIDE_NEST_VARIATIONS = constants.SUICIDE_NEST_VARIATIONS
@ -566,12 +569,12 @@ buildUnitSpawner(
createSuicideAttack,
{
unit = 10,
unit = SUICIDE_UNIT_VARIATIONS,
unitSpawner = SUICIDE_NEST_VARIATIONS
},
{
unit = 10,
unit = SUICIDE_UNIT_TIERS,
unitSpawner = SUICIDE_NEST_TIERS
}
)

View File

@ -4,6 +4,7 @@ local swarmUtils = {}
local biterUtils = require("utils/BiterUtils")
package.path = "../?.lua;" .. package.path
local mathUtils = require("libs/MathUtils")
local constants = require("libs/Constants")
-- imported functions
@ -18,6 +19,9 @@ local mFloor = math.floor
local deepcopy = util.table.deepcopy
local TIER_SET_10 = constants.TIER_SET_10
local TIER_SET_5 = constants.TIER_SET_5
local xorRandom = mathUtils.xorRandom(settings.startup["rampant-enemySeed"].value)
local makeBiterCorpse = biterUtils.makeBiterCorpse
@ -40,9 +44,9 @@ local function unitSetToProbabilityTable(upgradeTable, unitSet)
end
if upgradeTable then
local points = #upgradeTable * 10
local points = #unitSet * 10
while (points > 0) do
local index = mFloor(xorRandom() * #upgradeTable)+1
local index = mFloor(xorRandom() * #unitSet)+1
local upgrade = upgradeTable[index]
dividers[index] = dividers[index] + upgrade
@ -280,7 +284,8 @@ end
local function buildUnits(template, attackGenerator, upgradeTable, variations, tiers)
local unitSet = {}
for t=1, tiers do
for tier=1, tiers do
local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
local result = {}
for i=1,variations do
@ -327,7 +332,8 @@ function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, v
variations.unit,
tiers.unit)
for t=1, tiers.unitSpawner do
for tier=1, tiers.unitSpawner do
local t = ((tiers.unitSpawner == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
for i=1,variations.unitSpawner do
local unitSpawner = deepcopy(templates.unitSpawner)
unitSpawner.name = unitSpawner.name .. "-v" .. i .. "-t" .. t
@ -352,7 +358,8 @@ function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, v
end
function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variations, tiers)
for t=1, tiers do
for tier=1, tiers do
local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
for i=1,variations do
local worm = deepcopy(template)
worm.name = worm.name .. "-v" .. i .. "-t" .. t

View File

@ -2,14 +2,15 @@
local acidBall = require("utils/AttackBall")
local biterUtils = require("utils/BiterUtils")
local smokeUtils = require("utils/SmokeUtils")
local swarmUtils = require("SwarmUtils")
local colorUtils = require("utils/ColorUtils")
package.path = "../libs/?.lua;" .. package.path
local constants = require("Constants")
-- constants
local TROLL_UNIT_TIERS = constants.TROLL_UNIT_TIERS
local TROLL_UNIT_VARIATIONS = constants.TROLL_UNIT_VARIATIONS
local TROLL_NEST_TIERS = constants.TROLL_NEST_TIERS
local TROLL_NEST_VARIATIONS = constants.TROLL_NEST_VARIATIONS
@ -18,10 +19,6 @@ local TROLL_WORM_VARIATIONS = constants.TROLL_WORM_VARIATIONS
-- imported functions
local makeColor = colorUtils.makeColor
local makeSmokeSoft = smokeUtils.makeSmokeSoft
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local buildWorm = swarmUtils.buildWorm
local createAttackBall = acidBall.createAttackBall
@ -520,12 +517,12 @@ buildUnitSpawner(
createMeleeAttack,
{
unit = 10,
unit = TROLL_UNIT_VARIATIONS,
unitSpawner = TROLL_NEST_VARIATIONS
},
{
unit = 10,
unit = TROLL_UNIT_TIERS,
unitSpawner = TROLL_NEST_TIERS
}
)
@ -1044,12 +1041,12 @@ buildUnitSpawner(
end,
{
unit = 10,
unit = TROLL_UNIT_VARIATIONS,
unitSpawner = TROLL_NEST_VARIATIONS
},
{
unit = 10,
unit = TROLL_UNIT_TIERS,
unitSpawner = TROLL_NEST_TIERS
}
)

View File

@ -66,17 +66,6 @@ data:extend({
order = "c[modifier]-a[threshold]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyVariations",
setting_type = "startup",
minimum_value = 1,
maximum_value = 20,
default_value = 1,
order = "d[modifier]-b[wave]",
per_user = false
},
{
type = "int-setting",
@ -257,8 +246,77 @@ data:extend({
default_value = false,
order = "l[modifier]-b[unit]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyNestTiers",
description = "rampant-newEnemyNestTiers",
setting_type = "startup",
default_value = 5,
allowed_values = { 5, 10 },
order = "l[modifer]-b[seed]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyNestVariations",
description = "rampant-newEnemyNestVariations",
setting_type = "startup",
minimum_value = 1,
maximum_value = 20,
default_value = 1,
order = "d[modifier]-b[wave]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyWormTiers",
description = "rampant-newEnemyWormTiers",
setting_type = "startup",
default_value = 5,
allowed_values = { 5, 10 },
order = "l[modifer]-b[seed]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyWormVariations",
description = "rampant-newEnemyWormVariations",
setting_type = "startup",
minimum_value = 1,
maximum_value = 20,
default_value = 1,
order = "d[modifier]-b[wave]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyUnitTiers",
description = "rampant-newEnemyUnitTiers",
setting_type = "startup",
default_value = 5,
allowed_values = { 5, 10 },
order = "l[modifer]-b[seed]",
per_user = false
},
{
type = "int-setting",
name = "rampant-newEnemyUnitVariations",
description = "rampant-newEnemyUnitVariations",
setting_type = "startup",
minimum_value = 1,
maximum_value = 20,
default_value = 1,
order = "d[modifier]-b[wave]",
per_user = false
}
-- {
-- type = "bool-setting",