Page 1 of 1

shooting events

Posted: Sat Sep 17, 2016 5:56 pm
by lux
Does anyone know if there are any lua events related to shooting? or being shot?

I am trying to modify friendly-fire damage values. The initial word on IRC was this was not possible, but wanted to confirm.

Re: shooting events

Posted: Sat Sep 17, 2016 6:11 pm
by aubergine18
You'd have to check specific entities during on_tick handler which would be very show.

However, there's perhaps another way to do it - when things are shot, does it create remnants? If so, does their creation trigger the entity creation events?

You could look at the Fire Extinguisher mod in mod portal - that works in similar way.

Re: shooting events

Posted: Sat Sep 17, 2016 6:13 pm
by aubergine18
from extinguisher mod:

Code: Select all

local function extinguish_fire(event)
  if event.entity.name == 'extinguisher-remnants' then
     -- you at least know where shots landed
  end
end

script.on_event(defines.events.on_trigger_created_entity, extinguish_fire)