Page 1 of 2

[0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 4:00 pm
by Schmendrick
Adds underground versions of surface resources; plays nicely with mods that add resources, as well as RSO. Yes, I know this concept has been done already in different mods, but I like to think of mine as a cleaner and more balanced implementation.
underground.jpg
underground.jpg (131.87 KiB) Viewed 36137 times
Underground resources are accessible only by the underground mining drill, and work like oil in that they lose richness (chance to produce) but eventually reach a minimum value. Underground mining also has a chance to bring up stone instead of the desired resource.

Adds the tech Combustion drilling (and Combustion drilling 2), which unlock the diesel mining drill and the underground (burner) mining drill, respectively. The diesel drill is simply an improved burner mining drill; the underground mining drill allows access to the new underground resources.
combustiondrilling.jpg
combustiondrilling.jpg (29.87 KiB) Viewed 36137 times
Underground resource generation can take a little time (especially if loading a large existing map, or loading for the first time after adding a mod that adds a new resource) on startup. When loading an old map, underground resources will be generated based on current surface values, not original ones. To force generation of underground resources based on original methods, use

Code: Select all

remote.call("underground-mining","regenerate")
while your mouse cursor is is hovered over a resource in question (this works for the first player only). If you are not the first player or for whatever reason can not reach a sample of such a resource, use

Code: Select all

remote.call("underground-mining","regenerate","iron-ore")
with the game engine name of the resource.

Using this method will *not* work nicely with alternate resource generation mods such as RSO, but rather will produce underground resources based on what vanilla autoplace settings would have yielded.

Mod authors: read the notes in data.lua to change the default behavior of this mod with your resources.
  • Fixed bug where the mod 'forgot' it had already generated ores, leading to sometimes enormous load times, every time.
  • Version for Factorio 0.12.11+

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 6:29 pm
by Schmendrick
Fixed load bug.

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 8:29 pm
by Trev_lite
do you think you could eventual add RSO comparability?

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 8:31 pm
by Schmendrick
Trev_lite wrote:do you think you could eventual add RSO comparability?
Schmendrick wrote:plays nicely with mods that add resources, as well as RSO.
RSO / alternate spawning mods will only be an issue when manually regenerating resources; there's not much of a way around this.

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 8:32 pm
by Trev_lite
YAY!
what would be the interaction of this mod with the infinite resource mod?

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 9:14 pm
by Schmendrick
This mod creates underground versions of any resource that:
  • Has an autoplace setting
  • Is of the default "basic-solid" resource category
  • Is not already infinite
It performs these changes in data-updates.lua, so if the infinite resources mod makes its changes in data.lua (or if for whatever reason is loaded by Factorio before Underground), then there will not also be underground copies made.

It names the new resource "underground-whatever", where "whatever" is the name of the source resource. If a mod adds resource(s) such that a "blah" and "underground-blah" both exist, this mod is likely to overwrite the "underground-blah" (though it has support to suppress this behavior if the mod author knows to indicate so). It will also place copies of "underground-blah" around deposits of "blah," based on their richness (there is currently no support to suppress this.)

Re: [0.11.21+] Underground mining drills

Posted: Sat May 09, 2015 10:29 pm
by Trev_lite
is RSO mod supposed to say underground-xxx is not configured and will not be spawned? (i think so)
maybe you can talk to who ever is currently maintaining RSO to not have this error messaged when both mods are used.

Re: [0.11.21+] Underground mining drills

Posted: Sat Jun 06, 2015 11:44 pm
by Schmendrick
So, as-is, underground ore generation is not very efficient, and can even crash Factorio if you load a large enough pre-existing map (especially with additional ores from mods). I'm working on making it a bit better, hopefully an update in a few days.

Re: [0.11.21+] Underground mining drills

Posted: Sat Jun 06, 2015 11:57 pm
by orzelek
I'm not sure how RSO should behave with this mod.

Reading your posts above - I think that RSO would need to take over spawning of underground copies of resources.
And fixed version of endless mod running in data-updates will mean no underground stuff - they are not needed then if I understand correctly.

To handle loading order I'd need to add dependency maybe - altho RSO does all the generation from control script so it would go after all data is ready.

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 12:07 am
by Schmendrick
Underground mining waits one tick after chunk generation (which is the time that RSO generates). So underground ores get placed after RSO places. With the exception of running the "regenerate" command (which runs Factorio's autoplace and then places underground ores based on them, then replaces the old surface resources), Underground mining works perfectly fine with RSO (or anything else that handles resource manipulation on the onchunkgenerated event). The upcoming update will wait even longer, because of the way I am spreading out the generation algorithm.

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 12:23 am
by orzelek
There are 2 ways:
1. Ignore the RSO warnings and all should work :D I can make it not display warning for underground-* ores.
2. Make RSO aware of underground resources and vice-versa. Then RSO can create the underground resource in it's own generation loop saving you lots of work. It goes creating resource tile by tile anyway.

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 12:37 am
by Schmendrick
orzelek wrote:There are 2 ways:
2. Make RSO aware of underground resources and vice-versa. Then RSO can create the underground resource in it's own generation loop saving you lots of work. It goes creating resource tile by tile anyway.
Underground ores are handled entirely by control.lua, based on surface resources generated by any method; it waits a tick to do its thing specifically so that it will work seamlessly with mods like RSO -- and it does, apart from possible warning announcements. Tightly integrating it with exceptions and special behavior for RSO (which would also need modification) is unnecessary, would only complicate its behavior with other configurations (including vanilla) as well, possibly, as updates to either mod, and would just generally be a waste of time.

The generated underground ores have no autoplace data. Resources with no autoplace data (from this or any other mod) will only ever be created by script and never by vanilla Factorio. Since RSO is intended to replace vanilla generation, perhaps it could be modified to ignore (and not produce warnings for) resources with no autoplace, since they are not under the purview of what it is replacing?

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 10:04 am
by orzelek
I'll take a look at adding auto-ignore for stuff that has no autoplace information. Might need to find some other mods that have resources like that but I have list of few already in explicit ignore list.

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 10:42 pm
by orzelek
It turns out that I can't check autoplace information - it's not accessible from control file.
I'll need to use the name prefix to suppress the warnings.

Re: [0.11.21+] Underground mining drills

Posted: Sun Jun 07, 2015 10:47 pm
by Schmendrick
Well, more and more info becomes available to scripting as versions advance... fingers crossed :)

Re: [0.11.21+] Underground mining drills

Posted: Wed Jun 10, 2015 2:57 pm
by Nafen
This does not seem to work with RSO despite RSO's changelog showing it now has compatibility ...

If I launch a new world with just RSO and Underground mining drills, no underground ores are generated. Even using Underground mining drills' regenerate command or RSO's regenerate command doesn't fix it.

Disabling RSO and restarting the game, Underground mining drills generates the underground ore on creating new world ..

Re: [0.11.21+] Underground mining drills

Posted: Wed Jun 10, 2015 5:58 pm
by orzelek
RSO's compatibility was only to disable it's ore check to not warn about unconfigured ores that underground mining drills make.
My guess would be that something broke with my RSO updates - I didn't do any long checking if to works properly.

Re: [0.11.21+] Underground mining drills

Posted: Mon Jun 22, 2015 8:01 pm
by Nafen
It sucks that they don't play nice together, I really like the idea that you would have to travel further away to get more resources to work with (RSO) but then you could still utilise each resource node once you have researched a bit more (underground drills).

Re: [0.11.21+] Underground mining drills

Posted: Mon Jun 22, 2015 9:19 pm
by orzelek
I might take a look at it at some point to try and figure out what's happening.
Not before 0.12 for sure.

Re: [0.11.21+] Underground mining drills

Posted: Fri Sep 18, 2015 12:52 pm
by Rhamphoryncus
Any news on updating underground mining drills for 0.12?

I poked at endless ores/bobsore infinite mode and underground mining drills seems much cleaner, so I'm quite curious to try it out.