[0.17.11] Inconsistant Mod Behaviour on Custom Created Map

Bugs that we were not able to reproduce, and/or are waiting for more detailed info.
Post Reply
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu May 04, 2017 12:07 pm

[0.17.11] Inconsistant Mod Behaviour on Custom Created Map

Post by TreefrogGreaken »

After creating a custom map in 17.11, my mod behaves inconsistently. The mod when after 80% of a fluid area is used, starts to replace the tiles in the fluid area with land tiles, it saves all the tiles locations to a global table, which is unique. In a newly made custom map, the mod doesn't work as intended, and only partially replaces tiles and when the offshore is built in the same location as before sets up a new fluid area, which shouldn't happen, it should recognize the existing fluid area.

This behavior doesn't happen in a Normal Map and the mod runs exactly as expected.

I rolled back to 16.51 and created the same map, with my old version of the mod, and it runs perfectly. I updated back to 17.11, and with the new version of the mod, using the map created in 16.51 also runs exactly right, only the map created in 17.11 has the weird behavior.

There have been very few code changes to the internal mechanics of my mod, it is largely the same. Some new use of the get_fluid_count() function but otherwise, the same.

The fact that the new version of the mod runs perfectly with the map made in 16.51 shows that this looks to be an issue with the map creation in 17.11.

I've attached 2 Scenarios. They are both identically created, the first was created in 16.51 and has no issues with either version of the mod. The second is the map made in 17.11, which has issues that otherwise aren't present in a Normal Map.

0.16 Version of Mod : https://mods.factorio.com/download/Wate ... 000c2a024e

0.17 Version of Mod : https://mods.factorio.com/download/Wate ... 000df00db9


1 - Run the scenario
2 - Change the Map Settings so that the Deep Water amount is 20.
3 - Retrieve the items stored in the steel chest bottom left of the map
4 - Place an offshore pump into any lake, attach a couple of storage tanks
5 - Wait around 40 - 60 seconds

In the 16.51 Map, the fluid area will deplete towards the pump and then replace the pump. As seen in the gif below.

In the 17.11 Map, the fluid area, will says its depleted an area, when no tiles have been replaced. Replacing the pump in the same position creates a new fluid area, and then re-depletes the area, sometimes replacing tiles, other times no replacement. The amount of fluid it suggests is in the area is also vastly under what it should be. For 20 fluid per deep tile, the 16.51 shows around 47K water, 17.11 shows around 8 - 9K fluid.

Expected Result.

I've also attached an image of the debug interface, showing 16.51/17.11 and a normal map compared, looks like for some reason the scripting time is taking much longer on the 17.11 created scenario.

I disabled all but my mod, I've looked around for any settings that might affect it and I'm at a loss, I can only see this as an issue with the Map Editor in 17.11. I've not checked the preceding versions of 17.X.

If i have missed something then let me know, I couldn't see any notes about what has changed internally with the map editor. Hoping that if this is a bug will help others out if they are having issues with their mods on custom maps.
CustomScenario Issues.png
CustomScenario Issues.png (2.65 MiB) Viewed 520 times
WaaR 0.17 Gif (Created in 17.11).zip
(108.81 KiB) Downloaded 19 times
WaaR 0.17 Gif (Created in 16.51).zip
(30.87 KiB) Downloaded 26 times

Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu May 04, 2017 12:07 pm

Re: [0.17.11] Inconsistant Mod Behaviour on Custom Created Map

Post by TreefrogGreaken »

So I've been doing a bit of investigation.

This looks to be an error in the initialization phase. The mod onit function sets up a list of global variables and tables. It seems that when in a scenario, the init function is messing up my global.LandFill table and filling it with 4000 entries, thus causing the large amount of scripting time.

It doesn't matter if I move this piece of code about in the init list, or change its name.

Code: Select all

function WaaRInit()
	if not global.WaterGlobalArea then global.WaterGlobalArea = {} end
	if not global.OPLocate then global.OPLocate = {} end
	if not global.ODLocate then global.ODLocate = {} end
	if not global.LandFill then global.LandFill = {} end
	if not global.Type then global.Type = 0 end
	if not global.FluidProducers then global.FluidProducers = {} end
	if not CWtr then CWtr = 0 end
	if not CDpWtr then CDpWtr = 0 end
	if not AmountWtr then AmountWtr = 1 end
	if not global.WaterFlow then global.WaterFlow = 0 end
	if not global.CrudeFlow then global.CrudeFlow = 0 end
	if not global.LastWaterFlow then global.LastWaterFlow = 0 end
	if not global.LastCrudeFlow then global.LastCrudeFlow = 0 end
	if not WaterBodyType then WaterBodyType = 0 end
	if not global.NewInstall then global.NewInstall = 0 end
	if not ActiveOPs then ActiveOPs = 0 end
	if not ActiveODs then ActiveODs = 0 end
	if not global.PercentChange then global.PercentChange = 0 end
	if not global.Added then global.Added = 1 end
	if not NewTick then NewTick = 0 end
	if not NIW then NIW = 0 end
I've had to specify this event

Code: Select all

And function

Code: Select all

function ScenFunc()
	global.LandFill = {}
I've also had a player with weird bugs during a normal play through, so I'm wondering if my mod is tripping up over an initialization bug?

Link to latest version of the mod: https://www.dropbox.com/s/2xka5ds78bbdt ... 2.zip?dl=0

Factorio Staff
Factorio Staff
Posts: 11923
Joined: Wed Jun 11, 2014 5:23 am

Re: [0.17.11] Inconsistant Mod Behaviour on Custom Created Map

Post by Rseding91 »

Can you confirm if this is still happening in the latest 0.17 using a fresh map and scenario? I think I fixed it but your reproduction steps are quite complicated :)
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Pending”