[MOD 0.13.17+] Rampant

Topics and discussion about specific mods
mg79
Burner Inserter
Burner Inserter
Posts: 18
Joined: Mon Apr 24, 2017 5:32 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.11

Post by mg79 »

After upgrading to Factorio 0.16.20 I've started getting this error whenever I build something using Nanobots. I don't know if it's an issue with Rampant or with Nanobots though. (I've posted in both threads). The message appears once for each item the bots build.

Code: Select all

Error while running event Rampant::on_player_built_tile (ID 45) __Rampant__/control.lua:473: attempt to index field 'item' (a nil value) stack traceback: __Nanobots__/control.lua:421: In function '?' __Nanobots__/scripts/hash_queue.lua:80: in function 'execute' __Nanobots__/control.lua:602: in function <__Nanobots__/control.lua:601> [C]: in function 'pcall' __Nanobots__/stdlib/event/event.lua:155: in function <__Nanobots__/stdlib/event/event.lua:134>

Officer Joe Balogna
Inserter
Inserter
Posts: 28
Joined: Mon Apr 04, 2016 1:00 am
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.11

Post by Officer Joe Balogna »

Is it an intentional feature that your custom nests do not drop any artifacts when destroyed? I've destroyed many of the custom ones, not a single artifact has dropped from them.

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.11

Post by Veden »

mg79 wrote:After upgrading to Factorio 0.16.20 I've started getting this error whenever I build something using Nanobots. I don't know if it's an issue with Rampant or with Nanobots though. (I've posted in both threads). The message appears once for each item the bots build.

Code: Select all

Error while running event Rampant::on_player_built_tile (ID 45) __Rampant__/control.lua:473: attempt to index field 'item' (a nil value) stack traceback: __Nanobots__/control.lua:421: In function '?' __Nanobots__/scripts/hash_queue.lua:80: in function 'execute' __Nanobots__/control.lua:602: in function <__Nanobots__/control.lua:601> [C]: in function 'pcall' __Nanobots__/stdlib/event/event.lua:155: in function <__Nanobots__/stdlib/event/event.lua:134>
Thanks for the report. This should be fixed in the latest.
Officer Joe Balogna wrote:Is it an intentional feature that your custom nests do not drop any artifacts when destroyed? I've destroyed many of the custom ones, not a single artifact has dropped from them.
No, it isn't intentional. The latest build should add support for bobs enemies and nee artifacts

TheTom
Fast Inserter
Fast Inserter
Posts: 185
Joined: Tue Feb 09, 2016 8:33 am
Contact:

And - Bug loading with latest update.

Post by TheTom »

Reads:

Failed to load mods....


__Rampant__/dataa-updates.loa:4:__Rampant__/libs/Constants.lua:198 attempt to index field 'NE_Difficulty' (a nil value)

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: And - Bug loading with latest update.

Post by Veden »

TheTom wrote:Reads:

Failed to load mods....


__Rampant__/dataa-updates.loa:4:__Rampant__/libs/Constants.lua:198 attempt to index field 'NE_Difficulty' (a nil value)
thanks for the report. Should be fixed in the latest.

prj
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Jan 31, 2018 5:07 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.15

Post by prj »

I can not get the building safety to work...

I am doing all this on a dedicated headless server.
I started a game with building safety disabled (I had it enabled in individual settings, but forgot to enable the global one), I then edited the mod-settings.json in the mods folder and enabled the global setting.
But the biters still munch my rails up. Funnily enough the spitters seem to be doing no damage, but the biters eat the rails.

Any idea what the problem could be?
Out of mods I only have Rampant AI, Vehicle Equipment Grid and vtk deep core mining. Nothing that modifies railroads I think.

Attached my mod-settings.json file.
Attachments
mod-settings.json
(2.97 KiB) Downloaded 146 times

prj
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Jan 31, 2018 5:07 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.15

Post by prj »

Here is my mods + savegame zipped into one also.
Attachments
mods.zip
(12.32 MiB) Downloaded 136 times

prj
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Jan 31, 2018 5:07 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.15

Post by prj »

I think I see the error in my ways. The mod-settings.json seems to get read only on startup, after that it is baked into the savegame.
I loaded the savegame on the client, modified the settings and re-saved, then re-uploaded the save onto the server and so far it seems that they don't munch on rails anymore.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.16

