function init(is_restart)

	-- Initialise arena - backdrop_name, start_pos, is_restart
	init_level("level-lair-of-the-cave-bear", CCPoint(-50, -20), is_restart)

end

function onLevelIntro()

	bot_manager.MaxBotsOnScreen = 2

	say("lumberjack", localize("MUSTY_CAVE_INTRO_1"), talkToFist)
	say("fist", localize("MUSTY_CAVE_INTRO_2"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_INTRO_3"), talkToFist)
	say("lumberjack", localize("MUSTY_CAVE_INTRO_4"), talkToFist)
	say("lumberjack", localize("MUSTY_CAVE_INTRO_5"), talkToFist, onLevelIntroEnd)

end

function onLookAtDrawings()

	disconnectControlsAndPauseBots()

	say("lumberjack", localize("MUSTY_CAVE_DRAWING_PAST_1"), talkToFist)
	say("fist", localize("MUSTY_CAVE_DRAWING_PAST_2"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_DRAWING_PAST_3"), talkToFist)
	say("fist", localize("MUSTY_CAVE_DRAWING_PAST_4"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_DRAWING_PAST_5"), talkToFist, connectControlsAndResumeBots)

	return true

end

function onLookAtBrian()

	disconnectControlsAndPauseBots()

	say("lumberjack", localize("MUSTY_CAVE_DRAWING_DUDE_1"), talkToFist)
	say("fist", localize("MUSTY_CAVE_DRAWING_DUDE_2"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_DRAWING_DUDE_3"), talkToFist)
	say("fist", localize("MUSTY_CAVE_DRAWING_DUDE_4"), fistTalk)
	say("fist", localize("MUSTY_CAVE_DRAWING_DUDE_5"), fistTalk)
	say("fist", localize("MUSTY_CAVE_DRAWING_DUDE_6"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_DRAWING_DUDE_7"), talkToFist)
	say("fist", localize("MUSTY_CAVE_DRAWING_DUDE_8"), fistTalk, connectControlsAndResumeBots)

	return true

end


function onLookAtWormhole()

	disconnectControls()

--	say("fist", "Another Lorentzian traversable wormhole.", fistTalk)

	say("lumberjack", localize("MUSTY_CAVE_OUTRO_1"), talkToFist)
	say("fist", localize("MUSTY_CAVE_OUTRO_2"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_OUTRO_3"), talkToFist)
	say("fist", localize("MUSTY_CAVE_OUTRO_4"), fistTalk)
	say("lumberjack", localize("MUSTY_CAVE_OUTRO_5"), connectControls)

	return true

end

function onAmbush()

   	-- Restart from here
	if (bIsRestart ~= true) then

   		-- Make this a bit harder than the last ambush
		bot_manager.MaxBotsOnScreen = bot_manager.MaxBotsOnScreen + 1

        -- Restart from here
        game_manager:setCheckpoint("onAmbush")

    end

	-- Spawn regular enemies
	local bot_descs = {}
	table.insert(bot_descs, game_manager:actorDescWithFile("jurassic-gruntbear.plist"))

	-- Spawn lots of enemies
	startAmbush(bot_descs, bot_manager.MaxBotsOnScreen * 2)

	return true
	
end

function onBossAmbush(bIsRestart)

	-- Restart from here
	game_manager:setCheckpoint("onBossAmbush")
                
    bot_manager.MaxBotsOnScreen = 4

	-- Spawn regular enemies
	local bot_descs = {}
	table.insert(bot_descs, game_manager:actorDescWithFile("jurassic-gruntbear.plist"))
	boss_id = startLevelBossFight("cave-bear", bot_descs, bIsRestart)

	return true

end

function onLevelBossSpeech()

	say("cave-bear", localize("MUSTY_CAVE_BOSS_1"))
	say("lumberjack", localize("MUSTY_CAVE_BOSS_2"))
	say("cave-bear", localize("MUSTY_CAVE_BOSS_3"))
	say("lumberjack", localize("MUSTY_CAVE_BOSS_4"))
	say("cave-bear", localize("MUSTY_CAVE_BOSS_5"), nil, onLevelBossSpeechEnd)

end
