CC BY-NC 4.0
You may use this mod and its code for non-commercial use, provided you give credit to me for such use.
I would appreciate a notification if you intend to include it in a modpack.
Long description
Combustion and Underground Mining
This mod adds deeper stores of the typical resources - iron or copper ore, coal, or stone (and potentially any new resources added by other mods!). Where vanilla Factorio has shallow deposits of such resources, this mod adds deeper versions, with unlimited potential. Underground resources are only accessible through the underground mining drill, but act like oil: slowly becoming less productive but never completely depleting. So when you've completely exhausted that patch of iron ore, you can replace your old mining drills with the new underground drill and leave your supply line almost just as it was!
Underground Mining adds a new technology with two levels: Combustion Drilling 1 and 2.
Combustion Drilling 1 is unlocked by Engine and provides the diesel drill, which is crafted from a regular burner drill, an engine unit, two iron gear wheels, and one piece of steel. The diesel drill mines only the area directly underneath it (like the burner drill) but its size is 3x3. Using a proper engine, it is much more efficient than the burner drill: it mines 20% faster than the electric mining drill and consumes a little over half the fuel of a burner drill.
Combustion Drilling 2 is unlocked after Oil Processing (and, of course, Combustion Drilling 1) and enables the underground mining drill. Crafted from two diesel drills, a steel furnace, two iron gear wheels, and 4 pipe to ground units, the underground mining drill is a 4x4 structure that is capable of accessing underground resources. There is no electric version of this drill: you must provide a steady source of fuel to keep the resources coming! In addition, you will need to use some method of filtering (smart inserters, or perhaps logistics chests), because sometimes stone will appear instead of the resource you intend (unless, of course, stone is what you want...)
Except in the richest areas, underground mining can be a little risky: each time the miner "completes" a mining cycle, it may not produce anything (not even stone ). As more resources are pulled from the ground, this chance will increase, but (like oil), it will never become zero.
New Mining Drills
Diesel Drill (3x3): Mining power 3, mining speed 0.7 (140% an electric drill). Energy consumption 160kW (burner), pollution 12
Underground drill (4x4): Mining power 4, mining speed 0.75 (roughly twice as fast as an electric drill). Energy consumption 420kW (burner), pollution 19
Pictures
combustionresearch.jpg (26.84 KiB) Viewed 31064 times
combustiondrills.jpg (96.82 KiB) Viewed 31064 times
Version history
Version history
0.0.3 (2016/01/04): Updated previous version (Factorio 0.11.x) for 0.12.11. Tweaked drill performance and vastly improved resource generation algorithm.
0.0.4 (2016/01/07): Fixed error with loading a saved game, because I'm a moron and try to use gamescript in on_load.
0.1.0 (2016/01/15): Fixed error with loading a saved game, because I'm a moron and didn't fully fix it the first time. Adding the mod to an existing save is currently broken (won't add underground ores to existing map), but won't break your game.
0.1.1 (2016/03/13): Revisited the logic for detecting changes. Should work correctly when introduced to an existing save game. Also increased speed of diesel drills from 0.6 to 0.7
Attention Mod Authors
This mod does its best with default settings to handle any new resources intelligently. However, it also provides for other mods to be more specific in how it handles any new resources. These methods are explained in data.lua.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Jan 07, 2016 10:09 pm
by Schmendrick
Fixed a stupid bug.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Fri Jan 15, 2016 3:58 pm
by TRauMa
Hello,
with factorio 0.12.17 (linux-x64) and v0.0.4 of your mod I get this error when I load a previously existing save created without the mod:
Error while running the event handler:
__underground-mining__/control.lua:147: bad argument #1 to 'next' (table expected, got nil)
No other mod messes with mining and ores, except Test Mode and Ore Expansion.
If you need more info, just poke me.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Fri Jan 15, 2016 4:28 pm
by Schmendrick
TRauMa wrote:Hello,
with factorio 0.12.17 (linux-x64) and v0.0.4 of your mod I get this error when I load a previously existing save created without the mod:
Error while running the event handler:
__underground-mining__/control.lua:147: bad argument #1 to 'next' (table expected, got nil)
No other mod messes with mining and ores, except Test Mode and Ore Expansion.
If you need more info, just poke me.
Yeah, I know. My conversion to ..11+ was incomplete, and I didn't test it enough in my rush to get it out. I have my local copy fixed, but the whole issue of loading an old save (or regenerating ore) is kinda broken right now. It's probably something simple I've overlooked, but I don't have time to work on it more at the moment. I suppose I should upload what I have though...
Re: [MOD 0.12.11+] Underground mining drills
Posted: Fri Jan 15, 2016 4:57 pm
by TRauMa
Schmendrick wrote:I suppose I should upload what I have though...
If you do, I'll perhaps look into bringing it up to speed over the weekend (didn't look inside yet, so no promises ).
Re: [MOD 0.12.11+] Underground mining drills
Posted: Sun Mar 13, 2016 1:39 pm
by vanatteveldt
Can I use this on an existing map (i.e. already played without the mod)?
Do I need to place this on an existing ore patch? Or can I place it on a completely exhausted ore patch?
How does deep mine yield (per second and per fuel used) compare to regular electric mine yield on a not-yet-depleted patch?
(i.e. is intended use to first strip an ore patch using regular mines, and then place deep mines, or directly place deep mines?)
Re: [MOD 0.12.11+] Underground mining drills
Posted: Sun Mar 13, 2016 9:25 pm
by Schmendrick
Updated/fixed.
vanatteveldt wrote:Can I use this on an existing map (i.e. already played without the mod)?
Yes. Version 0.1.0 didn't, but 0.1.1 should work again.
Do I need to place this on an existing ore patch? Or can I place it on a completely exhausted ore patch?
How does deep mine yield (per second and per fuel used) compare to regular electric mine yield on a not-yet-depleted patch?
(i.e. is intended use to first strip an ore patch using regular mines, and then place deep mines, or directly place deep mines?)
The mod adds an "underground" version of the resource, which normal drills can't mine (just like a normal mining drill can't drill for oil), and it places patches of the underground ore in areas where the "surface" resource is (you can see this in the second picture). So you could put both normal miners and underground miners in the same patch. But underground mining is slow, unreliable, pollutes very much, and sometimes yields stone instead of (or in addition to) what you wanted - and sometimes completes a mining cycle without producing anything, if it is a poor vein! (Underground resources will never completely run out, but their odds to produce with each cycle get less and less as time goes on, to a certain minimum.) So you would almost never want to use underground mining while there is still surface ore. A full deposit will yield ore roughly 50% faster than an electric miner, a depleted one (after taking into account its rate of "dud" cycles) might produce ore at 1/3 or even 1/5th the speed (it varies by resource).
Re: [MOD 0.12.11+] Underground mining drills
Posted: Sun Mar 13, 2016 10:08 pm
by vanatteveldt
I added the mod to a game I'm running, but I don't see any "underground ore" sprites like in your picture, and I can't place a undergroud miner on a depleted or active mine. Does it only work on new fields? Can I generate the ore layer somehow?
Re: [MOD 0.12.11+] Underground mining drills
Posted: Mon Mar 14, 2016 12:14 am
by Schmendrick
Hm. I'm not sure what went wrong. The mod works by watching as new map is generated and placing the underground resources where it already finds surface ones. When it's starting with a pre-existing map, it will base them on whatever is left on the surface at that time, so you won't get underground fields anywhere you've already removed a field (or almost removed; the )
Do you have any other mods active? Is/was it a multiplayer map (it should work for multiplayer maps, but I haven't tested it so I can't be certain)?
I was going to give you a few commands to see if they helped, but I tested them myself to make sure they were working and... something's wrong with them. My underground resources generate appropriately on a new map, and seemed to do so when loaded into an existing save (though just a quick one I made for testing, not an established game), but I tested the regeneration function and it's buggy, so now I have that to look into. You're welcome to try it anyway in the meantime.
Bugged Regeneration
There is a way to manually force regeneration of a resource type, but it might take a while on a large map. Hold your mouse cursor over a resource (so that it appears in the information bar on the right), and while the mouse is there enter the command
I ran the command with my cursor on an iron ore field. It hung for a while (30 seconds or so), but didn't seem to generate any underground resources (not visible and a deep miner has no expected resources and can't be placed). What it did do is mess up my resource count according to YARM, it went down to 0 for all my iron ore fields. I'm now restarting without YARM, if that doesn't fix it Il'l post a list of all mods.
Edit: no luck. List of mods is copied below. Anything else I can try? Want me to post my savegame?
vanatteveldt wrote:I ran the command with my cursor on an iron ore field. It hung for a while (30 seconds or so), but didn't seem to generate any underground resources (not visible and a deep miner has no expected resources and can't be placed). What it did do is mess up my resource count according to YARM, it went down to 0 for all my iron ore fields. I'm now restarting without YARM, if that doesn't fix it Il'l post a list of all mods.
Edit: no luck. List of mods is copied below. Anything else I can try? Want me to post my savegame?
Ok well first of all, the regenerate command takes so long because it records EVERY resource tile (of the resource in question), deletes it, calls Factorio's regenerate function, places the underground resources, deletes all the newly regenerated resources, and then recreates each of the recorded patches. This is why YARM got zeroed out: all the resources it was monitoring were destroyed and replaced with copies. This also means that regeneration is incompatible with RSO: it will place underground ore where vanilla would have generated them (and if I remember correctly, RSO actually zeroes out this generation to avoid being interfered with). So regenerate won't work for you with RSO. I'm still not sure why no patches were generated when you loaded the map, though, because it looks at existing resources (and it waits a tick before doing so, to ensure mods like RSO have a chance to do their thing first). I still suspect there's an issue with RSO though. I haven't looked at its more recent versions very closely, and maybe some of those changes are part of it. Underground mining looks at resource autoplace information to generate appropriate values for the underground stuff, and right now I'm thinking my mod is seeing a lot of zeroes and deciding nothing's worth existing. I'll take a look into it to see if that's the case, and try to come up with a good fallback if it is.
(This still doesn't help me figure out what's wrong with my own broken regeneration function though... it works, kinda, but with weird large gaps in the underground patches.)
Re: [MOD 0.12.11+] Underground mining drills
Posted: Mon Mar 14, 2016 9:11 pm
by vanatteveldt
Cool! Give me a shout when I can do/test anything. Happy debugging
Re: [MOD 0.12.11+] Underground mining drills
Posted: Wed Mar 23, 2016 2:55 am
by Overene
Schmendrick wrote:
vanatteveldt wrote:I ran the command with my cursor on an iron ore field. It hung for a while (30 seconds or so), but didn't seem to generate any underground resources (not visible and a deep miner has no expected resources and can't be placed). What it did do is mess up my resource count according to YARM, it went down to 0 for all my iron ore fields. I'm now restarting without YARM, if that doesn't fix it Il'l post a list of all mods.
Edit: no luck. List of mods is copied below. Anything else I can try? Want me to post my savegame?
Ok well first of all, the regenerate command takes so long because it records EVERY resource tile (of the resource in question), deletes it, calls Factorio's regenerate function, places the underground resources, deletes all the newly regenerated resources, and then recreates each of the recorded patches. This is why YARM got zeroed out: all the resources it was monitoring were destroyed and replaced with copies. This also means that regeneration is incompatible with RSO: it will place underground ore where vanilla would have generated them (and if I remember correctly, RSO actually zeroes out this generation to avoid being interfered with). So regenerate won't work for you with RSO. I'm still not sure why no patches were generated when you loaded the map, though, because it looks at existing resources (and it waits a tick before doing so, to ensure mods like RSO have a chance to do their thing first). I still suspect there's an issue with RSO though. I haven't looked at its more recent versions very closely, and maybe some of those changes are part of it. Underground mining looks at resource autoplace information to generate appropriate values for the underground stuff, and right now I'm thinking my mod is seeing a lot of zeroes and deciding nothing's worth existing. I'll take a look into it to see if that's the case, and try to come up with a good fallback if it is.
(This still doesn't help me figure out what's wrong with my own broken regeneration function though... it works, kinda, but with weird large gaps in the underground patches.)
This actually seemed like a cool mod until I realized that underground ores appear only in the spawn area and no where else.
Was happy to delete this.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Wed Mar 23, 2016 3:22 am
by Schmendrick
Overene wrote:This actually seemed like a cool mod until I realized that underground ores appear only in the spawn area and no where else.
Was happy to delete this.
Thank you for the compliment! Sorry you deleted a cool mod.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Mar 24, 2016 1:43 am
by Dreadicon
Just wanted to chime in that I love your mod and am quite happy you have kept it up to date. It's my favorite of the 'underground mining' mods.
A suggestion for the regen script: you might need to just brute-force it and scan the whole map manually; same for newly generated terrain, or hook into RSO directly. I wouldn't sweat it too much though; I LOVE RSO and wouldnt play without it.....but the devs apparently have something of the same idea. In a recent blog post, they basically outlined a mining overhaul that's something like a combo of RSO and your mod. I don't think it will make your mod or RSO obsolete, but it will make both your and the RSO devs' lives easier as you won't be fighting/hacking with the game so much as tweaking it.
Another idea that just popped into my head: prospecting! Set it up such that using an item will scan the map chunk for resources and place them at that time. That way you only need a brute-force regen command, and a localized regen action.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Mar 24, 2016 5:17 am
by Schmendrick
Dreadicon wrote:Just wanted to chime in that I love your mod and am quite happy you have kept it up to date. It's my favorite of the 'underground mining' mods.
Thanks! Generally I like keeping things simple, and I like opening up options (hence my inclusion of the diesel drill; it's not just a stepping stone for the underground drill, though I'm not sure how much use it sees by players. It is more efficient than the basic electric drill, solar power aside).
Dreadicon wrote:A suggestion for the regen script: you might need to just brute-force it and scan the whole map manually; same for newly generated terrain, or hook into RSO directly.
Actually, this is pretty much what it does. It doesn't hook into RSO directly, but I have added a "refresh" option in my working build that just recalculates the underground resources based on current surface ones (without resetting anything), in case resources like RSO's haven't been caught for some reason.
Dreadicon wrote:In a recent blog post, they basically outlined a mining overhaul that's something like a combo of RSO and your mod. I don't think it will make your mod or RSO obsolete, but it will make both your and the RSO devs' lives easier as you won't be fighting/hacking with the game so much as tweaking it.
Yeah, I'm looking forward to it, provided it doesn't go against my personal ideas of game balance
In any case, they have been talking for a long time about exposing more of the map gen process to scripting, so hopefully mods like mine or RSO will be a lot cleaner and easier to implement, and even allow (non-hacky implementation of) complex stuff (abandoned villages? mazes?) ... eventually.
Dreadicon wrote:
Another idea that just popped into my head: prospecting! Set it up such that using an item will scan the map chunk for resources and place them at that time. That way you only need a brute-force regen command, and a localized regen action.
I prefer to add as few new items or interfaces as possible, so probably not. If I did do something like that (and I do have ideas for a more comprehensive mod, actually, that might), it would probably be through some sort of custom radar type.
That said, an update: The problem with RSO was, indeed, related to the way RSO modifies base resources to not autoplace (basically, its massive negative influence addition caused my richness estimator to use its sanity check to wrap around to very positive, pushing to insanely high levels the threshold of surface resource concentration required for underground to appear). I've fixed that, but I'm still getting weird gaps in placed underground resources. I'm not sure why.
If anybody is interested in giving it a shot, here is my work in progress. It's mostly the same as the version in the OP, but it works with RSO and it (still?) sometimes has odd gaps in the middle of a field. It should be usable overall though if you want to get right to using it on an RSO map.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Mar 24, 2016 11:50 am
by orzelek
The autoplace trick on RSO - I do think it's not needed but I didn't play with it to check how it works if it simply removes all the autoplaces. That wouldn't help you I think
Other thing is that RSO could spawn underground ore's in same way it upgrades ore to infinite one for Angelsores mod. It's quite easy to add - would need some input from you on how the infinite patches should relate to over-ground patches.
You can fire RSO with Angelsores to see how it works currently.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Mar 24, 2016 1:37 pm
by Schmendrick
orzelek wrote:The autoplace trick on RSO - I do think it's not needed but I didn't play with it to check how it works if it simply removes all the autoplaces. That wouldn't help you I think
Other thing is that RSO could spawn underground ore's in same way it upgrades ore to infinite one for Angelsores mod. It's quite easy to add - would need some input from you on how the infinite patches should relate to over-ground patches.
You can fire RSO with Angelsores to see how it works currently.
I think you misunderstand; the mod (probably) works fine with RSO as it (the 0.1.2 WIP) is; the inconsistencies it has at this point don't seem to be caused by RSO and are probably a completely irrelevant bug. I can't speak with 100% assurance because, of course, I haven't found the bug yet and one never knows. But it shows up both with and without RSO, which otherwise seems to be handled fine.
RSO doesn't remove autoplace settings, it just adds a constant -1000 influence peak to all of them, causing them to never be high enough to generate. Underground mining (which attempts to dynamically be as compatible as possible with any mods or vanilla changes) uses the autoplace information of a resource to estimate appropriate richness values/thresholds for its underground counterpart, and this was throwing it off. It now ignores any constant (non-noise/attribute layer) influence -- though I should probably change that to have it ignore any influences beyond certain bounds, instead (or as well).
Re: [MOD 0.12.11+] Underground mining drills
Posted: Thu Mar 24, 2016 4:23 pm
by orzelek
Schmendrick wrote:
orzelek wrote:The autoplace trick on RSO - I do think it's not needed but I didn't play with it to check how it works if it simply removes all the autoplaces. That wouldn't help you I think
Other thing is that RSO could spawn underground ore's in same way it upgrades ore to infinite one for Angelsores mod. It's quite easy to add - would need some input from you on how the infinite patches should relate to over-ground patches.
You can fire RSO with Angelsores to see how it works currently.
I think you misunderstand; the mod (probably) works fine with RSO as it (the 0.1.2 WIP) is; the inconsistencies it has at this point don't seem to be caused by RSO and are probably a completely irrelevant bug. I can't speak with 100% assurance because, of course, I haven't found the bug yet and one never knows. But it shows up both with and without RSO, which otherwise seems to be handled fine.
RSO doesn't remove autoplace settings, it just adds a constant -1000 influence peak to all of them, causing them to never be high enough to generate. Underground mining (which attempts to dynamically be as compatible as possible with any mods or vanilla changes) uses the autoplace information of a resource to estimate appropriate richness values/thresholds for its underground counterpart, and this was throwing it off. It now ignores any constant (non-noise/attribute layer) influence -- though I should probably change that to have it ignore any influences beyond certain bounds, instead (or as well).
I know those
I'm simply offering to add support to RSO - it would guarantee ore spawns when both mods are in use.
Edit:
Actually about your bug. I took a quick look in the code and it seems for me then there is no trigger for generation of underground ores other then calling the regenerate command. So generation happens once on init and then it won't fire unless triggered. Might be missing something tho.
Re: [MOD 0.12.11+] Underground mining drills
Posted: Sat Mar 26, 2016 2:23 am
by Overene
Schmendrick wrote:
Overene wrote:This actually seemed like a cool mod until I realized that underground ores appear only in the spawn area and no where else.
Was happy to delete this.
Thank you for the compliment! Sorry you deleted a cool mod.
Is there a way to make underground ores spawn farther away from spawn or was that just a bug?