options:
debug: true
limit: 5
delay: 1
function breakBlockRecursive(b: location, t: string, i: number = 0):
if {_i} is greater than {@limit}:
if {@debug}:
broadcast "recursion limit exceeded"
stop
if "%type of block at {_b}%" is not {_t}:
stop
add 1 to {_i}
set block at {_b} to air
if {@delay} is greater than 0:
wait {@delay} ticks
breakBlockRecursive(block north {_b}, {_t}, {_i})
breakBlockRecursive(block south {_b}, {_t}, {_i})
breakBlockRecursive(block east {_b}, {_t}, {_i})
breakBlockRecursive(block west {_b}, {_t}, {_i})
breakBlockRecursive(block above {_b}, {_t}, {_i})
breakBlockRecursive(block under {_b}, {_t}, {_i})
#Change this to your event handler:
on break of stone:
breakBlockRecursive(location of event-block, "%type of event-block%")