mirror of
https://github.com/veden/Rampant.git
synced 2025-09-16 09:16:43 +02:00
see changelog
This commit is contained in:
15
Upgrade.lua
15
Upgrade.lua
@@ -2,7 +2,6 @@ local upgrade = {}
|
||||
|
||||
-- imports
|
||||
|
||||
local squadAttack = require("libs/SquadAttack")
|
||||
local constants = require("libs/Constants")
|
||||
local mathUtils = require("libs/MathUtils")
|
||||
|
||||
@@ -17,8 +16,6 @@ local SQUAD_GUARDING = constants.SQUAD_GUARDING
|
||||
|
||||
-- imported functions
|
||||
|
||||
local scoreAttackLocation = squadAttack.scoreAttackLocation
|
||||
|
||||
local roundToNearest = mathUtils.roundToNearest
|
||||
|
||||
-- module code
|
||||
@@ -245,14 +242,16 @@ function upgrade.attempt(natives)
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.37")
|
||||
global.version = constants.VERSION_72
|
||||
end
|
||||
if (global.version < constants.VERSION_73) then
|
||||
if (global.version < constants.VERSION_74) then
|
||||
|
||||
for _,squad in pairs(natives.squads) do
|
||||
squad.attackScoreFunction = scoreAttackLocation
|
||||
for _,squad in pairs(natives.squads) do
|
||||
squad.status = SQUAD_GUARDING
|
||||
squad.cycles = 0
|
||||
squad.attackScoreFunction = nil
|
||||
end
|
||||
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.38")
|
||||
global.version = constants.VERSION_73
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.39")
|
||||
global.version = constants.VERSION_74
|
||||
end
|
||||
|
||||
return starting ~= global.version, natives
|
||||
|
@@ -1,3 +1,10 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.16.39
|
||||
Date: 2. 15. 2019
|
||||
Bugfixes:
|
||||
- Reset squad scoring functions and set default scoring function
|
||||
- Switched to single instance require statements causing multiple sentinel memory objects
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.16.38
|
||||
Date: 2. 14. 2019
|
||||
|
@@ -582,8 +582,7 @@ local function onSurfaceTileChange(event)
|
||||
local position = tiles[i].position
|
||||
local chunk = getChunkByPosition(map, position, true)
|
||||
|
||||
-- weird bug with table pointer equality using name instead of pointer comparison
|
||||
if not chunk.name then
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
map.chunkToPassScan[chunk] = true
|
||||
else
|
||||
local x,y = positionToChunkXY(position)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "Rampant",
|
||||
"factorio_version" : "0.16",
|
||||
"version" : "0.16.38",
|
||||
"version" : "0.16.39",
|
||||
"title" : "Rampant",
|
||||
"author" : "Veden",
|
||||
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if (aiAttackWaveG) then
|
||||
return aiAttackWaveG
|
||||
end
|
||||
local aiAttackWave = {}
|
||||
|
||||
-- imports
|
||||
@@ -256,4 +259,5 @@ function aiAttackWave.formSquads(map, surface, natives, chunk, cost)
|
||||
return (natives.points - cost) > 0
|
||||
end
|
||||
|
||||
aiAttackWaveG = aiAttackWave
|
||||
return aiAttackWave
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if aiPlanningG then
|
||||
return aiPlanningG
|
||||
end
|
||||
local aiPlanning = {}
|
||||
|
||||
-- imports
|
||||
@@ -145,4 +148,5 @@ function aiPlanning.planning(natives, evolution_factor, tick, surface, connected
|
||||
|
||||
end
|
||||
|
||||
aiPlanningG = aiPlanning
|
||||
return aiPlanning
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if (aiPredicatesG) then
|
||||
return aiPredicatesG
|
||||
end
|
||||
local aiPredicates = {}
|
||||
|
||||
-- imports
|
||||
@@ -33,4 +36,5 @@ function aiPredicates.canMigrate(natives, surface)
|
||||
(natives.aiNocturnalMode and surface.darkness > 0.65))
|
||||
end
|
||||
|
||||
aiPredicatesG = aiPredicates
|
||||
return aiPredicates
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if baseUtilsG then
|
||||
return baseUtilsG
|
||||
end
|
||||
local baseUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -828,4 +831,5 @@ function baseUtils.rebuildNativeTables(natives, surface, rg)
|
||||
natives.evolutionTableWorm = normalizeProbabilities(natives.evolutionTableWorm)
|
||||
end
|
||||
|
||||
baseUtilsG = baseUtils
|
||||
return baseUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if bobsBaseUnits then
|
||||
return bobsBaseUnits
|
||||
end
|
||||
local bobs = {}
|
||||
|
||||
-- imports
|
||||
@@ -118,4 +121,5 @@ function bobs.processBobsUnitClass(natives, surface)
|
||||
|
||||
end
|
||||
|
||||
bobsBaseUnits = bobs
|
||||
return bobs
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if (chunkProcessorG) then
|
||||
return chunkProcessorG
|
||||
end
|
||||
local chunkProcessor = {}
|
||||
|
||||
-- imports
|
||||
@@ -159,4 +162,5 @@ end
|
||||
-- end
|
||||
|
||||
|
||||
chunkProcessorG = chunkProcessor
|
||||
return chunkProcessor
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if chunkPropertyUtilsG then
|
||||
return chunkPropertyUtilsG
|
||||
end
|
||||
local chunkPropertyUtils = {}
|
||||
|
||||
local constants = require("Constants")
|
||||
@@ -204,4 +207,5 @@ function chunkPropertyUtils.addPlayerBaseGenerator(map, chunk, playerGenerator)
|
||||
map.chunkToPlayerBase[chunk] = (map.chunkToPlayerBase[chunk] or 0) + playerGenerator
|
||||
end
|
||||
|
||||
chunkPropertyUtilsG = chunkPropertyUtils
|
||||
return chunkPropertyUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if chunkUtilsG then
|
||||
return chunkUtilsG
|
||||
end
|
||||
local chunkUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -547,4 +550,5 @@ function chunkUtils.makeImmortalEntity(surface, entity)
|
||||
newEntity.destructible = false
|
||||
end
|
||||
|
||||
chunkUtilsG = chunkUtils
|
||||
return chunkUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if constantsG then
|
||||
return constantsG
|
||||
end
|
||||
local constants = {}
|
||||
|
||||
-- versions
|
||||
@@ -23,6 +26,7 @@ constants.VERSION_51 = 51
|
||||
constants.VERSION_57 = 57
|
||||
constants.VERSION_72 = 72
|
||||
constants.VERSION_73 = 73
|
||||
constants.VERSION_74 = 74
|
||||
|
||||
-- misc
|
||||
|
||||
@@ -710,4 +714,5 @@ constants.POISON_UNIT_TIERS = unitTiers
|
||||
constants.POISON_UNIT_VARIATIONS = unitVariations
|
||||
|
||||
|
||||
constantsG = constants
|
||||
return constants
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if interopG then
|
||||
return interopG
|
||||
end
|
||||
local interop = {}
|
||||
|
||||
local unitGroupUtils = require("UnitGroupUtils")
|
||||
@@ -84,4 +87,5 @@ function interop.registerUnitGroup(unitGroup)
|
||||
unitGroupUtils.createSquad(unitGroup.position, unitGroup.surface, global.natives, unitGroup)
|
||||
end
|
||||
|
||||
interopG = interop
|
||||
return interop
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if mapProcessorG then
|
||||
return mapProcessorG
|
||||
end
|
||||
local mapProcessor = {}
|
||||
|
||||
-- imports
|
||||
@@ -307,4 +310,5 @@ function mapProcessor.scanMap(map, surface, natives, tick)
|
||||
end
|
||||
end
|
||||
|
||||
mapProcessorG = mapProcessor
|
||||
return mapProcessor
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if mapUtilsG then
|
||||
return mapUtilsG
|
||||
end
|
||||
local mapUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -198,4 +201,5 @@ function mapUtils.positionFromDirectionAndChunk(direction, startPosition, endPos
|
||||
return endPosition
|
||||
end
|
||||
|
||||
mapUtilsG = mapUtils
|
||||
return mapUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if mathUtilsG then
|
||||
return mathUtilsG
|
||||
end
|
||||
local mathUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -170,4 +173,5 @@ function mathUtils.distortPosition(position)
|
||||
position.y = position.y + (yDistort * 48)
|
||||
end
|
||||
|
||||
mathUtilsG = mathUtils
|
||||
return mathUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if movementUtilsG then
|
||||
return movementUtilsG
|
||||
end
|
||||
local movementUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -197,4 +200,5 @@ function movementUtils.scoreNeighborsForFormation(neighborChunks, validFunction,
|
||||
return highestChunk, highestDirection
|
||||
end
|
||||
|
||||
movementUtilsG = movementUtils
|
||||
return movementUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if neBaseUtilsG then
|
||||
return neBaseUtilsG
|
||||
end
|
||||
local ne = {}
|
||||
|
||||
-- imports
|
||||
@@ -200,4 +203,5 @@ function ne.processNEUnitClass(natives, surface)
|
||||
end
|
||||
end
|
||||
|
||||
neBaseUtilsG = ne
|
||||
return ne
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if pheromoneUtilsG then
|
||||
return pheromoneUtilsG
|
||||
end
|
||||
local pheromoneUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -203,4 +206,5 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
end
|
||||
end
|
||||
|
||||
pheromoneUtilsG = pheromoneUtils
|
||||
return pheromoneUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if playerUtilsG then
|
||||
return playerUtilsG
|
||||
end
|
||||
local playerUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -25,4 +28,5 @@ function playerUtils.playersWithinProximityToPosition(players, position, distanc
|
||||
return false
|
||||
end
|
||||
|
||||
playerUtilsG = playerUtils
|
||||
return playerUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if (squadAttackG) then
|
||||
return squadAttackG
|
||||
end
|
||||
local squadAttack = {}
|
||||
|
||||
-- imports
|
||||
@@ -9,9 +12,6 @@ local playerUtils = require("PlayerUtils")
|
||||
local movementUtils = require("MovementUtils")
|
||||
local mathUtils = require("MathUtils")
|
||||
local chunkPropertyUtils = require("ChunkPropertyUtils")
|
||||
local chunkUtils = require("ChunkUtils")
|
||||
|
||||
--local chunkUtils = require("ChunkUtils")
|
||||
|
||||
-- constants
|
||||
|
||||
@@ -80,7 +80,7 @@ local function scoreSiegeLocation(squad, neighborChunk)
|
||||
return settle - lookupMovementPenalty(squad, neighborChunk)
|
||||
end
|
||||
|
||||
function squadAttack.scoreAttackLocation(natives, squad, neighborChunk)
|
||||
local function scoreAttackLocation(natives, squad, neighborChunk)
|
||||
local damage
|
||||
|
||||
if (neighborChunk[MOVEMENT_PHEROMONE] >= 0) then
|
||||
@@ -167,7 +167,7 @@ local function attackMove(map, attackPosition, attackCmd, squad, group, natives,
|
||||
natives,
|
||||
chunk,
|
||||
getNeighborChunks(map, x, y),
|
||||
squad.attackScoreFunction,
|
||||
squad.attackScoreFunction or scoreAttackLocation,
|
||||
squad)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
@@ -260,7 +260,7 @@ function squadAttack.squadsBeginAttack(natives, players)
|
||||
if squad.kamikaze and (mRandom() < (kamikazeThreshold * 0.75)) then
|
||||
squad.attackScoreFunction = scoreAttackKamikazeLocation
|
||||
else
|
||||
squad.attackScoreFunction = squadAttack.scoreAttackLocation
|
||||
squad.attackScoreFunction = scoreAttackLocation
|
||||
end
|
||||
squad.status = SQUAD_RAIDING
|
||||
end
|
||||
@@ -268,4 +268,5 @@ function squadAttack.squadsBeginAttack(natives, players)
|
||||
end
|
||||
end
|
||||
|
||||
squadAttackG = squadAttack
|
||||
return squadAttack
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if aiDefenseG then
|
||||
return aiDefenseG
|
||||
end
|
||||
local aiDefense = {}
|
||||
|
||||
-- imports
|
||||
@@ -113,4 +116,5 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, natives, t
|
||||
end
|
||||
end
|
||||
|
||||
aiDefenseG = aiDefense
|
||||
return aiDefense
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if stringUtilsG then
|
||||
return stringUtilsG
|
||||
end
|
||||
local stringUtils = {}
|
||||
|
||||
local sFind = string.find
|
||||
@@ -10,4 +13,5 @@ function stringUtils.isSpawnerEgg(str)
|
||||
return sFind(str, "spawner", -#"spawner")
|
||||
end
|
||||
|
||||
stringUtilsG = stringUtils
|
||||
return stringUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if unitGroupUtilsG then
|
||||
return unitGroupUtilsG
|
||||
end
|
||||
local unitGroupUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -305,4 +308,5 @@ function unitGroupUtils.regroupSquads(natives, map)
|
||||
end
|
||||
end
|
||||
|
||||
unitGroupUtilsG = unitGroupUtils
|
||||
return unitGroupUtils
|
||||
|
@@ -1,3 +1,6 @@
|
||||
if (unitUtilsG) then
|
||||
return unitUtilsG
|
||||
end
|
||||
local unitUtils = {}
|
||||
|
||||
-- imports
|
||||
@@ -50,4 +53,5 @@ function unitUtils.convertTypeToDrainCrystal(evolutionFactor, entity)
|
||||
end
|
||||
end
|
||||
|
||||
unitUtilsG = unitUtils
|
||||
return unitUtils
|
||||
|
Reference in New Issue
Block a user