(I don't really need the event at this moment so didn't write a request, and don't even know whether it has been requested or not.)
However, I saw a reply from Rseding91 saying that performance for something like that will be a problem.
(The original thread here)Rseding91 wrote:Such an event is unlikely to be added due to performance reasons.
Such an event would be fired hundreds/thousands of times per second during normal combat while not adding a lot of value for the few times it was used.
As a (not so professional) programmer, I think I might understand that it is caused by the overhead for communication between the game engine and lua scripts.
If that is the case, then how about eliminating unnecessary communications?
Currently, the events are registered in "script" without specific targets. But what if we can register the entity-related events to the wanted entity when it is built? (Note: we will still need on_built_entity and on_robot_built_entity to be in "script", because we don't have the entity before them.)
In this way, the events will no longer need to fire for all entities, but only fire for the entities that have the events registered and when each individual meets the requirements. As the result, performance can be increased!
This can also be applied to player-related events, and maybe GUI-related ones too.
But, it is just my (not so professional) assumption without knowing how the game engine actually works. Correct me if I am wrong.