I think this functionality is essentially a port of an old version of this script:
The newer version has settings to deal with this, so you could look into adapting some of those. (Because smouldering durtles does not have enough settings yet of course)