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 Some above ground resources / Mineable cave walls

6 years ago
(updated 6 years ago)

It would make sense to have options for above ground resources. I think at least oil and stone would make more sense on surface.

6 years ago

I've been messing with the code a bit and added a setting for this. Also, mineable cave walls (high hardness yield 1 stone) ... think train systems in caves! @CaveGrinder let me know how I can contribute.

6 years ago

you can landfill the walls so why make it so you can mine it i don't see the point in that to be honest

6 years ago
(updated 6 years ago)

Oh! I did not know that haha, landfill is better UX and research requirement anyway!

Hmm, I was experimenting with having to mine away the cave walls to reveal more of the resource patch, not sure if I can get landfill to work with that.

6 years ago

Hi!

yes an option to set which resource is above or below ground makes sense; just need to ensure it works also when spawning might otherwise be disabled (e.g. stone is not generated with angel's ores). I didn't setup a github yet, but if you feel like sharing it, you could upload it somewhere and i can merge it in.

Landfill currently works, but isn't really intended since it doesn't make too much sense :)
But i was thinking of something similar to it, an item that might be craftable a bit later in the game, maybe requiring explosives. that way there would be a solution for the endgame while keeping the cave puzzle challenges in the early game.
I don't know exactly how yet, but i just saw
https://wiki.factorio.com/Types/CollisionMask
that there are custom layers (layer-11 and more) that might be usable for something like that. (will take a couple of days till i have time to try it though)

6 years ago
(updated 6 years ago)

Technical Investigation:

I was able to disable landfill by changing the wall collision mask from "water-layer" to player/item/object layer (can't landfill land). But then the wall can be replaced by brick/concrete tiles instantly. "water-layer" seems to be the only layer that does not allow tile replacement. I have some code to stop tile replacement by re-replacing tiles, not ideal tho :(

Also ... for fun, I hacked together some dynamite with a delay, and damage to nearby structures/player but clears walls https://www.dropbox.com/s/7f0wju62l9nfbr3/Screenshot%202017-07-18%2006.14.53.png?dl=0

I'm thinking early game you can mine as long as you have a pickaxe, but with a really long mining time and hardness.

As you can see, I'm having some issues with allowing resources to spawn in walls, which would make the excavation more meaningful. I want wall tiles to hide resources, but tiles cant draw over resource layers, seems baked in to the core. :(

6 years ago

So for the landfill, found an easier way:
I just gave the wall both the "water-tile" and "ground-tile" (and others).
for the "enhanced-explosive-landfill" (name subject to change) i just use an empty condition value.
The result is that concrete is not placeable due to the water, landfill is not usable due to ground. But the new one works just fine.
(side effect is that this item could be used to fill actual water, but for me that would be fine since i would make the recipe cost something like 1 explosives + 2 landfill = 1 enhanced-explosive-landfill, so there is no point in using it for water)
the throwable dynamite is neat, not sure if i want to go that route though (the mod is already very script heavy).
I think making the walls also mineable might be an option; i am not sure if it should be on by default and how to balance it. i feel like it should be a bit difficult to remove walls, otherwise players will just mine it all flat even in the early game. (i am thinking of 30 seconds with an iron pick for a start. This would mean that players can remove really troublesome corners, but not create hallways without the better landfill)

i have not found a way to have resources below the walls either. Unfortunately regeneration can only done for whole chunks and not per tile, so you cannot create it afterwards(correctly at least. a hack would be to create the entity by simply looking in yet another surface for what the map generator should have created, and copy it over.)
I am not sure about the resources below walls in general, because it means that the goal for the player will be to tear down all walls in order to get everything...

6 years ago
(updated 6 years ago)

Landfill fix sounds great! .. also maybe the goal "should" be to tear down walls to get everything :D ... but maybe as an option "mining mode"

Was going to make a patch but had a tabs vs spaces issue and it's not that much code, so I made kind of a manual patch. This adds optional surface resources, with default set to crude-oil:

https://pastebin.com/vsnCgeep

Also, I think I have an idea for allowing resources inside walls ... placing a dark image entity over all overlapping resource/wall tiles, so the resources within walls are basically just darker but you could still see where they were! Something like what this mod does: https://mods.factorio.com/mods/nucleargen/Mountains-up

Edit: Had issue when experimenting with your "enhanced-explosive-landfill" idea ... here is a quick patch that will convert cave-ground tiles to grass tiles if they happen to get placed on the surface https://pastebin.com/5rXhhsz5 ... alternatively, the explosive landfill could place "grass" tiles, and the cave could replace them with "cave-ground"

6 years ago

thanks, yes saw that too that you would end up with cave-ground when using it one the surface (but then again, the regular landfill recipe creates grass out of stone); it probably makes sense to place grass on the surface. (probably i would flip it so it places cave-ground only in caves, for the situation that a player might use it in another surface)

6 years ago

so i have finalized (for now) the minable walls aspect; went for hardness = 0.2, mining_time = 20.0 which felt ok. (Also it gets better with a steel-axe).
i tried the approach to replace the tile in on_player_built_tile (thanks for finding that one-off bug, would have taken me some time). But it has a problem: the game tries to place tiles whenever the mouse is moved. so if i would try to replace a 4 wall segment, it could end up wasting hundreds of items. The reason is that the game prevents tile placement if the tile is already there. So if the script changes the tile, then one tick later the game tries to place a tile again.

finally i just made 2 seperate items; one that places dirt and another that places cave-ground. so the player just has to craft the right one.

For resources below walls: i think i would rather wait for 0.16 to see how they will adress the flatness. I could imagine if they find an approach, that it could be useful for this problem too.

New response