dofile("script/layouts/room2_defaults.lua")
dofile("script/shifts/shift2_4_animations.lua")

levelDesc.name = "Shift 2.4"
levelDesc.levelId = 24
levelDesc.musicMood = "1"
levelDesc.timer = 3000
levelDesc.trigger =
{
	class = "TriggerSystem",
	triggers =
	{
		{ trigger = "spawn", delay=1, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY_MINIGAME", "GERM_MATCH"} } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS3", } } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS1", } } },
		{ trigger = "spawn", delay=10000, hearts=3, diseaseDesc = { class="Disease", steps={"XRAY_MINIGAME", } } },
 		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"GERM_MATCH" } } },
 		{ trigger = "spawn", delay=1000, hearts=3, diseaseDesc = { class="Disease", steps={"PUT_ON_CREAM", } } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"PILLS3", } } },
		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"GERM_MATCH", } } },
 		{ trigger = "spawn", delay=20000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY", "GIVE_BLOOD" } } },
		{ trigger = "spawn", delay=6000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY_MINIGAME", "GERM_MATCH" } } },
		{ trigger = "spawn", delay=15000, hearts=3, diseaseDesc = { class="Disease", steps={"GIVE_BLOOD", } } },
 		{ trigger = "spawn", delay=6000, hearts=2, diseaseDesc = { class="Disease", steps={"PILLS3", "GERM_MATCH"} } },
 		{ trigger = "spawn", delay=25000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY", "GIVE_BLOOD" } } },
		{ trigger = "spawn", delay=1000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY", "GIVE_BLOOD", } } },
 		{ trigger = "spawn", delay=20000, hearts=3, diseaseDesc = { class="Disease", steps={"GERM_MATCH" } } },
 		{ trigger = "spawn", delay=1000, hearts=2, diseaseDesc = { class="Disease", steps={"XRAY", "GERM_MATCH", } } },
	}
}

levelDesc.patientList =
{
	p0 = { weight = 50,
		base = "axel",
	},
	p1 = { weight = 50,
		base = "lady",
	},
	p3 = { weight = 25,
		base = "teen",
	},
	p3 = { weight = 25,
		base = "mother",
	},
	p5 = { weight = 25,
		base = "local_male",
	},
}

levelDesc.eventDesc =
{
	class="FixEvent",
	scoreOneDone = 0,
	eventScore = 15,
	eventBarText = "TEXT_EVENT_FIX2",
	eventBarImage = "EVENTBAR_ICON_R2_S4:icons",
	items = {
		{ obj="coffee_puddle", activate=nil },
	},
	scoreAllDone = 10,
}

function levelDesc:onTick(time)
	self:tick(time)
	self.timer = self.timer - time
	if (self.timer < 0) then
		self.timer = 100
		if (level.event.completed and not self.doNotActivateCoffee) then
			level:getObject("coffee1").clickable = true
			level:getObject("coffee_spill").visible = false
	        level:getObject("coffee1").cup.visible = true
			self.doNotActivateCoffee = true
		end
	end
end

function levelDesc:onInitialized()
	PigRace.initShift(self)
	level:getObject("coffee1").cup.visible = false
end

function levelDesc:onShiftStartEnd()
	self:fireTrigger("startEvent")
	level:getObject("coffee1").clickable = false	
end
