Add source entity argument to entity.damage

Post Reply
unhott
Inserter
Inserter
Posts: 29
Joined: Tue Jan 09, 2018 3:01 am
Contact:

Add source entity argument to entity.damage

Post by unhott »

https://lua-api.factorio.com/latest/Lua ... ity.damage
entity.damage() takes the arguments damage, force, and type, but does not allow you to specify a source. If I recall correctly, on_entity_damaged and on_entity_died events will then fire off with a nil source. I was working on a series of events that would be greatly simplified if I could just pass a source entity in entity.damage()

Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Add source entity argument to entity.damage

Post by Honktown »

Curious, why can't the entity deal the damage itself?

There's also script.raise_event, but there's not much documentation on how that works.

https://lua-api.factorio.com/0.12.35/Lu ... aise_event
I have mods! I guess!
Link

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Add source entity argument to entity.damage

Post by Bilka »

Okay, added for the next version.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

unhott
Inserter
Inserter
Posts: 29
Joined: Tue Jan 09, 2018 3:01 am
Contact:

Re: Add source entity argument to entity.damage

Post by unhott »

Thanks!

Post Reply

Return to “Implemented mod requests”