Restricted visibility option for simple-entity-with-* types

Post Reply
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Restricted visibility option for simple-entity-with-* types

Post by Earendel »

As far as I'm aware, there's currently no way of doing things that are user-interface related but within the game world space.

It would be extremely useful to be able to create things within the world that are only visible to specific players, or a specific force.

It seems like a convenient way to do this, is if the simple-entity-with-owner and simple-entity-with-force prototypes had an option for "only_visible_to_owner".
If true, it would simply mean that the entity would only render for the owning player/force. For non owners it would not render but otherwise be unaffected.
The default value for only_visible_to_owner would be false, and if false the entities would act exactly as they do now.

Use-cases:
Any time you need to make a UI-style in-game indicator that has relevance to only 1 player, such as the Even Distribution mod.
In the AAI Programmable Vehicles mod you can order vehicles around. I'm in the process of adding additional overlays that show where a vehicle is going. This information is only relevant to the player selecting the vehicles, other people don't need the extra screen clutter. Also in a PVP mode this would be visible to the enemy so they'd see attack vectors that they shouldn't.
Various other PVP applications.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Restricted visibility option for simple-entity-with-* types

Post by eradicator »

OH yea. I want this so much. I've thought about requesting this myself so often that i'm not even sure anymore if i actually did (though with a quick search i only found one similar request i posted). I don't even care if it's an entity. Could be a decorative even (no logic or anyhing attached, no collision box either, just the sprite, though selection box+tooltip description would be a nice bonus...), as long as it's only visible to one player. Ghosts are already only visible to one force so this should definetly be possible.

Usecase: Showing various rpg, prospecting, targeting, etc related hints (think of "augmented reality" type displays) that are only relevant to one player. And are most likely different for each player.
HUD
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: Restricted visibility option for simple-entity-with-* types

Post by Earendel »

Yeah, the problem with an actual decorative though is you can switch decoratives off, but something similar in that there's no collision or logic would be fine.

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

Re: Restricted visibility option for simple-entity-with-* types

Post by Bilka »

Hello, multiple solutions have been implemented for this in 0.17:
You can set simple entities with owner to only render for ally/enemy (etc) forces in the prototype. Furthermore, it is possible to runtime set which player or forces see simple-entity-with-force, simple-entity-with-owner and flying-text. I also implemented a custom render system: https://lua-api.factorio.com/0.17.0-pre ... ering.html
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”