Caves


Adds a cave system to the game that contains the resources instead of the normal surface.

Content
6 years ago
0.15
19
Mining

i Both Surface and Underground

6 years ago

Does your mod (or do you know of any other cave mods) allow both resources at the surface level AND underground?
Regards,
~B

6 years ago
(updated 6 years ago)

I started a discussion on that here, this mod does not currently support it: https://mods.factorio.com/mods/CaveGrinder/Caves/discussion/17210

There is a bit of technical discussion about multiple features in that thread tho, might be good to break it out here

There are other mods that allow multiple "surfaces" with resources, but I haven't seen any that provide a cave-like experience

6 years ago

yes might be easier to have a thread for only this here
Currently not yet, but i want to add this.
I was struggling a bit with how to do the settings, since i wanted a nice dialog (e.g. dropdown/checkbox per existing resource) but that seemed to be impossible in a generic way. (no access to the global state at that point)
so i am considering an approach quite similar to bitbased's patch; one string to specify which resources are excluded from the transfer into the cave.

6 years ago
(updated 6 years ago)

This is the format of the string I ended up with for "List of surface resource names":

Basic usage for specifying which resources should be only on the surface:
all -- all resources are surface resources, no cave resources
both -- all resources are both on surface and cave
crude-oil -- crude oil is on the surface but not in the cave
crude-oil stone -- crude oil and stone are on the surface and not in the cave
both coal -- coal is only on surface, but all other resources are both on surface and cave

More advanced usage with + for including a resource both on surface and cave:
+all -- same as "both" above
+stone -- stone is both on surface and in cave, all other resources are only in cave
crude-oil +stone -- stone is both on surface and in cave, crude-oil is only on the surface, all other resources are only in cave
all +coal -- all resources are only on surface, except for coal, which is also in cave

Here are the patched files, and a git diff:
https://www.dropbox.com/s/071b65en9virfwy/SurfaceResourcesPatch.zip?dl=0
https://www.dropbox.com/s/ivi17l66i7ia5zm/SurfaceResourcesPatch.diff?dl=0

6 years ago
(updated 6 years ago)

thanks for the diff; i have implemented it now into 0.1.6
basically i liked the flexibilty you added here, but thought that for a user it is difficult to specify it like that. so instead i added a dropdown for the default value ("nowhere", "cave-only", "surface-only", "cave and surface"), and then 4 additional string settings where users can name individual resources that should behave differently. the default is that crude-oil is surface only, and stone is both, everything else is cave-only.
i added this now in version 0.1.6.

i investigated the direction of the data-raw-prototypes approach, but finally decided against it. i think it is a quite useful mod but i am not sure how robust it is against future changes, and i don't want to force a dependency on to all users. (an optional dependency doesn't make sense to me here since that makes the code more complex while providing more confusion to users).
also, personally i am not a fan of regular expressions although i see that without a string split function in lua it kind of forces that direction; but for me they are always a mystery; especially when i later have to come back to them for debugging :)

6 years ago
(updated 6 years ago)

Tnanks, sounds great! ... and yes, regex in Lua being completely different (and less powerful) than basically every other languages regex is also "fun" :-D

6 years ago
(updated 6 years ago)

Sounds awesome! I assume this is something recommended for new game starts only, right?

6 years ago

yes, on an existing save the same settings as before are in effect, and changing the settings after map creation won't take an effect. maybe it should, but i didn't consider that.

New response