1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

see changelog

This commit is contained in:
Aaron Veden 2019-10-19 12:13:48 -07:00
parent 173858ef14
commit ac640e6978
29 changed files with 3194 additions and 2972 deletions

View File

@ -16,6 +16,8 @@ local ATTACK_SCORE = constants.ATTACK_SCORE
local SQUAD_GUARDING = constants.SQUAD_GUARDING
local AI_MAX_OVERFLOW_POINTS = constants.AI_MAX_OVERFLOW_POINTS
-- imported functions
local roundToNearest = mathUtils.roundToNearest
@ -330,6 +332,10 @@ function upgrade.attempt(natives)
end
end
natives.pendingAttack.len = #natives.pendingAttack
natives.squads.len = #natives.squads
natives.maxOverflowPoints = AI_MAX_OVERFLOW_POINTS
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.29")
global.version = 99
end

View File

@ -2,11 +2,18 @@
Version: 0.17.29
Date: 10. 13. 2019
Improvements:
- Pathfinding now looks two steps ahead and using the compound command
- Pathfinding now looks two steps ahead
- Squad formation now has a gathering delay to allow all members to make the initial group
- Better tracking of squads on chunks to accommodate the two step path finding
Optimizations:
- Better object reuse for squad and pending attack, creating less garbage
Bugfixes:
- Fixed old savegames penalties having nil chunk index
- Fixed that mining a resource by hand unregister all remaining resource on a tile
- Fixed pheromone dispersal not following pathing restrictions
- Fixed chunk scan and player building pheromone generator mismatch
- Fixed ai credits being uncapped and accumulating more than Max Credits available for that evolution level
- Fixed retreating squads being adding to squad set multiple times
---------------------------------------------------------------------------------------------------
Version: 0.17.28

View File

