mirror of
https://github.com/veden/Rampant.git
synced 2025-02-05 13:14:51 +02:00
added an initialPeaceTime setting allow initial base setup
This commit is contained in:
parent
424b7a6d9d
commit
219826fa86
@ -508,6 +508,7 @@ function upgrade.attempt(universe)
|
||||
universe.chunkToPassScan = {}
|
||||
universe.chunkToPassScanIterator = nil
|
||||
universe.baseId = 0
|
||||
universe.awake = false
|
||||
|
||||
game.print("Rampant - Version 2.0.0")
|
||||
end
|
||||
@ -592,7 +593,7 @@ function upgrade.prepMap(universe, surface)
|
||||
map.baseIndex = 1
|
||||
map.baseIncrement = 0
|
||||
map.points = 0
|
||||
map.state = constants.AI_STATE_AGGRESSIVE
|
||||
map.state = constants.AI_STATE_PEACEFUL
|
||||
map.squads = nil
|
||||
map.pendingAttack = nil
|
||||
map.building = nil
|
||||
|
@ -36,6 +36,7 @@ Date: 23. 11. 2021
|
||||
- Siege groups now try to settle just outside player structures as opposed to attacking
|
||||
- Added Raid AI state to lower temperament scores @ 20% at 0 temperament and 15% at (0.2, 0.4)
|
||||
- Vengence squads now have a 7.5% chance to be a settler group if migration is enabled
|
||||
- Added configurable initial amount of time before the AI goes out of peaceful mode (Thank you Dimm2101)
|
||||
Tweaks:
|
||||
- Increase chance to upgrade an enemy structure from 5% to 30%
|
||||
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures
|
||||
|
@ -23,6 +23,7 @@ local queryUtils = require("libs/QueryUtils")
|
||||
|
||||
-- constants
|
||||
|
||||
local TICKS_A_MINUTE = constants.TICKS_A_MINUTE
|
||||
local COMMAND_TIMEOUT = constants.COMMAND_TIMEOUT
|
||||
local AI_SQUAD_COST = constants.AI_SQUAD_COST
|
||||
local AI_SETTLER_COST = constants.AI_SETTLER_COST
|
||||
@ -235,6 +236,9 @@ local function onModSettingsChange(event)
|
||||
universe["AI_MAX_BUILDER_COUNT"] = settings.global["rampant--maxNumberOfBuilders"].value
|
||||
universe["MAX_BASE_MUTATIONS"] = settings.global["rampant--max-base-mutations"].value
|
||||
|
||||
universe["initialPeaceTime"] = settings.global["rampant--initialPeaceTime"].value * TICKS_A_MINUTE
|
||||
universe["printAwakenMessage"] = settings.global["rampant--printAwakenMessage"].value
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -152,177 +152,185 @@ local function planning(map, evolution_factor, tick)
|
||||
map.points = maxOverflowPoints
|
||||
end
|
||||
|
||||
if (map.stateTick <= tick) then
|
||||
local roll = universe.random()
|
||||
if (map.temperament < 0.05) then -- 0 - 0.05
|
||||
if universe.enabledMigration then
|
||||
if (roll < 0.30) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif (roll < 0.50) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
else
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
else
|
||||
if universe.raidAIToggle then
|
||||
if (roll < 0.70) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
if (map.stateTick > tick) or not universe.awake then
|
||||
if (not universe.awake) and (tick >= universe.initialPeaceTime) then
|
||||
universe.awake = true
|
||||
if universe.printAwakenMessage then
|
||||
game.print({"description.rampant--planetHasAwoken"})
|
||||
end
|
||||
elseif (map.temperament < 0.20) then -- 0.05 - 0.2
|
||||
if (universe.enabledMigration) then
|
||||
if (roll < 0.4) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif (roll < 0.55) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
else
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
else
|
||||
if universe.raidAIToggle then
|
||||
if (roll < 0.40) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
else
|
||||
map.state = AI_STATE_RAIDING
|
||||
end
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.4) then -- 0.2 - 0.4
|
||||
if (universe.enabledMigration) then
|
||||
if (roll < 0.2) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.2) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.8) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
else
|
||||
if (roll < 0.3) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.6) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.6) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.6) then -- 0.4 - 0.6
|
||||
if (roll < 0.4) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.5) and universe.raidAIToggle then
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
local roll = universe.random()
|
||||
if (map.temperament < 0.05) then -- 0 - 0.05
|
||||
if universe.enabledMigration then
|
||||
if (roll < 0.30) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif (roll < 0.50) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.75) and universe.peacefulAIToggle then
|
||||
elseif universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
else
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
else
|
||||
if universe.raidAIToggle then
|
||||
if (roll < 0.70) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.20) then -- 0.05 - 0.2
|
||||
if (universe.enabledMigration) then
|
||||
if (roll < 0.4) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif (roll < 0.55) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
else
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
else
|
||||
if universe.raidAIToggle then
|
||||
if (roll < 0.40) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
else
|
||||
map.state = AI_STATE_RAIDING
|
||||
end
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.4) then -- 0.2 - 0.4
|
||||
if (universe.enabledMigration) then
|
||||
if (roll < 0.2) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.2) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.8) then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
elseif universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
if universe.enabledMigration then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
map.state = AI_STATE_MIGRATING
|
||||
end
|
||||
elseif (map.temperament < 0.8) then -- 0.6 - 0.8
|
||||
if (roll < 0.4) then
|
||||
else
|
||||
if (roll < 0.3) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.6) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
elseif (roll < 0.8) then
|
||||
elseif (roll < 0.6) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.6) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (map.temperament < 0.95) then -- 0.8 - 0.95
|
||||
if (universe.enabledMigration and universe.raidAIToggle) then
|
||||
if (roll < 0.20) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.45) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.85) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (universe.enabledMigration) then
|
||||
if (roll < 0.20) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.75) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (universe.raidAIToggle) then
|
||||
if (roll < 0.45) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
elseif (roll < 0.75) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.6) then -- 0.4 - 0.6
|
||||
if (roll < 0.4) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.5) and universe.raidAIToggle then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.75) and universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
if universe.enabledMigration then
|
||||
map.state = AI_STATE_MIGRATING
|
||||
else
|
||||
if (roll < 0.65) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
elseif (map.temperament < 0.8) then -- 0.6 - 0.8
|
||||
if (roll < 0.4) then
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
elseif (roll < 0.6) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
elseif (roll < 0.8) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif universe.peacefulAIToggle then
|
||||
map.state = AI_STATE_PEACEFUL
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (map.temperament < 0.95) then -- 0.8 - 0.95
|
||||
if (universe.enabledMigration and universe.raidAIToggle) then
|
||||
if (roll < 0.20) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.45) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
elseif (roll < 0.85) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (universe.enabledMigration) then
|
||||
if (roll < 0.20) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.75) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
elseif (universe.raidAIToggle) then
|
||||
if (roll < 0.45) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
elseif (roll < 0.75) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
else
|
||||
if (universe.enabledMigration and universe.raidAIToggle) then
|
||||
if (roll < 0.30) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.65) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
end
|
||||
elseif (universe.enabledMigration) 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.45) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_RAIDING
|
||||
end
|
||||
if (roll < 0.65) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_AGGRESSIVE
|
||||
end
|
||||
end
|
||||
else
|
||||
if (universe.enabledMigration and universe.raidAIToggle) then
|
||||
if (roll < 0.30) and universe.siegeAIToggle then
|
||||
map.state = AI_STATE_SIEGE
|
||||
elseif (roll < 0.65) then
|
||||
map.state = AI_STATE_RAIDING
|
||||
else
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
end
|
||||
elseif (universe.enabledMigration) 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.45) then
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
else
|
||||
map.state = AI_STATE_RAIDING
|
||||
end
|
||||
else
|
||||
map.state = AI_STATE_ONSLAUGHT
|
||||
end
|
||||
end
|
||||
|
||||
map.destroyPlayerBuildings = 0
|
||||
map.lostEnemyUnits = 0
|
||||
map.lostEnemyBuilding = 0
|
||||
map.rocketLaunched = 0
|
||||
map.builtEnemyBuilding = 0
|
||||
map.ionCannonBlasts = 0
|
||||
map.artilleryBlasts = 0
|
||||
map.destroyPlayerBuildings = 0
|
||||
map.lostEnemyUnits = 0
|
||||
map.lostEnemyBuilding = 0
|
||||
map.rocketLaunched = 0
|
||||
map.builtEnemyBuilding = 0
|
||||
map.ionCannonBlasts = 0
|
||||
map.artilleryBlasts = 0
|
||||
|
||||
map.stateTick = randomTickEvent(map.random, tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
|
||||
map.stateTick = randomTickEvent(map.random, tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
|
||||
|
||||
if universe.printAIStateChanges then
|
||||
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
|
||||
if universe.printAIStateChanges then
|
||||
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
|
||||
|
||||
|
@ -18789,6 +18789,8 @@ poison-worm-v20-t10-rampant=Poison worm: t10 Leviathan
|
||||
[entity-description]
|
||||
|
||||
[mod-setting-name]
|
||||
rampant--printAwakenMessage=World: Print when initial peace ends
|
||||
rampant--initialPeaceTime=World: Starting peace duration
|
||||
rampant--printBaseUpgrades=AI: Print Faction Base Upgrades
|
||||
rampant--max-base-mutations=World: Max Mutations per faction
|
||||
rampant--baseDistanceModifier=AI: Faction Base Distance Modifier
|
||||
@ -18895,6 +18897,8 @@ rampant--enableFadeTime=Enable corpse fade time
|
||||
rampant--temperamentRateModifier=AI: Temperament Rate Modifier
|
||||
|
||||
[mod-setting-description]
|
||||
rampant--printAwakenMessage=Print a message to the console when the initial peace time ends
|
||||
rampant--initialPeaceTime=The AI will remain in the peaceful state until the specified number of minutes have passed in game. This should give time for someone to get an initial base started.
|
||||
rampant--printBaseUpgrades=Print to console when a building is upgraded by the AI. These should not happen during a migration, but over the lifetime of a enemy structure.
|
||||
rampant--max-base-mutations=Requires Rampant new enemies to have any affect. This number represents the number of times a regional faction group can mutate into other factions. Regional faction groups adapt over time typically to a faction that is strong against the type of damage they are being killed with. Death threshold for mutation is based on evolution. (4500 Deaths:<50% Evolution, 7500:<70%, 11000:<90%, 16000)
|
||||
rampant--baseDistanceModifier=Modifies the distance between factions as a percentage change. Low percentages may impact performance.
|
||||
@ -18999,6 +19003,7 @@ rampant--maxNumberOfSquads=More squads requires more UPS.
|
||||
rampant--temperamentRateModifier=Change how quickly Rampant will hit extremes in the ai temperament stat which control attacking and expanding. This is a percentage increase or decrease with 1 being equal to 100%.
|
||||
|
||||
[description]
|
||||
rampant--planetHasAwoken=Rampant: The natives are beginning to react to your presence.
|
||||
rampant-bobs-nee-newEnemies=Bobs enemies or NEE has been detected with Rampants new enemies,\nthe artifacts from each of these mods will still work with Rampants new enemies.\nThe generation of bobs or NEE unit spawners explicitly by Rampant is\nno longer supported when the Rampants new enemies are active.
|
||||
rampant--adaptation2DebugMessage=Faction has mutated bacause the damage type called __1__. Now the Faction will produce __2__ and __3__. Faction mutations __6__ out of __7__. [gps=__4__,__5__]
|
||||
rampant--adaptation1DebugMessage=Faction has mutated bacause the damage type called __1__. Now the Faction will produce __2__. Faction mutations __5__ out of __6__. [gps=__3__,__4__]
|
||||
|
21
settings.lua
21
settings.lua
@ -463,6 +463,27 @@ data:extend({
|
||||
per_user = false
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
type = "int-setting",
|
||||
name = "rampant--initialPeaceTime",
|
||||
setting_type = "runtime-global",
|
||||
minimum_value = 0,
|
||||
default_value = 20,
|
||||
maximum_value = 9999999999,
|
||||
order = "m[total]-c[ai]",
|
||||
per_user = false
|
||||
},
|
||||
|
||||
{
|
||||
type = "bool-setting",
|
||||
name = "rampant--printAwakenMessage",
|
||||
setting_type = "runtime-global",
|
||||
default_value = true,
|
||||
order = "m[total]-c[ai]",
|
||||
per_user = false
|
||||
},
|
||||
|
||||
{
|
||||
type = "bool-setting",
|
||||
name = "rampant--peacefulAIToggle",
|
||||
|
Loading…
x
Reference in New Issue
Block a user