Page 1 of 1

What event fires when player explode cliff?

Posted: Mon Aug 03, 2020 7:09 am
by x2605
I can't find it from API site.
I can't find it anyone asking about that on this forum.

Re: What event fires when player explode cliff?

Posted: Mon Aug 03, 2020 3:23 pm
by eradicator
When i'm unsure what events are firing i just have them printed to console:

Code: Select all

/c
local rev = function(a,b) for k,v in pairs(a) do b[v]=k end return b end
local del = function(a,b) for _,k in pairs(a) do b[k]=nil end return b end
local nam = rev(del({'on_tick','on_chunk_generated'},defines.events),{})
script.on_event(rev(nam,{}),function(e) game.print(e.tick..': '..nam[e.name]) end)
Looks like there is no event for cliffs exploding.

Re: What event fires when player explode cliff?

Posted: Sat Aug 22, 2020 2:11 pm
by x2605
eradicator wrote: Mon Aug 03, 2020 3:23 pm When i'm unsure what events are firing i just have them printed to console:

Code: Select all

/c
local rev = function(a,b) for k,v in pairs(a) do b[v]=k end return b end
local del = function(a,b) for _,k in pairs(a) do b[k]=nil end return b end
local nam = rev(del({'on_tick','on_chunk_generated'},defines.events),{})
script.on_event(rev(nam,{}),function(e) game.print(e.tick..': '..nam[e.name]) end)
Looks like there is no event for cliffs exploding.
thanks! this code is so useful, but unfortunately i couldn't found any events but only on_player_used_capsule fires.
may be cliffs affected by throwing can be determined by combining some informations...

Re: What event fires when player explode cliff?

Posted: Sun Aug 23, 2020 9:06 am
by ickputzdirwech
x2605 wrote: Sat Aug 22, 2020 2:11 pm
thanks! this code is so useful, but unfortunately i couldn't found any events but only on_player_used_capsule fires.
may be cliffs affected by throwing can be determined by combining some informations...
Keep in mind that robots can blow up cliffs as well.

I once tried to give the player an item if they blow up a cliff. In the end I implemented a entity similar to item on ground and expanded the following table to create one of it:

Code: Select all

data.raw.capsule[„cliff-explosives“].robot_action.action_delivery.target_effects = ...
There were two major issues with this however. It doesn’t take in to account how many cliffs you blew up with the one cliff explosion and it only works when a robot throws the cliff explosion. I could get the latter to work by expanding

Code: Select all

 data.raw.projectile[„cliff-explosives“].action.action_delivery.target_effects = ...
Strange thing about this is that it only works for the player and none of it worked if I tried to implement both at the same time.