[MOD 0.12.x] Finite Water

Topics and discussion about specific mods
ljdp
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Wed Jul 01, 2015 12:33 am
Contact:

[MOD 0.12.x] Finite Water

Post by ljdp »

Name: Finite Water
Description: Offshore pumps slowly drain lakes until they are removed entirely.
Licence: MIT
Version: 1.0.0
Last Release: 2015-08-04
Tested With Factorio: 0.12.1
Dependencies: Factorio 0.12.x
Tags: Enhancement, Water, Lakes, Finite
Download Link: https://github.com/perky/factorio-finitewater/releases
Updated download by db48x.

This mod adds functionality for finite water. Offshore pumps will slowly drain lakes, causing them to shrink until they disappear entirely. The more pumps at a single lake, the faster it's drained. Huge oceans aren't affected and are still infinite sources of water.

See a GIF of Finite Water in action. (Sped up for demonstration purposes)

If you want to change how fast the water is drained, perhaps to show it off in a spotlight, then in water_drain.lua you can change line 11: "local WATER_PER_TILE". Setting that to something small like 1 or 0.5 will cause lakes to drain really fast.
Last edited by ljdp on Mon Apr 25, 2016 10:06 pm, edited 3 times in total.
Dawnzy
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Aug 04, 2015 6:02 pm
Contact:

Re: [0.12.x] Finite Water

Post by Dawnzy »

Looks interesting, could be quite nice for a hardcore playthrough :)
Darloth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [0.12.x] Finite Water

Post by Darloth »

If it's possible to add a new ground texture, then a sandy ground texture that has almost no border with water, but a strongly defined border with grass/sand/other, would make it look like you're leaving a lake-bed behind.

I'm not sure it actually is possible to add new ground textures like this (they'd be a new biome, I assume, and I don't know how the graphics for in between biomes / terrain works) but it's a nice idea.

Regardless, good stuff, thanks!
ares0027
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun May 04, 2014 6:48 pm
Contact:

Re: [0.12.x] Finite Water

Post by ares0027 »

awesome one. but i was guessing maybe add some ore generation to it? (i have no idea if it is possible) but i dont know some stones, or if we are lucky other ores "generate" occasionally from water?
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: [0.12.x] Finite Water

Post by db48x »

This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.
ljdp
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Wed Jul 01, 2015 12:33 am
Contact:

Re: [0.12.x] Finite Water

Post by ljdp »

db48x wrote:This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.
Thanks, i've re-uploaded a fixed version.

So far I'm happy with the balance in my current play-through. 2 hours in and I had a blackout and I was thinking "there's loads of coal left", completely forgot about my own mod! Rather than moving all my boilers I created a huge pipeline to another lake, which I thought looked pretty cool, there are some really long pipelines here on earth. I am interested to hear how it spans out in other people's maps.
Airat9000
Smart Inserter
Smart Inserter
Posts: 1418
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: [0.12.x] Finite Water

Post by Airat9000 »

ljdp wrote:
db48x wrote:This is working well so far, but there's a bug that must be fixed before it'll run. The data.lua script loads prototypes/items.lua, but the file is actually called entities.lua. The easiest fix is to extract the contents of the zip file, then navigate into the prototypes directory and rename entities.lua to items.lua. Then go back and delete the zip file (Factorio won't start if it detects duplicate mods).

I can't say for sure how the balance is; this map I'm using has quite a large number of medium-sized ponds so I doubt I'll ever run out. It does work though. Our power generation is pumping from one of the smaller ponds in the starting area and it's gotten smaller as we played. It's slow enough that you have to pay close attention to notice it. I expect that this small pond will last through the mid-game before we must pump from somewhere else.
Thanks, i've re-uploaded a fixed version.

So far I'm happy with the balance in my current play-through. 2 hours in and I had a blackout and I was thinking "there's loads of coal left", completely forgot about my own mod! Rather than moving all my boilers I created a huge pipeline to another lake, which I thought looked pretty cool, there are some really long pipelines here on earth. I am interested to hear how it spans out in other people's maps.
the author, it would be good to do all the same ends oceans.
orzelek
Smart Inserter
Smart Inserter
Posts: 3923
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.12.x] Finite Water

Post by orzelek »

I think you might need to mark this mod as single player only.

My lua knowledge is a bit limited but I was curious to see how you implemented the water removal and took a peek - this mod is threaded which might mean desyncs in multiplayer.
ljdp
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Wed Jul 01, 2015 12:33 am
Contact:

Re: [0.12.x] Finite Water

Post by ljdp »

orzelek wrote:I think you might need to mark this mod as single player only.

My lua knowledge is a bit limited but I was curious to see how you implemented the water removal and took a peek - this mod is threaded which might mean desyncs in multiplayer.
The mod uses coroutines but that isn't to be confused with threads. Coroutines are still deterministic. (But I haven't tested this with multiplayer yet).
adalah217
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Aug 09, 2015 5:34 am
Contact:

Re: [0.12.x] Finite Water

Post by adalah217 »

Awesome mod. Perfect for an added challenge to a world with "very low" resources, and forces me to use trains to transport water from far.

