Turn on/off rendering of all entities with a specific flag/name/whatever

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
blankdiploma
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Feb 20, 2019 6:10 am
Contact:

Turn on/off rendering of all entities with a specific flag/name/whatever

Post by blankdiploma »

Hello,

I am working on a mod that implements different layers of resources (e.g. shallow/mid/deep ore mining.)

I would like to be able to offer the player a way to switch between viewing different "depths" of ore deposits so that the screen isn't too cluttered at any given time, which means I need to be able to toggle on/off the visibility of entire classes of entity in a way that will not absolutely trash performance (so no iterating over the entire map and swapping out all ore entities for different ones...)

I would prefer this to be based off of a flag on the prototype, or the name of a prototype, or something like that - would it be possible to implement such a feature? Something like a RenderLayer that can be enabled/disabled from the GameScript or Surface would work just fine.

blankdiploma
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Feb 20, 2019 6:10 am
Contact:

Re: Turn on/off rendering of all entities with a specific flag/name/whatever

Post by blankdiploma »

So on further reading, there already is a "renderlayer" property but it's only customizeable for decoratives.

So, I guess what I'm really asking for is:

1) Moddable Render Layer for resource entities
2) API call to hide everything in a given render layer

Thank you!

Bilka
Factorio Staff
Factorio Staff
Posts: 2504
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Turn on/off rendering of all entities with a specific flag/name/whatever

Post by Bilka »

All of the things that you are requesting are very unlikely to be added, so I want to explain some alternatives for you. You could use the script rendering to draw all the resources and use the ability of the script rendering to only be rendered to who you want. This will be a bit janky because it means that the actual resource entity has to be invisible, so it shows as invisible when the player selects it. However, it is basically the only way that you can currently (in 0.17) implement conditional rendering. I hope this will work for you.

PS: A lot more things than decoratives can have custom render layers. See https://wiki.factorio.com/Special:WhatL ... enderLayer
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

blankdiploma
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Feb 20, 2019 6:10 am
Contact:

Re: Turn on/off rendering of all entities with a specific flag/name/whatever

Post by blankdiploma »

I expected a "not likely" reply, so I've been formulating a backup plan that's similar to what you're describing :)

Thank you for taking the time to reply, nonetheless!

Post Reply

Return to “Modding interface requests”

Who is online

Users browsing this forum: Xon1