Rampant Evolution Fixed


Changes evolution mechanic to allow for green play. All evolution parameters are configurable and retroactively work on-the-fly. Tries to balance evolution level with number of nests covered by pollution. Killing units reduces evolution. Sets vanilla map evolution factors to 0 in new game settings and can change existing save map evolution factors in mod settings. If you want the vanilla options still, use the mod settings in Rampant Evolution.

Tweaks
12 days ago
2.0
299
Enemies

b new game is not started

a month ago

Hi, pls check this

Мод Rampant Evolution Fixed (1.7.0) caused an unrecoverable error.
Please report this error to the mod's author.

Error while running event RampantEvolutionFixed::on_init()
RampantEvolutionFixed/control.lua:105: attempt to index local 'player' (a nil value)
stack traceback:
RampantEvolutionFixed/control.lua:105: in function 'get_player_surface_index'
RampantEvolutionFixed/control.lua:271: in function 'onModSettingsChange'
RampantEvolutionFixed/control.lua:469: in function 'onConfigChanged'
RampantEvolutionFixed/control.lua:740: in function <RampantEvolutionFixed/control.lua:735>

a month ago

are you on Factorio Space Age? Was this a multiplayer or single player game?

will try and get it fixed when i have time

30 days ago

I have the same error. For me it's without Space Age, in single player (using other mods too, notably Krastorio). The crash happens on starting a new game, it starts loading the map and immediately fails.

21 days ago
(updated 21 days ago)

unfortunately i dont currently have space age so the most i can do is bandage the launch but i cant guarantee evolution factors will run properly unless i rewrite a fair chunk to support handling evolution factors for multiple surfaces.

This would be significantly harder without myself owning space age and so i wont be able to support space age until i own it myself so i can uplift the mod to support it.

if anyone else wants to do this sooner they can as the source code is freely available on github from either the original or mine.
Apologies

13 days ago

My man this has nothing to do with the space age dlc.
This error happens with no space age dlc
You do not need the dlc to get this error
I don't have the dlc

This is an error that should occur for everyone when trying to make a new world with your mod installed, Even with nothing else but rampant running

I can't say I particularly have figured out how to mod factorio yet, but I do know how to read code and error messages, and here's what I can tell you.
In control.lua near the beginning, when you are defining functions you use this code on line 104 :
local player = game.players[1]
What I can tell you about this line from the error code is that game.players[1] is not valid during world creation (there's no player yet) and therefore assigns nil to the local variable player.

This means on lines 105 (only during world creation) when you return player.surface.index you're indexing a nil value, which instantly causes a crash (that factorio understands so it boots you to title with the log).

The line works and everything seems to work fine while playing, which is why I noted it's only invalid on world creation.
The big hiccup ultimately comes on line 105 when called by line 271 from what I can tell. Line 469 and 740 show up because of nested function calls.
This means you might need to add an if statement before 105 checking to see if player==nil and if so return something special (maybe nil) for the function get_player_surface_index and then of course checking to see if that special value was given prior to line 271, and if so respond accordingly.

I don't know if the space age dlc lets you start on alien planets and what the ramifications of what that does to the surface index might be. What I can tell you is that Nauvis (the default world) has a surface index of 1 (where we primarily care about changing evolution) therefore adding the following after line 104 should put a bandaid on the issue.

if player == nil then
return 1
end

12 days ago
(updated 12 days ago)

chill out, il post a fix tonight.

Thank you for the explanation but honestly you dont need to do a deep dive into it as im a very experienced dev, i just quite often just lack the time to work on things.

i may have misread a previous comment where they mentioned it happens without space age. my mistake

12 days ago

fixed

New response