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

Added Map Setting to disable the AI's Peaceful State

Added an AI: Enable Peaceful toggle. Defaults on. If it's disabled and the AI: Enable Migration setting is enabled, then when the AI state rolls Peaceful it is instead converted to Migrating.

Added a 2nd setting to display AI state changes in chat. Defaults off.
This commit is contained in:
Dagothur 2021-04-16 09:54:58 -04:00
parent 5821b8e4e3
commit 485abfd19c
6 changed files with 48 additions and 2 deletions

View File

@ -370,6 +370,8 @@ function upgrade.attempt(universe)
universe.settlerWaveSize = 0
universe.enabledMigration = universe.expansion and settings.global["rampant--enableMigration"].value
universe.peacefulAIToggle = not universe.enabledMigration or settings.global["rampant--peacefulAIToggle"].value
universe.printAIStateChanges = settings.global["rampant--printAIStateChanges"].value
universe.enemyAlignmentLookup = {}

View File

@ -233,6 +233,8 @@ local function onModSettingsChange(event)
settings.global["rampant--aiPointsScaler"].value)
universe.enabledMigration = universe.expansion and settings.global["rampant--enableMigration"].value
universe.peacefulAIToggle = not universe.enabledMigration or settings.global["rampant--peacefulAIToggle"].value
universe.printAIStateChanges = settings.global["rampant--printAIStateChanges"].value
upgrade.compareTable(universe,
"AI_MAX_SQUAD_COUNT",

View File

@ -255,8 +255,20 @@ function aiPlanning.planning(map, evolution_factor, tick)
map.builtEnemyBuilding = 0
map.ionCannonBlasts = 0
map.artilleryBlasts = 0
if map.state == AI_STATE_PEACEFUL and (not universe.peacefulAIToggle) then
if universe.printAIStateChanges then
game.print("Forcing AI_STATE_PEACEFUL to AI_STATE_MIGRATING")
end
map.state = AI_STATE_MIGRATING
end
map.stateTick = randomTickEvent(tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
if universe.printAIStateChanges then
game.print("AI state is now: " .. map.state .. " " .. constants.stateEnglish[map.state] .. " Next state change is in " .. (map.stateTick - tick) / 60 .. " seconds")
end
end
end

View File

@ -144,6 +144,14 @@ constants.AI_STATE_MIGRATING = 5
constants.AI_STATE_SIEGE = 6
constants.AI_STATE_ONSLAUGHT = 7
constants.stateEnglish = {}
constants.stateEnglish[constants.AI_STATE_PEACEFUL] = "AI_STATE_PEACEFUL"
constants.stateEnglish[constants.AI_STATE_AGGRESSIVE] = "AI_STATE_AGGRESSIVE"
constants.stateEnglish[constants.AI_STATE_RAIDING] = "AI_STATE_RAIDING"
constants.stateEnglish[constants.AI_STATE_MIGRATING] = "AI_STATE_MIGRATING"
constants.stateEnglish[constants.AI_STATE_SIEGE] = "AI_STATE_SIEGE"
constants.stateEnglish[constants.AI_STATE_ONSLAUGHT] = "AI_STATE_ONSLAUGHT"
constants.BASE_AI_STATE_DORMANT = 0
constants.BASE_AI_STATE_ACTIVE = 1
constants.BASE_AI_STATE_OVERDRIVE = 2

View File

@ -18822,6 +18822,8 @@ rampant--disallowFriendlyFire=Safety: Disallow Friendly Fire Splash Damage
rampant--tierStart=World: Beginning enemy level
rampant--tierEnd=World: Ending enemy level
rampant--enableMigration=AI: Enable Migration
rampant--peacefulAIToggle=AI: Enable Peaceful
rampant--printAIStateChanges=AI: Print State Changes to Chat
# rampant--liteMode=Optimization: Lite mode
rampant--attackWaveGenerationUsePlayerProximity=Attack Wave: Use Player Proximity as attack trigger
@ -18919,8 +18921,10 @@ rampant--deadZoneFrequency=The percentage of zones that start without worms or n
rampant--newEnemyVariations=This number corresponds to the number of variations per tier. This adds randominess to each tier power level. Min 1, Max 20
rampant--disallowFriendlyFire=Prevents enemy spitters and worms from damaging units or buildings from the same force through splash damage
rampant--tierStart=This is the starting level of the enemy that will be used when generating the set of enemies for the specified number of tiers and increases linearly to the end tier for as many tiers selected. Roughly healthwise each tier is a follows (1-15,2-75,3-150,4-250,5-1000,6-2000,7-3500,8-7500,9-15000,10-30000). min 1, max 10
rampant--tierEnd=This is the ending tier level that is reached after increasing linearly from the start tier for as many tiers selected. Roughly healthwise each tier is a follows (1-15,2-75,3-150,4-250,5-1000,6-2000,7-3500,8-7500,9-15000,10-30000). min 1, max 10
rampant--tierEnd=This is the ending tier level that is reached after increasing linearly from the start tier for as many tiers selected. Roughly healthwise each tier is as follows (1-15,2-75,3-150,4-250,5-1000,6-2000,7-3500,8-7500,9-15000,10-30000). min 1, max 10
rampant--enableMigration=This will allow the ai to expand its worms and nests. Respects the map settings for biter expansion.
rampant--peacefulAIToggle=The Rampant AI can roll the peaceful state. If this is disabled and the biters roll the peaceful state, they are instead changed to the migration state. Requires AI: Enable Migration to be enabled for this setting to have any effect. This does not relate to whether your map has Factorio's Peaceful Mode enabled or disabled. Disable for the hardest Rampant experience.
rampant--printAIStateChanges=Gives you information in the game chat about Rampant's AI state. Messages are displayed for each surface. Disable for the hardest Rampant experience.
rampant--enableShrinkNestsAndWorms=Reduce the collision box size of nests and worms by 50%. May cause overlapping entities due to the collision box being smaller than the entity graphic.
rampant--attackWaveGenerationUsePlayerProximity=Include player pheromones amount for threshold on chunks with biter nests that will generate a Rampant attack wave. DOES NOT affect vanilla biters waves

View File

@ -450,7 +450,25 @@ data:extend({
order = "m[total]-c[ai]",
per_user = false
},
{
type = "bool-setting",
name = "rampant--peacefulAIToggle",
setting_type = "runtime-global",
default_value = true,
order = "m[total]-c[ai]",
per_user = false
},
{
type = "bool-setting",
name = "rampant--printAIStateChanges",
setting_type = "runtime-global",
default_value = false,
order = "m[total]-c[ai]z",
per_user = false
},
{
type = "bool-setting",
name = "rampant--permanentNocturnal",