Post by wvlad »

Hi, I enabled new enemies and they are much stronger (attack & hp) than vanilla. They blowup my turret wall easily (at evolution 80%). I like the idea of having different types of enemies with different abilities but I don't want them to be so much stronger than vanilla. Can you add please some settings to scale their attributes to be more like vanilla?

For now I'll try

Code: Select all


local fixedTIER_SET_5 = { 1, 2, 2, 3, 4 }
local fixedTIER_SET_10 = { 1, 1, 2, 2, 2, 3, 3, 3, 3, 4 }

	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	    upgradeEntity(worm, upgradeTable, tReal)
Full SwarmUtils.lua

Code: Select all

local swarmUtils = {}
-- imports

local biterUtils = require("utils/BiterUtils")
package.path = "../?.lua;" .. package.path
local mathUtils = require("libs/MathUtils")
local constants = require("libs/Constants")

-- imported functions

local gaussianRandomRangeRG = mathUtils.gaussianRandomRangeRG

local roundToNearest = mathUtils.roundToNearest

local mMax = math.max
local mMin = math.min

local mFloor = math.floor

local deepcopy = util.table.deepcopy

local TIER_SET_10 = constants.TIER_SET_10
local TIER_SET_5 = constants.TIER_SET_5

local xorRandom = mathUtils.xorRandom(settings.startup["rampant-enemySeed"].value)

local makeBiterCorpse = biterUtils.makeBiterCorpse
local makeUnitSpawnerCorpse = biterUtils.makeUnitSpawnerCorpse
local makeWormCorpse = biterUtils.makeWormCorpse
local makeSpitterCorpse = biterUtils.makeSpitterCorpse

local makeBiter = biterUtils.makeBiter
local makeSpitter = biterUtils.makeSpitter
local makeWorm = biterUtils.makeWorm
local makeUnitSpawner = biterUtils.makeUnitSpawner

local fixedTIER_SET_5 = { 1, 2, 2, 3, 4 }
local fixedTIER_SET_10 = { 1, 1, 2, 2, 2, 3, 3, 3, 3, 4 }


-- module code

