mirror of
https://github.com/veden/Rampant.git
synced 2024-12-26 20:54:12 +02:00
FACTO-250: Moving enemy seed and variations into constants, using
enemy seed for random ai generator
This commit is contained in:
parent
e189001880
commit
9232f4583b
@ -33,6 +33,7 @@ Version: 3.2.0
|
||||
- Moved new enemies creation from data-update-final to data stage
|
||||
- Reduced the size of stickers applied by Rampant new enemies to player entities
|
||||
- Recording the resource chunks covered by a given base as a property of a base
|
||||
- Use the enemy seed value instead of the map seed for puesdo random generating used by AI
|
||||
Bugfixes:
|
||||
- Removed layer-13 from projectiles
|
||||
- script_raised_built now looks for enemy faction and registers as needed
|
||||
|
@ -327,8 +327,6 @@ local function onConfigChanged()
|
||||
|
||||
onModSettingsChange({setting="rampant--"})
|
||||
|
||||
Universe["ENEMY_SEED"] = settings.startup["rampant--enemySeed"].value
|
||||
Universe["ENEMY_VARIATIONS"] = settings.startup["rampant--newEnemyVariations"].value
|
||||
Universe["NEW_ENEMIES"] = settings.startup["rampant--newEnemies"].value
|
||||
|
||||
-- not a completed implementation needs if checks to use all forces
|
||||
|
@ -23,6 +23,9 @@ local mathUtils = require("MathUtils")
|
||||
|
||||
-- misc
|
||||
|
||||
constants.ENEMY_SEED = settings.startup["rampant--enemySeed"].value
|
||||
constants.ENEMY_VARIATIONS = settings.startup["rampant--newEnemyVariations"].value
|
||||
|
||||
constants.MAGIC_MAXIMUM_NUMBER = 1e99 -- used in loops trying to find the lowest/highest score
|
||||
constants.MAGIC_MAXIMUM_BASE_NUMBER = 100000000
|
||||
constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL_MIN = (1 - 0.001)
|
||||
@ -367,7 +370,7 @@ buildTier(constants.TIERS, tiersSet)
|
||||
|
||||
constants.TIER_UPGRADE_SET = tiersSet
|
||||
|
||||
local variations = settings.startup["rampant--newEnemyVariations"].value
|
||||
local variations = constants.ENEMY_VARIATIONS
|
||||
|
||||
constants.ENERGY_THIEF_LOOKUP = {}
|
||||
|
||||
@ -1720,7 +1723,7 @@ for i=1,#constants.FACTION_SET do
|
||||
end
|
||||
|
||||
local variationSet = {}
|
||||
for v=1,settings.startup["rampant--newEnemyVariations"].value
|
||||
for v=1,constants.ENEMY_VARIATIONS
|
||||
do
|
||||
local entry = faction.type .. "-" .. building.name .. "-v" .. v .. "-t" .. t .. "-rampant"
|
||||
enemyAlignmentLookup[entry] = faction.type
|
||||
|
@ -18,18 +18,18 @@ local Upgrade = {}
|
||||
|
||||
-- imports
|
||||
|
||||
local constants = require("libs/Constants")
|
||||
local chunkProcessor = require("libs/ChunkProcessor")
|
||||
local chunkPropertyUtils = require("libs/ChunkPropertyUtils")
|
||||
local mapUtils = require("libs/MapUtils")
|
||||
local Constants = require("libs/Constants")
|
||||
local ChunkProcessor = require("libs/ChunkProcessor")
|
||||
local ChunkPropertyUtils = require("libs/ChunkPropertyUtils")
|
||||
local MapUtils = require("libs/MapUtils")
|
||||
|
||||
--
|
||||
|
||||
local Universe
|
||||
|
||||
-- constants
|
||||
-- Constants
|
||||
|
||||
local MINIMUM_EXPANSION_DISTANCE = constants.MINIMUM_EXPANSION_DISTANCE
|
||||
local MINIMUM_EXPANSION_DISTANCE = Constants.MINIMUM_EXPANSION_DISTANCE
|
||||
local DEFINES_COMMAND_GROUP = defines.command.group
|
||||
local DEFINES_COMMAND_WANDER = defines.command.wander
|
||||
local DEFINES_COMMAND_BUILD_BASE = defines.command.build_base
|
||||
@ -45,22 +45,22 @@ local DEFINES_DISTRACTION_NONE = defines.distraction.none
|
||||
local DEFINES_DISTRACTION_BY_ENEMY = defines.distraction.by_enemy
|
||||
local DEFINES_DISTRACTION_BY_ANYTHING = defines.distraction.by_anything
|
||||
|
||||
local CHUNK_SIZE = constants.CHUNK_SIZE
|
||||
local TRIPLE_CHUNK_SIZE = constants.TRIPLE_CHUNK_SIZE
|
||||
local CHUNK_SIZE = Constants.CHUNK_SIZE
|
||||
local TRIPLE_CHUNK_SIZE = Constants.TRIPLE_CHUNK_SIZE
|
||||
|
||||
local ENEMY_PHEROMONE = constants.ENEMY_PHEROMONE
|
||||
local CHUNK_TICK = constants.CHUNK_TICK
|
||||
local ENEMY_PHEROMONE = Constants.ENEMY_PHEROMONE
|
||||
local CHUNK_TICK = Constants.CHUNK_TICK
|
||||
|
||||
local TICKS_A_MINUTE = constants.TICKS_A_MINUTE
|
||||
local TICKS_A_MINUTE = Constants.TICKS_A_MINUTE
|
||||
|
||||
-- imported functions
|
||||
|
||||
local addBaseResourceChunk = chunkPropertyUtils.addBaseResourceChunk
|
||||
local getChunkBase = chunkPropertyUtils.getChunkBase
|
||||
local getResourceGenerator = chunkPropertyUtils.getResourceGenerator
|
||||
local addBaseResourceChunk = ChunkPropertyUtils.addBaseResourceChunk
|
||||
local getChunkBase = ChunkPropertyUtils.getChunkBase
|
||||
local getResourceGenerator = ChunkPropertyUtils.getResourceGenerator
|
||||
local sFind = string.find
|
||||
local queueGeneratedChunk = mapUtils.queueGeneratedChunk
|
||||
local processPendingChunks = chunkProcessor.processPendingChunks
|
||||
local queueGeneratedChunk = MapUtils.queueGeneratedChunk
|
||||
local processPendingChunks = ChunkProcessor.processPendingChunks
|
||||
|
||||
-- module code
|
||||
|
||||
@ -580,14 +580,14 @@ function Upgrade.attempt()
|
||||
game.forces.enemy.kill_all_units()
|
||||
|
||||
game.map_settings.path_finder.min_steps_to_check_path_find_termination =
|
||||
constants.PATH_FINDER_MIN_STEPS_TO_CHECK_PATH
|
||||
Constants.PATH_FINDER_MIN_STEPS_TO_CHECK_PATH
|
||||
|
||||
game.map_settings.unit_group.min_group_radius = constants.UNIT_GROUP_MAX_RADIUS * 0.5
|
||||
game.map_settings.unit_group.max_group_radius = constants.UNIT_GROUP_MAX_RADIUS
|
||||
game.map_settings.unit_group.min_group_radius = Constants.UNIT_GROUP_MAX_RADIUS * 0.5
|
||||
game.map_settings.unit_group.max_group_radius = Constants.UNIT_GROUP_MAX_RADIUS
|
||||
|
||||
game.map_settings.unit_group.max_member_speedup_when_behind = constants.UNIT_GROUP_MAX_SPEED_UP
|
||||
game.map_settings.unit_group.max_member_slowdown_when_ahead = constants.UNIT_GROUP_MAX_SLOWDOWN
|
||||
game.map_settings.unit_group.max_group_slowdown_factor = constants.UNIT_GROUP_SLOWDOWN_FACTOR
|
||||
game.map_settings.unit_group.max_member_speedup_when_behind = Constants.UNIT_GROUP_MAX_SPEED_UP
|
||||
game.map_settings.unit_group.max_member_slowdown_when_ahead = Constants.UNIT_GROUP_MAX_SLOWDOWN
|
||||
game.map_settings.unit_group.max_group_slowdown_factor = Constants.UNIT_GROUP_SLOWDOWN_FACTOR
|
||||
|
||||
game.map_settings.max_failed_behavior_count = 3
|
||||
game.map_settings.unit_group.member_disown_distance = 10
|
||||
@ -608,7 +608,7 @@ function Upgrade.attempt()
|
||||
end
|
||||
end
|
||||
|
||||
Universe.random = game.create_random_generator()
|
||||
Universe.random = game.create_random_generator(Constants.ENEMY_SEED)
|
||||
|
||||
Upgrade.excludeSurface()
|
||||
|
||||
|
@ -52,7 +52,7 @@ local deepcopy = util.table.deepcopy
|
||||
|
||||
local TIER_UPGRADE_SET = constants.TIER_UPGRADE_SET
|
||||
|
||||
local xorRandom = mathUtils.xorRandom(settings.startup["rampant--enemySeed"].value)
|
||||
local xorRandom = mathUtils.xorRandom(constants.ENEMY_SEED)
|
||||
|
||||
local biterattackanimation = unitUtils.biterattackanimation
|
||||
|
||||
@ -932,7 +932,7 @@ end
|
||||
local function buildUnits(template)
|
||||
local unitSet = {}
|
||||
|
||||
local variations = settings.startup["rampant--newEnemyVariations"].value
|
||||
local variations = constants.ENEMY_VARIATIONS
|
||||
|
||||
for tier=1, TIERS do
|
||||
local effectiveLevel = TIER_UPGRADE_SET[tier]
|
||||
@ -1015,7 +1015,7 @@ local function buildEntities(entityTemplates)
|
||||
end
|
||||
|
||||
local function buildEntitySpawner(template)
|
||||
local variations = settings.startup["rampant--newEnemyVariations"].value
|
||||
local variations = constants.ENEMY_VARIATIONS
|
||||
|
||||
for tier=1, TIERS do
|
||||
local effectiveLevel = TIER_UPGRADE_SET[tier]
|
||||
@ -1042,7 +1042,7 @@ local function buildEntitySpawner(template)
|
||||
end
|
||||
|
||||
local function buildUnitSpawner(template)
|
||||
local variations = settings.startup["rampant--newEnemyVariations"].value
|
||||
local variations = constants.ENEMY_VARIATIONS
|
||||
|
||||
for tier=1, TIERS do
|
||||
local effectiveLevel = TIER_UPGRADE_SET[tier]
|
||||
@ -1071,7 +1071,7 @@ local function buildUnitSpawner(template)
|
||||
end
|
||||
|
||||
local function buildWorm(template)
|
||||
local variations = settings.startup["rampant--newEnemyVariations"].value
|
||||
local variations = constants.ENEMY_VARIATIONS
|
||||
|
||||
for tier=1, TIERS do
|
||||
local effectiveLevel = TIER_UPGRADE_SET[tier]
|
||||
@ -1536,7 +1536,7 @@ local function buildUnitSpawnerTemplate(faction, incomingTemplate, unitSets)
|
||||
|
||||
local unitSet = {}
|
||||
|
||||
-- local unitVariations = settings.startup["rampant--newEnemyVariations"].value
|
||||
-- local unitVariations = constants.ENEMY_VARIATIONS
|
||||
|
||||
for t=1,TIERS do
|
||||
for i=1,#template.buildSets do
|
||||
|
Loading…
Reference in New Issue
Block a user