//Armageddon destroys scenary
addHook("ShieldSpecial", function(p)
	if p and p.valid and p.mo and p.mo.valid then
		if p.powers[pw_shield] == SH_ARMAGEDDON then
			if p.mo.skin == "taz" and p.mo.state != S_SPINTWIN then return end
			local burp = P_SpawnMobj(p.mo.x, p.mo.y, p.mo.z, MT_BURPLOSION)
			burp.firer = p
			P_StartQuake(FRACUNIT*10, TICRATE)
			p.powers[pw_shield] = SH_NONE
			P_FlashPal(p, PAL_MIXUP, TICRATE/4)
			S_StartSound(p.mo, sfx_bkpoof) 
		return true
		end
	end
end)

addHook("MobjThinker",function(m)
	if m.scale == FRACUNIT
	and m.bpspawn != true then
		m.scalespeed = FRACUNIT*300
		m.destscale = FRACUNIT*1536
		m.bpspawn = true
	end
	if m.scale == FRACUNIT*1536 then
		m.destscale = FRACUNIT/64
	end
	if m.scale == FRACUNIT/64 then
		P_KillMobj(m)
	end
end, MT_BURPLOSION)

addHook("MobjMoveCollide", function(m, thing)
	if thing and thing.valid
	and m and m.valid then
		if thing.flags & MF_ENEMY
		or thing.flags & MF_BOSS then
			P_DamageMobj(thing, m, m.firer.mo)
		elseif thing.flags & MF_SHOOTABLE
		and thing.flags & MF_SCENERY then
			if thing.busted != true
				if thing.info.deathstate == S_TAZW
				or thing.info.deathstate == S_TAZW2 then
					P_AddPlayerScore(m.firer, thing.reactiontime)
					local tzw1 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, thing.info.painchance)
					tzw1.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw1.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw1.momz = P_RandomRange(4, 7)*FRACUNIT
					local tzw2 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, thing.info.painchance)
					tzw2.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw2.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw2.momz = P_RandomRange(4, 7)*FRACUNIT
					local tzw3 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, thing.info.painchance)
					tzw3.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw3.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw3.momz = P_RandomRange(4, 7)*FRACUNIT
					S_StartSound(thing, sfx_wbreak)
					P_StartQuake(FRACUNIT*8, TICRATE/4)
					thing.busted = true
					P_RemoveMobj(thing)
				else
					thing.state = S_TAZW
					P_AddPlayerScore(m.firer, 100)
					local tzw1 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, MT_EXPLODE)
					tzw1.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw1.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw1.momz = P_RandomRange(4, 7)*FRACUNIT
					local tzw2 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, MT_EXPLODE)
					tzw2.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw2.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw2.momz = P_RandomRange(4, 7)*FRACUNIT
					local tzw3 = P_SpawnMobj(thing.x, thing.y, thing.z+15*FRACUNIT, MT_EXPLODE)
					tzw3.momx = P_RandomRange(-3 ,3)*FRACUNIT
					tzw3.momy = P_RandomRange(-3 ,3)*FRACUNIT
					tzw3.momz = P_RandomRange(4, 7)*FRACUNIT
					S_StartSound(thing, sfx_wbreak)
					P_StartQuake(FRACUNIT*8, TICRATE/4)
					thing.busted = true
					P_RemoveMobj(thing)
				end
			end
		end
	end
end, MT_BURPLOSION)