local basic3DWorld = require("basic3DWorld")
local blockRespawning = require("scripts/blockRespawning")

blockRespawning.defaultRespawnTime = 64*60
blockRespawning.maxPlayersRespawnTimeMultiplier = 0.75


-- Allow explosions to destroy almost any block
local battlePhanto = require("scripts/battlePhanto")
local onlinePlay = require("scripts/onlinePlay")

function onPostExplosion(ex,culprit)
    if ex.id == 0 then
        return
    end

    if onlinePlay.currentMode ~= onlinePlay.MODE_CLIENT then        
        local isPhantoExplosion = (ex.id == NPC.config[battlePhanto.fireNPCID].explosionID)
        local collider = ex.collider

        if isPhantoExplosion and type(collider) == "CircleCollider" then
            collider = Colliders.Circle(collider.x,collider.y,math.lerp(collider.radius,32,0.5))
        end

		local blocks = Colliders.getColliding{a = collider,btype = Colliders.BLOCK}

		for _,b in ipairs(blocks) do
			b:remove(isPhantoExplosion)
		end
	end
end