Page 1 of 1

add information to event for fast_replace of entities

Posted: Tue Dec 01, 2020 11:07 am
by Jaren Taq
Hello,

is it possible to add information to the event table, if an entity is up-/downgraded/fast-replaced?
Something like this:

Code: Select all

-- in on_destroy
event.reason = "fast_replace"
-- in on_create
event.replaced_unit_number = old_entity.unit_number
With this information custom entities, e.g. based on simple-entity-with-*, which store additional information in a global table based on their unit_number can be handled without heuristics based on tick, position and surface.

Thanks,
Jaren

Re: add information to event for fast_replace of entities

Posted: Sun Jan 10, 2021 9:19 pm
by Muppet9010
+1
Hit a similar sounding scenario where I use simple-entity-with-force as the player interaction entity, and a bunch of mod placed entities and mod global data around them.
Have to use the pre_build and match up positions and (hopefully correct) player surface against mod global data to detect a fast_upgrade affecting mining and building events.