1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-30 21:19:46 +02:00

added base detection, creation, and removal. needs base location on register

This commit is contained in:
Aaron Veden 2018-01-14 23:41:55 -08:00
parent 3c8b82acae
commit 8e76817a19
14 changed files with 325 additions and 186 deletions

View File

@ -63,7 +63,7 @@ buildUnitSpawner(
}, },
unitSpawner = { unitSpawner = {
name = "rampant-suicide-nest", name = "rampant-suicide-biter-nest",
attributes = { attributes = {
health = 30, health = 30,
healing = 0.01, healing = 0.01,
@ -73,6 +73,7 @@ buildUnitSpawner(
spawingCooldownStop = 150, spawingCooldownStop = 150,
}, },
resistances = { resistances = {
explosion = { explosion = {
decrease = 0, decrease = 0,

View File

@ -276,12 +276,78 @@ local function onModSettingsChange(event)
end end
local function rebuildNativeTables() local function rebuildNativeTables()
local position = { x=0, y=0 }
for v=1,SUICIDE_NEST_VARIATIONS do for v=1,SUICIDE_NEST_VARIATIONS do
local entity = surface.create_entity() for t=1,SUICIDE_NEST_TIERS do
natives. local entity = surface.create_entity({
entity.die() name="rampant-suicide-biter-nest-v" .. v .. "-t" .. t,
position=position
})
local evoRequirement = entity.prototype.build_base_evolution_requirement
natives.evolutionTable[#natives.evolutionTable[evoRequirement]+1] = entity.name
entity.die()
end
end end
for v=1,ACID_NEST_VARIATIONS do -- for v=1,ACID_NEST_VARIATIONS do
-- for t=1,ACID_NEST_TIERS do
-- end
-- end
-- for v=1,FIRE_NEST_VARIATIONS do
-- for t=1,FIRE_NEST_TIERS do
-- end
-- end
-- for v=1,PHYSICAL_NEST_VARIATIONS do
-- for t=1,PHYSICAL_NEST_TIERS do
-- end
-- end
-- for v=1,LASER_NEST_VARIATIONS do
-- for t=1,LASER_NEST_TIERS do
-- end
-- end
-- for v=1,INFERNO_NEST_VARIATIONS do
-- for t=1,INFERNO_NEST_TIERS do
-- end
-- end
-- for v=1,POSION_NEST_VARIATIONS do
-- for t=1,POSION_NEST_TIERS do
-- end
-- end
-- for v=1,INFESTER_NEST_VARIATIONS do
-- for t=1,INFESTER_NEST_TIERS do
-- end
-- end
-- for v=1,TROLL_NEST_VARIATIONS do
-- for t=1,TROLL_NEST_TIERS do
-- end
-- end
-- for v=1,FAST_NEST_VARIATIONS do
-- for t=1,FAST_NEST_TIERS do
-- end
-- end
-- for v=1,WEB_NEST_VARIATIONS do
-- for t=1,WEB_NEST_TIERS do
-- end
-- end
-- for v=1,DECAYING_NEST_VARIATIONS do
-- for t=1,DECAYING_NEST_TIERS do
-- end
-- end
-- for v=1,UNDYING_NEST_VARIATIONS do
-- for t=1,UNDYING_NEST_TIERS do
-- end
-- end
end end
local function onConfigChanged() local function onConfigChanged()

View File

@ -4,7 +4,7 @@ local aiAttackWave = {}
local constants = require("Constants") local constants = require("Constants")
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local chunkUtils = require("ChunkUtils") local chunkPropetyUtils = require("ChunkPropertyUtils")
local unitGroupUtils = require("UnitGroupUtils") local unitGroupUtils = require("UnitGroupUtils")
local movementUtils = require("MovementUtils") local movementUtils = require("MovementUtils")
package.path = "../?.lua;" .. package.path package.path = "../?.lua;" .. package.path
@ -41,9 +41,9 @@ local mRandom = math.random
local positionFromDirectionAndChunk = mapUtils.positionFromDirectionAndChunk local positionFromDirectionAndChunk = mapUtils.positionFromDirectionAndChunk
local getNestCount = chunkUtils.getNestCount local getNestCount = chunkPropetyUtils.getNestCount
local getRallyTick = chunkUtils.getRallyTick local getRallyTick = chunkPropetyUtils.getRallyTick
local setRallyTick = chunkUtils.setRallyTick local setRallyTick = chunkPropetyUtils.setRallyTick
local getNeighborChunks = mapUtils.getNeighborChunks local getNeighborChunks = mapUtils.getNeighborChunks
local getChunkByXY = mapUtils.getChunkByXY local getChunkByXY = mapUtils.getChunkByXY

View File

@ -2,8 +2,8 @@ local baseProcessor = {}
-- imports -- imports
local nestUtils = require("NestUtils") -- local nestUtils = require("NestUtils")
local tendrilUtils = require("TendrilUtils") -- local tendrilUtils = require("TendrilUtils")
local constants = require("Constants") local constants = require("Constants")
-- constants -- constants
@ -14,8 +14,8 @@ local BASE_QUEUE_SIZE = constants.BASE_QUEUE_SIZE
local mMin = math.min local mMin = math.min
local buildOrder = nestUtils.buildOrder -- local buildOrder = nestUtils.buildOrder
local advanceTendrils = tendrilUtils.advanceTendrils -- local advanceTendrils = tendrilUtils.advanceTendrils
-- module code -- module code

View File

@ -5,6 +5,8 @@ local baseUtils = {}
local stringUtils = require("StringUtils") local stringUtils = require("StringUtils")
local mathUtils = require("MathUtils") local mathUtils = require("MathUtils")
local constants = require("Constants") local constants = require("Constants")
local mapUtils = require("MapUtils")
local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -12,6 +14,8 @@ local BASE_DISTANCE_THRESHOLD = constants.BASE_DISTANCE_THRESHOLD
local BASE_ALIGNMENT_NEUTRAL = constants.BASE_ALIGNMENT_NEUTRAL local BASE_ALIGNMENT_NEUTRAL = constants.BASE_ALIGNMENT_NEUTRAL
local CHUNK_SIZE = constants.CHUNK_SIZE
local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER
local MAGIC_MAXIMUM_BASE_NUMBER = constants.MAGIC_MAXIMUM_BASE_NUMBER local MAGIC_MAXIMUM_BASE_NUMBER = constants.MAGIC_MAXIMUM_BASE_NUMBER
@ -23,62 +27,82 @@ local isRampant = stringUtils.isRampant
local mFloor = math.floor local mFloor = math.floor
-- local buildTendril = tendrilUtils.buildTendril local positionToChunkXY = mapUtils.positionToChunkXY
local getChunkBase = chunkPropertyUtils.getChunkBase
local setChunkBase = chunkPropertyUtils.setChunkBase
local mRandom = math.random local mRandom = math.random
-- module code -- module code
function baseUtils.findNearbyBase(natives, position) function baseUtils.findNearbyBase(map, chunk, chunkRadius)
local bases = natives.bases local x = chunk.x
local foundBase local y = chunk.y
local foundBase = getChunkBase(map, chunk)
if foundBase then
return foundBase
end
local closest = MAGIC_MAXIMUM_NUMBER local closest = MAGIC_MAXIMUM_NUMBER
for i=1,#bases do for xi = x-chunkRadius, x+chunkRadius, CHUNK_SIZE do
local base = bases[i] for yi = y-chunkRadius, y+chunkRadius, CHUNK_SIZE do
local distance = euclideanDistancePoints(base.x, base.y, position.x, position.y) if (xi ~= x) and (yi ~= y) then
if (distance <= (BASE_DISTANCE_THRESHOLD + (base.level * 100))) and (distance < closest) then local base = getChunkBase(map, positionToChunkXY(map, xi, yi))
closest = distance if base then
foundBase = base local distance = euclideanDistancePoints(base.x, base.y, x, y)
if (distance <= (BASE_DISTANCE_THRESHOLD + (base.level * 100))) and (distance < closest) then
closest = distance
foundBase = base
end
end
end
end end
end end
return foundBase return foundBase
end end
function baseUtils.upgradeEntity(map, entity, surface, natives) function baseUtils.upgradeEntity(map, entity, surface, natives, evolutionFactor, tick)
if not isRampant(entity.name) then if not isRampant(entity.name) then
local position = entity.position local position = entity.position
-- build_base_evolution_requirement
entity.die() entity.die()
entity = surface.create_entity({name = "rampant-suicide-nest-v" .. mRandom(5) .. "-t1", local chunk = positionToChunkXY(map, position)
position = position}) local base = getChunkBase(map, chunk)
if not base then
baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tick)
end
entity = surface.creaate_entity({name = "rampant-suicide-nest-v" .. mRandom(5) .. "-t1",
position = position})
end end
return entity return entity
end end
function baseUtils.createBase(map, natives, position, surface, tick) function baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tick)
local bases = natives.bases local x = chunk.x
local distance = euclideanDistancePoints(position.x, position.y, 0, 0) local y = chunk.y
local distance = euclideanDistancePoints(x, y, 0, 0)
local base = { local base = {
x = position.x, x = x,
y = position.y, y = y,
created = tick, created = tick,
alignment = { BASE_ALIGNMENT_NEUTRAL }, alignment = { BASE_ALIGNMENT_NEUTRAL },
hives = {},
tendrils = {},
nests = {},
worms = {},
eggs = {},
upgradePoints = 0,
growth = tick,
pattern = mRandom(MAGIC_MAXIMUM_BASE_NUMBER), pattern = mRandom(MAGIC_MAXIMUM_BASE_NUMBER),
level = mFloor(distance / 200) level = mFloor(distance / 200)
} }
if not buildHive(map, base, surface) then
return nil setChunkBase(map, chunk, base)
end
-- buildTendril(map, natives, base, surface, tick) -- if not buildHive(map, base, surface) then
bases[#bases+1] = base -- return nil
-- end
natives.bases[natives.bases+1] = base
return base return base
end end

View File

@ -19,7 +19,7 @@ local chunkPassScan = chunkUtils.chunkPassScan
-- module code -- module code
function chunkProcessor.processPendingChunks(natives, map, surface, pendingStack) function chunkProcessor.processPendingChunks(natives, map, surface, pendingStack, tick)
local processQueue = map.processQueue local processQueue = map.processQueue
local area = map.area local area = map.area
@ -41,7 +41,7 @@ function chunkProcessor.processPendingChunks(natives, map, surface, pendingStack
bottomOffset[1] = x + CHUNK_SIZE bottomOffset[1] = x + CHUNK_SIZE
bottomOffset[2] = y + CHUNK_SIZE bottomOffset[2] = y + CHUNK_SIZE
chunk = initialScan(chunk, natives, surface, map) chunk = initialScan(chunk, natives, surface, map, tick)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
local chunkX = chunk.x local chunkX = chunk.x

136
libs/ChunkProperties.lua Executable file
View File

@ -0,0 +1,136 @@
local chunkPropertyUtils = {}
-- imported functions
local tRemove = table.remove
-- module code
function chunkPropertyUtils.getNestCount(map, chunk)
return map.chunkToNests[chunk] or 0
end
function chunkPropertyUtils.getWormCount(map, chunk)
return map.chunkToWorms[chunk] or 0
end
function chunkPropertyUtils.setWormCount(map, chunk, count)
if (count == 0) then
map.chunkToWorms[chunk] = nil
else
map.chunkToWorms[chunk] = count
end
end
function chunkPropertyUtils.setNestCount(map, chunk, count)
if (count == 0) then
map.chunkToNests[chunk] = nil
else
map.chunkToNests[chunk] = count
end
end
function chunkPropertyUtils.getNestCount(map, chunk)
return map.chunkToNests[chunk] or 0
end
function chunkPropertyUtils.getChunkBase(map, chunk)
return map.chunkToBase[chunk]
end
function chunkPropertyUtils.setChunkBase(map, chunk, base)
map.chunkToBase[chunk] = base
end
function chunkPropertyUtils.getWormCount(map, chunk)
return map.chunkToWorms[chunk] or 0
end
function chunkPropertyUtils.getEnemyStructureCount(map, chunk)
return (map.chunkToNests[chunk] or 0) + (map.chunkToWorms[chunk] or 0)
end
function chunkPropertyUtils.getRetreatTick(map, chunk)
return map.chunkToRetreats[chunk] or 0
end
function chunkPropertyUtils.getRallyTick(map, chunk)
return map.chunkToRallys[chunk] or 0
end
function chunkPropertyUtils.setRallyTick(map, chunk, tick)
map.chunkToRallys[chunk] = tick
end
function chunkPropertyUtils.setRetreatTick(map, chunk, tick)
map.chunkToRetreats[chunk] = tick
end
function chunkPropertyUtils.setResourceGenerator(map, chunk, resourceGenerator)
if (resourceGenerator == 0) then
map.chunkToResource[chunk] = nil
else
map.chunkToResource[chunk] = resourceGenerator
end
end
function chunkPropertyUtils.getResourceGenerator(map, chunk)
return map.chunkToResource[chunk] or 0
end
function chunkPropertyUtils.addResourceGenerator(map, chunk, delta)
map.chunkToResource[chunk] = (map.chunkToResource[chunk] or 0) + delta
end
function chunkPropertyUtils.getPlayerBaseGenerator(map, chunk)
return map.chunkToPlayerBase[chunk] or 0
end
function chunkPropertyUtils.addSquadToChunk(map, chunk, squad)
if (chunk ~= squad.chunk) then
local chunkToSquad = map.chunkToSquad
chunkPropertyUtils.removeSquadFromChunk(map, squad)
if not chunkToSquad[chunk] then
chunkToSquad[chunk] = {}
end
chunkToSquad[chunk][#chunkToSquad[chunk]+1] = squad
squad.chunk = chunk
end
end
function chunkPropertyUtils.removeSquadFromChunk(map, squad)
local chunkToSquad = map.chunkToSquad
if squad.chunk then
local squads = chunkToSquad[squad.chunk]
if squads then
for i=#squads, 1, -1 do
if (squads[i] == squad) then
tRemove(squads, i)
break
end
end
if (#squads == 0) then
chunkToSquad[squad.chunk] = nil
end
end
end
end
function chunkPropertyUtils.getSquadsOnChunk(map, chunk)
return map.chunkToSquad[chunk] or {}
end
function chunkPropertyUtils.setPlayerBaseGenerator(map, chunk, playerGenerator)
if (playerGenerator == 0) then
map.chunkToPlayerBase[chunk] = nil
else
map.chunkToPlayerBase[chunk] = playerGenerator
end
end
function chunkPropertyUtils.addPlayerBaseGenerator(map, chunk, playerGenerator)
map.chunkToPlayerBase[chunk] = (map.chunkToPlayerBase[chunk] or 0) + playerGenerator
end
return chunkPropertyUtils

View File

@ -2,8 +2,10 @@ local chunkUtils = {}
-- imports -- imports
local baseUtils = require("BaseUtils")
local constants = require("Constants") local constants = require("Constants")
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -29,6 +31,8 @@ local CHUNK_IMPASSABLE = constants.CHUNK_IMPASSABLE
local CHUNK_TICK = constants.CHUNK_TICK local CHUNK_TICK = constants.CHUNK_TICK
local BASE_SEARCH_RADIUS = constants.BASE_SEARCH_RADIUS
local PATH_RATING = constants.PATH_RATING local PATH_RATING = constants.PATH_RATING
local PASSABLE = constants.PASSABLE local PASSABLE = constants.PASSABLE
@ -37,9 +41,12 @@ local RESOURCE_GENERATOR_INCREMENT = constants.RESOURCE_GENERATOR_INCREMENT
-- imported functions -- imported functions
local getChunkByUnalignedXY = mapUtils.getChunkByUnalignedXY local findNearbyBase = baseUtils.findNearbyBase
local createBase = baseUtils.createBase
local tRemove = table.remove local setChunkBase = chunkPropertyUtils.setChunkBase
local getChunkByUnalignedXY = mapUtils.getChunkByUnalignedXY
local mFloor = math.floor local mFloor = math.floor
@ -265,7 +272,7 @@ function chunkUtils.scoreEnemyBuildings(surface, map)
return nests, worms return nests, worms
end end
function chunkUtils.initialScan(chunk, natives, surface, map) function chunkUtils.initialScan(chunk, natives, surface, map, tick, evolutionFactor)
local passScore = chunkUtils.calculatePassScore(surface, map) local passScore = chunkUtils.calculatePassScore(surface, map)
if (passScore >= 0.40) then if (passScore >= 0.40) then
@ -281,6 +288,15 @@ function chunkUtils.initialScan(chunk, natives, surface, map)
pass = CHUNK_ALL_DIRECTIONS pass = CHUNK_ALL_DIRECTIONS
end end
if (nests > 0) or (worms > 0) then
local base = findNearbyBase(map, chunk, BASE_SEARCH_RADIUS)
if base then
setChunkBase(map, chunk, base)
else
createBase(map, natives, evolutionFactor, chunk, surface, tick)
end
end
chunkUtils.setNestCount(map, chunk, nests) chunkUtils.setNestCount(map, chunk, nests)
chunkUtils.setPlayerBaseGenerator(map, chunk, playerObjects) chunkUtils.setPlayerBaseGenerator(map, chunk, playerObjects)
chunkUtils.setResourceGenerator(map, chunk, resources) chunkUtils.setResourceGenerator(map, chunk, resources)
@ -323,125 +339,6 @@ function chunkUtils.analyzeChunk(chunk, natives, surface, map)
chunkUtils.setPlayerBaseGenerator(map, chunk, playerObjects) chunkUtils.setPlayerBaseGenerator(map, chunk, playerObjects)
end end
function chunkUtils.getNestCount(map, chunk)
return map.chunkToNests[chunk] or 0
end
function chunkUtils.getWormCount(map, chunk)
return map.chunkToWorms[chunk] or 0
end
function chunkUtils.setWormCount(map, chunk, count)
if (count == 0) then
map.chunkToWorms[chunk] = nil
else
map.chunkToWorms[chunk] = count
end
end
function chunkUtils.setNestCount(map, chunk, count)
if (count == 0) then
map.chunkToNests[chunk] = nil
else
map.chunkToNests[chunk] = count
end
end
function chunkUtils.getNestCount(map, chunk)
return map.chunkToNests[chunk] or 0
end
function chunkUtils.getWormCount(map, chunk)
return map.chunkToWorms[chunk] or 0
end
function chunkUtils.getEnemyStructureCount(map, chunk)
return (map.chunkToNests[chunk] or 0) + (map.chunkToWorms[chunk] or 0)
end
function chunkUtils.getRetreatTick(map, chunk)
return map.chunkToRetreats[chunk] or 0
end
function chunkUtils.getRallyTick(map, chunk)
return map.chunkToRallys[chunk] or 0
end
function chunkUtils.setRallyTick(map, chunk, tick)
map.chunkToRallys[chunk] = tick
end
function chunkUtils.setRetreatTick(map, chunk, tick)
map.chunkToRetreats[chunk] = tick
end
function chunkUtils.setResourceGenerator(map, chunk, resourceGenerator)
if (resourceGenerator == 0) then
map.chunkToResource[chunk] = nil
else
map.chunkToResource[chunk] = resourceGenerator
end
end
function chunkUtils.getResourceGenerator(map, chunk)
return map.chunkToResource[chunk] or 0
end
function chunkUtils.addResourceGenerator(map, chunk, delta)
map.chunkToResource[chunk] = (map.chunkToResource[chunk] or 0) + delta
end
function chunkUtils.getPlayerBaseGenerator(map, chunk)
return map.chunkToPlayerBase[chunk] or 0
end
function chunkUtils.addSquadToChunk(map, chunk, squad)
if (chunk ~= squad.chunk) then
local chunkToSquad = map.chunkToSquad
chunkUtils.removeSquadFromChunk(map, squad)
if not chunkToSquad[chunk] then
chunkToSquad[chunk] = {}
end
chunkToSquad[chunk][#chunkToSquad[chunk]+1] = squad
squad.chunk = chunk
end
end
function chunkUtils.removeSquadFromChunk(map, squad)
local chunkToSquad = map.chunkToSquad
if squad.chunk then
local squads = chunkToSquad[squad.chunk]
if squads then
for i=#squads, 1, -1 do
if (squads[i] == squad) then
tRemove(squads, i)
break
end
end
if (#squads == 0) then
chunkToSquad[squad.chunk] = nil
end
end
end
end
function chunkUtils.getSquadsOnChunk(map, chunk)
return map.chunkToSquad[chunk] or {}
end
function chunkUtils.setPlayerBaseGenerator(map, chunk, playerGenerator)
if (playerGenerator == 0) then
map.chunkToPlayerBase[chunk] = nil
else
map.chunkToPlayerBase[chunk] = playerGenerator
end
end
function chunkUtils.addPlayerBaseGenerator(map, chunk, playerGenerator)
map.chunkToPlayerBase[chunk] = (map.chunkToPlayerBase[chunk] or 0) + playerGenerator
end
function chunkUtils.createChunk(topX, topY) function chunkUtils.createChunk(topX, topY)
local chunk = { local chunk = {
x = topX, x = topX,
@ -514,15 +411,27 @@ function chunkUtils.unregisterEnemyBaseStructure(map, entity)
if (leftTop ~= SENTINEL_IMPASSABLE_CHUNK) then if (leftTop ~= SENTINEL_IMPASSABLE_CHUNK) then
removeEnemyStructureFromChunk(map, leftTop, entity) removeEnemyStructureFromChunk(map, leftTop, entity)
if getEnemyStructureCount(map, leftTop) == 0 then
setChunkBase(map, leftTop, nil)
end
end end
if (rightTop ~= SENTINEL_IMPASSABLE_CHUNK) then if (rightTop ~= SENTINEL_IMPASSABLE_CHUNK) then
removeEnemyStructureFromChunk(map, rightTop, entity) removeEnemyStructureFromChunk(map, rightTop, entity)
if getEnemyStructureCount(map, rightTop) == 0 then
setChunkBase(map, rightTop, nil)
end
end end
if (leftBottom ~= SENTINEL_IMPASSABLE_CHUNK) then if (leftBottom ~= SENTINEL_IMPASSABLE_CHUNK) then
removeEnemyStructureFromChunk(map, leftBottom, entity) removeEnemyStructureFromChunk(map, leftBottom, entity)
if getEnemyStructureCount(map, leftBottom) == 0 then
setChunkBase(map, leftBottom, nil)
end
end end
if (rightBottom ~= SENTINEL_IMPASSABLE_CHUNK) then if (rightBottom ~= SENTINEL_IMPASSABLE_CHUNK) then
removeEnemyStructureFromChunk(map, rightBottom, entity) removeEnemyStructureFromChunk(map, rightBottom, entity)
if getEnemyStructureCount(map, rightBottom) == 0 then
setChunkBase(map, rightBottom, nil)
end
end end
end end
end end

View File

@ -63,6 +63,8 @@ constants.CHUNK_ALL_DIRECTIONS = 3
-- constants.CHUNK_PLAYER_BORDER = 4 -- constants.CHUNK_PLAYER_BORDER = 4
-- constants.CHUNK_PLAYER_INTERIOR = 5 -- constants.CHUNK_PLAYER_INTERIOR = 5
constants.BASE_SEARCH_RADIUS = 4 * constants.CHUNK_SIZE
-- ai -- ai
constants.AI_POINT_GENERATOR_AMOUNT = 6 constants.AI_POINT_GENERATOR_AMOUNT = 6

View File

@ -10,6 +10,7 @@ local constants = require("Constants")
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local playerUtils = require("PlayerUtils") local playerUtils = require("PlayerUtils")
local chunkUtils = require("ChunkUtils") local chunkUtils = require("ChunkUtils")
local chunkPropertyUtils = require("ChunkPropertyUtils")
local mathUtils = require("MathUtils") local mathUtils = require("MathUtils")
-- constants -- constants
@ -49,8 +50,8 @@ local validPlayer = playerUtils.validPlayer
local analyzeChunk = chunkUtils.analyzeChunk local analyzeChunk = chunkUtils.analyzeChunk
local getNestCount = chunkUtils.getNestCount local getNestCount = chunkPropertyUtils.getNestCount
local getEnemyStructureCount = chunkUtils.getEnemyStructureCount local getEnemyStructureCount = chunkPropertyUtils.getEnemyStructureCount
local canAttack = aiPredicates.canAttack local canAttack = aiPredicates.canAttack

View File

@ -4,7 +4,7 @@ local pheromoneUtils = {}
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local constants = require("Constants") local constants = require("Constants")
local chunkUtils = require("ChunkUtils") local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -30,9 +30,9 @@ local PATH_RATING = constants.PATH_RATING
local getCardinalChunks = mapUtils.getCardinalChunks local getCardinalChunks = mapUtils.getCardinalChunks
local mMax = math.max local mMax = math.max
local getEnemyStructureCount = chunkUtils.getEnemyStructureCount local getEnemyStructureCount = chunkPropertyUtils.getEnemyStructureCount
local getPlayerBaseGenerator = chunkUtils.getPlayerBaseGenerator local getPlayerBaseGenerator = chunkPropertyUtils.getPlayerBaseGenerator
local getResourceGenerator = chunkUtils.getResourceGenerator local getResourceGenerator = chunkPropertyUtils.getResourceGenerator
-- module code -- module code

View File

@ -8,7 +8,7 @@ local unitGroupUtils = require("UnitGroupUtils")
local playerUtils = require("PlayerUtils") local playerUtils = require("PlayerUtils")
local movementUtils = require("MovementUtils") local movementUtils = require("MovementUtils")
local mathUtils = require("MathUtils") local mathUtils = require("MathUtils")
local chunkUtils = require("ChunkUtils") local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -38,7 +38,7 @@ local mRandom = math.random
local findMovementPosition = movementUtils.findMovementPosition local findMovementPosition = movementUtils.findMovementPosition
local getNeighborChunks = mapUtils.getNeighborChunks local getNeighborChunks = mapUtils.getNeighborChunks
local addSquadToChunk = chunkUtils.addSquadToChunk local addSquadToChunk = chunkPropertyUtils.addSquadToChunk
local getChunkByXY = mapUtils.getChunkByXY local getChunkByXY = mapUtils.getChunkByXY
local positionToChunkXY = mapUtils.positionToChunkXY local positionToChunkXY = mapUtils.positionToChunkXY
local addMovementPenalty = movementUtils.addMovementPenalty local addMovementPenalty = movementUtils.addMovementPenalty
@ -49,7 +49,7 @@ local positionFromDirectionAndChunk = mapUtils.positionFromDirectionAndChunk
local euclideanDistanceNamed = mathUtils.euclideanDistanceNamed local euclideanDistanceNamed = mathUtils.euclideanDistanceNamed
local playersWithinProximityToPosition = playerUtils.playersWithinProximityToPosition local playersWithinProximityToPosition = playerUtils.playersWithinProximityToPosition
local getPlayerBaseGenerator = chunkUtils.getPlayerBaseGenerator local getPlayerBaseGenerator = chunkPropertyUtils.getPlayerBaseGenerator
local scoreNeighborsForAttack = movementUtils.scoreNeighborsForAttack local scoreNeighborsForAttack = movementUtils.scoreNeighborsForAttack

View File

@ -6,7 +6,7 @@ local constants = require("Constants")
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local unitGroupUtils = require("UnitGroupUtils") local unitGroupUtils = require("UnitGroupUtils")
local movementUtils = require("MovementUtils") local movementUtils = require("MovementUtils")
local chunkUtils = require("ChunkUtils") local chunkPropetyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -25,7 +25,7 @@ local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
local mRandom = math.random local mRandom = math.random
local addSquadToChunk = chunkUtils.addSquadToChunk local addSquadToChunk = chunkPropetyUtils.addSquadToChunk
local calculateKamikazeThreshold = unitGroupUtils.calculateKamikazeThreshold local calculateKamikazeThreshold = unitGroupUtils.calculateKamikazeThreshold
@ -38,10 +38,10 @@ local membersToSquad = unitGroupUtils.membersToSquad
local scoreNeighborsForRetreat = movementUtils.scoreNeighborsForRetreat local scoreNeighborsForRetreat = movementUtils.scoreNeighborsForRetreat
local findMovementPosition = movementUtils.findMovementPosition local findMovementPosition = movementUtils.findMovementPosition
local getRetreatTick = chunkUtils.getRetreatTick local getRetreatTick = chunkPropetyUtils.getRetreatTick
local getPlayerBaseGenerator = chunkUtils.getPlayerBaseGenerator local getPlayerBaseGenerator = chunkPropetyUtils.getPlayerBaseGenerator
local setRetreatTick = chunkUtils.setRetreatTick local setRetreatTick = chunkPropetyUtils.setRetreatTick
local getEnemyStructureCount = chunkUtils.getEnemyStructureCount local getEnemyStructureCount = chunkPropetyUtils.getEnemyStructureCount
-- module code -- module code

View File

@ -5,7 +5,7 @@ local unitGroupUtils = {}
local mapUtils = require("MapUtils") local mapUtils = require("MapUtils")
local mathUtils = require("MathUtils") local mathUtils = require("MathUtils")
local constants = require("Constants") local constants = require("Constants")
local chunkUtils = require("ChunkUtils") local chunkPropertyUtils = require("ChunkPropertyUtils")
-- constants -- constants
@ -38,8 +38,8 @@ local mLog = math.log10
local mMin = math.min local mMin = math.min
local getSquadsOnChunk = chunkUtils.getSquadsOnChunk local getSquadsOnChunk = chunkPropertyUtils.getSquadsOnChunk
local removeSquadFromChunk = chunkUtils.removeSquadFromChunk local removeSquadFromChunk = chunkPropertyUtils.removeSquadFromChunk
local getNeighborChunks = mapUtils.getNeighborChunks local getNeighborChunks = mapUtils.getNeighborChunks