Hiding in upgrade planner.

Place to get help with not working mods / modding interface.
Post Reply
Anachrony
Fast Inserter
Fast Inserter
Posts: 134
Joined: Thu Sep 21, 2017 10:55 pm
Contact:

Hiding in upgrade planner.

Post by Anachrony »

I have some entities in the same fast_replaceable_group that I would like to not appear in the upgrade planner. I tried the not-upgradable flag, but it only prevents it from being in the left column (things being replaced) but not the right column (what it turns into). I tried the hidden flag, but that doesn't seem to stop things from showing up in the upgrade planner at all. I'd like them to be able to be built on top of the other by hand or by blueprint, which is why I don't just remove them from the fast_replaceable_group, but I don't want them to appear as an option in the upgrade planner.

For some context on why I'm doing this, I have a few items that when you build them a script replaces one entity with another. In the upgrade planner, it shows both versions of these entities, which is confusing to users. Functionally, it doesn't seem to actually matter which one you pick, since they're both placeable by the same item, but it's not what people are expecting to see. One example of an item that gets replaced is a miner that gets replaced by something else, so that it has the placement requirements of a miner, but the behavior of a different entity. Another example is one that gets replaced by a script controlled animation, but the build version is a separate entity with a different graphic so it doesn't look weird while it's being placed.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Hiding in upgrade planner.

Post by DaveMcW »

Anachrony wrote:
Mon Feb 01, 2021 10:26 am
I tried the hidden flag, but that doesn't seem to stop things from showing up in the upgrade planner at all.
You need to set the hidden flag on the item used to build it.

Anachrony
Fast Inserter
Fast Inserter
Posts: 134
Joined: Thu Sep 21, 2017 10:55 pm
Contact:

Re: Hiding in upgrade planner.

Post by Anachrony »

I tried that too, but that's not what I'm looking for in this situation, since it hides both versions of the entity from the upgrade planner instead of just 1. I want the item to be in the upgrade planner, I just don't want it to be there twice per item.
There are 2 entities that share only 1 item, so hiding one item hides both. You place the item, it lays down the build version, a script replaces it with the built version, and if you pick it up you get back the original item. And then there are different levels of these items, which I do want to be upgradeable. Everything works fine except for the part that the upgrade planner view is confusing due to the duplication.
This is not a unique way to implement entities. Another modder on the factorio discord reported that they have entities implemented similarly and have the same upgrade planner problem.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Hiding in upgrade planner.

Post by DaveMcW »

Anachrony wrote:
Mon Feb 01, 2021 7:26 pm
There are 2 entities that share only 1 item, so hiding one item hides both.
You must have 2 items. That is the only way to make the hidden upgrade planner work.

In Burner Fuel Bonus I use 2 items for N entities, one for the visible entity and one for the N - 1 hidden entities.

Anachrony
Fast Inserter
Fast Inserter
Posts: 134
Joined: Thu Sep 21, 2017 10:55 pm
Contact:

Re: Hiding in upgrade planner.

Post by Anachrony »

But if the script removes the original entity rather than just adding new hidden entities, then when you deconstruct it you'd be getting some new hidden item instead of the original item that you built. You'd need to have a script intercepting any item being added to their inventory, which seems like adding more complication to a system that already works fine in all respects except for a cosmetic issue with the upgrade planner.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Hiding in upgrade planner.

Post by DaveMcW »

Use minable.result to give the original item that you built, when you deconstruct it.

Anachrony
Fast Inserter
Fast Inserter
Posts: 134
Joined: Thu Sep 21, 2017 10:55 pm
Contact:

Re: Hiding in upgrade planner.

Post by Anachrony »

OK, that makes sense, I'll give it a try.

Anachrony
Fast Inserter
Fast Inserter
Posts: 134
Joined: Thu Sep 21, 2017 10:55 pm
Contact:

Re: Hiding in upgrade planner.

Post by Anachrony »

OK, I tried that. Even though the minable result is set and the placeable_by field is set, simply having the hidden item exist means that when I make a blueprint it will make the blueprint using the wrong item, which doesn't exist so bots can't build it. The best result so far still seems to be to have 1 item for 2 entities. I've put in a feature request to deal with this using the hidden entity flag or a new flag. If it isn't implemented, I can live with the current behavior, which is fine in all respects except the cosmetic upgrade planner issue.

Post Reply

Return to “Modding help”