Add information about the used weaponry to on_entity_damaged event.
Why?
I'm trying to implement two new weapons that have different effects depending on what they hit (player, biter, building, etc). So i have to implement the damage logic in lua, for which i need to know which weapon (or weapon tier, etc) was used. Currently i use a projectile with a zero damage explosion to raise on_entity_damaged, but the only way to tell apart different weapons seems to be to use different damage types for each of them. It would be easier if the event knew what weapon was used, e.g:
Code: Select all
--hit by a grenade
event.weapon == 'cluser-grenade'
event.magazine == nil
Code: Select all
--shot with a pistol
event.weapon == 'pistol'
event.magazine == 'uranium-rounds-magazine'
Code: Select all
--shot by a laser turret (this could be done by event.cause.name too, or .magazin for ammo-turret)
event.projectile == 'laser'