diff --git a/changelog.txt b/changelog.txt index aa35eb4..38648dd 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,10 +1,11 @@ --------------------------------------------------------------------------------------------------- -Version: 1.0.10 +Version: 1.1.0 Date: 29. 04. 2021 Contributions: - Astorin removed old unused ru.cfg locale - Dagothur added a mod setting to print ai point gains to chat - Dagothur added a mod setting to print ai point usage to chat + - Dagothur added a /rampantSetAIState to modify the ai state Improvements: - Increased ai baseline point accumulation based on temperament Tweaks: @@ -13,13 +14,15 @@ Date: 29. 04. 2021 - Increased baseline ai point accumulation for active nests by x3 - Increased baseline ai point accumulation at min and max temperament by 0.2 - Increased raid nest contribution to temperament by x2.7 - - Increased siege chance at max ai temperament by 25% + - Increased siege chance at temperament above 50% by 50% - Decreased settler cost to ai by 33% - Increased base ai min and max duration by ~x1.8 - Increased biter base point gain by x3.5 + - AI Siege state now tries to expand active spawners then raid spawners then all spawners Bugfixes: - Settlers not spawning as they should do to incorrect weighting on spawn locations - - Fixed new enemies factions not mutating or upgrading structures overtime + - Fixed new enemies factions not mutating or upgrading structures over time + - Spawners built on impassable chunks now get tracked properly --------------------------------------------------------------------------------------------------- Version: 1.0.9 diff --git a/control.lua b/control.lua index 67622a6..cc57c61 100644 --- a/control.lua +++ b/control.lua @@ -654,6 +654,17 @@ local function onEnemyBaseBuild(event) if entity and entity.valid then event.entity = registerEnemyBaseStructure(map, entity, base) end + else + local x,y = positionToChunkXY(entity.position) + onChunkGenerated({ + surface = entity.surface, + area = { + left_top = { + x = x, + y = y + } + } + }) end end end @@ -814,6 +825,16 @@ local function onEntitySpawned(event) event.entity = registerEnemyBaseStructure(map, entity, base) end else + local x,y = positionToChunkXY(entity.position) + onChunkGenerated({ + surface = entity.surface, + area = { + left_top = { + x = x, + y = y + } + } + }) entity.destroy() end end @@ -1132,7 +1153,7 @@ remote.add_interface("rampantTests", } ) -function rampantSetAIState(event) +local function rampantSetAIState(event) local surfaceIndex = game.players[event.player_index].surface.index local map = universe.maps[surfaceIndex] diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 84c34af..b777268 100755 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -71,30 +71,6 @@ if settings.startup["rampant--enableShrinkNestsAndWorms"].value then end end --- if not settings.startup["rampant--newEnemies"].value then --- unit = data.raw["unit"]["small-biter"] --- if string.find(k, "biter") then --- unit.max_health = unit.max_health * settings.startup["rampant--unitBiterHealthScaler"].value --- unit.max_health = unit.healing_per_tick * settings.startup["rampant--unitBiterHealingScaler"].value --- unit.range = unit.range * settings.startup["rampant--unitBiterRangeScaler"].value - --- else if string.find(k, "spitter") then - --- end - --- for k, spawner in pairs(data.raw["unit-spawner"]) do --- if string.find(k, "hive") or string.find(k, "spawner") then - --- end --- end - --- for k, unit in pairs(data.raw["turret"]) do --- if string.find(k, "worm") then - --- end --- end --- end - if settings.startup["rampant--enableFadeTime"].value then for k, corpse in pairs(data.raw["corpse"]) do if (string.find(k, "biter") or string.find(k, "spitter") or string.find(k, "hive") or diff --git a/libs/AIPlanning.lua b/libs/AIPlanning.lua index 9f6338a..0982776 100644 --- a/libs/AIPlanning.lua +++ b/libs/AIPlanning.lua @@ -51,6 +51,18 @@ local mMin = math.min -- module code +local function getTimeStringFromTick(tick) + + local tickToSeconds = tick / 60 + + local days = math.floor(tickToSeconds / 86400) + local hours = math.floor((tickToSeconds % 86400) / 3600) + local minutes = math.floor((tickToSeconds % 3600) / 60) + local seconds = math.floor(tickToSeconds % 60) + return days .. "d " .. hours .. "h " .. minutes .. "m " .. seconds .. "s" +end + + function aiPlanning.planning(map, evolution_factor, tick) local universe = map.universe map.evolutionLevel = evolution_factor @@ -209,33 +221,33 @@ function aiPlanning.planning(map, evolution_factor, tick) end elseif (map.temperament < 0.95) then -- 0.8 - 0.95 if (universe.enabledMigration and universe.raidAIToggle) then - if (roll < 0.15) and universe.siegeAIToggle then + if (roll < 0.20) and universe.siegeAIToggle then map.state = AI_STATE_SIEGE - elseif (roll < 0.4) then + elseif (roll < 0.45) then map.state = AI_STATE_RAIDING - elseif (roll < 0.8) then + elseif (roll < 0.85) then map.state = AI_STATE_ONSLAUGHT else map.state = AI_STATE_AGGRESSIVE end elseif (universe.enabledMigration) then - if (roll < 0.15) and universe.siegeAIToggle then + if (roll < 0.20) and universe.siegeAIToggle then map.state = AI_STATE_SIEGE - elseif (roll < 0.7) then + elseif (roll < 0.75) then map.state = AI_STATE_ONSLAUGHT else map.state = AI_STATE_AGGRESSIVE end elseif (universe.raidAIToggle) then - if (roll < 0.4) then + if (roll < 0.45) then map.state = AI_STATE_ONSLAUGHT - elseif (roll < 0.7) then + elseif (roll < 0.75) then map.state = AI_STATE_RAIDING else map.state = AI_STATE_AGGRESSIVE end else - if (roll < 0.6) then + if (roll < 0.65) then map.state = AI_STATE_ONSLAUGHT else map.state = AI_STATE_AGGRESSIVE @@ -243,21 +255,21 @@ function aiPlanning.planning(map, evolution_factor, tick) end else if (universe.enabledMigration and universe.raidAIToggle) then - if (roll < 0.25) and universe.siegeAIToggle then + if (roll < 0.30) and universe.siegeAIToggle then map.state = AI_STATE_SIEGE - elseif (roll < 0.6) then + elseif (roll < 0.65) then map.state = AI_STATE_RAIDING else map.state = AI_STATE_ONSLAUGHT end elseif (universe.enabledMigration) then - if (roll < 0.25) and universe.siegeAIToggle then + if (roll < 0.30) and universe.siegeAIToggle then map.state = AI_STATE_SIEGE else map.state = AI_STATE_ONSLAUGHT end elseif (universe.raidAIToggle) then - if (roll < 0.4) then + if (roll < 0.45) then map.state = AI_STATE_ONSLAUGHT else map.state = AI_STATE_RAIDING @@ -281,22 +293,8 @@ function aiPlanning.planning(map, evolution_factor, tick) game.print(map.surface.name .. ": AI is now: " .. constants.stateEnglish[map.state] .. ", Next state change is in " .. string.format("%.2f", (map.stateTick - tick) / (60*60)) .. " minutes @ " .. getTimeStringFromTick(map.stateTick) .. " playtime") end end - end -function getTimeStringFromTick(tick) - - local tickToSeconds = tick / 60 - - local days = math.floor(tickToSeconds / 86400) - local hours = math.floor((tickToSeconds % 86400) / 3600) - local minutes = math.floor((tickToSeconds % 3600) / 60) - local seconds = math.floor(tickToSeconds % 60) - return days .. "d " .. hours .. "h " .. minutes .. "m " .. seconds .. "s" -end - - - function aiPlanning.temperamentPlanner(map) local destroyPlayerBuildings = map.destroyPlayerBuildings local lostEnemyUnits = map.lostEnemyUnits diff --git a/libs/MapProcessor.lua b/libs/MapProcessor.lua index 9c0b4b4..17b7d72 100755 --- a/libs/MapProcessor.lua +++ b/libs/MapProcessor.lua @@ -534,10 +534,6 @@ function mapProcessor.processSpawners(map, tick) "processActiveSpawnerIterator", map.chunkToActiveNest) elseif (map.state == AI_STATE_SIEGE) then - processSpawners(map, - tick, - "processMigrationIterator", - map.chunkToNests) processSpawners(map, tick, "processActiveSpawnerIterator", @@ -546,6 +542,10 @@ function mapProcessor.processSpawners(map, tick) tick, "processActiveRaidSpawnerIterator", map.chunkToActiveRaidNest) + processSpawners(map, + tick, + "processMigrationIterator", + map.chunkToNests) else processSpawners(map, tick,