local function unitSetToProbabilityTable(upgradeTable, unitSet)
    local dividers = {}
    
    for i=1,#unitSet do
	dividers[i] = 1
    end

    if upgradeTable then
	local points = #unitSet * 10
	while (points > 0) do
	    local index = mFloor(xorRandom() * #unitSet)+1
	    local upgrade = upgradeTable[index]

	    dividers[index] = dividers[index] + upgrade
	    
	    points = points - 1
	end
    end
    
    local total = 0
    for i=1,#dividers do
	total = total + dividers[i]
    end

    local runningTotal = 0
    for i=1,#dividers do
	runningTotal = runningTotal + (dividers[i] / total)
	dividers[i] = runningTotal
    end

    local stepUnit = 1 / (#unitSet[1] + 1)
    
    local probabilityTable = {}

    for i=1,#unitSet do
	local result
    	if (i == 1) then
    	    result = {
    		{
    		    0,
    		    stepUnit
    		},
    		{
    		    dividers[i],
    		    0
    		}
    	    }
    	elseif (i == #unitSet) then
    	    result = {
    		{
    		    dividers[i-2],
    		    0
    		},
    		{
    		    1,
    		    stepUnit
    		}
    	    }
    	else
    	    result = {
    		{
    		    ((i - 2) > 0 and dividers[i-2]) or 0,
    		    0
    		},
    		{
    		    dividers[i-1],
    		    stepUnit
    		},
    		{
    		    dividers[i],
    		    0
    		}
    	    }
    	end

	probabilityTable[i] = result
    end

    local result = {}

    for i=1, #probabilityTable do
	local probability = probabilityTable[i]
	for x=1, #unitSet[i] do
	    result[#result+1] = {unitSet[i][x], probability}
	end
    end
    
    return result
end

local function upgradeEntity(entity, upgradeTable, tier)
    if upgradeTable then
	for upgradeIndex=1, #upgradeTable do
	    local upgrade = upgradeTable[upgradeIndex]
	    
	    if (upgrade.type == "attribute") then
		if upgrade.mapping then
		    entity.attributes[upgrade.mapping] = upgrade[tier]
		else
		    local adj = upgrade[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.attributes[upgrade.name] = (entity.attributes[upgrade.name] or 0) + adj
		end
	    end
	    if (upgrade.type == "resistance") then
		local field = upgrade.name
		if not entity.resistances[field] then
		    entity.resistances[field] = {}
		end
		local adj
		if upgrade.decrease then
		    adj = upgrade.decrease[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.resistances[field].decrease = (entity.resistances[field].decrease or 0) + adj
		end
		if upgrade.percent then
		    adj = upgrade.percent[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.resistances[field].percent = mMin((entity.resistances[field].percent or 0) + adj, 100)
		end
	    end
	    if (upgrade.type == "attack") then
		if upgrade.mapping then
		    entity.attack[upgrade.mapping] = upgrade[tier]
		else
		    local adj = upgrade[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.attack[upgrade.name] = (entity.attack[upgrade.name] or 0) + adj
		end
	    end
	end
    end
end

local function calculateRGBa(tint, tier)
    local r = gaussianRandomRangeRG(tint.r, tint.r * 0.10 + (0.005 * tier), mMax(tint.r * 0.85 - (0.005 * tier), 0), mMin(tint.r * 1.15, 1), xorRandom)
    local g = gaussianRandomRangeRG(tint.g, tint.g * 0.10 + (0.005 * tier), mMax(tint.g * 0.85 - (0.005 * tier), 0), mMin(tint.g * 1.15, 1), xorRandom)
    local b = gaussianRandomRangeRG(tint.b, tint.b * 0.10 + (0.005 * tier), mMax(tint.b * 0.85 - (0.005 * tier), 0), mMin(tint.b * 1.15, 1), xorRandom)
    local a = gaussianRandomRangeRG(tint.a, tint.a * 0.10 + (0.005 * tier), mMax(tint.a * 0.85 - (0.005 * tier), 0), mMin(tint.a * 1.15, 1), xorRandom)
    
    return { r=r, g=g, b=b, a=a }
end

local function generateApperance(unit, tier)
    local scaleValue = unit.scales[tier]
    local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.12, scaleValue * 0.60, scaleValue * 1.40, xorRandom)

    unit.scale = scale
    unit.attributes.scale = scale
    if unit.tint then
	local tint = calculateRGBa(unit.tint, tier)
	
	unit.attributes.tint = tint

	if unit.attack then
	    unit.attack.scale = scale
	    unit.attack.tint = tint
	end
    end
    if unit.tint1 and unit.tint2 then
	local tint1 = calculateRGBa(unit.tint1, tier)
	local tint2 = calculateRGBa(unit.tint2, tier)
	
	unit.attributes.tint1 = tint1
	unit.attributes.tint2 = tint2

	if unit.attack then
	    unit.attack.scale = scale
	    unit.attack.tint1 = tint1
	    unit.attack.tint2 = tint2
	end
    end
    if unit.attack then
	if unit.pTint then
	    unit.attack.pTint = calculateRGBa(unit.pTint, tier)
	end
	if unit.sTint then
	    unit.attack.sTint = calculateRGBa(unit.sTint, tier)
	end
	if unit.smTint then
	    unit.attack.smTint = calculateRGBa(unit.smTint, tier)
	end
    end
end

local function buildUnits(template, attackGenerator, upgradeTable, variations, tiers)
    local unitSet = {}
    
    for tier=1, tiers do
	local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	local result = {}
	
	for i=1,variations do
	    local unit = deepcopy(template)
	    unit.name = unit.name .. "-v" .. i .. "-t" .. tier
	    generateApperance(unit, t)
	    upgradeEntity(unit, upgradeTable,  tReal)
	    
	    if unit.attackName then
		unit.attack.name = unit.attackName .. "-v" .. i .. "-t" .. tier
	    end

	    if unit.loot then
		unit.attributes.loot = { unit.loot[tReal] }
	    end
	    
	    local entity
	    if (unit.type == "spitter") then
		unit.attributes.corpse = makeSpitterCorpse(unit)
		entity = makeSpitter(unit.name,
				     unit.attributes,
				     attackGenerator(unit.attack),
				     unit.resistances)
	    elseif (unit.type == "biter") then
		unit.attributes.corpse = makeBiterCorpse(unit)
		entity = makeBiter(unit.name,
				   unit.attributes,
				   attackGenerator(unit.attack),
				   unit.resistances)
	    end

	    result[#result+1] = entity.name
	    
	    data:extend({entity})
	end
	
	unitSet[#unitSet+1] = result
    end
    
    return unitSet
end

function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, variations, tiers)
    
    local unitSet = buildUnits(templates.unit,
			       attackGenerator,
			       upgradeTable.unit,
			       variations.unit,
			       tiers.unit)
    
    for tier=1, tiers.unitSpawner do
	local t = ((tiers.unitSpawner == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers.unitSpawner == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	for i=1,variations.unitSpawner do
	    local unitSpawner = deepcopy(templates.unitSpawner)
	    unitSpawner.name = unitSpawner.name .. "-v" .. i .. "-t" .. t
	    local unitTable = unitSetToProbabilityTable(upgradeTable.probabilityTable,
							unitSet)
	    generateApperance(unitSpawner, t)
	    upgradeEntity(unitSpawner, upgradeTable.unitSpawner, tReal)

	    if unitSpawner.loot then
		unitSpawner.attributes.loot = { unitSpawner.loot[tReal] }
	    end
	    
	    if unitSpawner.autoplace then
		unitSpawner.attributes["autoplace"] = unitSpawner.autoplace[tReal]
	    end
	    unitSpawner.attributes.corpse = makeUnitSpawnerCorpse(unitSpawner)
	    data:extend({
		    makeUnitSpawner(unitSpawner.name,
				    unitSpawner.attributes,
				    unitSpawner.resistances,
				    unitTable)
	    })
	end
    end
    
end

function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variations, tiers)
    for tier=1, tiers do
	local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	for i=1,variations do
	    local worm = deepcopy(template)
	    worm.name = worm.name .. "-v" .. i .. "-t" .. t
	    generateApperance(worm, t)
	    upgradeEntity(worm, upgradeTable, tReal)

	    if worm.attackName then
		worm.attack.name = worm.attackName .. "-v" .. i .. "-t" .. t
	    end

	    if worm.loot then
		worm.attributes.loot = { worm.loot[tReal] }
	    end
	    
	    if worm.autoplace then
		worm.attributes["autoplace"] = worm.autoplace[tReal]
	    end
	    worm.attributes.corpse = makeWormCorpse(worm)
	    data:extend({
		    makeWorm(worm.name,
			     worm.attributes,
			     attackGenerator(worm.attack),
			     worm.resistances)
	    })
	end
    end
end

return swarmUtils

Tampa_Gamer
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Jul 19, 2016 12:34 am
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.16

Post by Tampa_Gamer »

First let me say, that I have been using this mod for the past 3 games I have played over the past 6 months, and it is the first mod I always make sure I have for each new game I play. So thank you very much for making this and putting your time into it.

I think this is my first bug I have encountered with this mod that I cannot seem to get around. I think it is partially my fault, because I am about 11 hours into my current game and have really not had any biter attacks except for a few early on when I was clearing nests for my initial base. Yesterday I thought it may be because there have been a number of updates to both the base game and Rampant and for some reason I thought it might be a good idea to reset the mod options and then check off the ones I didn't need again (I am not using Bob's enemies or Natural Evolution, etc.). After doing so, I loaded the game and got a message that the game was deleting a number of Rampant entities (which I have seen before in between updates so I didn't think twice about it). However, a few minutes later into the game I got an error message regarding Rampant (see uploaded attachment) and then Factorio crashed to the main screen. I have tried this twice more with the same result. Save game is also attached. Any suggestions?
Attachments
Game06_befbedA.zip
This is the save game
(8.12 MiB) Downloaded 145 times
This is the error message
This is the error message
20180204091557_1.jpg (517.91 KiB) Viewed 10383 times

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.16

Post by Veden »

wvlad wrote:Hi, I enabled new enemies and they are much stronger (attack & hp) than vanilla. They blowup my turret wall easily (at evolution 80%). I like the idea of having different types of enemies with different abilities but I don't want them to be so much stronger than vanilla. Can you add please some settings to scale their attributes to be more like vanilla?

For now I'll try

Code: Select all


local fixedTIER_SET_5 = { 1, 2, 2, 3, 4 }
local fixedTIER_SET_10 = { 1, 1, 2, 2, 2, 3, 3, 3, 3, 4 }

	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	    upgradeEntity(worm, upgradeTable, tReal)
Full SwarmUtils.lua

Code: Select all

local swarmUtils = {}
-- imports

local biterUtils = require("utils/BiterUtils")
package.path = "../?.lua;" .. package.path
local mathUtils = require("libs/MathUtils")
local constants = require("libs/Constants")

-- imported functions

local gaussianRandomRangeRG = mathUtils.gaussianRandomRangeRG

local roundToNearest = mathUtils.roundToNearest

local mMax = math.max
local mMin = math.min

local mFloor = math.floor

local deepcopy = util.table.deepcopy

local TIER_SET_10 = constants.TIER_SET_10
local TIER_SET_5 = constants.TIER_SET_5

local xorRandom = mathUtils.xorRandom(settings.startup["rampant-enemySeed"].value)

local makeBiterCorpse = biterUtils.makeBiterCorpse
local makeUnitSpawnerCorpse = biterUtils.makeUnitSpawnerCorpse
local makeWormCorpse = biterUtils.makeWormCorpse
local makeSpitterCorpse = biterUtils.makeSpitterCorpse

local makeBiter = biterUtils.makeBiter
local makeSpitter = biterUtils.makeSpitter
local makeWorm = biterUtils.makeWorm
local makeUnitSpawner = biterUtils.makeUnitSpawner

local fixedTIER_SET_5 = { 1, 2, 2, 3, 4 }
local fixedTIER_SET_10 = { 1, 1, 2, 2, 2, 3, 3, 3, 3, 4 }


-- module code

local function unitSetToProbabilityTable(upgradeTable, unitSet)
    local dividers = {}
    
    for i=1,#unitSet do
	dividers[i] = 1
    end

    if upgradeTable then
	local points = #unitSet * 10
	while (points > 0) do
	    local index = mFloor(xorRandom() * #unitSet)+1
	    local upgrade = upgradeTable[index]

	    dividers[index] = dividers[index] + upgrade
	    
	    points = points - 1
	end
    end
    
    local total = 0
    for i=1,#dividers do
	total = total + dividers[i]
    end

    local runningTotal = 0
    for i=1,#dividers do
	runningTotal = runningTotal + (dividers[i] / total)
	dividers[i] = runningTotal
    end

    local stepUnit = 1 / (#unitSet[1] + 1)
    
    local probabilityTable = {}

    for i=1,#unitSet do
	local result
    	if (i == 1) then
    	    result = {
    		{
    		    0,
    		    stepUnit
    		},
    		{
    		    dividers[i],
    		    0
    		}
    	    }
    	elseif (i == #unitSet) then
    	    result = {
    		{
    		    dividers[i-2],
    		    0
    		},
    		{
    		    1,
    		    stepUnit
    		}
    	    }
    	else
    	    result = {
    		{
    		    ((i - 2) > 0 and dividers[i-2]) or 0,
    		    0
    		},
    		{
    		    dividers[i-1],
    		    stepUnit
    		},
    		{
    		    dividers[i],
    		    0
    		}
    	    }
    	end

	probabilityTable[i] = result
    end

    local result = {}

    for i=1, #probabilityTable do
	local probability = probabilityTable[i]
	for x=1, #unitSet[i] do
	    result[#result+1] = {unitSet[i][x], probability}
	end
    end
    
    return result
end

local function upgradeEntity(entity, upgradeTable, tier)
    if upgradeTable then
	for upgradeIndex=1, #upgradeTable do
	    local upgrade = upgradeTable[upgradeIndex]
	    
	    if (upgrade.type == "attribute") then
		if upgrade.mapping then
		    entity.attributes[upgrade.mapping] = upgrade[tier]
		else
		    local adj = upgrade[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.attributes[upgrade.name] = (entity.attributes[upgrade.name] or 0) + adj
		end
	    end
	    if (upgrade.type == "resistance") then
		local field = upgrade.name
		if not entity.resistances[field] then
		    entity.resistances[field] = {}
		end
		local adj
		if upgrade.decrease then
		    adj = upgrade.decrease[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.resistances[field].decrease = (entity.resistances[field].decrease or 0) + adj
		end
		if upgrade.percent then
		    adj = upgrade.percent[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.resistances[field].percent = mMin((entity.resistances[field].percent or 0) + adj, 100)
		end
	    end
	    if (upgrade.type == "attack") then
		if upgrade.mapping then
		    entity.attack[upgrade.mapping] = upgrade[tier]
		else
		    local adj = upgrade[tier]
		    local min = upgrade.min or adj * 0.70
		    local max = upgrade.max or adj * 1.30
		    if (adj < 0) then
			local t = min
			min = max
			max = t
		    end
		    adj = roundToNearest(gaussianRandomRangeRG(adj, adj * 0.2, min, max, xorRandom), 0.001)
		    entity.attack[upgrade.name] = (entity.attack[upgrade.name] or 0) + adj
		end
	    end
	end
    end
end

local function calculateRGBa(tint, tier)
    local r = gaussianRandomRangeRG(tint.r, tint.r * 0.10 + (0.005 * tier), mMax(tint.r * 0.85 - (0.005 * tier), 0), mMin(tint.r * 1.15, 1), xorRandom)
    local g = gaussianRandomRangeRG(tint.g, tint.g * 0.10 + (0.005 * tier), mMax(tint.g * 0.85 - (0.005 * tier), 0), mMin(tint.g * 1.15, 1), xorRandom)
    local b = gaussianRandomRangeRG(tint.b, tint.b * 0.10 + (0.005 * tier), mMax(tint.b * 0.85 - (0.005 * tier), 0), mMin(tint.b * 1.15, 1), xorRandom)
    local a = gaussianRandomRangeRG(tint.a, tint.a * 0.10 + (0.005 * tier), mMax(tint.a * 0.85 - (0.005 * tier), 0), mMin(tint.a * 1.15, 1), xorRandom)
    
    return { r=r, g=g, b=b, a=a }
end

local function generateApperance(unit, tier)
    local scaleValue = unit.scales[tier]
    local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.12, scaleValue * 0.60, scaleValue * 1.40, xorRandom)

    unit.scale = scale
    unit.attributes.scale = scale
    if unit.tint then
	local tint = calculateRGBa(unit.tint, tier)
	
	unit.attributes.tint = tint

	if unit.attack then
	    unit.attack.scale = scale
	    unit.attack.tint = tint
	end
    end
    if unit.tint1 and unit.tint2 then
	local tint1 = calculateRGBa(unit.tint1, tier)
	local tint2 = calculateRGBa(unit.tint2, tier)
	
	unit.attributes.tint1 = tint1
	unit.attributes.tint2 = tint2

	if unit.attack then
	    unit.attack.scale = scale
	    unit.attack.tint1 = tint1
	    unit.attack.tint2 = tint2
	end
    end
    if unit.attack then
	if unit.pTint then
	    unit.attack.pTint = calculateRGBa(unit.pTint, tier)
	end
	if unit.sTint then
	    unit.attack.sTint = calculateRGBa(unit.sTint, tier)
	end
	if unit.smTint then
	    unit.attack.smTint = calculateRGBa(unit.smTint, tier)
	end
    end
end

local function buildUnits(template, attackGenerator, upgradeTable, variations, tiers)
    local unitSet = {}
    
    for tier=1, tiers do
	local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	local result = {}
	
	for i=1,variations do
	    local unit = deepcopy(template)
	    unit.name = unit.name .. "-v" .. i .. "-t" .. tier
	    generateApperance(unit, t)
	    upgradeEntity(unit, upgradeTable,  tReal)
	    
	    if unit.attackName then
		unit.attack.name = unit.attackName .. "-v" .. i .. "-t" .. tier
	    end

	    if unit.loot then
		unit.attributes.loot = { unit.loot[tReal] }
	    end
	    
	    local entity
	    if (unit.type == "spitter") then
		unit.attributes.corpse = makeSpitterCorpse(unit)
		entity = makeSpitter(unit.name,
				     unit.attributes,
				     attackGenerator(unit.attack),
				     unit.resistances)
	    elseif (unit.type == "biter") then
		unit.attributes.corpse = makeBiterCorpse(unit)
		entity = makeBiter(unit.name,
				   unit.attributes,
				   attackGenerator(unit.attack),
				   unit.resistances)
	    end

	    result[#result+1] = entity.name
	    
	    data:extend({entity})
	end
	
	unitSet[#unitSet+1] = result
    end
    
    return unitSet
end

function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, variations, tiers)
    
    local unitSet = buildUnits(templates.unit,
			       attackGenerator,
			       upgradeTable.unit,
			       variations.unit,
			       tiers.unit)
    
    for tier=1, tiers.unitSpawner do
	local t = ((tiers.unitSpawner == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers.unitSpawner == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	for i=1,variations.unitSpawner do
	    local unitSpawner = deepcopy(templates.unitSpawner)
	    unitSpawner.name = unitSpawner.name .. "-v" .. i .. "-t" .. t
	    local unitTable = unitSetToProbabilityTable(upgradeTable.probabilityTable,
							unitSet)
	    generateApperance(unitSpawner, t)
	    upgradeEntity(unitSpawner, upgradeTable.unitSpawner, tReal)

	    if unitSpawner.loot then
		unitSpawner.attributes.loot = { unitSpawner.loot[tReal] }
	    end
	    
	    if unitSpawner.autoplace then
		unitSpawner.attributes["autoplace"] = unitSpawner.autoplace[tReal]
	    end
	    unitSpawner.attributes.corpse = makeUnitSpawnerCorpse(unitSpawner)
	    data:extend({
		    makeUnitSpawner(unitSpawner.name,
				    unitSpawner.attributes,
				    unitSpawner.resistances,
				    unitTable)
	    })
	end
    end
    
end

function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variations, tiers)
    for tier=1, tiers do
	local t = ((tiers == 5) and TIER_SET_5[tier]) or TIER_SET_10[tier]
	local tReal = ((tiers == 5) and fixedTIER_SET_5[tier]) or fixedTIER_SET_10[tier]
	for i=1,variations do
	    local worm = deepcopy(template)
	    worm.name = worm.name .. "-v" .. i .. "-t" .. t
	    generateApperance(worm, t)
	    upgradeEntity(worm, upgradeTable, tReal)

	    if worm.attackName then
		worm.attack.name = worm.attackName .. "-v" .. i .. "-t" .. t
	    end

	    if worm.loot then
		worm.attributes.loot = { worm.loot[tReal] }
	    end
	    
	    if worm.autoplace then
		worm.attributes["autoplace"] = worm.autoplace[tReal]
	    end
	    worm.attributes.corpse = makeWormCorpse(worm)
	    data:extend({
		    makeWorm(worm.name,
			     worm.attributes,
			     attackGenerator(worm.attack),
			     worm.resistances)
	    })
	end
    end
end

return swarmUtils
Good idea, I have added some settings to control the start and end tier from the settings menu.
Tampa_Gamer wrote:First let me say, that I have been using this mod for the past 3 games I have played over the past 6 months, and it is the first mod I always make sure I have for each new game I play. So thank you very much for making this and putting your time into it.

I think this is my first bug I have encountered with this mod that I cannot seem to get around. I think it is partially my fault, because I am about 11 hours into my current game and have really not had any biter attacks except for a few early on when I was clearing nests for my initial base. Yesterday I thought it may be because there have been a number of updates to both the base game and Rampant and for some reason I thought it might be a good idea to reset the mod options and then check off the ones I didn't need again (I am not using Bob's enemies or Natural Evolution, etc.). After doing so, I loaded the game and got a message that the game was deleting a number of Rampant entities (which I have seen before in between updates so I didn't think twice about it). However, a few minutes later into the game I got an error message regarding Rampant (see uploaded attachment) and then Factorio crashed to the main screen. I have tried this twice more with the same result. Save game is also attached. Any suggestions?
When I tried your save, I didn't get the error message.

Try the latest build, if you are still having issues, please send me what settings you have configured for rampant and I will take another look

Affly
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Aug 15, 2016 12:11 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.17

Post by Affly »

Getting the following error after updating:

Image

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.17

Post by wvlad »

Good idea, I have added some settings to control the start and end tier from the settings menu.
Please ensure that their entities will still have old tier names otherwise they will be just removed from game when you load. I wouldn't want half of spawners to be removed after tweaking that setting. So it should control only tier settings but not change tier number used in naming.

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.18

Post by Veden »

Affly wrote:Getting the following error after updating:

Image
Thanks, this should be fixed in the latest.
wvlad wrote:
Good idea, I have added some settings to control the start and end tier from the settings menu.
Please ensure that their entities will still have old tier names otherwise they will be just removed from game when you load. I wouldn't want half of spawners to be removed after tweaking that setting. So it should control only tier settings but not change tier number used in naming.
Good catch, the latest build should have this fixed

Tampa_Gamer
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Jul 19, 2016 12:34 am
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.18

Post by Tampa_Gamer »

Thanks Veden - I was able to fix my game by unloading my mods (I only use a few graphical, EVOGUI, Far Reacher and Bullet Trails in addition to Rampant). Then I loaded the savegame and saved a no-mod version of it. Then I slowly added the mods back and tested each one, including the last - Rampant 0.16.18 version. No issues so far. Keep up the great work!

leoch
Fast Inserter
Fast Inserter
Posts: 135
Joined: Fri Dec 16, 2016 9:37 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.18

Post by leoch »

Just had a crash with this message (Rampant 0.16.16):

Code: Select all

Error while running event Rampant::on_tick (ID 0)
__Rampant__/libs/BaseUtils.lua:167: attempt to index local 'alignments' (a nil value)
I will upgrade but it doesn't sound like this bug was addressed.

leoch
Fast Inserter
Fast Inserter
Posts: 135
Joined: Fri Dec 16, 2016 9:37 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.18

Post by leoch »

Those "spawner spitters" certainly are interesting to fight, but sometimes I end up with thousands (or even tens of thousands) of spawner biters to fight (or which just hang around). Really kills the FPS and gets monotonous. I think part of the problem is that the spitters can end up in a frenzy and continually spit at rocks or rails without damaging them, which the newly spawned biters ignore — continue for a while and there can be huge numbers of spawner biters sitting there doing nothing. [Rampant 0.16.18 this time.]

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.19

Post by Veden »

leoch wrote:Those "spawner spitters" certainly are interesting to fight, but sometimes I end up with thousands (or even tens of thousands) of spawner biters to fight (or which just hang around). Really kills the FPS and gets monotonous. I think part of the problem is that the spitters can end up in a frenzy and continually spit at rocks or rails without damaging them, which the newly spawned biters ignore — continue for a while and there can be huge numbers of spawner biters sitting there doing nothing. [Rampant 0.16.18 this time.]
The latest version should have a decaying mechanic now on the spitters so each time they shoot, they take some damage.

Let me know if the alignment issue comes back

leoch
Fast Inserter
Fast Inserter
Posts: 135
Joined: Fri Dec 16, 2016 9:37 pm
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.19

Post by leoch »

I've noticed a bunch of invisible entities which just show a cross if trying to build on them (presumably zero-size hit-box). The only way to destroy them is to run them over with a car/tank. I think they are the remains of the spawner eggs? They really should get cleaned up, I imagine there are hundreds in my game now.

Speaking of cleaning up, the spawner biters often don't form squads but just hang around. I wonder if they should have a maximum lifetime or something? I suppose Rampant's "refund" mechanism should eventually clear them up.

Tampa_Gamer
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Jul 19, 2016 12:34 am
Contact:

Re: [MOD 0.13.17+] Rampant - 0.16.19

Post by Tampa_Gamer »

Wondering if this is normal behavior for the latest versions. I really have had very little interaction except for clearing out a few nests early on. I am 136 days in now and they have hardly expanded or attacked their nests in any meaningful way. Posting screenshot of map and also my settings page in case I screwed up a setting or something. Please help. Any pointers would be appreciated, I really dont want to start a new game/map.
Overview of Map
First Page of Settings
Second Page of Settings

Post Reply

Return to “Mods”