Page 1 of 1

Add source entity argument to entity.damage

Posted: Wed Jan 15, 2020 3:03 am
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()

Re: Add source entity argument to entity.damage

Posted: Wed Jan 15, 2020 12:53 pm
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

Re: Add source entity argument to entity.damage

Posted: Wed Jan 15, 2020 1:43 pm
by Bilka
Okay, added for the next version.

Re: Add source entity argument to entity.damage

Posted: Wed Jan 15, 2020 11:34 pm
by unhott
Thanks!