1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-14 02:23:01 +02:00

see changelog

This commit is contained in:
Aaron Veden 2019-02-16 10:45:42 -08:00
parent 9814fdd788
commit 9d5429ec96
7 changed files with 30 additions and 17 deletions

View File

@ -12,6 +12,8 @@ local BASE_AI_STATE_DORMANT = constants.BASE_AI_STATE_DORMANT
local INTERVAL_LOGIC = constants.INTERVAL_LOGIC
local CHUNK_SIZE = constants.CHUNK_SIZE
local ATTACK_SCORE = constants.ATTACK_SCORE
local SQUAD_GUARDING = constants.SQUAD_GUARDING
-- imported functions
@ -242,16 +244,14 @@ function upgrade.attempt(natives)
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.37")
global.version = constants.VERSION_72
end
if (global.version < constants.VERSION_74) then
if (global.version < constants.VERSION_75) then
for _,squad in pairs(natives.squads) do
squad.status = SQUAD_GUARDING
squad.cycles = 0
squad.attackScoreFunction = nil
squad.attackScoreFunction = ATTACK_SCORE
end
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.39")
global.version = constants.VERSION_74
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.40")
global.version = constants.VERSION_75
end
return starting ~= global.version, natives

View File

@ -1,3 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 0.16.40
Date: 2. 16. 2019
Bugfixes:
- Switched to numeric value to represent scoring functions
---------------------------------------------------------------------------------------------------
Version: 0.16.39
Date: 2. 15. 2019

View File

@ -1,7 +1,7 @@
{
"name" : "Rampant",
"factorio_version" : "0.16",
"version" : "0.16.39",
"version" : "0.16.40",
"title" : "Rampant",
"author" : "Veden",
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",

View File

@ -194,9 +194,8 @@ function aiAttackWave.formSettlers(map, surface, natives, chunk, cost, tick)
CHUNK_SIZE,
4)
if squadPosition then
local squad = createSquad(squadPosition, surface, natives)
local squad = createSquad(squadPosition, surface, natives, nil, true)
squad.settlers = true
squad.maxDistance = gaussianRandomRange(natives.expansionMaxDistance,
natives.expansionMaxDistanceDerivation,
CHUNK_SIZE * 1,

View File

@ -26,7 +26,7 @@ constants.VERSION_51 = 51
constants.VERSION_57 = 57
constants.VERSION_72 = 72
constants.VERSION_73 = 73
constants.VERSION_74 = 74
constants.VERSION_75 = 75
-- misc
@ -400,6 +400,9 @@ constants.SQUAD_BUILDING = 6
-- Squad Related
constants.ATTACK_SCORE = 1
constants.ATTACK_SCORE_KAMIKAZE = 2
constants.RETREAT_GRAB_RADIUS = 24
constants.RETREAT_SPAWNER_GRAB_RADIUS = 75

View File

@ -20,6 +20,9 @@ local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
local BASE_PHEROMONE = constants.BASE_PHEROMONE
local RESOURCE_PHEROMONE = constants.RESOURCE_PHEROMONE
local ATTACK_SCORE = constants.ATTACK_SCORE
local ATTACK_SCORE_KAMIKAZE = constants.ATTACK_SCORE_KAMIKAZE
local SQUAD_BUILDING = constants.SQUAD_BUILDING
local SQUAD_RAIDING = constants.SQUAD_RAIDING
@ -163,11 +166,15 @@ local function attackMove(map, attackPosition, attackCmd, squad, group, natives,
local groupPosition = group.position
local x, y = positionToChunkXY(groupPosition)
local chunk = getChunkByXY(map, x, y)
local attackScorer = scoreAttackLocation
if (squad.attackScoreFunction == ATTACK_SCORE_KAMIKAZE) then
attackScorer = scoreAttackKamikazeLocation
end
local attackChunk, attackDirection = scoreNeighborsForAttack(map,
natives,
chunk,
getNeighborChunks(map, x, y),
squad.attackScoreFunction or scoreAttackLocation,
attackScorer,
squad)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
addSquadToChunk(map, chunk, squad)
@ -258,9 +265,7 @@ function squadAttack.squadsBeginAttack(natives, players)
end
if squad.kamikaze and (mRandom() < (kamikazeThreshold * 0.75)) then
squad.attackScoreFunction = scoreAttackKamikazeLocation
else
squad.attackScoreFunction = scoreAttackLocation
squad.attackScoreFunction = ATTACK_SCORE_KAMIKAZE
end
squad.status = SQUAD_RAIDING
end

View File

@ -103,25 +103,25 @@ function unitGroupUtils.findNearbySquad(map, chunk, position)
return nil
end
function unitGroupUtils.createSquad(position, surface, natives, group)
function unitGroupUtils.createSquad(position, surface, natives, group, settlers)
local unitGroup = group or surface.create_unit_group({position=position})
local squad = {
group = unitGroup,
status = SQUAD_GUARDING,
penalties = {},
settlers = false,
rabid = false,
frenzy = false,
settlers = settlers or false,
kamikaze = false,
frenzyPosition = {x = 0,
y = 0},
cycles = 0,
maxDistance = 0,
attackScoreFunction = 1,
originPosition = {x = 0,
y = 0},
chunk = nil
}
natives.squads[#natives.squads+1] = squad
return squad