mirror of
https://github.com/veden/Rampant.git
synced 2025-01-28 03:29:34 +02:00
fix settings crash, fix deadzone application, moved settings
This commit is contained in:
parent
a534caafcc
commit
5ff1caece3
@ -218,7 +218,7 @@ function upgrade.attempt(natives)
|
||||
global.version = constants.VERSION_57
|
||||
end
|
||||
if (global.version < constants.VERSION_67) then
|
||||
|
||||
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.32")
|
||||
global.version = constants.VERSION_67
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.16.32
|
||||
Date: 7. 19. 2018
|
||||
Date: 8. 1. 2018
|
||||
Improvements:
|
||||
- Raiding AI Toggle - toggles the ai raiding parties from outside your pollution cloud
|
||||
- Added a check for waterfill to trigger pass ability scan on affected chunks
|
||||
Tweaks:
|
||||
- Lowered base alignment selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for factions
|
||||
- Lowered upgrade entity selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for spawners and worms
|
||||
@ -11,6 +12,10 @@ Date: 7. 19. 2018
|
||||
- Surface tile change event wasn't correctly accounting active surface
|
||||
- Normalized evolution requirements so when starting at a higher enemy level they are placed at the correct starting distances
|
||||
- Fixed NEE compatibility
|
||||
- Version upgrade map rebuild will no longer reapply deadzones
|
||||
- Parenthesis in the wrong spot in pheromone dispersal algorithm
|
||||
- Moved AI toggles to map settings instead of startup settings
|
||||
- Changing new biter settings mid game no longer crashes the saves, still can cause entity loss
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.16.31
|
||||
|
22
control.lua
22
control.lua
@ -294,16 +294,16 @@ local function onModSettingsChange(event)
|
||||
upgrade.compareTable(natives, "enemySeed", settings.startup["rampant-enemySeed"].value)
|
||||
|
||||
-- RE-ENABLE WHEN COMPLETE
|
||||
upgrade.compareTable(natives, "disableVanillaAI", settings.startup["rampant-disableVanillaAI"].value)
|
||||
upgrade.compareTable(natives, "disableVanillaAI", settings.global["rampant-disableVanillaAI"].value)
|
||||
|
||||
natives.enabledMigration = natives.expansion and settings.startup["rampant-enableMigration"].value
|
||||
natives.enabledMigration = natives.expansion and settings.global["rampant-enableMigration"].value
|
||||
|
||||
game.forces.enemy.ai_controllable = not natives.disableVanillaAI
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function onConfigChanged()
|
||||
local function prepWorld(rebuild)
|
||||
local upgraded
|
||||
|
||||
if (game.surfaces["battle_surface_2"] ~= nil) then
|
||||
@ -316,6 +316,9 @@ local function onConfigChanged()
|
||||
|
||||
upgraded, natives = upgrade.attempt(natives)
|
||||
onModSettingsChange(nil)
|
||||
if natives.newEnemies then
|
||||
rebuildNativeTables(natives, game.surfaces[natives.activeSurface], game.create_random_generator(natives.enemySeed))
|
||||
end
|
||||
if upgraded then
|
||||
rebuildMap()
|
||||
|
||||
@ -333,13 +336,14 @@ local function onConfigChanged()
|
||||
y = chunk.y * 32 }}})
|
||||
end
|
||||
|
||||
processPendingChunks(natives, map, surface, pendingChunks, tick, game.forces.enemy.evolution_factor, true)
|
||||
end
|
||||
if natives.newEnemies then
|
||||
rebuildNativeTables(natives, game.surfaces[natives.activeSurface], game.create_random_generator(natives.enemySeed))
|
||||
processPendingChunks(natives, map, surface, pendingChunks, tick, game.forces.enemy.evolution_factor, rebuild)
|
||||
end
|
||||
end
|
||||
|
||||
local function onConfigChanged()
|
||||
prepWorld(true)
|
||||
end
|
||||
|
||||
script.on_nth_tick(INTERVAL_PROCESS,
|
||||
function (event)
|
||||
|
||||
@ -512,7 +516,7 @@ end
|
||||
|
||||
local function onSurfaceTileChange(event)
|
||||
local surfaceIndex = event.surface_index or (event.robot and event.robot.surface and event.robot.surface.index)
|
||||
if event.item and (event.item.name == "landfill") and (surfaceIndex == natives.activeSurface) then
|
||||
if event.item and ((event.item.name == "landfill") or (event.item.name == "waterfill")) and (surfaceIndex == natives.activeSurface) then
|
||||
local surface = game.surfaces[natives.activeSurface]
|
||||
local chunks = {}
|
||||
local tiles = event.tiles
|
||||
@ -601,7 +605,7 @@ local function onInit()
|
||||
natives = global.natives
|
||||
pendingChunks = global.pendingChunks
|
||||
|
||||
onConfigChanged()
|
||||
prepWorld(false)
|
||||
hookEvents()
|
||||
end
|
||||
|
||||
|
@ -348,7 +348,7 @@ function baseUtils.processBase(map, chunk, surface, natives, tick, base, evoluti
|
||||
base.tick = tick
|
||||
end
|
||||
|
||||
function baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tick)
|
||||
function baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tick, rebuilding)
|
||||
local x = chunk.x
|
||||
local y = chunk.y
|
||||
local distance = euclideanDistancePoints(x, y, 0, 0)
|
||||
@ -360,7 +360,7 @@ function baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tic
|
||||
|
||||
|
||||
local alignment
|
||||
if (mRandom() < natives.deadZoneFrequency) then
|
||||
if (not rebuilding) and (mRandom() < natives.deadZoneFrequency) then
|
||||
alignment = BASE_ALIGNMENT_DEADZONE
|
||||
else
|
||||
alignment = findBaseInitialAlignment(evoIndex, natives, natives.evolutionTableAlignment) or BASE_ALIGNMENT_NEUTRAL
|
||||
|
@ -273,7 +273,7 @@ function chunkUtils.initialScan(chunk, natives, surface, map, tick, evolutionFac
|
||||
setChunkBase(map, chunk, base)
|
||||
end
|
||||
else
|
||||
base = createBase(map, natives, evolutionFactor, chunk, surface, tick)
|
||||
base = createBase(map, natives, evolutionFactor, chunk, surface, tick, rebuilding)
|
||||
end
|
||||
local alignment = base.alignment
|
||||
if (#nests > 0) then
|
||||
|
@ -78,33 +78,37 @@ function pheromoneUtils.processPheromone(map, chunk)
|
||||
local baseTotal = 0
|
||||
local playerTotal = 0
|
||||
local resourceTotal = 0
|
||||
|
||||
if not tempNeighbors[1].name then
|
||||
movementTotal = (movementTotal + tempNeighbors[1][MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (tempNeighbors[1][BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + tempNeighbors[1][PLAYER_PHEROMONE] - chunkPlayer
|
||||
resourceTotal = resourceTotal + (tempNeighbors[1][RESOURCE_PHEROMONE] - chunkResource)
|
||||
|
||||
local neighbor = tempNeighbors[1]
|
||||
if not neighbor.name then
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + neighbor[PLAYER_PHEROMONE] - chunkPlayer
|
||||
resourceTotal = resourceTotal + (neighbor[RESOURCE_PHEROMONE] - chunkResource)
|
||||
end
|
||||
|
||||
if not tempNeighbors[2].name then
|
||||
movementTotal = movementTotal + (tempNeighbors[2][MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (tempNeighbors[2][BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (tempNeighbors[2][PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (tempNeighbors[2][RESOURCE_PHEROMONE] - chunkResource)
|
||||
neighbor = tempNeighbors[2]
|
||||
if not neighbor.name then
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (neighbor[PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (neighbor[RESOURCE_PHEROMONE] - chunkResource)
|
||||
end
|
||||
|
||||
if not tempNeighbors[3].name then
|
||||
movementTotal = movementTotal + (tempNeighbors[3][MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (tempNeighbors[3][BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (tempNeighbors[3][PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (tempNeighbors[3][RESOURCE_PHEROMONE] - chunkResource)
|
||||
neighbor = tempNeighbors[3]
|
||||
if not neighbor.name then
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (neighbor[PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (neighbor[RESOURCE_PHEROMONE] - chunkResource)
|
||||
end
|
||||
|
||||
if not tempNeighbors[4].name then
|
||||
movementTotal = movementTotal + (tempNeighbors[4][MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (tempNeighbors[4][BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (tempNeighbors[4][PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (tempNeighbors[4][RESOURCE_PHEROMONE] - chunkResource)
|
||||
neighbor = tempNeighbors[4]
|
||||
if not neighbor.name then
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
playerTotal = playerTotal + (neighbor[PLAYER_PHEROMONE] - chunkPlayer)
|
||||
resourceTotal = resourceTotal + (neighbor[RESOURCE_PHEROMONE] - chunkResource)
|
||||
end
|
||||
|
||||
chunk[MOVEMENT_PHEROMONE] = (chunkMovement + (0.125 * movementTotal)) * MOVEMENT_PHEROMONE_PERSISTANCE * chunkPathRating
|
||||
|
@ -359,7 +359,7 @@ data:extend({
|
||||
type = "bool-setting",
|
||||
name = "rampant-disableVanillaAI",
|
||||
description = "rampant-disableVanillaAI",
|
||||
setting_type = 'startup',
|
||||
setting_type = 'runtime-global',
|
||||
default_value = true,
|
||||
order = "m[total]-a[ai]",
|
||||
per_user = false
|
||||
@ -369,7 +369,7 @@ data:extend({
|
||||
type = "bool-setting",
|
||||
name = "rampant-enableMigration",
|
||||
description = "rampant-enableMigration",
|
||||
setting_type = 'startup',
|
||||
setting_type = 'runtime-global',
|
||||
default_value = true,
|
||||
order = "m[total]-b[ai]",
|
||||
per_user = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user