Page 1 of 1

on_ghost_upgraded event

Posted: Thu Sep 07, 2023 10:19 pm
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!

Re: on_ghost_upgraded event

Posted: Fri Sep 08, 2023 4:19 pm
by curiosity
Shouldn't you better be asking for an entity flag that makes it keep graphics variation on fast replace?

Re: on_ghost_upgraded event

Posted: Fri Sep 08, 2023 9:54 pm
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.