[1.1.85] Missing events when ghost getting replaced in some circumstances

This subforum contains all the issues which we already resolved.
kryojenik
Inserter
Inserter
Posts: 27
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

[1.1.85] Missing events when ghost getting replaced in some circumstances

Post by kryojenik »

I am working with a custom entity that used LuaEntity.tags to manage custom settings and see some inconsistencies to when events are or are not getting fired.

It also seems like this has been a long discussed topic with several differing answers, and current behavior doesn't seem to consistantly match answers circa .17.

With a ghost on the surface: (entity-ghost has tags with custom settings)
If the player right-clicks the ghost it will fire:
on_pre_player_mined_item
on_player_mined_entity

If the player is holding an item that will place the entity and clicks the ghost with the held item in the same orientation / direction it will fire:
on_pre_buld
on_built_entity.
This will event the tags from the entity-ghost and they can be acted upon in on_built_entity.

If the player is holding the item and clicks it on the ghost with a different rotation it will fire:
on_pre_build
on_pre_player_mined_item
on_player_mined_entity
on_built_entity
on_built_entity
Here we can collect the tags off the entity-ghost in on_player_mined_entity, and then act upon them in on_built_entity since the tags from the mined entity-ghost are not evented.

If the player is holding a _ghost_ of the item and clicks the existing ghost with a different rotation it fires:
on_pre_build
on_built_entity
This is the problem situaion. The existing ghost is deleted without any event to pass the entity to LUA extract any tags that need to be maintained. An new entity-ghost is created and the tags of the previous entity-ghost are not evented in on_build_entity for the new entity-ghost.


It appears that the firing of "mined" events for ghosts is something that has been added since earlier conversations on the subject, but there is at least one place where it is still desired.

Also tested with the same results on 1.1.80
Rseding91
Factorio Staff
Factorio Staff
Posts: 14269
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.85] Missing events when ghost getting replaced in some circumstances

Post by Rseding91 »

Thanks for the report. This is now fixed for 2.0.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”