dofile("script/layouts/room4_defaults.lua")
dofile("script/shifts/shift4_3_animations.lua")

levelDesc.name = "Shift 4.3"
levelDesc.levelId = 43
levelDesc.musicMood = "2"
levelDesc.trigger =
{
	class = "TriggerSystem",
	triggers =
	{
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"VITAMIN"} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"MIRROR", "NITROGEN",} } },
		{ trigger = "spawn", delay=7000, hearts=3, diseaseDesc = { class="Disease", steps={"WAX",} } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN",} } },
		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"VITAMIN", "LASER",} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"WAX",} } },
		{ trigger = "spawn", delay=7000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN",} } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"CREAM",} } },
		{ trigger = "spawn", delay=16000, hearts=2, diseaseDesc = { class="Disease", steps={"MIRROR", "VITAMIN",} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"WAX"} } },
		{ trigger = "spawn", delay=5000, hearts=2, diseaseDesc = { class="Disease", steps={"CREAM", "LASER"} } },
		{ trigger = "spawn", delay=7000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN"} } },
		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"MIRROR", "VITAMIN"} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"LASER"} } },
		{ trigger = "spawn", delay=6000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN"} } },
		{ trigger = "spawn", delay=10000, hearts=3, diseaseDesc = { class="Disease", steps={"WAX"} } },
		{ trigger = "spawn", delay=8000, hearts=1, diseaseDesc = { class="Disease", steps={"MIRROR", "VITAMIN", "LASER"} } },
		{ trigger = "spawn", delay=25000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN"} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"LASER"} } },
		{ trigger = "spawn", delay=8000, hearts=3, diseaseDesc = { class="Disease", steps={"NITROGEN"} } },
		{ trigger = "spawn", delay=5000, hearts=3, diseaseDesc = { class="Disease", steps={"VITAMIN"} } },
		{ trigger = "spawn", delay=10000, hearts=2, diseaseDesc = { class="Disease", steps={"MIRROR", "NITROGEN"} } },
		{ trigger = "spawn", delay=5000, hearts=2, diseaseDesc = { class="Disease", steps={"MIRROR", "LASER"} } },
	}
}
levelDesc.areas[1].droolResidentSpot = {x=930, y=570}
levelDesc.patientList =
{
	p0 = { weight = 500,
		base = "axel",
	},
	p2 = { weight = 500,
		base = "teen",
	},
	p3 = { weight = 500,
		base = "local_male",
	},
	p4 = { weight = 500,
		base = "mother",
	},
}

