diff --git a/changelog.txt b/changelog.txt index 2a712ea..9b38e0d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +--------------------------------------------------------------------------------------------------- +Version: 3.0.3 + Bugfixes: + - Fixed settling squads not detecting players on a chunk when deciding to settle early + --------------------------------------------------------------------------------------------------- Version: 3.0.2 Bugfixes: diff --git a/info.json b/info.json index 2c9005d..21fad1f 100644 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name" : "Rampant", "factorio_version" : "1.1", - "version" : "3.0.2", + "version" : "3.0.3", "title" : "Rampant", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", diff --git a/libs/SquadAttack.lua b/libs/SquadAttack.lua index 54afaea..2dc179b 100644 --- a/libs/SquadAttack.lua +++ b/libs/SquadAttack.lua @@ -65,7 +65,7 @@ local removeSquadFromChunk = chunkPropertyUtils.removeSquadFromChunk local addDeathGenerator = chunkPropertyUtils.addDeathGenerator local getDeathGeneratorRating = chunkPropertyUtils.getDeathGeneratorRating - +local getPlayersOnChunk = chunkPropertyUtils.getPlayersOnChunk local getHiveCount = chunkPropertyUtils.getHiveCount local getNestCount = chunkPropertyUtils.getNestCount @@ -201,7 +201,8 @@ local function settleMove(map, squad) local attackPlayerThreshold = universe.attackPlayerThreshold if (nextAttackChunk ~= -1) then - if (getPlayerBaseGenerator(map,nextAttackChunk) == 0) or (squad.type ~= BASE_AI_STATE_SIEGE) then + if (getPlayerBaseGenerator(map, nextAttackChunk) == 0) and (getPlayersOnChunk(map, nextAttackChunk) == 0) + then attackChunk = nextAttackChunk position = findMovementPosition( surface, @@ -241,8 +242,7 @@ local function settleMove(map, squad) end if (nextAttackChunk ~= -1) and - (squad.type == BASE_AI_STATE_SIEGE) and - (getPlayerBaseGenerator(map, nextAttackChunk) ~= 0) + ((getPlayerBaseGenerator(map, nextAttackChunk) ~= 0) or (getPlayersOnChunk(map, nextAttackChunk) ~= 0)) then cmd = universe.settleCommand squad.status = SQUAD_BUILDING