@ -1,5 +1,6 @@
-- imports
local chunkPropertyUtils = require("libs/ChunkPropertyUtils")
local unitUtils = require("libs/UnitUtils")
local baseUtils = require("libs/BaseUtils")
local mapUtils = require("libs/MapUtils")
@ -40,8 +41,6 @@ local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
local AI_MAX_OVERFLOW_POINTS = constants.AI_MAX_OVERFLOW_POINTS
local RETREAT_GRAB_RADIUS = constants.RETREAT_GRAB_RADIUS
local RETREAT_SPAWNER_GRAB_RADIUS = constants.RETREAT_SPAWNER_GRAB_RADIUS
@ -81,6 +80,7 @@ local squadsDispatch = squadAttack.squadsDispatch
local positionToChunkXY = mapUtils.positionToChunkXY
local getPlayerBaseGenerator = chunkPropertyUtils.getPlayerBaseGenerator
local getChunkByPosition = mapUtils.getChunkByPosition
@ -143,9 +143,6 @@ local function onIonCannonFired(event)
local surface = event.surface
if (surface.index == natives.activeSurface) then
natives.points = natives.points + 3000
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
local chunk = getChunkByPosition(map, event.position)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
rallyUnits(chunk, map, surface, natives, event.tick)
@ -297,12 +294,36 @@ local function rebuildMap()
end
end
map.filteredEntitiesPlayerQuery50 = { area=map.area, force=map.activePlayerForces, type={"wall","transport-belt"}}
map.filteredEntitiesPlayerQuery200 = { area=map.area, force=map.activePlayerForces, type={"splitter","pump","offshore-pump"}}
map.filteredEntitiesPlayerQuery1000 = { area=map.area, force=map.activePlayerForces, type={"lamp","generator","solar-panel", "programmable-speaker", "accumulator", "assembling-machine", "turret", "roboport", "beacon", "ammo-turret"}}
map.filteredEntitiesPlayerQuery2000 = { area=map.area, force=map.activePlayerForces, type={"boiler", "furnace", "lab", "reactor", "radar","electric-turret"}}
map.filteredEntitiesPlayerQuery3500 = { area=map.area, force=map.activePlayerForces, type={"fluid-turret", "mining-drill"}}
map.filteredEntitiesPlayerQuery12000 = { area=map.area, force=map.activePlayerForces, type={"artillery-turret", "rocket-silo"}}
map.filteredEntitiesPlayerQuery50 = { area=map.area, force=map.activePlayerForces, type={"wall",
"transport-belt"}}
map.filteredEntitiesPlayerQuery200 = { area=map.area, force=map.activePlayerForces, type={"splitter",
"pump",
"offshore-pump"}}
map.filteredEntitiesPlayerQuery1000 = { area=map.area, force=map.activePlayerForces, type={"lamp",
"solar-panel",
"programmable-speaker",
"accumulator",
"assembling-machine",
"turret",
"ammo-turret"}}
map.filteredEntitiesPlayerQuery2000 = { area=map.area, force=map.activePlayerForces, type={"furnace",
"lab",
"roboport",
"beacon",
"radar",
"electric-turret"}}
map.filteredEntitiesPlayerQuery3500 = { area=map.area, force=map.activePlayerForces, type={"boiler",
"generator",
"fluid-turret",
"mining-drill"}}
map.filteredEntitiesPlayerQuery12000 = { area=map.area, force=map.activePlayerForces, type={"artillery-turret",
"reactor",
"rocket-silo"}}
local sharedArea = {{0,0},{0,0}}
map.filteredEntitiesCliffQuery = { area=sharedArea, type="cliff", limit = 1 }
@ -317,25 +338,10 @@ local function rebuildMap()
distraction = DEFINES_DISTRACTION_BY_ANYTHING
}
map.attack2Command = {
type = DEFINES_COMMAND_ATTACK_AREA,
destination = map.position2,
radius = CHUNK_SIZE * 1.5,
distraction = DEFINES_DISTRACTION_BY_ANYTHING
}
map.moveCommand = {
type = DEFINES_COMMAND_GO_TO_LOCATION,
destination = map.position,
radius = 1,
pathfind_flags = { prefer_straight_paths = true, cache = true },
distraction = DEFINES_DISTRACTION_BY_ENEMY
}
map.move2Command = {
type = DEFINES_COMMAND_GO_TO_LOCATION,
destination = map.position2,
radius = 1,
radius = 2,
pathfind_flags = { prefer_straight_paths = true, cache = true },
distraction = DEFINES_DISTRACTION_BY_ENEMY
}
@ -350,8 +356,8 @@ local function rebuildMap()
map.wonderCommand = {
type = DEFINES_COMMAND_WANDER,
wander_in_group = false,
radius = DOUBLE_CHUNK_SIZE,
ticks_to_wait = 360
radius = TRIPLE_CHUNK_SIZE,
ticks_to_wait = 3600
}
map.stopCommand = {
@ -367,33 +373,6 @@ local function rebuildMap()
}
}
map.compoundMoveMoveCommand = {
type = DEFINES_COMMMAD_COMPOUND,
structure_type = DEFINES_COMPOUND_COMMAND_RETURN_LAST,
commands = {
map.moveCommand,
map.move2Command
}
}
map.compoundMoveAttackCommand = {
type = DEFINES_COMMMAD_COMPOUND,
structure_type = DEFINES_COMPOUND_COMMAND_RETURN_LAST,
commands = {
map.moveCommand,
map.attack2Command
}
}
map.compoundAttackAttackCommand = {
type = DEFINES_COMMMAD_COMPOUND,
structure_type = DEFINES_COMPOUND_COMMAND_RETURN_LAST,
commands = {
map.attackCommand,
map.attack2Command
}
}
map.retreatCommand = {
type = DEFINES_COMMAND_GROUP,
group = nil,
@ -583,12 +562,31 @@ end)
script.on_nth_tick(INTERVAL_SQUAD,
function ()
local surface = game.surfaces[natives.activeSurface]
squadsBeginAttack(natives)
local time = game.create_profiler()
squadsBeginAttack(natives)
log(game.tick .. " " .. #natives.squads .. " " .. #natives.pendingAttack)
time.reset()
squadsDispatch(map, surface, natives)
log(time)
log("beginAttack")
-- game.players[1].print("dispatch")
-- game.players[1].print(time)
-- time.reset()
regroupSquads(natives, map)
-- game.players[1].print("regroupSquads")
-- game.players[1].print(time)
-- time.reset()
cleanBuilders(map, natives, surface)
-- game.players[1].print("cleanBuilders")
-- game.players[1].print(time)
log("-------------------")
end)
local function onBuild(event)
@ -603,7 +601,7 @@ local function onBuild(event)
entity.destructible = false
end
end
end
end
end
end
@ -615,7 +613,7 @@ local function onMine(event)
if (entity.amount == 0) then
unregisterResource(entity, map)
end
else
else
accountPlayerEntity(map, entity, natives, false, false)
end
end
@ -629,11 +627,12 @@ local function onDeath(event)
local chunk = getChunkByPosition(map, entityPosition)
local cause = event.cause
local tick = event.tick
local entityType = entity.type
if (entity.force.name == "enemy") then
local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret")))
if (entity.type == "unit") then
if (entityType == "unit") then
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
-- drop death pheromone where unit died
deathScent(map, chunk)
@ -663,12 +662,9 @@ local function onDeath(event)
name=cloudName})
end
elseif event.force and (event.force.name ~= "enemy") and ((entity.type == "unit-spawner") or (entity.type == "turret")) then
elseif event.force and (event.force.name ~= "enemy") and ((entityType == "unit-spawner") or (entityType == "turret")) then
natives.points = natives.points + (((entity.type == "unit-spawner") and RECOVER_NEST_COST) or RECOVER_WORM_COST)
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
natives.points = natives.points + (((entityType == "unit-spawner") and RECOVER_NEST_COST) or RECOVER_WORM_COST)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
unregisterEnemyBaseStructure(map, entity)
@ -719,13 +715,13 @@ local function onDeath(event)
if (event.force ~= nil) and (event.force.name == "enemy") then
creditNatives = true
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
victoryScent(map, chunk, entity.type)
victoryScent(map, chunk, entityType)
end
local drained = (entity.type == "electric-turret") and map.chunkToDrained[chunk]
local drained = (entityType == "electric-turret") and map.chunkToDrained[chunk]
if (cause ~= nil) or (drained and (drained - tick) > 0) then
if ((cause and ENERGY_THIEF_LOOKUP[cause.name]) or (not cause)) then
local conversion = ENERGY_THIEF_CONVERSION_TABLE[entity.type]
local conversion = ENERGY_THIEF_CONVERSION_TABLE[entityType]
if conversion then
local newEntity = surface.create_entity({position=entity.position,
name=convertTypeToDrainCrystal(entity.force.evolution_factor, conversion),
@ -764,11 +760,12 @@ local function onDeath(event)
end
end
if creditNatives and natives.safeBuildings and (natives.safeEntities[entity.type] or natives.safeEntityName[entity.name]) then
if creditNatives and natives.safeBuildings and (natives.safeEntities[entityType] or natives.safeEntityName[entity.name]) then
makeImmortalEntity(surface, entity)
else
accountPlayerEntity(map, entity, natives, false, creditNatives)
end
-- print("destroyed", entityType, getPlayerBaseGenerator(map,chunk))
end
end
end
@ -873,9 +870,6 @@ local function onRocketLaunch(event)
local entity = event.rocket_silo or event.rocket
if entity and (entity.surface.index == natives.activeSurface) then
natives.points = natives.points + 2000
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
end
end
@ -905,7 +899,7 @@ local function onInit()
end
local function onCommandDebugger(event)
for i=1,#natives.squads do
for i=1,natives.squads.len do
if (natives.squads[i].group.valid) and (natives.squads[i].group.group_number == event.unit_number) then
local msg
if (event.result == defines.behavior_result.in_progress) then
@ -915,7 +909,7 @@ local function onCommandDebugger(event)
elseif (event.result == defines.behavior_result.success) then
msg = "success"
elseif (event.result == defines.behavior_result.deleted) then
msg = "deleted"
msg = "deleted"
end
print(msg, event.unit_number)
return
@ -933,7 +927,7 @@ local function onForceMerged(event)
tRemove(map.activePlayerForces, i)
break
end
end
end
end
-- hooks

View File

@ -157,7 +157,7 @@ local function noNearbySettlers(map, chunk, tick)
end
function aiAttackWave.formSettlers(map, surface, natives, chunk, tick)
if (mRandom() < natives.formSquadThreshold) and ((#natives.squads + #natives.building) < AI_MAX_SQUAD_COUNT) then
if (mRandom() < natives.formSquadThreshold) and ((natives.squads.len + #natives.building) < AI_MAX_SQUAD_COUNT) then
local squadPath, squadDirection
if (natives.state == AI_STATE_SIEGE) then
@ -196,7 +196,9 @@ function aiAttackWave.formSettlers(map, surface, natives, chunk, tick)
local foundUnits = surface.set_multi_command(map.formCommand)
if (foundUnits > 0) then
setChunkSettlerTick(map, squadPath, tick + natives.settlerCooldown)
natives.pendingAttack[#natives.pendingAttack+1] = squad
local pending = natives.pendingAttack
pending.len = pending.len + 1
pending[pending.len] = squad
natives.points = natives.points - AI_SETTLER_COST
else
if (squad.group.valid) then
@ -211,7 +213,7 @@ function aiAttackWave.formSettlers(map, surface, natives, chunk, tick)
end
function aiAttackWave.formVengenceSquad(map, surface, natives, chunk)
if (mRandom() < natives.formSquadThreshold) and (#natives.squads < AI_MAX_SQUAD_COUNT)
if (mRandom() < natives.formSquadThreshold) and (natives.squads.len < AI_MAX_SQUAD_COUNT)
then
local squadPath, squadDirection = scoreNeighborsForFormation(getNeighborChunks(map, chunk.x, chunk.y),
@ -237,7 +239,9 @@ function aiAttackWave.formVengenceSquad(map, surface, natives, chunk)
map.formCommand.unit_count = scaledWaveSize
local foundUnits = surface.set_multi_command(map.formCommand)
if (foundUnits > 0) then
natives.pendingAttack[#natives.pendingAttack+1] = squad
local pending = natives.pendingAttack
pending.len = pending.len + 1
pending[pending.len] = squad
natives.points = natives.points - AI_VENGENCE_SQUAD_COST
else
if (squad.group.valid) then
@ -254,7 +258,7 @@ end
function aiAttackWave.formSquads(map, surface, natives, chunk, tick)
if attackWaveValidCandidate(chunk, natives, map) and
(mRandom() < natives.formSquadThreshold) and
(#natives.squads < AI_MAX_SQUAD_COUNT)
(natives.squads.len < AI_MAX_SQUAD_COUNT)
then
local squadPath, squadDirection = scoreNeighborsForFormation(getNeighborChunks(map, chunk.x, chunk.y),
validUnitGroupLocation,
@ -279,7 +283,9 @@ function aiAttackWave.formSquads(map, surface, natives, chunk, tick)
map.formCommand.unit_count = scaledWaveSize
local foundUnits = surface.set_multi_command(map.formCommand)
if (foundUnits > 0) then
natives.pendingAttack[#natives.pendingAttack+1] = squad
local pending = natives.pendingAttack
pending.len = pending.len + 1
pending[pending.len] = squad
natives.points = natives.points - AI_SQUAD_COST
if tick and (natives.state == AI_STATE_AGGRESSIVE) then
natives.canAttackTick = randomTickEvent(tick,

View File

@ -26,8 +26,6 @@ local AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = constants.AGGRESSIVE_CAN_ATTACK_
local AI_UNIT_REFUND = constants.AI_UNIT_REFUND
local AI_MAX_OVERFLOW_POINTS = constants.AI_MAX_OVERFLOW_POINTS
local AI_MAX_POINTS = constants.AI_MAX_POINTS
local AI_POINT_GENERATOR_AMOUNT = constants.AI_POINT_GENERATOR_AMOUNT
@ -60,8 +58,10 @@ function aiPlanning.planning(natives, evolution_factor, tick)
local maxPoints = AI_MAX_POINTS * evolution_factor
if natives.aiNocturnalMode then
maxPoints = maxPoints * 0.85
maxPoints = maxPoints * 0.85
end
local maxOverflowPoints = maxPoints * 3
local attackWaveMaxSize = natives.attackWaveMaxSize
natives.retreatThreshold = linearInterpolation(evolution_factor, RETREAT_MOVEMENT_PHEROMONE_LEVEL_MIN, RETREAT_MOVEMENT_PHEROMONE_LEVEL_MAX)
@ -88,44 +88,47 @@ function aiPlanning.planning(natives, evolution_factor, tick)
natives.baseIncrement = points
if (natives.points < maxPoints) then
natives.points = natives.points + points
local currentPoints = natives.points
if (currentPoints < maxPoints) then
natives.points = currentPoints + points
end
if (currentPoints > maxOverflowPoints) then
natives.points = maxOverflowPoints
end
if (natives.temperamentTick <= tick) then
natives.temperament = mRandom()
natives.temperamentTick = randomTickEvent(tick, AI_MIN_TEMPERAMENT_DURATION, AI_MAX_TEMPERAMENT_DURATION)
natives.temperament = mRandom()
natives.temperamentTick = randomTickEvent(tick, AI_MIN_TEMPERAMENT_DURATION, AI_MAX_TEMPERAMENT_DURATION)
end
if (natives.stateTick <= tick) then
local roll = mRandom() * mMax(1 - evolution_factor, 0.15) * natives.aiAggressiveness
if (roll > natives.temperament) then
natives.state = AI_STATE_PEACEFUL
else
roll = mRandom()
if (roll < 0.65) then
natives.state = AI_STATE_AGGRESSIVE
local roll = mRandom() * mMax(1 - evolution_factor, 0.15) * natives.aiAggressiveness
if (roll > natives.temperament) then
natives.state = AI_STATE_PEACEFUL
else
roll = mRandom()
if (roll < 0.65) then
natives.state = AI_STATE_AGGRESSIVE
natives.canAttackTick = randomTickEvent(tick,
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
elseif ((natives.enabledMigration) and (natives.expansion) and (roll < 0.75)) then
natives.state = AI_STATE_MIGRATING
elseif ((natives.siegeAIToggle) and (natives.expansion) and (roll < 0.80)) then
natives.state = AI_STATE_SIEGE
elseif ((natives.enabledMigration) and (natives.expansion) and (roll < 0.75)) then
natives.state = AI_STATE_MIGRATING
elseif ((natives.siegeAIToggle) and (natives.expansion) and (roll < 0.80)) then
natives.state = AI_STATE_SIEGE
elseif ((natives.onslaughtAIToggle) and (roll < 0.85)) then
natives.state = AI_STATE_ONSLAUGHT
elseif ((natives.raidAIToggle) and (evolution_factor >= 0.04)) then
natives.state = AI_STATE_RAIDING
natives.state = AI_STATE_ONSLAUGHT
elseif ((natives.raidAIToggle) and (evolution_factor >= 0.04)) then
natives.state = AI_STATE_RAIDING
natives.points = natives.points + 1000
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
else
natives.state = AI_STATE_AGGRESSIVE
end
end
natives.stateTick = randomTickEvent(tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
natives.points = natives.points + 1000
else
natives.state = AI_STATE_AGGRESSIVE
end
end
natives.stateTick = randomTickEvent(tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
end
end

View File

@ -28,7 +28,7 @@ end
function aiPredicates.canMigrate(natives, surface)
return ((natives.state == AI_STATE_MIGRATING) or
(natives.state == AI_STATE_SIEGE))
(natives.state == AI_STATE_SIEGE))
and natives.expansion
and not surface.peaceful_mode
and ((not natives.aiNocturnalMode) or

View File

@ -197,20 +197,20 @@ local function normalizeProbabilities(probabilityTable)
local result = {}
for alignment,probabilitySet in pairs(probabilityTable) do
local max = 0
local min = MAGIC_MAXIMUM_NUMBER
local max = 0
local min = MAGIC_MAXIMUM_NUMBER
for probability, _ in pairs(probabilitySet) do
if (probability > max) then
max = probability
end
if (probability < min) then
min = probability
end
end
for probability, _ in pairs(probabilitySet) do
if (probability > max) then
max = probability
end
if (probability < min) then
min = probability
end
end
local alignmentResult = {}
for probability, entities in pairs(probabilitySet) do
for probability, entities in pairs(probabilitySet) do
local normalizeProbability = 0
if (probability ~= 0) then
normalizeProbability = mMin(mFloor(((probability - min) / (max - min)) * 100), 97)
@ -223,7 +223,7 @@ local function normalizeProbabilities(probabilityTable)
for i=1,#entities do
set[#set+1] = entities[i]
end
end
end
local paired = {}
for probability, entities in pairs(alignmentResult) do
@ -243,18 +243,18 @@ function baseUtils.findNearbyBase(map, chunk, natives)
local foundBase = getChunkBase(map, chunk)
if foundBase then
return foundBase
return foundBase
end
local bases = natives.bases
local closet = MAGIC_MAXIMUM_NUMBER
for i=1, #bases do
local base = bases[i]
local distance = euclideanDistancePoints(base.x, base.y, x, y)
if (distance <= base.distanceThreshold) and (distance < closet) then
local base = bases[i]
local distance = euclideanDistancePoints(base.x, base.y, x, y)
if (distance <= base.distanceThreshold) and (distance < closet) then
closet = distance
foundBase = base
end
foundBase = base
end
end
return foundBase
@ -270,7 +270,7 @@ local function findEntityUpgrade(baseAlignment, currentEvo, evoIndex, entityAlig
)
if not alignments or (adjCurrentEvo > evoIndex) then
return nil
return nil
end
local entity = nil
@ -319,8 +319,8 @@ local function findBaseInitialAlignment(evoIndex, natives, evolutionTable)
for i=1,#natives.evolutionTableAlignmentOrder do
local evo = natives.evolutionTableAlignmentOrder[i]
local entitySet = evolutionTable[evo]
if (evo <= evoTop) and entitySet and (#entitySet > 0) then
if not pickedEvo then
if (evo <= evoTop) and entitySet and (#entitySet > 0) then
if not pickedEvo then
alignment = entitySet[mRandom(#entitySet)]
pickedEvo = evo
else
@ -504,29 +504,29 @@ function baseUtils.processBase(map, chunk, surface, natives, tick, base, evoluti
end
if (base.temperamentTick <= tick) then
base.temperament = mRandom()
base.temperamentTick = randomTickEvent(tick, BASE_AI_MIN_TEMPERAMENT_DURATION, BASE_AI_MAX_TEMPERAMENT_DURATION)
base.temperament = mRandom()
base.temperamentTick = randomTickEvent(tick, BASE_AI_MIN_TEMPERAMENT_DURATION, BASE_AI_MAX_TEMPERAMENT_DURATION)
end
if (base.stateTick <= tick) then
local roll = mRandom() * mMax(1 - evolutionFactor, 0.15)
if (roll > natives.temperament) then
base.state = BASE_AI_STATE_DORMANT
else
roll = mRandom()
if (roll < 0.70) then
base.state = BASE_AI_STATE_ACTIVE
elseif (roll < 0.80) then
base.state = BASE_AI_STATE_NESTS
local roll = mRandom() * mMax(1 - evolutionFactor, 0.15)
if (roll > natives.temperament) then
base.state = BASE_AI_STATE_DORMANT
else
roll = mRandom()
if (roll < 0.70) then
base.state = BASE_AI_STATE_ACTIVE
elseif (roll < 0.80) then
base.state = BASE_AI_STATE_NESTS
elseif (roll < 0.90) then
base.state = BASE_AI_STATE_WORMS
base.state = BASE_AI_STATE_WORMS
elseif (roll < 0.975) then
base.state = BASE_AI_STATE_OVERDRIVE
base.state = BASE_AI_STATE_OVERDRIVE
else
base.state = BASE_AI_STATE_MUTATE
end
end
base.stateTick = randomTickEvent(tick, BASE_AI_MIN_STATE_DURATION, BASE_AI_MAX_STATE_DURATION)
base.state = BASE_AI_STATE_MUTATE
end
end
base.stateTick = randomTickEvent(tick, BASE_AI_MIN_STATE_DURATION, BASE_AI_MAX_STATE_DURATION)
end
base.tick = tick

View File

@ -21,13 +21,13 @@ local function fileEntity(baseAlignment, entity, evolutionTable, natives, evo)
local evoRequirement = mMin(evo or entity.prototype.build_base_evolution_requirement, 1)
local eTable = evolutionTable[baseAlignment]
if not eTable then
eTable = {}
evolutionTable[baseAlignment] = eTable
eTable = {}
evolutionTable[baseAlignment] = eTable
end
local aTable = eTable[evoRequirement]
if not aTable then
aTable = {}
eTable[evoRequirement] = aTable
aTable = {}
eTable[evoRequirement] = aTable
end
aTable[#aTable+1] = entity.name
@ -38,85 +38,85 @@ function bobs.processBobsUnitClass(natives, surface)
local position = { x = 0, y = 0 }
local entity = surface.create_entity({
name = "bob-biter-spawner",
position = position
name = "bob-biter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "bob-spitter-spawner",
position = position
name = "bob-spitter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "small-worm-turret",
position = position
name = "small-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "medium-worm-turret",
position = position
name = "medium-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "big-worm-turret",
position = position
name = "big-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-explosive-worm-turret",
position = position
name = "bob-big-explosive-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-fire-worm-turret",
position = position
name = "bob-big-fire-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-poison-worm-turret",
position = position
name = "bob-big-poison-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-piercing-worm-turret",
position = position
name = "bob-big-piercing-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-electric-worm-turret",
position = position
name = "bob-big-electric-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-giant-worm-turret",
position = position
name = "bob-giant-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "behemoth-worm-turret",
position = position
name = "behemoth-worm-turret",
position = position
})
fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm, natives)
entity.destroy()

View File

@ -61,14 +61,14 @@ function chunkProcessor.processPendingChunks(natives, map, surface, pendingStack
local event = pendingStack[i]
pendingStack[i] = nil
local topLeft = event.area.left_top
local x = topLeft.x
local y = topLeft.y
local topLeft = event.area.left_top
local x = topLeft.x
local y = topLeft.y
topOffset[1] = x
topOffset[2] = y
bottomOffset[1] = x + CHUNK_SIZE
bottomOffset[2] = y + CHUNK_SIZE
topOffset[1] = x
topOffset[2] = y
bottomOffset[1] = x + CHUNK_SIZE
bottomOffset[2] = y + CHUNK_SIZE
if map[x] and map[x][y] then
mapScanChunk(map[x][y], surface, map)
@ -106,21 +106,21 @@ function chunkProcessor.processScanChunks(map, surface)
local removals = {}
for chunk,_ in pairs(map.chunkToPassScan) do
local x = chunk.x
local y = chunk.y
local x = chunk.x
local y = chunk.y
topOffset[1] = x
topOffset[2] = y
bottomOffset[1] = x + CHUNK_SIZE
bottomOffset[2] = y + CHUNK_SIZE
topOffset[1] = x
topOffset[2] = y
bottomOffset[1] = x + CHUNK_SIZE
bottomOffset[2] = y + CHUNK_SIZE
chunk = chunkPassScan(chunk, surface, map)
if (chunk == SENTINEL_IMPASSABLE_CHUNK) then
map[x][y] = nil
if (chunk == SENTINEL_IMPASSABLE_CHUNK) then
map[x][y] = nil
removals[#removals+1] = chunk
end
removals[#removals+1] = chunk
end
end
if (#removals > 0) then

View File

@ -42,6 +42,13 @@ local RESOURCE_NORMALIZER = constants.RESOURCE_NORMALIZER
local CHUNK_TICK = constants.CHUNK_TICK
local GENERATOR_PHEROMONE_LEVEL_1 = constants.GENERATOR_PHEROMONE_LEVEL_1
local GENERATOR_PHEROMONE_LEVEL_2 = constants.GENERATOR_PHEROMONE_LEVEL_2
local GENERATOR_PHEROMONE_LEVEL_3 = constants.GENERATOR_PHEROMONE_LEVEL_3
local GENERATOR_PHEROMONE_LEVEL_4 = constants.GENERATOR_PHEROMONE_LEVEL_4
local GENERATOR_PHEROMONE_LEVEL_5 = constants.GENERATOR_PHEROMONE_LEVEL_5
local GENERATOR_PHEROMONE_LEVEL_6 = constants.GENERATOR_PHEROMONE_LEVEL_6
-- imported functions
local isRampant = stringUtils.isRampant
@ -170,12 +177,12 @@ local function scanPaths(chunk, surface, map)
end
local function scorePlayerBuildings(surface, map)
return (surface.count_entities_filtered(map.filteredEntitiesPlayerQuery50) * 25) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery200) * 100) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery1000) * 500) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery2000) * 1000) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery3500) * 1750) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery12000) * 6000)
return (surface.count_entities_filtered(map.filteredEntitiesPlayerQuery50) * GENERATOR_PHEROMONE_LEVEL_1) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery200) * GENERATOR_PHEROMONE_LEVEL_2) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery1000) * GENERATOR_PHEROMONE_LEVEL_3) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery2000) * GENERATOR_PHEROMONE_LEVEL_4) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery3500) * GENERATOR_PHEROMONE_LEVEL_5) +
(surface.count_entities_filtered(map.filteredEntitiesPlayerQuery12000) * GENERATOR_PHEROMONE_LEVEL_6)
end
function chunkUtils.initialScan(chunk, natives, surface, map, tick, evolutionFactor, rebuilding)

View File

@ -45,7 +45,7 @@ constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL_MAX = 221000
constants.PROCESS_QUEUE_SIZE = 85
constants.SCAN_QUEUE_SIZE = 10
constants.ATTACK_QUEUE_SIZE = 20
constants.ATTACK_QUEUE_SIZE = 18
constants.BASE_QUEUE_SIZE = 1
constants.SQUAD_QUEUE_SIZE = 2
constants.PROCESS_PLAYER_BOUND = 128
@ -437,32 +437,44 @@ constants.MAX_PENALTY_BEFORE_PURGE = 36000
-- player building pheromones
constants.GENERATOR_PHEROMONE_LEVEL_1 = 25
constants.GENERATOR_PHEROMONE_LEVEL_2 = 100
constants.GENERATOR_PHEROMONE_LEVEL_3 = 500
constants.GENERATOR_PHEROMONE_LEVEL_4 = 1000
constants.GENERATOR_PHEROMONE_LEVEL_5 = 1750
constants.GENERATOR_PHEROMONE_LEVEL_6 = 6000
constants.BUILDING_PHEROMONES = {}
constants.BUILDING_PHEROMONES["wall"] = 25
constants.BUILDING_PHEROMONES["transport-belt"] = 25 -- 1
constants.BUILDING_PHEROMONES["splitter"] = 100
constants.BUILDING_PHEROMONES["pump"] = 100
constants.BUILDING_PHEROMONES["offshore-pump"] = 100 -- 2
constants.BUILDING_PHEROMONES["lamp"] = 500
constants.BUILDING_PHEROMONES["generator"] = 500
constants.BUILDING_PHEROMONES["solar-panel"] = 500
constants.BUILDING_PHEROMONES["programmable-speaker"] = 500
constants.BUILDING_PHEROMONES["accumulator"] = 500
constants.BUILDING_PHEROMONES["assembling-machine"] = 500
constants.BUILDING_PHEROMONES["turret"] = 500
constants.BUILDING_PHEROMONES["roboport"] = 500
constants.BUILDING_PHEROMONES["beacon"] = 500
constants.BUILDING_PHEROMONES["ammo-turret"] = 500 -- 3
constants.BUILDING_PHEROMONES["boiler"] = 500
constants.BUILDING_PHEROMONES["furnace"] = 500
constants.BUILDING_PHEROMONES["lab"] = 500
constants.BUILDING_PHEROMONES["reactor"] = 500
constants.BUILDING_PHEROMONES["radar"] = 500
constants.BUILDING_PHEROMONES["electric-turret"] = 500 -- 4
constants.BUILDING_PHEROMONES["fluid-turret"] = 1750
constants.BUILDING_PHEROMONES["mining-drill"] = 1750 -- 5
constants.BUILDING_PHEROMONES["artillery-turret"] = 6000
constants.BUILDING_PHEROMONES["rocket-silo"] = 6000 -- 6
constants.BUILDING_PHEROMONES["wall"] = constants.GENERATOR_PHEROMONE_LEVEL_1
constants.BUILDING_PHEROMONES["transport-belt"] = constants.GENERATOR_PHEROMONE_LEVEL_1
constants.BUILDING_PHEROMONES["splitter"] = constants.GENERATOR_PHEROMONE_LEVEL_2
constants.BUILDING_PHEROMONES["pump"] = constants.GENERATOR_PHEROMONE_LEVEL_2
constants.BUILDING_PHEROMONES["offshore-pump"] = constants.GENERATOR_PHEROMONE_LEVEL_2
constants.BUILDING_PHEROMONES["lamp"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["solar-panel"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["programmable-speaker"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["accumulator"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["assembling-machine"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["turret"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["ammo-turret"] = constants.GENERATOR_PHEROMONE_LEVEL_3
constants.BUILDING_PHEROMONES["furnace"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["lab"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["roboport"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["beacon"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["radar"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["electric-turret"] = constants.GENERATOR_PHEROMONE_LEVEL_4
constants.BUILDING_PHEROMONES["boiler"] = constants.GENERATOR_PHEROMONE_LEVEL_5
constants.BUILDING_PHEROMONES["generator"] = constants.GENERATOR_PHEROMONE_LEVEL_5
constants.BUILDING_PHEROMONES["fluid-turret"] = constants.GENERATOR_PHEROMONE_LEVEL_5
constants.BUILDING_PHEROMONES["mining-drill"] = constants.GENERATOR_PHEROMONE_LEVEL_5
constants.BUILDING_PHEROMONES["artillery-turret"] = constants.GENERATOR_PHEROMONE_LEVEL_6
constants.BUILDING_PHEROMONES["reactor"] = constants.GENERATOR_PHEROMONE_LEVEL_6
constants.BUILDING_PHEROMONES["rocket-silo"] = constants.GENERATOR_PHEROMONE_LEVEL_6
-- constants.RETREAT_FILTER = {}

View File

@ -93,7 +93,8 @@ end
function interop.registerUnitGroup(unitGroup, isSettler)
local squad = unitGroupUtils.createSquad(unitGroup.position, unitGroup.surface, unitGroup, isSettler)
global.natives.pendingAttack[#global.natives.pendingAttack+1] = squad
global.natives.pendingAttack.len = global.natives.pendingAttack.len + 1
global.natives.pendingAttack[global.natives.pendingAttack.len] = squad
end
interopG = interop

View File

@ -92,13 +92,13 @@ local mRandom = math.random
local function nonRepeatingRandom(players)
local ordering = {}
for _,player in pairs(players) do
ordering[#ordering+1] = player.index
ordering[#ordering+1] = player.index
end
for i=#ordering,1,-1 do
local s = mRandom(i)
local t = ordering[i]
ordering[i] = ordering[s]
ordering[s] = t
local s = mRandom(i)
local t = ordering[i]
ordering[i] = ordering[s]
ordering[s] = t
end
return ordering
end
@ -136,8 +136,8 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
for x=index,endIndex do
local chunk = processQueue[x]
if (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
if (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
if squads then
squads = formSquads(map, surface, natives, chunk, tick)
@ -146,23 +146,23 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
settlers = formSettlers(map, surface, natives, chunk, tick)
end
if newEnemies then
local base = chunkToBase[chunk]
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) and (mRandom() < 0.10) then
processBase(map, chunk, surface, natives, tick, base, evolutionFactor)
end
end
end
i = i + 1
if newEnemies then
local base = chunkToBase[chunk]
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) and (mRandom() < 0.10) then
processBase(map, chunk, surface, natives, tick, base, evolutionFactor)
end
end
end
i = i + 1
end
i = 1
for x=index,endIndex do
local chunk = processQueue[x]
if (chunk[CHUNK_TICK] ~= tick) then
commitPheromone(map, chunk, scentStaging[i], tick)
end
i = i + 1
local chunk = processQueue[x]
if (chunk[CHUNK_TICK] ~= tick) then
commitPheromone(map, chunk, scentStaging[i], tick)
end
i = i + 1
end
if (endIndex == #processQueue) then
@ -193,22 +193,22 @@ function mapProcessor.processPlayers(players, map, surface, natives, tick)
-- not looping everyone because the cost is high enough already in multiplayer
if (#playerOrdering > 0) then
local player = players[playerOrdering[1]]
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
local player = players[playerOrdering[1]]
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
local i = 1
local vengence = (allowingAttacks and
(natives.points >= AI_VENGENCE_SQUAD_COST) and
((getEnemyStructureCount(map, playerChunk) > 0) or (playerChunk[MOVEMENT_PHEROMONE] < -natives.retreatThreshold)))
local vengence = (allowingAttacks and
(natives.points >= AI_VENGENCE_SQUAD_COST) and
((getEnemyStructureCount(map, playerChunk) > 0) or (playerChunk[MOVEMENT_PHEROMONE] < -natives.retreatThreshold)))
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
local chunk = getChunkByXY(map, x, y)
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
local chunk = getChunkByXY(map, x, y)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
local nests = getNestCount(map, chunk)
if (nests > 0) then
@ -242,34 +242,34 @@ function mapProcessor.processPlayers(players, map, surface, natives, tick)
if vengence and (getNestCount(map, chunk) > 0) then
vengence = formVengenceSquad(map, surface, natives, chunk)
end
end
i = i + 1
end
end
end
i = i + 1
end
end
i = 1
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
local chunk = getChunkByXY(map, x, y)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
commitPheromone(map, chunk, scentStaging[i], tick)
end
i = i + 1
end
end
end
end
i = 1
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
local chunk = getChunkByXY(map, x, y)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
commitPheromone(map, chunk, scentStaging[i], tick)
end
i = i + 1
end
end
end
end
end
for i=1,#playerOrdering do
local player = players[playerOrdering[i]]
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
local player = players[playerOrdering[i]]
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
playerScent(playerChunk)
end
end
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
playerScent(playerChunk)
end
end
end
end
@ -295,47 +295,47 @@ function mapProcessor.scanMap(map, surface, natives, tick)
local isFullMapScan = settings.global["rampant-enableFullMapScan"].value
for x=index,endIndex do
local chunk = processQueue[x]
local chunk = processQueue[x]
chunkBox[1] = chunk.x
chunkBox[2] = chunk.y
chunkBox[1] = chunk.x
chunkBox[2] = chunk.y
offset[1] = chunk.x + CHUNK_SIZE
offset[2] = chunk.y + CHUNK_SIZE
offset[1] = chunk.x + CHUNK_SIZE
offset[2] = chunk.y + CHUNK_SIZE
local retreatTick = retreats[chunk]
if retreatTick and ((tick - retreatTick) > INTERVAL_RETREAT) then
retreats[chunk] = nil
end
local retreatTick = retreats[chunk]
if retreatTick and ((tick - retreatTick) > INTERVAL_RETREAT) then
retreats[chunk] = nil
end
local rallyTick = rallys[chunk]
if rallyTick and ((tick - rallyTick) > INTERVAL_RALLY) then
rallys[chunk] = nil
end
local rallyTick = rallys[chunk]
if rallyTick and ((tick - rallyTick) > INTERVAL_RALLY) then
rallys[chunk] = nil
end
local settlerTick = settlers[chunk]
if settlerTick and ((tick - settlerTick) > 0) then
settlers[chunk] = nil
end
local settlerTick = settlers[chunk]
if settlerTick and ((tick - settlerTick) > 0) then
settlers[chunk] = nil
end
local drainTick = drained[chunk]
if drainTick and ((tick - drainTick) > 0) then
drained[chunk] = nil
end
if drainTick and ((tick - drainTick) > 0) then
drained[chunk] = nil
end
local closeBy = findNearbySquad(map, chunk, chunk)
local closeBy = findNearbySquad(map, chunk, chunk)
if not closeBy then
local deadGroup = surface.count_entities_filtered(unitCountQuery) > 300
if not closeBy then
local deadGroup = surface.count_entities_filtered(unitCountQuery) > 300
if deadGroup then
recycleBiters(natives, surface.find_enemy_units(chunk, TRIPLE_CHUNK_SIZE))
end
end
if deadGroup then
recycleBiters(natives, surface.find_enemy_units(chunk, TRIPLE_CHUNK_SIZE))
end
end
if isFullMapScan then
mapScanChunk(chunk, surface, map)
end
end
local nests = getNestCount(map, chunk)
if (nests > 0) then

View File

@ -223,11 +223,10 @@ function mapUtils.positionFromDirectionAndFlat(direction, startPosition, endPosi
ly = ly + CHUNK_SIZE
elseif (direction == 8) then
lx = lx + CHUNK_SIZE
ly = ly + CHUNK_SIZE
ly = ly + CHUNK_SIZE
end
endPosition.x = lx
endPosition.y = ly
-- return lx, ly
end

View File

@ -31,22 +31,22 @@ local distortPosition = mathUtils.distortPosition
-- module code
function movementUtils.findMovementPosition(surface, position, distort)
function movementUtils.findMovementPosition(surface, position)
local pos = position
if not surface.can_place_entity({name="chunk-scanner-squad-movement-rampant", position=position}) then
pos = surface.find_non_colliding_position("chunk-scanner-squad-movement-rampant", position, 4, 2, true)
end
return (distort and distortPosition(pos)) or pos
end
function movementUtils.findMovementXY(surface, x, y)
local pos = position
if not surface.can_place_entity({name="chunk-scanner-squad-movement-rampant", position={}}) then
pos = surface.find_non_colliding_position("chunk-scanner-squad-movement-rampant", position, 4, 2, true)
if not surface.can_place_entity({name="chunk-scanner-squad-movement-rampant", position=pos}) then
pos = surface.find_non_colliding_position("chunk-scanner-squad-movement-rampant", pos, 15, 2, true)
end
return pos
end
function movementUtils.findMovementPositionDistort(surface, position)
local pos = position
if not surface.can_place_entity({name="chunk-scanner-squad-movement-rampant", position=pos}) then
pos = surface.find_non_colliding_position("chunk-scanner-squad-movement-rampant", pos, 15, 2, true)
end
return distortPosition(pos)
end
function movementUtils.addMovementPenalty(units, chunk)
local penalties = units.penalties
for i=1,#penalties do
@ -76,7 +76,6 @@ function movementUtils.lookupMovementPenalty(squad, chunk)
return 0
end
--[[
Expects all neighbors adjacent to a chunk
--]]
@ -107,7 +106,8 @@ function movementUtils.scoreNeighborsForAttack(map, natives, chunk, neighborDire
for x=1,8 do
local neighborChunk = neighborDirectionChunks[x]
if (neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, highestChunk, neighborChunk) then
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborChunk ~= chunk) and
canMoveChunkDirection(map, x, highestChunk, neighborChunk)) then
local score = scoreFunction(natives, squad, neighborChunk)
if (score > nextHighestScore) then
nextHighestScore = score
@ -118,6 +118,10 @@ function movementUtils.scoreNeighborsForAttack(map, natives, chunk, neighborDire
end
end
if (nextHighestChunk == nil) then
nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
end
return highestChunk, highestDirection, nextHighestChunk, nextHighestDirection
end
@ -129,6 +133,7 @@ function movementUtils.scoreNeighborsForSettling(map, chunk, neighborDirectionCh
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
local highestScore = -MAGIC_MAXIMUM_NUMBER
local highestDirection
for x=1,8 do
local neighborChunk = neighborDirectionChunks[x]
if (neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, chunk, neighborChunk) then
@ -142,10 +147,35 @@ function movementUtils.scoreNeighborsForSettling(map, chunk, neighborDirectionCh
end
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (scoreFunction(squad, chunk) > highestScore) then
return chunk, -1
return chunk, 0, SENTINEL_IMPASSABLE_CHUNK, 0
end
return highestChunk, highestDirection
local nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
local nextHighestScore = -MAGIC_MAXIMUM_NUMBER
local nextHighestDirection
if (highestChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
neighborDirectionChunks = getNeighborChunks(map, highestChunk.x, highestChunk.y)
for x=1,8 do
local neighborChunk = neighborDirectionChunks[x]
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborChunk ~= chunk) and
canMoveChunkDirection(map, x, highestChunk, neighborChunk)) then
local score = scoreFunction(squad, neighborChunk)
if (score > nextHighestScore) then
nextHighestScore = score
nextHighestChunk = neighborChunk
nextHighestDirection = x
end
end
end
end
if (nextHighestChunk == nil) then
nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
end
return highestChunk, highestDirection, nextHighestChunk, nextHighestDirection
end
--[[

View File

@ -28,13 +28,13 @@ local function fileEntity(baseAlignment, entity, evolutionTable, natives, evo)
local evoRequirement = mMin(evo or entity.prototype.build_base_evolution_requirement, 1)
local eTable = evolutionTable[baseAlignment]
if not eTable then
eTable = {}
evolutionTable[baseAlignment] = eTable
eTable = {}
evolutionTable[baseAlignment] = eTable
end
local aTable = eTable[evoRequirement]
if not aTable then
aTable = {}
eTable[evoRequirement] = aTable
aTable = {}
eTable[evoRequirement] = aTable
end
aTable[#aTable+1] = entity.name
@ -47,161 +47,161 @@ function ne.processNEUnitClass(natives, surface)
local factionSet = {}
local entity = surface.create_entity({
name = "biter-spawner",
position = position
name = "biter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "spitter-spawner",
position = position
name = "spitter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
if settings.startup["NE_Blue_Spawners"].value then
entity = surface.create_entity({
name = "ne-spawner-blue",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_BLUE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_BLUE
entity.destroy()
entity = surface.create_entity({
name = "ne-spawner-blue",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_BLUE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_BLUE
entity.destroy()
end
if settings.startup["NE_Red_Spawners"].value then
entity = surface.create_entity({
name = "ne-spawner-red",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_RED, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_RED
entity.destroy()
entity = surface.create_entity({
name = "ne-spawner-red",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_RED, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_RED
entity.destroy()
end
if settings.startup["NE_Green_Spawners"].value then
entity = surface.create_entity({
name = "ne-spawner-green",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_GREEN, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_GREEN
entity.destroy()
entity = surface.create_entity({
name = "ne-spawner-green",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_GREEN, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_GREEN
entity.destroy()
end
if settings.startup["NE_Yellow_Spawners"].value then
entity = surface.create_entity({
name = "ne-spawner-yellow",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_YELLOW, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_YELLOW
entity.destroy()
entity = surface.create_entity({
name = "ne-spawner-yellow",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_YELLOW, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_YELLOW
entity.destroy()
end
if settings.startup["NE_Pink_Spawners"].value then
entity = surface.create_entity({
name = "ne-spawner-pink",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_PINK, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_PINK
entity.destroy()
entity = surface.create_entity({
name = "ne-spawner-pink",
position = position
})
fileEntity(BASE_ALIGNMENT_NE_PINK, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_PINK
entity.destroy()
end
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE
if ENABLED_BOBS_UNITS then
entity = surface.create_entity({
name = "bob-biter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "bob-biter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "bob-spitter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
entity = surface.create_entity({
name = "bob-spitter-spawner",
position = position
})
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, natives, 0.0)
entity.destroy()
for _,alignment in pairs(factionSet) do
entity = surface.create_entity({
name = "bob-big-fire-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
for _,alignment in pairs(factionSet) do
entity = surface.create_entity({
name = "bob-big-fire-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-poison-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-poison-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-piercing-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-piercing-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-electric-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-electric-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-giant-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-giant-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "behemoth-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "behemoth-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "bob-big-explosive-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
end
entity = surface.create_entity({
name = "bob-big-explosive-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
end
end
for _,alignment in pairs(factionSet) do
entity = surface.create_entity({
name = "small-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "small-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "medium-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "medium-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "big-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
entity = surface.create_entity({
name = "big-worm-turret",
position = position
})
fileEntity(alignment, entity, natives.evolutionTableWorm, natives)
entity.destroy()
end
end

View File

@ -13,6 +13,10 @@ local chunkPropertyUtils = require("ChunkPropertyUtils")
local CHUNK_TICK = constants.CHUNK_TICK
local CHUNK_ALL_DIRECTIONS = constants.CHUNK_ALL_DIRECTIONS
local CHUNK_NORTH_SOUTH = constants.CHUNK_NORTH_SOUTH
local CHUNK_EAST_WEST = constants.CHUNK_EAST_WEST
local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
local BASE_PHEROMONE = constants.BASE_PHEROMONE
local PLAYER_PHEROMONE = constants.PLAYER_PHEROMONE
@ -36,6 +40,7 @@ local getNeighborChunks = mapUtils.getNeighborChunks
local getEnemyStructureCount = chunkPropertyUtils.getEnemyStructureCount
local getPathRating = chunkPropertyUtils.getPathRating
local getPassable = chunkPropertyUtils.getPassable
local getPlayerBaseGenerator = chunkPropertyUtils.getPlayerBaseGenerator
local getResourceGenerator = chunkPropertyUtils.getResourceGenerator
local getDeathGenerator = chunkPropertyUtils.getDeathGenerator
@ -51,8 +56,8 @@ function pheromoneUtils.victoryScent(map, chunk, entityType)
local value = BUILDING_PHEROMONES[entityType]
if value then
local scaledVal = (value * 3)
addDeathGenerator(map, chunk, -scaledVal)
chunk[MOVEMENT_PHEROMONE] = chunk[MOVEMENT_PHEROMONE] + scaledVal
addDeathGenerator(map, chunk, -scaledVal)
chunk[MOVEMENT_PHEROMONE] = chunk[MOVEMENT_PHEROMONE] + scaledVal
end
end
@ -81,7 +86,7 @@ function pheromoneUtils.commitPheromone(map, chunk, staging, tick)
chunk[MOVEMENT_PHEROMONE] = chunk[MOVEMENT_PHEROMONE] - (getDeathGenerator(map, chunk))
if (resourceGenerator > 0) and (enemyCount == 0) then
chunk[RESOURCE_PHEROMONE] = chunk[RESOURCE_PHEROMONE] + (linearInterpolation(resourceGenerator, 15000, 20000))
chunk[RESOURCE_PHEROMONE] = chunk[RESOURCE_PHEROMONE] + (linearInterpolation(resourceGenerator, 15000, 20000))
end
end
@ -109,86 +114,158 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
local neighborCount = 0
local neighbor
local neighbor1
local neighbor2
local neighbor3
local neighbor4
local neighbor5
local neighbor6
local neighbor7
local neighbor8
neighbor = tempNeighbors[2]
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
neighborFlagNW = neighborFlagNW + 1
neighborFlagNE = neighborFlagNE + 1
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
local neighborPass1
local neighborPass2
local neighborPass3
local neighborPass4
local neighborPass5
local neighborPass6
local neighborPass7
local neighborPass8
local chunkPass = getPassable(map, chunk)
if (chunkPass == CHUNK_ALL_DIRECTIONS) then
neighbor2 = tempNeighbors[2]
neighborPass2 = getPassable(map, neighbor2)
if ((neighbor2 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass2 == CHUNK_ALL_DIRECTIONS) or (neighborPass2 == CHUNK_NORTH_SOUTH))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor2[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor2[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor2[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor2[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[4]
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
neighborFlagNW = neighborFlagNW + 1
neighborFlagSW = neighborFlagSW + 1
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
neighbor7 = tempNeighbors[7]
neighborPass7 = getPassable(map, neighbor7)
if ((neighbor7 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass7 == CHUNK_ALL_DIRECTIONS) or (neighborPass7 == CHUNK_NORTH_SOUTH))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor7[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor7[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor7[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor7[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[5]
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
neighborFlagNE = neighborFlagNE + 1
neighborFlagSE = neighborFlagSE + 1
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
neighbor4 = tempNeighbors[4]
neighborPass4 = getPassable(map, neighbor4)
if ((neighbor4 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass4 == CHUNK_ALL_DIRECTIONS) or (neighborPass4 == CHUNK_EAST_WEST))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor4[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor4[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor4[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor4[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[7]
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
neighborFlagSW = neighborFlagSW + 1
neighborFlagSE = neighborFlagSE + 1
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
neighbor5 = tempNeighbors[5]
neighborPass5 = getPassable(map, neighbor5)
if ((neighbor5 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass5 == CHUNK_ALL_DIRECTIONS) or (neighborPass5 == CHUNK_EAST_WEST))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor5[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor5[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + neighbor5[PLAYER_PHEROMONE] - chunkPlayer
resourceTotal = resourceTotal + (neighbor5[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[1]
if (neighborFlagNW == 2) and neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
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
neighbor1 = tempNeighbors[1]
neighborPass1 = getPassable(map, neighbor1)
if (neighbor1 ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass1 == CHUNK_ALL_DIRECTIONS) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor1[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor1[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + neighbor1[PLAYER_PHEROMONE] - chunkPlayer
resourceTotal = resourceTotal + (neighbor1[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[3]
if (neighborFlagNE == 2) and neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
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
neighbor3 = tempNeighbors[3]
neighborPass3 = getPassable(map, neighbor3)
if (neighbor3 ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass3 == CHUNK_ALL_DIRECTIONS) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor3[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor3[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor3[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor3[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[6]
if (neighborFlagSW == 2) and neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
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
neighbor6 = tempNeighbors[6]
neighborPass6 = getPassable(map, neighbor6)
if (neighbor6 ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass6 == CHUNK_ALL_DIRECTIONS) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor6[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor6[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor6[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor6[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor = tempNeighbors[8]
if (neighborFlagSE == 2) and neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor[RESOURCE_PHEROMONE] - chunkResource)
neighbor8 = tempNeighbors[8]
neighborPass8 = getPassable(map, neighbor8)
if (neighbor8 ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass8 == CHUNK_ALL_DIRECTIONS) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor8[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor8[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor8[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor8[RESOURCE_PHEROMONE] - chunkResource)
end
elseif (chunkPass == CHUNK_EAST_WEST) then
neighbor4 = tempNeighbors[4]
neighborPass4 = getPassable(map, neighbor4)
if ((neighbor4 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass4 == CHUNK_ALL_DIRECTIONS) or (neighborPass4 == CHUNK_EAST_WEST))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor4[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor4[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor4[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor4[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor5 = tempNeighbors[5]
neighborPass5 = getPassable(map, neighbor5)
if ((neighbor5 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass5 == CHUNK_ALL_DIRECTIONS) or (neighborPass5 == CHUNK_EAST_WEST))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor5[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor5[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + neighbor5[PLAYER_PHEROMONE] - chunkPlayer
resourceTotal = resourceTotal + (neighbor5[RESOURCE_PHEROMONE] - chunkResource)
end
elseif (chunkPass == CHUNK_NORTH_SOUTH) then
neighbor2 = tempNeighbors[2]
neighborPass2 = getPassable(map, neighbor2)
if ((neighbor2 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass2 == CHUNK_ALL_DIRECTIONS) or (neighborPass2 == CHUNK_NORTH_SOUTH))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor2[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor2[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor2[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor2[RESOURCE_PHEROMONE] - chunkResource)
end
neighbor7 = tempNeighbors[7]
neighborPass7 = getPassable(map, neighbor7)
if ((neighbor7 ~= SENTINEL_IMPASSABLE_CHUNK) and
((neighborPass7 == CHUNK_ALL_DIRECTIONS) or (neighborPass7 == CHUNK_NORTH_SOUTH))) then
neighborCount = neighborCount + 1
movementTotal = movementTotal + (neighbor7[MOVEMENT_PHEROMONE] - chunkMovement)
baseTotal = baseTotal + (neighbor7[BASE_PHEROMONE] - chunkBase)
playerTotal = playerTotal + (neighbor7[PLAYER_PHEROMONE] - chunkPlayer)
resourceTotal = resourceTotal + (neighbor7[RESOURCE_PHEROMONE] - chunkResource)
end
end
local neighborDiv
@ -202,9 +279,9 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
staging[BASE_PHEROMONE] = (chunkBase + (neighborDiv * baseTotal)) * BASE_PHEROMONE_PERSISTANCE * chunkPathRating
staging[PLAYER_PHEROMONE] = (chunkPlayer + (neighborDiv * playerTotal)) * PLAYER_PHEROMONE_PERSISTANCE * chunkPathRating
if clear then
staging[RESOURCE_PHEROMONE] = (chunkResource + (neighborDiv * resourceTotal)) * RESOURCE_PHEROMONE_PERSISTANCE * chunkPathRating
staging[RESOURCE_PHEROMONE] = (chunkResource + (neighborDiv * resourceTotal)) * RESOURCE_PHEROMONE_PERSISTANCE * chunkPathRating
else
staging[RESOURCE_PHEROMONE] = (chunkResource + (neighborDiv * resourceTotal)) * 0.01
staging[RESOURCE_PHEROMONE] = (chunkResource + (neighborDiv * resourceTotal)) * 0.01
end
end

View File

@ -19,11 +19,11 @@ end
function playerUtils.playersWithinProximityToPosition(players, position, distance, natives)
for _,player in pairs(players) do
if (player ~= nil) and player.connected and (player.character ~= nil) and player.character.valid and (player.character.surface.index == natives.activeSurface) then
if (euclideanDistanceNamed(player.character.position, position) < distance) then
return true
end
end
if (player ~= nil) and player.connected and (player.character ~= nil) and player.character.valid and (player.character.surface.index == natives.activeSurface) then
if (euclideanDistanceNamed(player.character.position, position) < distance) then
return true
end
end
end
return false
end

View File

@ -34,6 +34,8 @@ local SQUAD_RETREATING = constants.SQUAD_RETREATING
local AI_MAX_BITER_GROUP_SIZE = constants.AI_MAX_BITER_GROUP_SIZE
local ATTACK_QUEUE_SIZE = constants.ATTACK_QUEUE_SIZE
local AI_STATE_SIEGE = constants.AI_STATE_SIEGE
local PLAYER_PHEROMONE_MULTIPLER = constants.PLAYER_PHEROMONE_MULTIPLER
@ -78,6 +80,8 @@ local euclideanDistanceNamed = mathUtils.euclideanDistanceNamed
local getPlayerBaseGenerator = chunkPropertyUtils.getPlayerBaseGenerator
local getResourceGenerator = chunkPropertyUtils.getResourceGenerator
local getChunkByPosition = mapUtils.getChunkByPosition
local scoreNeighborsForAttack = movementUtils.scoreNeighborsForAttack
local scoreNeighborsForSettling = movementUtils.scoreNeighborsForSettling
@ -98,7 +102,7 @@ local function scoreAttackLocation(natives, squad, neighborChunk)
local movementPheromone = neighborChunk[MOVEMENT_PHEROMONE]
if (movementPheromone >= 0) then
damage = movementPheromone + (neighborChunk[BASE_PHEROMONE] ) + (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
damage = movementPheromone + (neighborChunk[BASE_PHEROMONE]) + (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
else
damage = (neighborChunk[BASE_PHEROMONE] * (1 - (movementPheromone / -natives.retreatThreshold))) + (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
end
@ -114,41 +118,35 @@ end
local function settleMove(map, squad, natives, surface)
local targetPosition = map.position
local targetPosition2 = map.position2
local group = squad.group
local groupPosition = group.position
local x, y = positionToChunkXY(groupPosition)
local chunk = getChunkByXY(map, x, y)
local scoreFunction = scoreResourceLocation
local groupState = group.state
if (natives.state == AI_STATE_SIEGE) then
scoreFunction = scoreSiegeLocation
end
if squad.chunk and (squad.chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (squad.chunk ~= chunk) then
addMovementPenalty(squad, squad.chunk)
end
local attackChunk, attackDirection = scoreNeighborsForSettling(map,
chunk,
getNeighborChunks(map, x, y),
scoreFunction,
squad)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
addSquadToChunk(map, chunk, squad)
end
local resourceGenerator = getResourceGenerator(map, chunk)
local distance = euclideanDistancePoints(groupPosition.x,
groupPosition.y,
squad.originPosition.x,
squad.originPosition.y)
local largeGroup = (#squad.group.members > 80)
local cmd
local position
if (distance >= squad.maxDistance) or
((resourceGenerator ~= 0) and (getNestCount(map, chunk) == 0))
local position2
if (distance >= squad.maxDistance) or ((getResourceGenerator(map, chunk) ~= 0) and (getNestCount(map, chunk) == 0))
then
if not ((group.state == DEFINES_GROUP_FINISHED) or ((group.state == DEFINES_GROUP_GATHERING) and (squad.cycles <= 0))) then
if not ((groupState == DEFINES_GROUP_FINISHED) or ((groupState == DEFINES_GROUP_GATHERING) and (squad.cycles <= 0))) then
return
end
@ -170,9 +168,7 @@ local function settleMove(map, squad, natives, surface)
map.buildPositionTop.x = position.x - BASE_CLEAN_DISTANCE
map.buildPositionTop.y = position.y - BASE_CLEAN_DISTANCE
map.buildPositionBottom.x = position.x + BASE_CLEAN_DISTANCE
map.buildPositionBottom.y = position.y + BASE_CLEAN_DISTANCE
squad.cycles = 400
map.buildPositionBottom.y = position.y + BASE_CLEAN_DISTANCE
local entities = surface.find_entities_filtered(map.filteredEntitiesClearBuildingQuery)
for i=1,#entities do
@ -181,41 +177,109 @@ local function settleMove(map, squad, natives, surface)
entity.die()
end
end
squad.cycles = 400
group.set_command(cmd)
else
local attackChunk, attackDirection, nextAttackChunk, nextAttackDirection = scoreNeighborsForSettling(map,
chunk,
getNeighborChunks(map, x, y),
scoreFunction,
squad)
if (attackChunk == SENTINEL_IMPASSABLE_CHUNK) then
squad.cycles = 30
cmd = map.wonderCommand
group.set_command(cmd)
return
else
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
position = findMovementPosition(surface, targetPosition)
if not position then
squad.cycles = 30
cmd = map.wonderCommand
group.set_command(cmd)
return
else
targetPosition.x = position.x
targetPosition.y = position.y
if (getPlayerBaseGenerator(map, attackChunk) ~= 0) or
(attackChunk[PLAYER_PHEROMONE] >= natives.attackPlayerThreshold)
then
cmd = map.attackCommand
if not squad.rabid then
squad.frenzy = true
squad.frenzyPosition.x = groupPosition.x
squad.frenzyPosition.y = groupPosition.y
end
else
cmd = map.moveCommand
if squad.rabid or squad.kamikaze then
cmd.distraction = DEFINES_DISTRACTION_NONE
else
cmd.distraction = DEFINES_DISTRACTION_BY_ENEMY
end
end
end
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
position2 = findMovementPosition(surface, targetPosition2)
if position2 then
targetPosition.x = position2.x
targetPosition.y = position2.y
if ((cmd ~= map.attackCommand) and
((getPlayerBaseGenerator(map, nextAttackChunk) ~= 0) or
(nextAttackChunk[PLAYER_PHEROMONE] >= natives.attackPlayerThreshold)))
then
cmd = map.attackCommand
if not squad.rabid then
squad.frenzy = true
squad.frenzyPosition.x = groupPosition.x
squad.frenzyPosition.y = groupPosition.y
end
end
end
end
end
if (getPlayerBaseGenerator(map, attackChunk) ~= 0) or
(attackChunk[PLAYER_PHEROMONE] >= natives.attackPlayerThreshold)
then
cmd = map.attackCommand
else
cmd = map.moveCommand
if squad.rabid or squad.kamikaze then
if (attackDirection == 0) then
cmd = map.settleCommand
if squad.kamikaze then
cmd.distraction = DEFINES_DISTRACTION_NONE
else
cmd.distraction = DEFINES_DISTRACTION_BY_ENEMY
end
squad.status = SQUAD_BUILDING
map.buildPositionTop.x = position.x - BASE_CLEAN_DISTANCE
map.buildPositionTop.y = position.y - BASE_CLEAN_DISTANCE
map.buildPositionBottom.x = position.x + BASE_CLEAN_DISTANCE
map.buildPositionBottom.y = position.y + BASE_CLEAN_DISTANCE
local entities = surface.find_entities_filtered(map.filteredEntitiesClearBuildingQuery)
for i=1,#entities do
local entity = entities[i]
if entity.valid and (entity.type ~= "cliff") then
entity.die()
end
end
squad.cycles = 400
group.set_command(cmd)
else
squad.cycles = 23
group.set_command(cmd)
end
end
if squad.status ~= SQUAD_BUILDING then
position = findMovementPosition(surface,
positionFromDirectionAndChunk(attackDirection,
groupPosition,
targetPosition,
(largeGroup and 1.1) or 0.9))
end
if position then
squad.cycles = (largeGroup and 6) or 4
targetPosition.x = position.x
targetPosition.y = position.y
group.set_command(cmd)
group.start_moving()
end
end
local function attackMove(map, squad, natives, surface)
@ -227,11 +291,10 @@ local function attackMove(map, squad, natives, surface)
local groupPosition = group.position
local x, y = positionToChunkXY(groupPosition)
local chunk = getChunkByXY(map, x, y)
local attackScorer = scoreAttackLocation
local attackScorer = ((squad.attackScoreFunction == ATTACK_SCORE_KAMIKAZE) and scoreAttackKamikazeLocation)
or scoreAttackLocation
local squadChunk = squad.chunk
if (squad.attackScoreFunction == ATTACK_SCORE_KAMIKAZE) then
attackScorer = scoreAttackKamikazeLocation
end
if (squadChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (squadChunk ~= chunk) then
addMovementPenalty(squad, squadChunk)
end
@ -245,113 +308,106 @@ local function attackMove(map, squad, natives, surface)
getNeighborChunks(map, x, y),
attackScorer,
squad)
if (attackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
if (attackChunk == SENTINEL_IMPASSABLE_CHUNK) then
squad.cycles = 30
cmd = map.wonderCommand
group.set_command(cmd)
return
else
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
local position = findMovementPosition(surface, targetPosition)
if not position then
squad.cycles = 30
cmd = map.wonderCommand
group.set_command(cmd)
return
end
if ((getPlayerBaseGenerator(map, attackChunk) == 0) and
(attackChunk[PLAYER_PHEROMONE] < natives.attackPlayerThreshold)) then
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
local position2 = findMovementPosition(surface, targetPosition2)
if position2 then
if ((getPlayerBaseGenerator(map, nextAttackChunk) == 0) and
(nextAttackChunk[PLAYER_PHEROMONE] < natives.attackPlayerThreshold)) then
cmd = map.compoundMoveMoveCommand
if squad.rabid or squad.frenzy then
cmd.commands[1].distraction = DEFINES_DISTRACTION_BY_ANYTHING
cmd.commands[2].distraction = DEFINES_DISTRACTION_BY_ANYTHING
else
cmd.commands[1].distraction = DEFINES_DISTRACTION_BY_ENEMY
cmd.commands[2].distraction = DEFINES_DISTRACTION_BY_ENEMY
end
else
cmd = map.compoundMoveAttackCommand
cmd.commands[1].distraction = DEFINES_DISTRACTION_BY_ANYTHING
end
else
cmd = map.moveCommand
if squad.rabid or squad.frenzy then
cmd.distraction = DEFINES_DISTRACTION_BY_ANYTHING
else
cmd.distraction = DEFINES_DISTRACTION_BY_ENEMY
end
end
else
cmd = map.attackCommand
end
else
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
targetPosition.x = position.x
targetPosition.y = position.y
if (getPlayerBaseGenerator(map, attackChunk) ~= 0) and
(attackChunk[PLAYER_PHEROMONE] >= natives.attackPlayerThreshold)
then
cmd = map.attackCommand
local position2 = findMovementPosition(surface, targetPosition2)
if position2 then
cmd = map.compoundAttackAttackCommand
else
cmd = map.attackCommand
if not squad.rabid then
squad.frenzy = true
squad.frenzyPosition.x = groupPosition.x
squad.frenzyPosition.y = groupPosition.y
end
else
cmd = map.attackCommand
end
if not squad.rabid then
squad.frenzy = true
squad.frenzyPosition.x = groupPosition.x
squad.frenzyPosition.y = groupPosition.y
cmd = map.moveCommand
if squad.rabid or squad.frenzy then
cmd.distraction = DEFINES_DISTRACTION_BY_ANYTHING
else
cmd.distraction = DEFINES_DISTRACTION_BY_ENEMY
end
end
end
group.set_command(cmd)
else
cmd = map.wonderCommand
local position2
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
position2 = findMovementPosition(surface, targetPosition2)
if position2 then
targetPosition.x = position2.x
targetPosition.y = position2.y
if (cmd ~= map.attackCommand) and
((getPlayerBaseGenerator(map, nextAttackChunk) ~= 0) or
(nextAttackChunk[PLAYER_PHEROMONE] >= natives.attackPlayerThreshold))
then
cmd = map.attackCommand
if not squad.rabid then
squad.frenzy = true
squad.frenzyPosition.x = groupPosition.x
squad.frenzyPosition.y = groupPosition.y
end
end
end
end
squad.cycles = 23
group.set_command(cmd)
end
end
function squadAttack.squadsDispatch(map, surface, natives)
local squads = natives.squads
-- local targetPosition = map.position
-- local attackCmd = map.attackAreaCommand
-- local settleCmd = map.settleCommand
-- print("start dispatch")
-- local startIndex = natives.attackIndex
-- local maxSquadIndex = mMin(startIndex + ATTACK_QUEUE_SIZE, #squads)
-- for i=maxSquadIndex,startIndex,-1 do
for i=#squads,1,-1 do
local pending = natives.pendingAttack
local squadsLen = squads.len
local x = 0
for i=1,squadsLen do
local squad = squads[i]
local group = squad.group
if group and group.valid then
local memberCount = #group.members
if (memberCount == 0) then
tRemove(squads, i)
removeSquadFromChunk(map, squad)
local deathGen = getDeathGenerator(map, squad.chunk)
local penalties = squad.penalties
for x=1,mMin(#squad.penalties,5) do
for xc=1,mMin(#squad.penalties,5) do
addDeathGenerator(map,
penalties[x].c,
deathGen * DIVISOR_DEATH_TRAIL_TABLE[x])
penalties[xc].c,
deathGen * DIVISOR_DEATH_TRAIL_TABLE[xc])
end
group.destroy()
elseif (memberCount > AI_MAX_BITER_GROUP_SIZE) then
local members = group.members
unitGroupUtils.recycleBiters(natives, members)
tRemove(squads, i)
removeSquadFromChunk(map, squad)
group.destroy()
else
@ -360,30 +416,46 @@ function squadAttack.squadsDispatch(map, surface, natives)
local groupState = group.state
if (status == SQUAD_RAIDING) then
x = x + 1
squads[x] = squad
if (groupState == DEFINES_GROUP_FINISHED) or
(groupState == DEFINES_GROUP_GATHERING) -- or
-- ((groupState == DEFINES_GROUP_MOVING) and (cycles <= 0))
(groupState == DEFINES_GROUP_GATHERING) or
((groupState == DEFINES_GROUP_MOVING) and (cycles <= 0))
then
-- print(group.group_number, groupState)
attackMove(map, squad, natives, surface)
else
local chunk = getChunkByPosition(map, group.position)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
addSquadToChunk(map, chunk, squad)
end
end
elseif (status == SQUAD_SETTLING) then
x = x + 1
squads[x] = squad
if (groupState == DEFINES_GROUP_FINISHED) or
(groupState == DEFINES_GROUP_GATHERING) -- or
-- ((groupState == DEFINES_GROUP_MOVING) and (cycles <= 0))
(groupState == DEFINES_GROUP_GATHERING) or
((groupState == DEFINES_GROUP_MOVING) and (cycles <= 0))
then
settleMove(map, squad, natives, surface)
else
local chunk = getChunkByPosition(map, group.position)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
addSquadToChunk(map, chunk, squad)
end
end
elseif (status == SQUAD_RETREATING) and (cycles <= 0) then
natives.pendingAttack[#natives.pendingAttack+1] = squad
pending.len = pending.len + 1
pending[pending.len] = squad
squad.status = SQUAD_GUARDING
elseif (status == SQUAD_BUILDING) then
tRemove(squads, i)
removeSquadFromChunk(map, squad)
natives.building[#natives.building+1] = squad
elseif (status == SQUAD_GUARDING) then
tRemove(squads, i)
natives.pendingAttack[#natives.pendingAttack+1] = squad
pending.len = pending.len + 1
pending[pending.len] = squad
else
x = x + 1
squads[x] = squad
end
if (cycles > 0) then
squad.cycles = cycles - 1
@ -391,12 +463,12 @@ function squadAttack.squadsDispatch(map, surface, natives)
end
else
tRemove(squads, i)
removeSquadFromChunk(map, squad)
end
end
squads.len = x
-- print("end dispatch")
-- if (maxSquadIndex >= #squads) then
-- natives.attackIndex = 1
@ -405,35 +477,44 @@ function squadAttack.squadsDispatch(map, surface, natives)
-- end
end
function squadAttack.squadsBeginAttack(natives)
local pending = natives.pendingAttack
local squads = natives.squads
for i=#pending,1,-1 do
local pendingLen = pending.len
local x = 0
for i=1,pendingLen do
local squad = pending[i]
local group = squad.group
if group and group.valid then
if (squad.cycles ~= 0) then
squad.cycles = squad.cycles - 1
else
x = x + 1
pending[x] = squad
else
local kamikazeThreshold = calculateKamikazeThreshold(#squad.group.members, natives)
if not squad.kamikaze then
squad.kamikaze = (mRandom() < kamikazeThreshold)
end
if squad.settlers then
squad.status = SQUAD_SETTLING
squads[#squads+1] = squad
squads.len = squads.len + 1
squads[squads.len] = squad
else
if squad.kamikaze and (mRandom() < (kamikazeThreshold * 0.75)) then
squad.attackScoreFunction = ATTACK_SCORE_KAMIKAZE
end
squad.status = SQUAD_RAIDING
squads[#squads+1] = squad
squads.len = squads.len + 1
squads[squads.len] = squad
end
tRemove(pending, i)
end
end
end
end
-- natives.pendingAttack = {}
pending.len = x
end
squadAttackG = squadAttack

View File

@ -98,7 +98,10 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, natives, t
if not newSquad then
newSquad = createSquad(retreatPosition, surface)
natives.squads[#natives.squads+1] = newSquad
local squads = natives.squads
print("adding squad defense")
squads.len = squads.len+1
squads[squads.len] = newSquad
end
if newSquad then

View File

@ -24,8 +24,6 @@ local SQUAD_GUARDING = constants.SQUAD_GUARDING
local NO_RETREAT_SQUAD_SIZE_BONUS_MAX = constants.NO_RETREAT_SQUAD_SIZE_BONUS_MAX
local AI_MAX_OVERFLOW_POINTS = constants.AI_MAX_OVERFLOW_POINTS
local AI_MAX_BITER_GROUP_SIZE = constants.AI_MAX_BITER_GROUP_SIZE
local AI_SQUAD_MERGE_THRESHOLD = constants.AI_SQUAD_MERGE_THRESHOLD
@ -156,7 +154,7 @@ function unitGroupUtils.convertUnitGroupToSquad(natives, unitGroup)
return nil
end
local squads = natives.squads
for i=1,#squads do
for i=1,squads.len do
local squad = squads[i]
if (squad.group == unitGroup) then
return squad
@ -178,10 +176,6 @@ function unitGroupUtils.recycleBiters(natives, biters)
biters[i].destroy()
end
natives.points = natives.points + (unitCount * natives.unitRefundAmount)
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
end
function unitGroupUtils.cleanBuilders(map, natives, surface)
@ -240,7 +234,7 @@ end
function unitGroupUtils.regroupSquads(natives, map)
local squads = natives.squads
local squadCount = #squads
local squadCount = squads.len
local startIndex = natives.regroupIndex

View File

@ -39,64 +39,64 @@ function acid.addFaction()
-- acid biters
buildUnitSpawner(
{
unit = {
name = "acid-biter",
{
unit = {
name = "acid-biter",
attributes = {
explosion = "blood-explosion-small"
},
attack = {
damageType = "acid"
},
resistances = {},
attributes = {
explosion = "blood-explosion-small"
},
attack = {
damageType = "acid"
},
resistances = {},
type = "biter",
loot = biterLoot,
tint = {r=0, g=0.85, b=0.13, a=0.65}
},
type = "biter",
loot = biterLoot,
tint = {r=0, g=0.85, b=0.13, a=0.65}
},
unitSpawner = {
name = "acid-biter-spawner",
unitSpawner = {
name = "acid-biter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0.85, b=0.13, a=0.65}
}
},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0.85, b=0.13, a=0.65}
}
},
{
unit = {
{
unit = {
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
@ -126,53 +126,53 @@ function acid.addFaction()
[10] = 60
}
}
},
},
unitSpawner = {
unitSpawner = {
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.12,
[3] = 0.22,
[4] = 0.32,
[5] = 0.42,
[6] = 0.52,
[7] = 0.62,
[8] = 0.72,
[9] = 0.82,
[10] = 0.92
},
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.12,
[3] = 0.22,
[4] = 0.32,
[5] = 0.42,
[6] = 0.52,
[7] = 0.62,
[8] = 0.72,
[9] = 0.82,
[10] = 0.92
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
@ -202,56 +202,56 @@ function acid.addFaction()
[10] = 60
}
}
}
},
}
},
createMeleeAttack,
createMeleeAttack,
{
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
{
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
)
-- acid spitters
buildUnitSpawner(
{
unit = {
name = "acid-spitter",
{
unit = {
name = "acid-spitter",
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
type = "projectile",
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
type = "projectile",
directionOnly = true
},
resistances = {},
},
resistances = {},
type = "spitter",
attackName = "acid-spitter",
tint = {r=0, g=0.85, b=0.1, a=0.65}
},
type = "spitter",
attackName = "acid-spitter",
tint = {r=0, g=0.85, b=0.1, a=0.65}
},
unitSpawner = {
name = "acid-spitter-spawner",
unitSpawner = {
name = "acid-spitter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0.85, b=0.13, a=1}
}
},
tint = {r=0, g=0.85, b=0.13, a=1}
}
},
{
unit = {
{
unit = {
{
@ -269,35 +269,35 @@ function acid.addFaction()
[10] = 1.4
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
},
{
type = "resistance",
@ -328,53 +328,53 @@ function acid.addFaction()
}
}
},
},
unitSpawner = {
unitSpawner = {
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.12,
[3] = 0.22,
[4] = 0.32,
[5] = 0.42,
[6] = 0.52,
[7] = 0.62,
[8] = 0.72,
[9] = 0.82,
[10] = 0.92
},
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.12,
[3] = 0.22,
[4] = 0.32,
[5] = 0.42,
[6] = 0.52,
[7] = 0.62,
[8] = 0.72,
[9] = 0.82,
[10] = 0.92
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
@ -405,76 +405,76 @@ function acid.addFaction()
}
}
}
}
},
},
function (attributes)
return createRangedAttack(attributes,
createAttackBall(attributes),
spitterattackanimation(attributes.scale,
attributes.tint,
function (attributes)
return createRangedAttack(attributes,
createAttackBall(attributes),
spitterattackanimation(attributes.scale,
attributes.tint,
attributes.tint))
end,
end,
{
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = ACID_UNIT_VARIATIONS,
unitSpawner = ACID_NEST_VARIATIONS
},
{
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
{
unit = ACID_UNIT_TIERS,
unitSpawner = ACID_NEST_TIERS
}
)
-- acid worms
buildWorm(
{
name = "acid-worm",
{
name = "acid-worm",
loot = wormLoot,
attributes = {},
attack = {
type = "projectile"
},
resistances = {},
loot = wormLoot,
attributes = {},
attack = {
type = "projectile"
},
resistances = {},
attackName = "acid-worm",
tint = {r=0, g=0.85, b=0.1, a=0.65}
},
attackName = "acid-worm",
tint = {r=0, g=0.85, b=0.1, a=0.65}
},
{
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
@ -504,15 +504,15 @@ function acid.addFaction()
[10] = 60
}
}
},
},
function (attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
function (attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
ACID_WORM_VARIATIONS,
ACID_WORM_TIERS
ACID_WORM_VARIATIONS,
ACID_WORM_TIERS
)
end

View File

@ -41,43 +41,43 @@ function electric.addFaction()
local wormLoot = makeWormAlienLootTable("blue")
local electricBubble = makeBubble({
name = "electric-worm",
tint = {r=0, g=0.1, b=1, a=1}
name = "electric-worm",
tint = {r=0, g=0.1, b=1, a=1}
})
-- electric biters
buildUnitSpawner(
{
unit = {
name = "electric-biter",
{
unit = {
name = "electric-biter",
attributes = {
explosion = "blood-explosion-small"
},
loot = biterLoot,
attack = {
damageType = "electric"
},
resistances = {},
attributes = {
explosion = "blood-explosion-small"
},
loot = biterLoot,
attack = {
damageType = "electric"
},
resistances = {},
type = "biter",
attackName = "biter-electric",
tint = {r=0, g=0.25, b=0.83, a=0.65}
},
type = "biter",
attackName = "biter-electric",
tint = {r=0, g=0.25, b=0.83, a=0.65}
},
unitSpawner = {
name = "electric-biter-spawner",
unitSpawner = {
name = "electric-biter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0.25, b=0.83, a=0.65}
}
},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0.25, b=0.83, a=0.65}
}
},
{
unit = {
{
{
unit = {
{
type = "attribute",
name = "health",
[1] = 10,
@ -92,50 +92,50 @@ function electric.addFaction()
[10] = 25000
},
{
type = "attack",
name = "width",
[1] = 1.5,
[2] = 1.5,
[3] = 1.6,
[4] = 1.6,
[5] = 1.7,
[6] = 1.7,
[7] = 1.8,
[8] = 1.8,
[9] = 1.9,
[10] = 1.9
},
{
type = "attack",
name = "width",
[1] = 1.5,
[2] = 1.5,
[3] = 1.6,
[4] = 1.6,
[5] = 1.7,
[6] = 1.7,
[7] = 1.8,
[8] = 1.8,
[9] = 1.9,
[10] = 1.9
},
{
type = "attack",
name = "damageInterval",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
name = "damageInterval",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
name = "duration",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
name = "duration",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
@ -152,232 +152,232 @@ function electric.addFaction()
[10] = 150
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
},
{
type = "attack",
name = "range",
[1] = 11,
[2] = 11,
[3] = 12,
[4] = 12,
[5] = 13,
[6] = 13,
[7] = 14,
[8] = 14,
[9] = 15,
[10] = 15
}
},
unitSpawner = {
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
},
{
type = "attribute",
name = "evolutionRequirement",
type = "attack",
name = "range",
[1] = 11,
[2] = 11,
[3] = 12,
[4] = 12,
[5] = 13,
[6] = 13,
[7] = 14,
[8] = 14,
[9] = 15,
[10] = 15
}
},
unitSpawner = {
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.12,
[3] = 0.17,
[4] = 0.32,
[5] = 0.42,
[6] = 0.57,
[7] = 0.72,
[8] = 0.82,
[9] = 0.87,
[10] = 0.92
},
[2] = 0.12,
[3] = 0.17,
[4] = 0.32,
[5] = 0.42,
[6] = 0.57,
[7] = 0.72,
[8] = 0.82,
[9] = 0.87,
[10] = 0.92
},
{
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
},
}
},
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
},
}
},
function (attributes)
return createElectricAttack(attributes,
makeBeam(attributes),
biterattackanimation(attributes.scale, attributes.tint, attributes.tint))
end,
function (attributes)
return createElectricAttack(attributes,
makeBeam(attributes),
biterattackanimation(attributes.scale, attributes.tint, attributes.tint))
end,
{
unit = ELECTRIC_UNIT_VARIATIONS,
unitSpawner = ELECTRIC_NEST_VARIATIONS
},
{
unit = ELECTRIC_UNIT_VARIATIONS,
unitSpawner = ELECTRIC_NEST_VARIATIONS
},
{
unit = ELECTRIC_UNIT_TIERS,
unitSpawner = ELECTRIC_NEST_TIERS
}
{
unit = ELECTRIC_UNIT_TIERS,
unitSpawner = ELECTRIC_NEST_TIERS
}
)
-- electric worms
buildWorm(
{
name = "electric-worm",
{
name = "electric-worm",
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
bubble = electricBubble,
damageType = "electric",
pointEffects = function(attributes)
return
{
{
type="nested-result",
action = {
{
type = "cluster",
cluster_count = attributes.clusters,
distance = attributes.clusterDistance,
distance_deviation = 3,
action_delivery =
{
type = "projectile",
projectile = attributes.laserName,
duration = 20,
direction_deviation = 0.6,
starting_speed = attributes.startingSpeed,
starting_speed_deviation = 0.3
}
}
},
}
}
end
},
resistances = {},
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
bubble = electricBubble,
damageType = "electric",
pointEffects = function(attributes)
return
{
{
type="nested-result",
action = {
{
type = "cluster",
cluster_count = attributes.clusters,
distance = attributes.clusterDistance,
distance_deviation = 3,
action_delivery =
{
type = "projectile",
projectile = attributes.laserName,
duration = 20,
direction_deviation = 0.6,
starting_speed = attributes.startingSpeed,
starting_speed_deviation = 0.3
}
}
},
}
}
end
},
resistances = {},
attackName = "worm-electric",
tint = {r=0, g=0.25, b=0.83, a=0.65}
},
attackName = "worm-electric",
tint = {r=0, g=0.25, b=0.83, a=0.65}
},
{
{
type = "attack",
name = "startingSpeed",
[1] = 0.25,
[2] = 0.25,
[3] = 0.27,
[4] = 0.27,
[5] = 0.29,
[6] = 0.29,
[7] = 0.31,
[8] = 0.31,
[9] = 0.33,
[10] = 0.33
},
{
{
type = "attack",
name = "startingSpeed",
[1] = 0.25,
[2] = 0.25,
[3] = 0.27,
[4] = 0.27,
[5] = 0.29,
[6] = 0.29,
[7] = 0.31,
[8] = 0.31,
[9] = 0.33,
[10] = 0.33
},
{
type = "attribute",
@ -394,65 +394,65 @@ function electric.addFaction()
[10] = 0.92
},
{
type = "attack",
name = "clusterDistance",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "clusterDistance",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "clusters",
min = 2,
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
{
type = "attack",
name = "clusters",
min = 2,
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
@ -482,16 +482,16 @@ function electric.addFaction()
[10] = 60
}
}
},
},
function (attributes)
attributes.laserName = makeLaser(attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
function (attributes)
attributes.laserName = makeLaser(attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
ELECTRIC_WORM_VARIATIONS,
ELECTRIC_WORM_TIERS
ELECTRIC_WORM_VARIATIONS,
ELECTRIC_WORM_TIERS
)
end

View File

@ -44,22 +44,22 @@ function energyThief.addFaction()
local wormLoot = makeWormAlienLootTable("blue")
local electricBubble = makeBubble({
name = "energy-thief-worm",
tint = {r=0, g=0, b=1, a=1}
name = "energy-thief-worm",
tint = {r=0, g=0, b=1, a=1}
})
-- energy-thief biters
buildUnitSpawner(
{
unit = {
name = "energy-thief-biter",
{
unit = {
name = "energy-thief-biter",
attributes = {
explosion = "blood-explosion-small"
},
loot = biterLoot,
attack = {
damageType = "electric",
attributes = {
explosion = "blood-explosion-small"
},
loot = biterLoot,
attack = {
damageType = "electric",
actions = function(attributes, electricBeam)
return
{
@ -73,33 +73,33 @@ function energyThief.addFaction()
}
},
{
type = "beam",
beam = electricBeam or "electric-beam",
duration = attributes.duration or 20
}
type = "beam",
beam = electricBeam or "electric-beam",
duration = attributes.duration or 20
}
}
end
},
resistances = {},
},
resistances = {},
type = "biter",
attackName = "biter-energy-thief",
tint = {r=0, g=0, b=0.83, a=0.65}
},
type = "biter",
attackName = "biter-energy-thief",
tint = {r=0, g=0, b=0.83, a=0.65}
},
unitSpawner = {
name = "energy-thief-biter-spawner",
unitSpawner = {
name = "energy-thief-biter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0, b=0.83, a=0.65}
}
},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0, g=0, b=0.83, a=0.65}
}
},
{
unit = {
{
{
unit = {
{
type = "attribute",
name = "health",
[1] = 10,
@ -114,35 +114,35 @@ function energyThief.addFaction()
[10] = 25000
},
{
type = "attack",
name = "width",
[1] = 1,
[2] = 1,
[3] = 1.2,
[4] = 1.2,
[5] = 1.3,
[6] = 1.3,
[7] = 1.4,
[8] = 1.4,
[9] = 1.5,
[10] = 1.5
},
{
type = "attack",
name = "width",
[1] = 1,
[2] = 1,
[3] = 1.2,
[4] = 1.2,
[5] = 1.3,
[6] = 1.3,
[7] = 1.4,
[8] = 1.4,
[9] = 1.5,
[10] = 1.5
},
{
type = "attack",
name = "damageInterval",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
name = "damageInterval",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "attack",
@ -159,97 +159,21 @@ function energyThief.addFaction()
[10] = 140
},
{
type = "attack",
name = "duration",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
type = "attack",
name = "duration",
[1] = 20,
[2] = 20,
[3] = 21,
[4] = 21,
[5] = 22,
[6] = 22,
[7] = 23,
[8] = 23,
[9] = 24,
[10] = 24
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "attack",
name = "range",
[1] = 9,
[2] = 9,
[3] = 10,
[4] = 10,
[5] = 11,
[6] = 11,
[7] = 12,
[8] = 12,
[9] = 13,
[10] = 13
}
},
unitSpawner = {
{
type = "resistance",
name = "laser",
@ -280,140 +204,216 @@ function energyThief.addFaction()
},
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.15,
[3] = 0.25,
[4] = 0.35,
[5] = 0.45,
[6] = 0.55,
[7] = 0.65,
[8] = 0.70,
[9] = 0.75,
[10] = 0.95
},
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "attack",
name = "range",
[1] = 9,
[2] = 9,
[3] = 10,
[4] = 10,
[5] = 11,
[6] = 11,
[7] = 12,
[8] = 12,
[9] = 13,
[10] = 13
}
},
unitSpawner = {
{
type = "resistance",
name = "laser",
decrease = {
[1] = 3,
[2] = 3,
[3] = 7,
[4] = 7,
[5] = 10,
[6] = 10,
[7] = 13,
[8] = 13,
[9] = 16,
[10] = 18
},
percent = {
[1] = 35,
[2] = 35,
[3] = 40,
[4] = 40,
[5] = 45,
[6] = 45,
[7] = 50,
[8] = 55,
[9] = 55,
[10] = 60
}
},
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.15,
[3] = 0.25,
[4] = 0.35,
[5] = 0.45,
[6] = 0.55,
[7] = 0.65,
[8] = 0.70,
[9] = 0.75,
[10] = 0.95
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
}
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
}
},
function (attributes)
return createElectricAttack(attributes,
makeBeam(attributes),
biterattackanimation(attributes.scale, attributes.tint, attributes.tint))
end,
function (attributes)
return createElectricAttack(attributes,
makeBeam(attributes),
biterattackanimation(attributes.scale, attributes.tint, attributes.tint))
end,
{
unit = ENERGY_THIEF_UNIT_VARIATIONS,
unitSpawner = ENERGY_THIEF_NEST_VARIATIONS
},
{
unit = ENERGY_THIEF_UNIT_VARIATIONS,
unitSpawner = ENERGY_THIEF_NEST_VARIATIONS
},
{
unit = ENERGY_THIEF_UNIT_TIERS,
unitSpawner = ENERGY_THIEF_NEST_TIERS
}
{
unit = ENERGY_THIEF_UNIT_TIERS,
unitSpawner = ENERGY_THIEF_NEST_TIERS
}
)
-- energy-thief worms
buildWorm(
{
name = "energy-thief-worm",
{
name = "energy-thief-worm",
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
bubble = electricBubble,
damageType = "electric",
pointEffects = function(attributes)
return
{
{
type="nested-result",
action = {
{
type = "cluster",
cluster_count = attributes.clusters,
distance = attributes.clusterDistance,
distance_deviation = 3,
action_delivery =
{
type = "projectile",
projectile = attributes.laserName,
duration = 20,
direction_deviation = 0.6,
starting_speed = attributes.startingSpeed,
starting_speed_deviation = 0.3
}
}
},
}
}
end
},
resistances = {},
attackName = "worm-energy-thief",
tint = {r=0, g=0, b=0.83, a=0.65}
},
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
bubble = electricBubble,
damageType = "electric",
pointEffects = function(attributes)
return
{
{
type="nested-result",
action = {
{
type = "cluster",
cluster_count = attributes.clusters,
distance = attributes.clusterDistance,
distance_deviation = 3,
action_delivery =
{
type = "projectile",
projectile = attributes.laserName,
duration = 20,
direction_deviation = 0.6,
starting_speed = attributes.startingSpeed,
starting_speed_deviation = 0.3
}
}
},
}
}
end
},
resistances = {},
attackName = "worm-energy-thief",
tint = {r=0, g=0, b=0.83, a=0.65}
},
{
{
type = "attack",
name = "startingSpeed",
[1] = 0.25,
[2] = 0.25,
[3] = 0.27,
[4] = 0.27,
[5] = 0.29,
[6] = 0.29,
[7] = 0.31,
[8] = 0.31,
[9] = 0.33,
[10] = 0.33
},
{
{
type = "attack",
name = "startingSpeed",
[1] = 0.25,
[2] = 0.25,
[3] = 0.27,
[4] = 0.27,
[5] = 0.29,
[6] = 0.29,
[7] = 0.31,
[8] = 0.31,
[9] = 0.33,
[10] = 0.33
},
{
type = "attack",
name = "clusterDistance",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "clusterDistance",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attribute",
@ -430,21 +430,21 @@ function energyThief.addFaction()
[10] = 0.95
},
{
type = "attack",
name = "clusters",
min = 2,
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
{
type = "attack",
name = "clusters",
min = 2,
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
{
type = "resistance",
@ -475,45 +475,45 @@ function energyThief.addFaction()
}
},
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
{
type = "resistance",
name = "electric",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
},
},
function (attributes)
attributes.laserName = makeLaser(attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
function (attributes)
attributes.laserName = makeLaser(attributes)
return createRangedAttack(attributes,
createAttackBall(attributes))
end,
ENERGY_THIEF_WORM_VARIATIONS,
ENERGY_THIEF_WORM_TIERS
ENERGY_THIEF_WORM_VARIATIONS,
ENERGY_THIEF_WORM_TIERS
)
data:extend({

View File

@ -40,161 +40,161 @@ function inferno.addFaction()
-- inferno spitters
buildUnitSpawner(
{
unit = {
name = "inferno-spitter",
{
unit = {
name = "inferno-spitter",
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
damageType = "acid",
fireDamagePerTickType = "acid",
stickerDamagePerTickType = "acid"
},
resistances = {},
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
damageType = "acid",
fireDamagePerTickType = "acid",
stickerDamagePerTickType = "acid"
},
resistances = {},
type = "spitter",
attackName = "spitter-inferno",
tint = {r=0.65, g=0, b=0, a=1}
},
type = "spitter",
attackName = "spitter-inferno",
tint = {r=0.65, g=0, b=0, a=1}
},
unitSpawner = {
name = "inferno-spitter-spawner",
unitSpawner = {
name = "inferno-spitter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0.99, g=0.09, b=0.09, a=1}
}
},
tint = {r=0.99, g=0.09, b=0.09, a=1}
}
},
{
unit = {
{
unit = {
{
type = "attack",
name = "stickerDamagePerTick",
[1] = 1.6,
[2] = 1.6,
[3] = 1.8,
[4] = 1.8,
[5] = 1.8,
[6] = 1.9,
[7] = 2,
[8] = 2,
[9] = 2.3,
[10] = 2.5
},
{
type = "attack",
name = "stickerDamagePerTick",
[1] = 0.6,
[2] = 0.6,
[3] = 0.8,
[4] = 0.8,
[5] = 0.8,
[6] = 0.9,
[7] = 1,
[8] = 1,
[9] = 1.3,
[10] = 1.5
},
{
type = "attack",
name = "particleTimeout",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "particleTimeout",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "fireSpreadRadius",
[1] = 0.75,
[2] = 0.75,
[3] = 0.77,
[4] = 0.77,
[5] = 0.79,
[6] = 0.79,
[7] = 0.83,
[8] = 0.83,
[9] = 0.85,
[10] = 0.85
},
{
type = "attack",
name = "fireSpreadRadius",
[1] = 0.75,
[2] = 0.75,
[3] = 0.77,
[4] = 0.77,
[5] = 0.79,
[6] = 0.79,
[7] = 0.83,
[8] = 0.83,
[9] = 0.85,
[10] = 0.85
},
{
type = "attack",
name = "damageMaxMultipler",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 8,
[10] = 9
},
{
type = "attack",
name = "damageMaxMultipler",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 8,
[10] = 9
},
{
type = "attack",
name = "stickerMovementModifier",
[1] = 1.1,
[2] = 1.1,
[3] = 1.1,
[4] = 1.1,
[5] = 1.1,
[6] = 1.1,
[7] = 1.1,
[8] = 1.1,
[9] = 1.1,
[10] = 1.1
},
{
type = "attack",
name = "stickerMovementModifier",
[1] = 1.1,
[2] = 1.1,
[3] = 1.1,
[4] = 1.1,
[5] = 1.1,
[6] = 1.1,
[7] = 1.1,
[8] = 1.1,
[9] = 1.1,
[10] = 1.1
},
{
type = "attack",
name = "fireSpreadCooldown",
[1] = 30,
[2] = 30,
[3] = 29,
[4] = 29,
[5] = 28,
[6] = 28,
[7] = 27,
[8] = 27,
[9] = 25,
[10] = 25
},
{
type = "attack",
name = "fireSpreadCooldown",
[1] = 30,
[2] = 30,
[3] = 29,
[4] = 29,
[5] = 28,
[6] = 28,
[7] = 27,
[8] = 27,
[9] = 25,
[10] = 25
},
{
type = "attack",
name = "stickerDuration",
[1] = 1800,
[2] = 1800,
[3] = 1900,
[4] = 1900,
[5] = 2000,
[6] = 2000,
[7] = 2100,
[8] = 2100,
[9] = 2200,
[10] = 2200
},
{
type = "attack",
name = "stickerDuration",
[1] = 800,
[2] = 800,
[3] = 900,
[4] = 900,
[5] = 1000,
[6] = 1000,
[7] = 1100,
[8] = 1100,
[9] = 1200,
[10] = 1200
},
{
type = "attack",
name = "damage",
[1] = 4,
[2] = 4,
[3] = 5,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 6,
[10] = 7
},
{
type = "attack",
name = "damage",
[1] = 4,
[2] = 4,
[3] = 5,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 6,
[10] = 7
},
{
{
type = "resistance",
name = "acid",
decrease = {
@ -254,37 +254,37 @@ function inferno.addFaction()
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 10,
[2] = 10,
[3] = 14,
[4] = 14,
[5] = 16,
[6] = 16,
[7] = 18,
[8] = 18,
[9] = 20,
[10] = 20
},
percent = {
[1] = 75,
[2] = 75,
[3] = 80,
[4] = 85,
[5] = 85,
[6] = 90,
[7] = 90,
[8] = 95,
[9] = 95,
[10] = 97
}
}
type = "resistance",
name = "fire",
decrease = {
[1] = 10,
[2] = 10,
[3] = 14,
[4] = 14,
[5] = 16,
[6] = 16,
[7] = 18,
[8] = 18,
[9] = 20,
[10] = 20
},
percent = {
[1] = 75,
[2] = 75,
[3] = 80,
[4] = 85,
[5] = 85,
[6] = 90,
[7] = 90,
[8] = 95,
[9] = 95,
[10] = 97
}
}
},
},
unitSpawner = {
unitSpawner = {
{
type = "resistance",
name = "acid",
@ -358,90 +358,90 @@ function inferno.addFaction()
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 10,
[2] = 10,
[3] = 14,
[4] = 14,
[5] = 16,
[6] = 16,
[7] = 18,
[8] = 18,
[9] = 20,
[10] = 20
},
percent = {
[1] = 75,
[2] = 75,
[3] = 80,
[4] = 85,
[5] = 85,
[6] = 90,
[7] = 90,
[8] = 95,
[9] = 95,
[10] = 97
}
}
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 10,
[2] = 10,
[3] = 14,
[4] = 14,
[5] = 16,
[6] = 16,
[7] = 18,
[8] = 18,
[9] = 20,
[10] = 20
},
percent = {
[1] = 75,
[2] = 75,
[3] = 80,
[4] = 85,
[5] = 85,
[6] = 90,
[7] = 90,
[8] = 95,
[9] = 95,
[10] = 97
}
}
}
},
function (attributes)
return createStreamAttack(attributes,
createAttackFlame(attributes),
spitterattackanimation(attributes.scale,
attributes.tint,
function (attributes)
return createStreamAttack(attributes,
createAttackFlame(attributes),
spitterattackanimation(attributes.scale,
attributes.tint,
attributes.tint))
end,
end,
{
unit = INFERNO_UNIT_VARIATIONS,
unitSpawner = INFERNO_NEST_VARIATIONS
},
{
unit = INFERNO_UNIT_VARIATIONS,
unitSpawner = INFERNO_NEST_VARIATIONS
},
{
unit = INFERNO_UNIT_TIERS,
unitSpawner = INFERNO_NEST_TIERS
}
{
unit = INFERNO_UNIT_TIERS,
unitSpawner = INFERNO_NEST_TIERS
}
)
-- inferno worms
buildWorm(
{
name = "inferno-worm",
{
name = "inferno-worm",
loot = wormLoot,
attributes = {},
attack = {
damageType = "acid",
fireDamagePerTickType = "acid",
stickerDamagePerTickType = "acid"
},
resistances = {},
loot = wormLoot,
attributes = {},
attack = {
damageType = "acid",
fireDamagePerTickType = "acid",
stickerDamagePerTickType = "acid"
},
resistances = {},
attackName = "worm-inferno",
tint = {r=0.65, g=0, b=0, a=0.65}
},
attackName = "worm-inferno",
tint = {r=0.65, g=0, b=0, a=0.65}
},
{
{
{
type = "attack",
name = "stickerDamagePerTick",
[1] = 1.6,
[2] = 1.6,
[3] = 1.8,
[4] = 1.8,
[5] = 1.8,
[6] = 1.9,
[7] = 2,
[8] = 2,
[9] = 2.3,
[10] = 2.5
},
{
type = "attack",
name = "stickerDamagePerTick",
[1] = 0.6,
[2] = 0.6,
[3] = 0.8,
[4] = 0.8,
[5] = 0.8,
[6] = 0.9,
[7] = 1,
[8] = 1,
[9] = 1.3,
[10] = 1.5
},
{
type = "attribute",
@ -458,110 +458,110 @@ function inferno.addFaction()
[10] = 0.95
},
{
type = "attack",
name = "particleTimeout",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "particleTimeout",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 5,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
{
type = "attack",
name = "fireSpreadRadius",
[1] = 0.75,
[2] = 0.75,
[3] = 0.77,
[4] = 0.77,
[5] = 0.79,
[6] = 0.79,
[7] = 0.83,
[8] = 0.83,
[9] = 0.85,
[10] = 0.85
},
{
type = "attack",
name = "fireSpreadRadius",
[1] = 0.75,
[2] = 0.75,
[3] = 0.77,
[4] = 0.77,
[5] = 0.79,
[6] = 0.79,
[7] = 0.83,
[8] = 0.83,
[9] = 0.85,
[10] = 0.85
},
{
type = "attack",
name = "damageMaxMultipler",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 8,
[10] = 9
},
{
type = "attack",
name = "damageMaxMultipler",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 8,
[10] = 9
},
{
type = "attack",
name = "stickerMovementModifier",
[1] = 1.1,
[2] = 1.1,
[3] = 1.1,
[4] = 1.1,
[5] = 1.1,
[6] = 1.1,
[7] = 1.1,
[8] = 1.1,
[9] = 1.1,
[10] = 1.1
},
{
type = "attack",
name = "stickerMovementModifier",
[1] = 1.1,
[2] = 1.1,
[3] = 1.1,
[4] = 1.1,
[5] = 1.1,
[6] = 1.1,
[7] = 1.1,
[8] = 1.1,
[9] = 1.1,
[10] = 1.1
},
{
type = "attack",
name = "fireSpreadCooldown",
[1] = 30,
[2] = 30,
[3] = 29,
[4] = 29,
[5] = 28,
[6] = 28,
[7] = 27,
[8] = 27,
[9] = 25,
[10] = 25
},
{
type = "attack",
name = "fireSpreadCooldown",
[1] = 30,
[2] = 30,
[3] = 29,
[4] = 29,
[5] = 28,
[6] = 28,
[7] = 27,
[8] = 27,
[9] = 25,
[10] = 25
},
{
type = "attack",
name = "stickerDuration",
[1] = 1800,
[2] = 1800,
[3] = 1900,
[4] = 1900,
[5] = 2000,
[6] = 2000,
[7] = 2100,
[8] = 2100,
[9] = 2200,
[10] = 2200
},
{
type = "attack",
name = "stickerDuration",
[1] = 800,
[2] = 800,
[3] = 900,
[4] = 900,
[5] = 1000,
[6] = 1000,
[7] = 1100,
[8] = 1100,
[9] = 1200,
[10] = 1200
},
{
type = "attack",
name = "damage",
[1] = 4,
[2] = 4,
[3] = 5,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 6,
[10] = 7
},
{
type = "attack",
name = "damage",
[1] = 4,
[2] = 4,
[3] = 5,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 6,
[10] = 7
},
{
type = "resistance",
@ -593,71 +593,71 @@ function inferno.addFaction()
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
},
function (attributes)
return createStreamAttack(attributes,
createAttackFlame(attributes))
end,
function (attributes)
return createStreamAttack(attributes,
createAttackFlame(attributes))
end,
INFERNO_WORM_VARIATIONS,
INFERNO_WORM_TIERS
INFERNO_WORM_VARIATIONS,
INFERNO_WORM_TIERS
)
end

View File

@ -42,199 +42,199 @@ function suicide.addFaction()
-- suicide biters
buildUnitSpawner(
{
unit = {
name = "suicide-biter",
{
unit = {
name = "suicide-biter",
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
scorchmark = "small-scorchmark"
},
resistances = {},
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
scorchmark = "small-scorchmark"
},
resistances = {},
type = "biter",
tint = {r=0.56, g=0.46, b=0, a=0.65}
},
type = "biter",
tint = {r=0.56, g=0.46, b=0, a=0.65}
},
unitSpawner = {
name = "suicide-biter-spawner",
unitSpawner = {
name = "suicide-biter-spawner",
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0.56, g=0.46, b=0, a=0.65}
}
},
loot = spawnerLoot,
attributes = {},
resistances = {},
tint = {r=0.56, g=0.46, b=0, a=0.65}
}
},
{
unit = {
{
{
unit = {
{
type = "attribute",
name = "health",
[1] = 7,
[2] = 42,
[3] = 75,
[4] = 125,
[5] = 200,
[6] = 350,
[7] = 750,
[8] = 1500,
[9] = 5000,
[10] = 10000
},
type = "attribute",
name = "health",
[1] = 7,
[2] = 42,
[3] = 150,
[4] = 250,
[5] = 1000,
[6] = 3000,
[7] = 5000,
[8] = 7000,
[9] = 9000,
[10] = 17500
},
{
type = "attribute",
name = "spawningTimeModifer",
[1] = 0,
[2] = 0,
[3] = 1,
[4] = 2,
[5] = 3,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 8,
[10] = 8
},
{
type = "attribute",
name = "spawningTimeModifer",
[1] = 0,
[2] = 0,
[3] = 1,
[4] = 2,
[5] = 3,
[6] = 5,
[7] = 6,
[8] = 6,
[9] = 8,
[10] = 8
},
{
type = "attack",
mapping = "explosion",
[1] = "explosion",
[2] = "explosion",
[3] = "big-explosion",
[4] = "big-explosion",
[5] = "big-explosion",
[6] = "big-explosion",
[7] = "massive-explosion",
[8] = "massive-explosion",
[9] = "massive-explosion",
[10] = "massive-explosion"
},
{
type = "attack",
mapping = "explosion",
[1] = "explosion",
[2] = "explosion",
[3] = "big-explosion",
[4] = "big-explosion",
[5] = "big-explosion",
[6] = "big-explosion",
[7] = "massive-explosion",
[8] = "massive-explosion",
[9] = "massive-explosion",
[10] = "massive-explosion"
},
{
type = "attack",
name = "radius",
[1] = 3.5,
[2] = 3.5,
[3] = 4,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 7,
[8] = 7,
[9] = 7.5,
[10] = 8
},
{
type = "attack",
name = "radius",
[1] = 3.5,
[2] = 3.5,
[3] = 4,
[4] = 5,
[5] = 6,
[6] = 6,
[7] = 7,
[8] = 7,
[9] = 7.5,
[10] = 8
},
{
type = "attack",
name = "explosionDistance",
[1] = 2,
[2] = 2,
[3] = 2,
[4] = 2,
[5] = 2,
[6] = 2.5,
[7] = 2.5,
[8] = 2.5,
[9] = 3,
[10] = 3
},
{
type = "attack",
name = "explosionDistance",
[1] = 2,
[2] = 2,
[3] = 2,
[4] = 2,
[5] = 2,
[6] = 2.5,
[7] = 2.5,
[8] = 2.5,
[9] = 3,
[10] = 3
},
{
type = "attack",
name = "explosionCount",
min = 2,
[1] = 2,
[2] = 3,
[3] = 4,
[4] = 5,
[5] = 6,
[6] = 8,
[7] = 10,
[8] = 12,
[9] = 13,
[10] = 14
},
{
type = "attack",
name = "explosionCount",
min = 2,
[1] = 2,
[2] = 3,
[3] = 4,
[4] = 5,
[5] = 6,
[6] = 8,
[7] = 10,
[8] = 12,
[9] = 13,
[10] = 14
},
{
type = "attack",
name = "damage",
[1] = 20,
[2] = 25,
[3] = 30,
[4] = 35,
[5] = 45,
[6] = 60,
[7] = 75,
[8] = 80,
[9] = 200,
[10] = 350
},
{
type = "attack",
name = "damage",
[1] = 100,
[2] = 200,
[3] = 300,
[4] = 400,
[5] = 600,
[6] = 800,
[7] = 1000,
[8] = 1200,
[9] = 1500,
[10] = 2000
},
{
type = "attribute",
name = "movement",
[1] = 0.23,
[2] = 0.23,
[3] = 0.22,
[4] = 0.22,
[5] = 0.21,
[6] = 0.21,
[7] = 0.2,
[8] = 0.2,
[9] = 0.19,
[10] = 0.19
},
{
type = "attribute",
name = "distancePerFrame",
[1] = 0.12,
[2] = 0.145,
[3] = 0.17,
[4] = 0.21,
[5] = 0.21,
[6] = 0.22,
[7] = 0.22,
[8] = 0.23,
[9] = 0.23,
[10] = 0.24
},
{
type = "attribute",
name = "movement",
[1] = 0.23,
[2] = 0.23,
[3] = 0.22,
[4] = 0.22,
[5] = 0.21,
[6] = 0.21,
[7] = 0.2,
[8] = 0.2,
[9] = 0.19,
[10] = 0.19
},
{
type = "attribute",
name = "distancePerFrame",
[1] = 0.12,
[2] = 0.145,
[3] = 0.17,
[4] = 0.21,
[5] = 0.21,
[6] = 0.22,
[7] = 0.22,
[8] = 0.23,
[9] = 0.23,
[10] = 0.24
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = -7,
[2] = -7,
[3] = -10,
[4] = -10,
[5] = -13,
[6] = -13,
[7] = -16,
[8] = -16,
[9] = -19,
[10] = -23
},
percent = {
[1] = -65,
[2] = -65,
[3] = -70,
[4] = -75,
[5] = -75,
[6] = -80,
[7] = -85,
[8] = -85,
[9] = -90,
[10] = -90
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = -7,
[2] = -7,
[3] = -10,
[4] = -10,
[5] = -13,
[6] = -13,
[7] = -16,
[8] = -16,
[9] = -19,
[10] = -23
},
percent = {
[1] = -65,
[2] = -65,
[3] = -70,
[4] = -75,
[5] = -75,
[6] = -80,
[7] = -85,
[8] = -85,
[9] = -90,
[10] = -90
}
},
{
type = "resistance",
@ -264,41 +264,41 @@ function suicide.addFaction()
[10] = 60
}
}
},
},
unitSpawner = {
unitSpawner = {
{
type = "attribute",
name = "spawingCooldownStart",
[1] = 330,
[2] = 330,
[3] = 325,
[4] = 325,
[5] = 320,
[6] = 320,
[7] = 315,
[8] = 315,
[9] = 310,
[10] = 310
},
{
type = "attribute",
name = "spawingCooldownStart",
[1] = 330,
[2] = 330,
[3] = 325,
[4] = 325,
[5] = 320,
[6] = 320,
[7] = 315,
[8] = 315,
[9] = 310,
[10] = 310
},
{
type = "attribute",
name = "spawingCooldownEnd",
[1] = 120,
[2] = 120,
[3] = 115,
[4] = 115,
[5] = 110,
[6] = 110,
[7] = 105,
[8] = 105,
[9] = 100,
[10] = 100
},
{
type = "attribute",
name = "spawingCooldownEnd",
[1] = 120,
[2] = 120,
[3] = 115,
[4] = 115,
[5] = 110,
[6] = 110,
[7] = 105,
[8] = 105,
[9] = 100,
[10] = 100
},
{
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
@ -313,35 +313,35 @@ function suicide.addFaction()
[10] = 0.97
},
{
type = "attribute",
name = "unitsOwned",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 8,
[6] = 8,
[7] = 9,
[8] = 9,
[9] = 10,
[10] = 10
},
{
type = "attribute",
name = "unitsOwned",
[1] = 6,
[2] = 6,
[3] = 7,
[4] = 7,
[5] = 8,
[6] = 8,
[7] = 9,
[8] = 9,
[9] = 10,
[10] = 10
},
{
type = "attribute",
name = "unitsToSpawn",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 5,
[5] = 5,
[6] = 6,
[7] = 6,
[8] = 7,
[9] = 7,
[10] = 8
},
{
type = "attribute",
name = "unitsToSpawn",
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 5,
[5] = 5,
[6] = 6,
[7] = 6,
[8] = 7,
[9] = 7,
[10] = 8
},
{
type = "resistance",
@ -372,147 +372,147 @@ function suicide.addFaction()
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 1,
[2] = 1,
[3] = 2,
[4] = 2,
[5] = 3,
[6] = 3,
[7] = 4,
[8] = 4,
[9] = 5,
[10] = 5
},
percent = {
[1] = 40,
[2] = 40,
[3] = 42,
[4] = 42,
[5] = 43,
[6] = 43,
[7] = 44,
[8] = 44,
[9] = 45,
[10] = 45
}
}
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 1,
[2] = 1,
[3] = 2,
[4] = 2,
[5] = 3,
[6] = 3,
[7] = 4,
[8] = 4,
[9] = 5,
[10] = 5
},
percent = {
[1] = 40,
[2] = 40,
[3] = 42,
[4] = 42,
[5] = 43,
[6] = 43,
[7] = 44,
[8] = 44,
[9] = 45,
[10] = 45
}
}
}
},
createSuicideAttack,
createSuicideAttack,
{
unit = SUICIDE_UNIT_VARIATIONS,
unitSpawner = SUICIDE_NEST_VARIATIONS
},
{
unit = SUICIDE_UNIT_VARIATIONS,
unitSpawner = SUICIDE_NEST_VARIATIONS
},
{
unit = SUICIDE_UNIT_TIERS,
unitSpawner = SUICIDE_NEST_TIERS
}
{
unit = SUICIDE_UNIT_TIERS,
unitSpawner = SUICIDE_NEST_TIERS
}
)
-- suicide worms
buildWorm(
{
name = "suicide-worm",
{
name = "suicide-worm",
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
force = "enemy",
stickerAnimation = {
filename = "__base__/graphics/entity/slowdown-sticker/slowdown-sticker.png",
priority = "extra-high",
width = 11,
height = 11,
frame_count = 13,
animation_speed = 0.4
},
areaEffects = function (attributes)
return {
{
type = "damage",
damage = { amount = attributes.damage, type = "acid" }
},
{
type = "create-sticker",
sticker = attributes.name .. "-sticker-rampant"
}
}
end
},
resistances = {},
loot = wormLoot,
attributes = {},
attack = {
type = "projectile",
force = "enemy",
stickerAnimation = {
filename = "__base__/graphics/entity/slowdown-sticker/slowdown-sticker.png",
priority = "extra-high",
width = 11,
height = 11,
frame_count = 13,
animation_speed = 0.4
},
areaEffects = function (attributes)
return {
{
type = "damage",
damage = { amount = attributes.damage, type = "acid" }
},
{
type = "create-sticker",
sticker = attributes.name .. "-sticker-rampant"
}
}
end
},
resistances = {},
attackName = "suicide-worm",
tint = {r=0.56, g=0.46, b=0, a=0.65}
},
attackName = "suicide-worm",
tint = {r=0.56, g=0.46, b=0, a=0.65}
},
{
{
{
type = "attack",
name = "stickerMovementModifier",
[1] = 0.8,
[2] = 0.8,
[3] = 0.7,
[4] = 0.7,
[5] = 0.6,
[6] = 0.6,
[7] = 0.5,
[8] = 0.5,
[9] = 0.4,
[10] = 0.4
},
{
type = "attack",
name = "stickerMovementModifier",
[1] = 0.8,
[2] = 0.8,
[3] = 0.7,
[4] = 0.7,
[5] = 0.6,
[6] = 0.6,
[7] = 0.5,
[8] = 0.5,
[9] = 0.4,
[10] = 0.4
},
{
type = "attack",
name = "stickerDuration",
[1] = 1800,
[2] = 1800,
[3] = 1900,
[4] = 1900,
[5] = 2000,
[6] = 2000,
[7] = 2100,
[8] = 2100,
[9] = 2200,
[10] = 2200
},
{
type = "attack",
name = "stickerDuration",
[1] = 1800,
[2] = 1800,
[3] = 1900,
[4] = 1900,
[5] = 2000,
[6] = 2000,
[7] = 2100,
[8] = 2100,
[9] = 2200,
[10] = 2200
},
{
type = "attribute",
@ -558,72 +558,72 @@ function suicide.addFaction()
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 1,
[2] = 1,
[3] = 2,
[4] = 2,
[5] = 3,
[6] = 3,
[7] = 4,
[8] = 4,
[9] = 5,
[10] = 5
},
percent = {
[1] = 40,
[2] = 40,
[3] = 42,
[4] = 42,
[5] = 43,
[6] = 43,
[7] = 44,
[8] = 44,
[9] = 45,
[10] = 45
}
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 1,
[2] = 1,
[3] = 2,
[4] = 2,
[5] = 3,
[6] = 3,
[7] = 4,
[8] = 4,
[9] = 5,
[10] = 5
},
percent = {
[1] = 40,
[2] = 40,
[3] = 42,
[4] = 42,
[5] = 43,
[6] = 43,
[7] = 44,
[8] = 44,
[9] = 45,
[10] = 45
}
}
},
function (attributes)
makeSticker(attributes)
return createRangedAttack(attributes, createAttackBall(attributes))
end,
function (attributes)
makeSticker(attributes)
return createRangedAttack(attributes, createAttackBall(attributes))
end,
SUICIDE_WORM_VARIATIONS,
SUICIDE_WORM_TIERS
SUICIDE_WORM_VARIATIONS,
SUICIDE_WORM_TIERS
)
end

File diff suppressed because it is too large Load Diff

View File

@ -2,25 +2,25 @@
data:extend({
{
type = "container",
name = "chunk-scanner-squad-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"player-layer", "object-layer", "water-tile"},
collision_box = {{-6, -6}, {6, 6}},
selection_box = {{-6, -6}, {6, 6}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
{
type = "container",
name = "chunk-scanner-squad-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"player-layer", "object-layer", "water-tile"},
collision_box = {{-6, -6}, {6, 6}},
selection_box = {{-6, -6}, {6, 6}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 32,
@ -36,29 +36,29 @@ data:extend({
scale = 0.5
}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
},
{
type = "container",
name = "chunk-scanner-squad-movement-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"water-tile"},
collision_box = {{-1, -1}, {1, 1}},
selection_box = {{-1, -1}, {1, 1}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
type = "container",
name = "chunk-scanner-squad-movement-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"water-tile"},
collision_box = {{-1, -1}, {1, 1}},
selection_box = {{-1, -1}, {1, 1}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 32,
@ -74,9 +74,9 @@ data:extend({
scale = 0.5
}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
}
})

View File

@ -49,7 +49,7 @@ end
function tests.killActiveSquads()
print("--")
for i=1, #global.natives.squads do
for i=1, global.natives.squads.len do
local squad = global.natives.squads[i]
if (squad.group.valid) then
local members = squad.group.members
@ -63,49 +63,51 @@ end
function tests.activeSquads()
print("-----")
print("Squads", #global.natives.squads)
for i=1, #global.natives.squads do
print("Squads", global.natives.squads.len)
for i=1, global.natives.squads.len do
print("-")
local squad = global.natives.squads[i]
local squadHealth = 0
local squadMakeup = {}
if squad.group.valid then
for x=1,#squad.group.members do
local member = squad.group.members[x].prototype
if not squadMakeup[member.name] then
squadMakeup[member.name] = 0
end
-- for x=1,#squad.group.members do
-- local member = squad.group.members[x].prototype
-- if not squadMakeup[member.name] then
-- squadMakeup[member.name] = 0
-- end
squadHealth = squadHealth + member.max_health
squadMakeup[member.name] = squadMakeup[member.name] + 1
end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squad.cycles, squad.group.group_number, squadHealth)
-- squadHealth = squadHealth + member.max_health
-- squadMakeup[member.name] = squadMakeup[member.name] + 1
-- end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squad.cycles, squad.group.group_number -- , squadHealth
)
-- print(serpent.dump(squadResistances))
print(serpent.dump(squadMakeup))
print(serpent.dump(squad))
-- print(serpent.dump(squadMakeup))
-- print(serpent.dump(squad))
end
end
print("---")
print("pending", #global.natives.pendingAttack)
for i=1, #global.natives.pendingAttack do
print("pending", global.natives.pendingAttack.len)
for i=1, global.natives.pendingAttack.len do
print("-")
local squad = global.natives.pendingAttack[i]
local squadHealth = 0
local squadMakeup = {}
if squad.group.valid then
for x=1,#squad.group.members do
local member = squad.group.members[x].prototype
if not squadMakeup[member.name] then
squadMakeup[member.name] = 0
end
-- for x=1,#squad.group.members do
-- local member = squad.group.members[x].prototype
-- if not squadMakeup[member.name] then
-- squadMakeup[member.name] = 0
-- end
squadHealth = squadHealth + member.max_health
squadMakeup[member.name] = squadMakeup[member.name] + 1
end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squad.cycles, squadHealth, squad.group.group_number)
-- squadHealth = squadHealth + member.max_health
-- squadMakeup[member.name] = squadMakeup[member.name] + 1
-- end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squad.cycles, -- squadHealth,
squad.group.group_number)
-- print(serpent.dump(squadResistances))
print(serpent.dump(squadMakeup))
print(serpent.dump(squad))
-- print(serpent.dump(squadMakeup))
-- print(serpent.dump(squad))
end
end
print("---")
@ -116,19 +118,19 @@ function tests.activeSquads()
local squadHealth = 0
local squadMakeup = {}
if squad.group.valid then
for x=1,#squad.group.members do
local member = squad.group.members[x].prototype
if not squadMakeup[member.name] then
squadMakeup[member.name] = 0
end
-- for x=1,#squad.group.members do
-- local member = squad.group.members[x].prototype
-- if not squadMakeup[member.name] then
-- squadMakeup[member.name] = 0
-- end
squadHealth = squadHealth + member.max_health
squadMakeup[member.name] = squadMakeup[member.name] + 1
end
-- squadHealth = squadHealth + member.max_health
-- squadMakeup[member.name] = squadMakeup[member.name] + 1
-- end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squad.cycles, squad.group.group_number, squadHealth)
-- print(serpent.dump(squadResistances))
print(serpent.dump(squadMakeup))
print(serpent.dump(squad))
-- print(serpent.dump(squadMakeup))
-- print(serpent.dump(squad))
end
end
end