gestureX = 820 - 55
gestureY = 450 - 55
levelDesc.eventDesc =
{
	class="GestureEvent",
	eventBarImage = "EVENTBAR_ICON_GESTURE:icons",
	gestureLocation = {x=500, y=500},
	doGestureObject = "event_gesture_girl",
	gestures = {
		{desc=9, objectId="hero", animation="FILLNEEDLE#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=15, drainSpeed = 30, growSpeed=20, objectId="hero", animation="TAPNEEDLE#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=13, objectId="hero", animation="INJECT#LEFT", gestureLocation={x=gestureX, y=gestureY}, trigger="place blanket"},
		{desc=8, objectId="hero", animation="WORKNOSE1#LEFT", gestureLocation={x=gestureX, y=gestureY}, timeBeforeStart=30000},
		{desc=6, objectId="hero", animation="WORKNOSE2#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=15, drainSpeed = 30, growSpeed=20, objectId="hero", animation="DAPBLOOD#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=6, objectId="hero", animation="WORKNOSE2#LEFT", gestureLocation={x=gestureX, y=gestureY}, timeBeforeStart=15000},
		{desc=15, drainSpeed = 30, growSpeed=20, objectId="hero", animation="DAPBLOOD#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=8, objectId="hero", animation="WORKNOSE1#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=15, drainSpeed = 30, growSpeed=20, objectId="hero", animation="DAPBLOOD#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=3, objectId="hero", animation="CASTDOWN#LEFT", gestureLocation={x=gestureX, y=gestureY}, trigger="remove blanket"},
		{desc=5, objectId="hero", animation="BANDAGE#LEFT", gestureLocation={x=gestureX, y=gestureY}, timeBeforeStart=15000},
		{desc=5, objectId="hero", animation="BANDAGE#LEFT", gestureLocation={x=gestureX, y=gestureY}},
		{desc=5, objectId="hero", animation="BANDAGE#LEFT", gestureLocation={x=gestureX, y=gestureY}},
	},
	scoreOneDone=1,
	scoreAllDone=1,
	hintTip = "bottomright",
}

function levelDesc:onInitialized()
	-- Create stretcher if there is no 2nd bed
	local desc = {
		class = "DoGestureObject",
		name = "event_table",
		x=739, y=533,
		floor = -83,
		baseAnimation = "ROOM4_EVENT_STRETCHER",
		workPos = {x=780, y=580},
		obstructs = levelDesc.tableObstructs,
	}
	local event_table = level:add(desc)

	local original_table = level:getObject("nitrogen_station_right")
	if (original_table) then
		-- Table present, set to occupied while patient is there
		original_table:setMaxOccupants(0)
		original_table:setVisible(false)

		-- Now pose as the original table
		event_table.baseAnimation = original_table.baseAnimation
	end
end

function levelDesc:onShiftStartEnd()
	self:fireTrigger("startEvent")
end

function levelDesc:handleTrigger(trigger, meta)
	CareLevel.handleTrigger(self, trigger, meta)	
	if (trigger == "place blanket") then
		level:getSpriteExt("blanket").visible = true
	elseif (trigger == "remove blanket") then
		level:getSpriteExt("blanket").visible = false
	end
end

levelDesc.tableObstructs = levelDesc.tableObstructs or {}
levelDesc.tableObstructs[1] = levelDesc.tableObstructs[1] or {}
levelDesc.tableObstructs[1].x = 21
levelDesc.tableObstructs[1].y = 9
levelDesc.tableObstructs[2] = levelDesc.tableObstructs[2] or {}
levelDesc.tableObstructs[2].x = 22
levelDesc.tableObstructs[2].y = 9
levelDesc.tableObstructs[3] = levelDesc.tableObstructs[3] or {}
levelDesc.tableObstructs[3].x = 23
levelDesc.tableObstructs[3].y = 9
levelDesc.tableObstructs[4] = levelDesc.tableObstructs[4] or {}
levelDesc.tableObstructs[4].x = 24
levelDesc.tableObstructs[4].y = 9
levelDesc.tableObstructs[5] = levelDesc.tableObstructs[5] or {}
levelDesc.tableObstructs[5].x = 25
levelDesc.tableObstructs[5].y = 9
levelDesc.tableObstructs[6] = levelDesc.tableObstructs[6] or {}
levelDesc.tableObstructs[6].x = 26
levelDesc.tableObstructs[6].y = 9
levelDesc.tableObstructs[7] = levelDesc.tableObstructs[7] or {}
levelDesc.tableObstructs[7].x = 6
levelDesc.tableObstructs[7].y = 9
levelDesc.tableObstructs[8] = levelDesc.tableObstructs[8] or {}
levelDesc.tableObstructs[8].x = 7
levelDesc.tableObstructs[8].y = 9
levelDesc.tableObstructs[9] = levelDesc.tableObstructs[9] or {}
levelDesc.tableObstructs[9].x = 8
levelDesc.tableObstructs[9].y = 9
levelDesc.tableObstructs[10] = levelDesc.tableObstructs[10] or {}
levelDesc.tableObstructs[10].x = 9
levelDesc.tableObstructs[10].y = 9
levelDesc.tableObstructs[11] = levelDesc.tableObstructs[11] or {}
levelDesc.tableObstructs[11].x = 10
levelDesc.tableObstructs[11].y = 9
levelDesc.tableObstructs[12] = levelDesc.tableObstructs[12] or {}
levelDesc.tableObstructs[12].x = 11
levelDesc.tableObstructs[12].y = 9
levelDesc.tableObstructs[13] = levelDesc.tableObstructs[13] or {}
levelDesc.tableObstructs[13].x = 12
levelDesc.tableObstructs[13].y = 9
levelDesc.tableObstructs[14] = levelDesc.tableObstructs[14] or {}
levelDesc.tableObstructs[14].x = 13
levelDesc.tableObstructs[14].y = 9
levelDesc.tableObstructs[15] = levelDesc.tableObstructs[15] or {}
levelDesc.tableObstructs[15].x = 14
levelDesc.tableObstructs[15].y = 9
levelDesc.tableObstructs[16] = levelDesc.tableObstructs[16] or {}
levelDesc.tableObstructs[16].x = 15
levelDesc.tableObstructs[16].y = 9
levelDesc.tableObstructs[17] = levelDesc.tableObstructs[17] or {}
levelDesc.tableObstructs[17].x = 16
levelDesc.tableObstructs[17].y = 9
levelDesc.tableObstructs[18] = levelDesc.tableObstructs[18] or {}
levelDesc.tableObstructs[18].x = 17
levelDesc.tableObstructs[18].y = 9
levelDesc.tableObstructs[19] = levelDesc.tableObstructs[19] or {}
levelDesc.tableObstructs[19].x = 18
levelDesc.tableObstructs[19].y = 9
levelDesc.tableObstructs[20] = levelDesc.tableObstructs[20] or {}
levelDesc.tableObstructs[20].x = 19
levelDesc.tableObstructs[20].y = 9
levelDesc.tableObstructs[21] = levelDesc.tableObstructs[21] or {}
levelDesc.tableObstructs[21].x = 20
levelDesc.tableObstructs[21].y = 9
levelDesc.tableObstructs[22] = levelDesc.tableObstructs[22] or {}
levelDesc.tableObstructs[22].x = 27
levelDesc.tableObstructs[22].y = 9
