hiding the "expected resources"

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
adamwong246
Fast Inserter
Fast Inserter
Posts: 148
Joined: Tue Dec 01, 2020 5:01 am
Contact:

hiding the "expected resources"

Post by adamwong246 »

viewtopic.php?f=25&t=103511

I would like to disable this GUI element
Image

In vanilla, you can hold a mining drill over a plot of land to get the "expected resources". Also, once the drill is activated, this info is also made available.

This collides with the aims of my mod which makes ores invisible, forcing the player to use tools like metal detectors.

Code: Select all

    resource.highlight = false;
    resource.map_grid = false;
    resource.resource_patch_search_radius = false
    resource.selectable_in_game = false;
    resource.map_color = {0, 0, 0, 0};
I propose a similar flag to control this behavior

Code: Select all

    resource.show_expected_resources = false;
🙏

Honktown
Smart Inserter
Smart Inserter
Posts: 1038
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: hiding the "expected resources"

Post by Honktown »

Unfortunately, the miner also shows when it can or cannot be placed. It would need to show red yet be place-able for "hiding" resources to work.

In my opinion, you are better off not making the resource entities, but storing if they *should* be there, and only placing them if the player uses an capsule, input, etc. A way to achieve this without removing normal autoplace logic, is, on_chunk_generated, check the area for resources and record/sort them. ([surface_index], [x][y] position, {name, amount/initial_amount are the same on creation} ). Then destroy the entity. If a player does the needed thing, then you can recreate the entity. Result: 100% invisible and non-game-influencing until the right action is taken. Sounds like what you desire?
I have mods! I guess!
Link

User avatar
adamwong246
Fast Inserter
Fast Inserter
Posts: 148
Joined: Tue Dec 01, 2020 5:01 am
Contact:

Re: hiding the "expected resources"

Post by adamwong246 »

Unfortunately, the miner also shows when it can or cannot be placed. It would need to show red yet be place-able for "hiding" resources to work.
I solved this problem by filling every empty space with "Earth" resource, which was also invisible. So that was able to work-around "the red-green problem".

Otherwise your approach still won't work, because I had hooked deeply into the existing API. Like, you can't see a resource, but your footsteps change and your speed goes decreases when you character walks over the invisible resource. And I wanted to hide the uranium ore, but NOT the glow, so the ore itself is invisible during the day but at night you can see the glow! I know it is a big ask to hook into the gui but I do think it's the right decision. I was able to stake out a mod that had a lot of cool ideas that used the existing API really nicely. I just don't have the resources to re-implement all that other stuff.

Honktown
Smart Inserter
Smart Inserter
Posts: 1038
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: hiding the "expected resources"

Post by Honktown »

For the uranium, there was a simpler option: void-powered lamps. Then at night the invisible lamps could start to emit uranium glows. registering uranium for destruction on chunk gen (LuaBootstrap.register_on_entity_destroyed) and using that to localise the lamp when the uranium is gone, would work. To simultaneously create the lamp, and even create an effect for *just* uranium so it would never need to be searched, one can use Prototype/Entity created_effect (one effect to make the lamp, one effect to raise a script trigger to know the lamp exists which can be on the lamp itself).

Creating an entity at every tile of not-ore is, frankly, incredibly over-complicated way to do it (and will probably cause a LOT of performance dropping). Pairing with create_effect, you can dynamically create a proxy resource (the proxy prototype can better match the original entity, *if* you wanted something visible), or even better, in data-final-fixes, replace the autoplace information of *your* entity with that of the desired resource, and remove autoplace from the original resource.

"because I had hooked deeply into the existing API" Please understand I make mods, too ;)
I have mods! I guess!
Link

Post Reply

Return to “Modding interface requests”