Events: on_entity_damaged and on_entity_repaired

Post Reply
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Events: on_entity_damaged and on_entity_repaired

Post by Narc »

Could possibly be a single event with negative damage for repairs, but it would certainly make a few more things possible.

Probably would have (beyond the basic event stuff):
  • event.entity -- the entity that was just damaged/repaired
  • event.damage -- the amount of damage that was just dealt
  • event.damage_source -- the entity that dealt the damage/did the repair, if one exists

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Events: on_entity_damaged and on_entity_repaired

Post by orzelek »

Wouldn't event like that cause a lot of lag?
Especially with machine guns and similar fast firing weaponry.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Events: on_entity_damaged and on_entity_repaired

Post by Adil »

Well, there is on_trigger_created_entity event which is only called for entities specially declared to raise that event.
Something similar might be used here. Maybe the timeout variable could be implemented as well, so that a single entity couldn't raise the same event on every tick.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Post Reply

Return to “Implemented mod requests”