on_ghost_upgraded event

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Wiwiweb
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Sat May 08, 2021 2:36 am
Contact:

on_ghost_upgraded event

Post by Wiwiweb »

NOT on_pre_ghost_upgraded. I need an event that can give me the new entity, not the old one.

My use case is the Text Plates mod. I want to make the different colors of text plates replaceable.
Each color is an entity prototype, each letter is a graphics_variation of that entity prototype. To change the color without changing the letter, I need to change the entity but keep the same graphics_variation.

For a real text plate that is being upgraded or fast-replaced, I can listen to on_player_mined_entity/on_robot_mined_entity, save the graphics_variation, then match the entity in on_built_entity/on_robot_built_entity, and restore the graphics_variation.

For a ghost that is being upgraded, I can listen to on_pre_ghost_upgraded to find the graphics_variation, but there's no event triggered afterwards so I cannot restore it. I could use an on_tick but that seems really overkill, performance-wise.

Thanks!

curiosity
Filter Inserter
Filter Inserter
Posts: 328
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: on_ghost_upgraded event

Post by curiosity »

Shouldn't you better be asking for an entity flag that makes it keep graphics variation on fast replace?

User avatar
Wiwiweb
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Sat May 08, 2021 2:36 am
Contact:

Re: on_ghost_upgraded event

Post by Wiwiweb »

I guess. I was thinking such a flag would be a bit too specific for my use case and not useful for any other mod. Still worth trying, you're right.

Post Reply

Return to “Modding interface requests”