i there a MOD that hides resources from players, and you have to prospect to find more.

This is the place to request new mods or give ideas about what could be done.
Post Reply
MasterW3
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Aug 13, 2018 11:53 pm
Contact:

i there a MOD that hides resources from players, and you have to prospect to find more.

Post by MasterW3 »

so i was think ing of a MOD that hides the resources form the player, you dont see them on the map, or in game, you might see a fewe piecesof ore in game, but that is random.
the thoughtr is that you would riun around wioth yuor pick and ''test' the ground, if you find ore, it reveals itself.
you can get and upgrade to a metal detector, takes the place of a weapon, uses bastteries for "ammo" and reveals spots on the ground when you walk over them.
bigger detectors can be researched, revealing larger areas at a time, suing less battery power.
i would say 1 battery would be like 100 ammo with this.
maybe then use a radar when crafting at some point, if not early on...
the first starting resources would be visible by a few pieces visikble on the ground.

is this possible?
can it be done?

early crafting recipe for metal detector would be like:
copper wire
metal plate
copper plate

possibly some power armor version that could be added when you get the going.. 2x2 slot on the grid .. infnite power with solar panels..
just tossing stuff in the air to see what hits a creative juice.

had a stroek, so the typing is horrendous.. plaese firgive.

is it possible?

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 380
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: i there a MOD that hides resources from players, and you have to prospect to find more.

Post by Silari »

I don't know of any mod that does it, but it should be possible to do something very similar.

After the map loads and the starting area is generated (so the player has some initial resources to use to make a detector) copy the map_gen_settings somewhere safe, then make another copy with the frequency of any ores in the autoplace_controls set to 0. Set that copy to the surfaces map_gen_settings. This will stop the map from creating any ore when new sectors are created. You'll also need to keep a record of what chunks were generated at this point - since they were generated with ore you don't want them to be scanned for ore. Tweaking the frequency/size/richness settings might let a tiny bit of ore peak out to alert the user there is a patch there to be scanned.

A weapon or capsule can have a script effect when fired, so making a detector should be easy enough, with multiple sizes. Making it work via walking would require the on_player_changed_position event, which could work but might end up taking some time if there are a lot of players. Radars are also doable with some limitations, as there's an on_sector_scanned event that could be used (IIRC radars won't scan sectors that are otherwise revealed, so they could miss some chunks that need to be checked for ores).

In any case when something needs to scan a chunk for ore, you copy the original map gen settings to the surface, call surface.regenerate_entity({<a list of all the ores you 0d back in the first step}, {list of ChunkPositions to scan for ore in}), then copy the modified map gen settings back to the surface. That'll make it spawn any ore that normally would have been generated in those chunks. Again, you'll need to track what chunks have been scanned for ore so that users can't rescan the chunk to get a bunch more ore again. I'm not sure if regenerate_entity will always make ore in the exact same way as the original generation does (if ores are on top of each other, for instance) but its not likely that big of a deal.

That method should work for anything that uses vanilla ore generation, and isn't messing with map_gen_settings during the run time. Using a list of ores would allow for supporting modded ores, and even making some ores generate normally and others require scanning. Multiple surfaces could be supported easily as well by storing the map gen settings in a table of surfacename->settings.

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2334
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: i there a MOD that hides resources from players, and you have to prospect to find more.

Post by BlueTemplar »

Diggy kind of does that in a contrived way, also implementing its own ore generation. (Later versions have tendrils of ore sneaking around (shown for debug purposes here).)

Something like this would be a cool new feature for the Factorio official expansion !
BobDiggity (mod-scenario-pack)

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 1029
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: i there a MOD that hides resources from players, and you have to prospect to find more.

Post by FuryoftheStars »

Silari wrote:
Wed Jan 12, 2022 1:14 am
After the map loads and the starting area is generated (so the player has some initial resources to use to make a detector) copy the map_gen_settings somewhere safe, then make another copy with the frequency of any ores in the autoplace_controls set to 0. Set that copy to the surfaces map_gen_settings. This will stop the map from creating any ore when new sectors are created. You'll also need to keep a record of what chunks were generated at this point - since they were generated with ore you don't want them to be scanned for ore. Tweaking the frequency/size/richness settings might let a tiny bit of ore peak out to alert the user there is a patch there to be scanned.
Does resource generation raise any events? Even if it's just an entity built event? Alternatively, on chunk generation, you can scan the chunk for resources. With this, you could potentially grab the resource information and store it away, then delete the resource until "scanned" later and put it back. This would be a bit more compatible with mods that handle resource generation on their own (RSO).
Silari wrote:
Wed Jan 12, 2022 1:14 am
(IIRC radars won't scan sectors that are otherwise revealed, so they could miss some chunks that need to be checked for ores).
I think they won't scan chunks that are currently visible/under LoS already. They will rescan revealed (not under fog of war) chunks, though.

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 380
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: i there a MOD that hides resources from players, and you have to prospect to find more.

Post by Silari »

Yeah i meant otherwise visible.

The problem with storing resource tile info for later replacement is that you can have up to 32x32=1024 resource tiles for every chunk that you'd need to store position, resource name, and amount for (or at least a table for each ore type and position and amount for each), instead of just a ChunkPosition. That's a lot of storage, since you can't know how long it'll be before the user scans a chunk. I think it'd be easier to just wipe any ore generated with the chunk and respawn it later - pretty sure I've seen RSO has it's own version of regenerate_entities you can use to make it respawn the ores.

It'd be more compatible, but i'm not sure of any mods other than RSO and probably dangoreous (which obviously ain't something to use with this anyway) that don't just use the vanilla generation.

Post Reply

Return to “Ideas and Requests For Mods”