I seem to be getting weird behavior though. At the beginning of the game, I drained a small pond fairly quickly with ~5 steam engines and a few boilers. I set up a new intake, and eventually it started going down too. But it just kinda stopped. Water across the map is staying infinite, across all the ponds. I double checked to make sure I had the mod installed of course. Maybe some weird behavior with bob's mod? Maybe the larger pond is acting like an ocean? Or maybe I haven't observed long enough to watch the water drain. Either way, I tried draining the water into about 10 fluid tanks and nothing happened. Just wanted to drop by and mention it :) Bob's mods are the only other thing installed.
Degraine
Filter Inserter
Filter Inserter
Posts: 282
Joined: Wed Aug 13, 2014 10:49 am
Contact:

Re: [0.12.x] Finite Water

Post by Degraine »

Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [0.12.x] Finite Water

Post by TheSAguy »

Degraine wrote:Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?
Great mod idea, going to give it a try when I have the time!

To add to the above note from Degraine, I think that small bodies of water should drain faster than larger bodies. Since larger bodies should be deeper and get more input that smaller bodies of water.
So very large bodies will take a very long, close to infinite to drain.
reddutton
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sun Jul 19, 2015 12:35 am
Contact:

Re: [0.12.x] Finite Water

Post by reddutton »

TheSAguy wrote:
Degraine wrote:Now all we need is a weather mod to add rain that refills the lakes.

It looks like it has a maximum range it will draw from, similar to how Red Power's drain + pump worked in Minecraft (which is probably the only sane way to do it, really). Have you thought about an option for sufficiently large bodies of water to be inexhaustible?
Great mod idea, going to give it a try when I have the time!

To add to the above note from Degraine, I think that small bodies of water should drain faster than larger bodies. Since larger bodies should be deeper and get more input that smaller bodies of water.
So very large bodies will take a very long, close to infinite to drain.
this would be a nice feature even if there are tiers of pumps for the range they can pump
thy may be stupid but thy am smart (reddutton 2006 seconlife)
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [0.12.x] Finite Water

Post by Afforess »

FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [0.12.x] Finite Water

Post by TheSAguy »

Afforess wrote:FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.
I've had this happen a few times with me. I think the freeze occurs when you empty a body of water, while laying new pipe.
I've opened a crash report: https://forums.factorio.com/forum/vie ... =7&t=15144

Still love the mod!
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [0.12.x] Finite Water

Post by Afforess »

TheSAguy wrote:
Afforess wrote:FYI, I have noticed this mod tends to cause unpredictable and non-reproducible freezes (In the console it reports that a linked-list has been corrupted in the game engine). This is not a normal factorio crash where you get logs, it is a very terse error message, and the game stays up, but no longer accepts input. I am on Linux, but I suspect this issue occurs on all platforms. I am suspect this is due to the use of coroutines, and that the game engine does not support asynchronus access to the lua API. I think it would be worthwhile to either a thread-safe lua API from the game devs, or rewrite this mod to not use coroutines.

The issue tends to occur when a lake or body of water nears becoming completely drained, although I have rarely had it occur in otherwise normal gameplay.

Just a word of caution to users, if your game freezes/crashes, try uninstalling this mod.
I've had this happen a few times with me. I think the freeze occurs when you empty a body of water, while laying new pipe.
I've opened a crash report: https://forums.factorio.com/forum/vie ... =7&t=15144

Still love the mod!
My crash doesn't look like yours. I intentionally started using a script that captures the stdout/stderr for factorio so I could catch the exact message next time. Here is an example of my log, and the only error msg I see:
*** Error in `/home/afforess/Downloads/factorio/bin/x64/factorio': corrupted double-linked list (not small): 0x00007fb7c4030a00 ***
ljdp
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Wed Jul 01, 2015 12:33 am
Contact:

Re: [MOD 0.12.x] Finite Water

Post by ljdp »

Interesting, not had that error.
I doubt it is because of coroutines, coroutines are not like threads, they are synchronous. But I would like to hear from the devs if they cause any other side-effects.
orzelek
Smart Inserter
Smart Inserter
Posts: 3923
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [MOD 0.12.x] Finite Water

Post by orzelek »

ljdp wrote:Interesting, not had that error.
I doubt it is because of coroutines, coroutines are not like threads, they are synchronous. But I would like to hear from the devs if they cause any other side-effects.
Devs already said that coroutines are not tested so might cause unexpected behavior.
Take a look here:
Suspicious bug thread
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: [MOD 0.12.x] Finite Water

Post by db48x »

I've updated the mod for 0.12.11 and put the code into a fork of the github repository at https://github.com/db48x/factorio-finitewater.

Initial testing looks good, though I cannot be entirely sure I haven't broken anything.
Attachments
finitewater_1.0.1.zip
My modified version of the Finite Water which supports Factorio 0.12.11.
(87.22 KiB) Downloaded 427 times
User avatar
Darkestnoir
Inserter
Inserter
Posts: 30
Joined: Sun Nov 23, 2014 8:57 pm
Contact:

Re: [MOD 0.12.x] Finite Water

Post by Darkestnoir »

Code: Select all

Error while running the event handler: __finitewater__/water_drain.lua:52: attempt to index field 'water_drain' (a nil value)
Can't start a new game with 12.13.
Post Reply

Return to “Mods”