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

fix math lib range and null position check for settlers

This commit is contained in:
Aaron Veden 2019-08-16 18:52:16 -07:00
parent aa0bbf7839
commit 3d3d45b403
7 changed files with 20 additions and 23 deletions

View File

@ -127,7 +127,7 @@ function upgrade.attempt(natives)
-- used for breaking up how many squads are processing per logic cycle
natives.regroupIndex = 1
natives.randomGenerator = game.create_random_generator()
natives.randomGenerator = game.create_random_generator(natives.enemySeed+1024)
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.11")
global.version = constants.VERSION_23
@ -308,10 +308,12 @@ function upgrade.attempt(natives)
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.22")
global.version = 89
end
if (global.version < 92) then
if (global.version < 94) then
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.26")
global.version = 92
natives.randomGenerator = game.create_random_generator(natives.enemySeed+1024)
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.27")
global.version = 94
end
return starting ~= global.version, natives

View File

@ -1,3 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 0.17.27
Date: 8. 16. 2019
Bugfixes:
- Fixed settle move position error
- Fixed gaussianRandom having min greater than max causing hangs
---------------------------------------------------------------------------------------------------
Version: 0.17.26
Date: 5. 14. 2019

View File

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

View File

@ -32,7 +32,6 @@ local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
local INTERVAL_RALLY = constants.INTERVAL_RALLY
local TRIPLE_CHUNK_SIZE = constants.TRIPLE_CHUNK_SIZE
local CHUNK_ALL_DIRECTIONS = constants.CHUNK_ALL_DIRECTIONS
local CHUNK_SIZE = constants.CHUNK_SIZE
@ -44,15 +43,10 @@ local RESOURCE_MINIMUM_FORMATION_DELTA = constants.RESOURCE_MINIMUM_FORMATION_DE
local AI_STATE_SIEGE = constants.AI_STATE_SIEGE
local DEFINES_COMMAND_GROUP = defines.command.group
local DEFINES_DISTRACTION_NONE = defines.distraction.none
local AI_STATE_RAIDING = constants.AI_STATE_RAIDING
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
-- local PASSABLE = constants.PASSABLE
-- imported functions
local randomTickEvent = mathUtils.randomTickEvent

View File

@ -313,11 +313,6 @@ function mapProcessor.scanMap(map, surface, natives, tick)
rallys[chunk] = nil
end
-- local spawnerTick = spawners[chunk]
-- if spawnerTick and ((tick - spawnerTick) > INTERVAL_SPAWNER) then
-- spawners[chunk] = nil
-- end
local settlerTick = settlers[chunk]
if settlerTick and ((tick - settlerTick) > 0) then
settlers[chunk] = nil

View File

@ -11,11 +11,8 @@ local constants = require("Constants")
local TICKS_A_MINUTE = constants.TICKS_A_MINUTE
local INTERVAL_LOGIC = constants.INTERVAL_LOGIC
-- imported functions
local mMax = math.max
local mSqrt = math.sqrt
local mLog10 = math.log10
@ -37,7 +34,6 @@ end
function mathUtils.randomTickEvent(tick, low, high)
local range = high - low
local minutesToTick = (range * mRandom()) + low
-- local nextTick = mathUtils.roundToNearest(, INTERVAL_LOGIC)
return tick + (TICKS_A_MINUTE * minutesToTick)
end
@ -85,7 +81,7 @@ function mathUtils.gaussianRandom(mean, std_dev)
end
function mathUtils.gaussianRandomRange(mean, std_dev, min, max)
if (min == max) then
if (min >= max) then
return min
end
local r
@ -124,7 +120,7 @@ end
function mathUtils.gaussianRandomRangeRG(mean, std_dev, min, max, rg)
local r
if (min == max) then
if (min >= max) then
return min
end
repeat

View File

@ -147,11 +147,14 @@ local function settleMove(map, squad, natives, surface)
((resourceGenerator ~= 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 (group.state ~= DEFINES_GROUP_FINISHED) then
return
end
position = findMovementPosition(surface, groupPosition)
if not position then
position = groupPosition
end
cmd = map.settleCommand
if squad.kamikaze then