

function main(self)
	if self.State == 0 then
        if GetCursesState() == false then
            self:Destroy()
        end
		self.Flags.AlwaysActive = true
        self.State = 1
	end

	if self.State == 1 and MultiMessage[0] ~= 0 then

        if MultiMessage[0] == 1 then
            PData().TNTAmmo = 0
            PlaySound"GAME_CURSED"
            TextOut"You lost all your dynamite!"

        elseif MultiMessage[0] == 2 then
            local resp = GetRespawnPoint()
            if resp.X > 0 and resp.Y > 0 then
                Teleport(resp.X, resp.Y)
            else
                Teleport(PData().SpawnPointX, PData().SpawnPointY)
            end
            TextOut"You have been teleported back!"
        end

        self.State = 2
    end

	if self.State == 2 then
        if MultiMessage[1] ~= 0 and GetObject(MultiMessage[1]) ~= nil then
            GetObject(MultiMessage[1]):Destroy()
        end
		ResetMultiMessage()
		self.State = 1
    end
end

