From 0183b78fd18e42487fd454c153ead1b2a5a08c1b Mon Sep 17 00:00:00 2001 From: Aaron Veden Date: Sat, 1 May 2021 10:26:05 -0700 Subject: [PATCH] see changelog --- Upgrade.lua | 4 ++-- changelog.txt | 2 ++ control.lua | 38 +++++++++++++++++++------------------- libs/AIAttackWave.lua | 6 +++--- libs/AIPlanning.lua | 2 +- libs/BaseUtils.lua | 10 +++++----- libs/ChunkUtils.lua | 4 ++-- settings.lua | 12 ++++++------ 8 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Upgrade.lua b/Upgrade.lua index f273d7f..84561ed 100755 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -336,10 +336,10 @@ function upgrade.attempt(universe) universe.safeEntities = {} universe.aiPointsScaler = settings.global["rampant--aiPointsScaler"].value - + universe.aiPointsPrintGainsToChat = settings.global["rampant--aiPointsPrintGainsToChat"].value universe.aiPointsPrintSpendingToChat = settings.global["rampant--aiPointsPrintSpendingToChat"].value - + universe.aiNocturnalMode = settings.global["rampant--permanentNocturnal"].value universe.mapIterator = nil diff --git a/changelog.txt b/changelog.txt index 56da20b..aa35eb4 100755 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ Version: 1.0.10 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 Improvements: - Increased ai baseline point accumulation based on temperament Tweaks: diff --git a/control.lua b/control.lua index 15eca66..67622a6 100644 --- a/control.lua +++ b/control.lua @@ -133,9 +133,9 @@ local function onIonCannonFired(event) map.ionCannonBlasts = map.ionCannonBlasts + 1 map.points = map.points + 4000 if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. 4000 .. ". [Ion Cannon] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. 4000 .. ". [Ion Cannon] Total: " .. string.format("%.2f", map.points)) end - + local chunk = getChunkByPosition(map, event.position) if (chunk ~= -1) then rallyUnits(chunk, map, event.tick) @@ -239,7 +239,7 @@ local function onModSettingsChange(event) universe.aiPointsPrintGainsToChat = settings.global["rampant--aiPointsPrintGainsToChat"].value universe.aiPointsPrintSpendingToChat = settings.global["rampant--aiPointsPrintSpendingToChat"].value - + universe.enabledMigration = universe.expansion and settings.global["rampant--enableMigration"].value universe.peacefulAIToggle = settings.global["rampant--peacefulAIToggle"].value universe.printAIStateChanges = settings.global["rampant--printAIStateChanges"].value @@ -518,10 +518,10 @@ local function onDeath(event) else map.points = map.points + RECOVER_WORM_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points)) end - end - + end + unregisterEnemyBaseStructure(map, entity, event.damage_type) if (chunk ~= -1) then @@ -763,7 +763,7 @@ local function onRocketLaunch(event) map.rocketLaunched = map.rocketLaunched + 1 map.points = map.points + 5000 if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. 5000 .. ". [Rocket Launch] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. 5000 .. ". [Rocket Launch] Total: " .. string.format("%.2f", map.points)) end end end @@ -836,7 +836,7 @@ local function onUnitGroupCreated(event) group.destroy() map.points = map.points + AI_SQUAD_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) end return end @@ -860,7 +860,7 @@ local function onUnitGroupCreated(event) if not (surface.darkness > 0.65) then map.points = map.points + AI_SQUAD_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) end group.destroy() return @@ -874,7 +874,7 @@ local function onUnitGroupCreated(event) group.destroy() map.points = map.points + AI_SQUAD_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) end return end @@ -922,7 +922,7 @@ local function onGroupFinishedGathering(event) group.destroy() map.points = map.points + AI_SQUAD_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) end end end @@ -935,7 +935,7 @@ local function onGroupFinishedGathering(event) group.destroy() map.points = map.points + AI_SQUAD_COST if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points)) end return end @@ -990,9 +990,9 @@ local function onBuilderArrived(event) local targetPosition = universe.position targetPosition.x = builder.position.x targetPosition.y = builder.position.y - + --local map = universe.maps[event.surface.index] -- crashes - if universe.aiPointsPrintSpendingToChat then + if universe.aiPointsPrintSpendingToChat then --game.print(map.surface.name .. ": Settled: [gps=" .. targetPosition.x .. "," .. targetPosition.y .."]") -- crashes game.print("Settled: [gps=" .. targetPosition.x .. "," .. targetPosition.y .."]") end @@ -1135,17 +1135,17 @@ remote.add_interface("rampantTests", function rampantSetAIState(event) local surfaceIndex = game.players[event.player_index].surface.index local map = universe.maps[surfaceIndex] - + game.print(map.surface.name .. " is in " .. constants.stateEnglish[map.state]) - + if event.parameter then local target = tonumber(event.parameter) - + if (target == nil) then game.print("invalid param") return end - + if (target ~= constants.AI_STATE_PEACEFUL and target ~= constants.AI_STATE_AGGRESSIVE and target ~= constants.AI_STATE_RAIDING and target ~= constants.AI_STATE_MIGRATING and target ~= constants.AI_STATE_SIEGE and target ~= constants.AI_STATE_ONSLAUGHT) then game.print(target .. " is not a valid state") return @@ -1156,4 +1156,4 @@ function rampantSetAIState(event) end end -commands.add_command('rampantSetAIState', "", rampantSetAIState) \ No newline at end of file +commands.add_command('rampantSetAIState', "", rampantSetAIState) diff --git a/libs/AIAttackWave.lua b/libs/AIAttackWave.lua index 5c6db8b..279fdc1 100755 --- a/libs/AIAttackWave.lua +++ b/libs/AIAttackWave.lua @@ -231,7 +231,7 @@ function aiAttackWave.formSettlers(map, chunk) squad.kamikaze = mRandom() < calculateKamikazeThreshold(foundUnits, universe) universe.builderCount = universe.builderCount + 1 map.points = map.points - AI_SETTLER_COST - if universe.aiPointsPrintSpendingToChat then + if universe.aiPointsPrintSpendingToChat then game.print(map.surface.name .. ": Points: -" .. AI_SETTLER_COST .. ". [Settler] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]") end map.groupNumberToSquad[squad.groupNumber] = squad @@ -282,7 +282,7 @@ function aiAttackWave.formVengenceSquad(map, chunk) map.groupNumberToSquad[squad.groupNumber] = squad universe.squadCount = universe.squadCount + 1 map.points = map.points - AI_VENGENCE_SQUAD_COST - if universe.aiPointsPrintSpendingToChat then + if universe.aiPointsPrintSpendingToChat then game.print(map.surface.name .. ": Points: -" .. AI_VENGENCE_SQUAD_COST .. ". [Vengence] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]") end else @@ -338,7 +338,7 @@ function aiAttackWave.formSquads(map, chunk, tick) AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION, AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION) end - if universe.aiPointsPrintSpendingToChat then + if universe.aiPointsPrintSpendingToChat then game.print(map.surface.name .. ": Points: -" .. AI_SQUAD_COST .. ". [Squad] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]") end else diff --git a/libs/AIPlanning.lua b/libs/AIPlanning.lua index 7d2e497..9f6338a 100644 --- a/libs/AIPlanning.lua +++ b/libs/AIPlanning.lua @@ -287,7 +287,7 @@ 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) diff --git a/libs/BaseUtils.lua b/libs/BaseUtils.lua index b6a8885..ab33404 100755 --- a/libs/BaseUtils.lua +++ b/libs/BaseUtils.lua @@ -364,13 +364,13 @@ function baseUtils.processBase(chunk, map, tick, base) end -- if (base.deathEvents > 1000) then - if (upgradeRoll > 0.95) then - if (base.points >= BASE_UPGRADE) then - if upgradeBase(map, base) then - base.points = base.points - BASE_UPGRADE - end + -- if (upgradeRoll > 0.95) then + if (base.points >= BASE_UPGRADE) then + if upgradeBase(map, base) then + base.points = base.points - BASE_UPGRADE end end + -- end -- base.damagedBy = {} -- base.deathEvents = 0 -- end diff --git a/libs/ChunkUtils.lua b/libs/ChunkUtils.lua index 5e5bbba..4856054 100755 --- a/libs/ChunkUtils.lua +++ b/libs/ChunkUtils.lua @@ -550,12 +550,12 @@ function chunkUtils.accountPlayerEntity(entity, map, addObject, creditNatives) if (map.state == AI_STATE_ONSLAUGHT) then map.points = map.points + entityValue if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points)) end else map.points = map.points + (entityValue * 0.12) if universe.aiPointsPrintGainsToChat then - game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue * 0.12) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points)) + game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue * 0.12) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points)) end end end diff --git a/settings.lua b/settings.lua index 849cfbd..ae0de3b 100755 --- a/settings.lua +++ b/settings.lua @@ -499,16 +499,16 @@ data:extend({ order = "m[total]-b[ai]1", per_user = false }, - + { type = "bool-setting", name = "rampant--aiPointsPrintSpendingToChat", description = "rampant--aiPointsPrintSpendingToChat", setting_type = "runtime-global", default_value = false, - order = "m[total]-b[ai]2", + order = "m[total]-c[ai]z", per_user = false - }, + }, { type = "bool-setting", @@ -516,10 +516,10 @@ data:extend({ description = "rampant--aiPointsPrintGainsToChat", setting_type = "runtime-global", default_value = false, - order = "m[total]-b[ai]3", + order = "m[total]-c[ai]z", per_user = false }, - + { type = "double-setting", name = "rampant--temperamentRateModifier", @@ -530,7 +530,7 @@ data:extend({ order = "m[total]-b[ai]", per_user = false }, - + { type = "bool-setting", name = "rampant--removeBloodParticles",