Water As A Resource


Turns Water into a non infinite resource. Water bodies get removed and replaced by solid ground. Offshore Drains allow water & oil to be put back into these depleted areas. 0.8.0 - 1.1 Factorio Compatibility, Multiplayer Multiple Forces Update, Krastorio2 Support, Reworked MapMarkers

1 year, 4 months ago
0.16 - 1.1
2.13K

g [Fixed - 0.8.4] - Crash with save before Water As A Resource 0.8.3

3 years ago

Hello Treefrog,

I'd like to report another crash. I tried to load a savegame that used your mod before your most recent update and the creative mod, and the game crashed with this message:


The mod Water As A Resource (0.8.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event WaterAsAResource::on_nth_tick(6)
WaterAsAResource/control.lua:162: attempt to index global 'player' (a nil value)
stack traceback:
WaterAsAResource/control.lua:162: in function 'GlobalWaterArea'
WaterAsAResource/control.lua:1733: in function 'ScanOffshores'
WaterAsAResource/control.lua:1831: in function <WaterAsAResource/control.lua:1827>


I tried to disable the mod, save the map, then update the mod, load the map. I also tried this again with the creative mod turned off.

3 years ago

Hello back_null,

Thanks for the details.

This is one of those self inflicted bugs, my old version of the mod, didnt set the player in the entity, so when the new version has come to get those details, they arn't present and crash.

I'll have to see what I can do for that, do you know which old version of the mod it was?

3 years ago

Having had a quick look, the upgrade script should have assigned a player value to any found offshorepumps on the map.

Hmmmm if you can let me know the old version of the mod, or pass me the save file, ill see whats going on.

3 years ago

Hi Treefrog,

There are no offshore pumps on the map whatsoever, I checked with all mods turned off.

Maybe it has something to do with the player sitting inside the spidertron?

Here is my save: https://easyupload.io/gmu3lk

3 years ago
(updated 3 years ago)

Another thing I noticed is, that when there are multiple pumps on one body of water and you load the save with your mod, calculation occurs for all pumps separately, and once finished, there is a marker at every pump that monitors the depletion, as if it were different bodies of water. Proof for me was that your mod named the same lake differently for every pump.

I remember that I deleted these multiple markers on that very save from above. Maybe that has something to do with the crash.

3 years ago
(updated 3 years ago)

(delete this)

3 years ago

ha i think this is a case where i dont test upgrading enough, sounds like as they are all built at once, the mod anlayses them all seperately, and makes seperate areas.

I'll look into that also!

3 years ago

I figured out what initially caused the faulty state. I was using The Ruins mod, which sometimes spawns a pond with an offshore pump. For some reason your mod doesn't like this. Even when The Ruins was deactivated but before has generated at least one ruin with an offshore pump somewhere on the map, loading the map with your mod causes the crash. My guess is now that the offshore pumps created by The Ruins mod belong to another player force than the default one.

You can reconstruct the state easily by activating Water As A Resource and The Ruins, and starting a new game with the mod scenario 'The Ruins Mod/Ruins Debug'.

3 years ago

Hey Back_Null,

My mod has never played nicelt with custom scenarios, even my own for testing ive a bit of code in to make it run correctly. I can make the mod run with that scenario, but not worth the trouble. The existing code should be ok for excluding the ruins it randomly creates, though I think a small change is also required.

Your save file does have around 12 offshore pumps to the North, which is where the issue is.

Im changing the mod so that it queues them up when the map has been scanned and will then go through them when the WaterArea has been created. Should sort the bug out.

3 years ago

Ah, I see... So the next version should be fine with The Ruins mod as long as it is not a scenario?

Thanks for the quick responses and the effort!

3 years ago

Yeah, new games or existing games that arnt a scenario should be fine, ill do some more testing when ive got the fixes in place.

3 years ago

Hey back_null,

So new queue implemented and working.

Have found an issue with 1 offshore pump on your map, which looks to have been generated by the ruins mod, which im going to need to deal with. Otherwise this problem should be sorted.

3 years ago
(updated 3 years ago)

Just as a bit more info, dont know if your able to find it on your map.

Factorio when you do a map scan for entities called offshore-pump, it finds 24 pumps, you have 23 at the northern waterarea. The scan if you specifiy an radius from the northern waterarea, is within 1000 tiles, more then 500 tiles away.

I ran about last night trying to find this other offshore pump so I could stare at it, but was unable to find it, dont know if you would have more luck with it.

3 years ago

I found it! CO-Ords 306, -1506 or so!

Well my mod found it, and provided me with its position :D

Anyways the issue should now be resolved. The mod builds a queue of all found offshore pumps when the mod is loaded into a new save, then goes through them 1 by 1 so there are no issues with mutlipump areas etc. I should have thought about this sooner to be fair!

Theres an exception in to ignore "neutral" offshore pumps so it'll ignore the ones added by AbandondedRuins before this mod was added, and the existing filters for when it adds them randomly later.

Just a slight logic change to do, and another bug to fix, but this will be sorted next version.

3 years ago

Really appreciate your efforts, makes me proud to be part of such a wholesome community :)

Even though I just wanted to report the issues, I didn't want to push you to fix it, so just you know. I'm always doing backups of my saves and don't start any new serious maps without carefully testing all the mods together.

New response