<scene name="SewerPipes" numVictoryConditions="1" numSteps="6">
	<inventory>
		<object name="Key" memberName="HUD_key" acquired="0" visible="0"/>
		<object name="Pipe" memberName="HUD_pipe" acquired="0" visible="0"/>
		<object name="Tape" memberName="HUD_tape" acquired="0" visible="0"/>
		<object name="Wrench" memberName="HUD_wrench" acquired="0" visible="0"/>
		<object name="Bolt" memberName="HUD_bolt" acquired="0" visible="0"/>
		<object name="Wheel" memberName="HUD_wheel" acquired="0" visible="0"/>
		<object name="Valve" memberName="HUD_valve" acquired="0" visible="0"/>
	</inventory>
	
	<finalStates>
		<finalState objName="FrontGrateWindow" state="done"/>
		<finalState objName="SideGrateWindow" state="done"/>
		<finalState objName="Valve" state="turned"/>
		<finalState objName="Pipe" state="acquired"/>
		<finalState objName="Light" state="fixed"/>
		<finalState objName="Door" state="replayExit"/>
		<finalState objName="DoorChecker" state="done"/>
	</finalStates>
	
	<slidersMap>
		<slider layerName="slider_L38_Debris" id="bridge19"/>
	</slidersMap>
	
	<animations>
		<animation name="GasAnim" type="loop" xpos="649" ypos="411" zpos="6" member="Gas Fire Loop"/>
		<animation name="SparkAnim" type="loop" xpos="585" ypos="366" zpos="6" member="Electrical Sparks Side"/>
		<animation name="WaterAnim" type="loop" zpos="6">
			<frames>
				<frame memberName="frame00_anim" frameDelay="60"/>
				<frame memberName="frame01_anim" frameDelay="60"/>
				<frame memberName="frame02_anim" frameDelay="60"/>
				<frame memberName="frame03_anim" frameDelay="60"/>
				<frame memberName="frame04_anim" frameDelay="60"/>
				<frame memberName="frame05_anim" frameDelay="60"/>
				<frame memberName="frame06_anim" frameDelay="60"/>
				<frame memberName="frame07_anim" frameDelay="60"/>
				<frame memberName="frame08_anim" frameDelay="60"/>
				<frame memberName="frame09_anim" frameDelay="60"/>
				<frame memberName="frame10_anim" frameDelay="60"/>
				<frame memberName="frame11_anim" frameDelay="60"/>
				<frame memberName="frame12_anim" frameDelay="60"/>
				<frame memberName="frame13_anim" frameDelay="60"/>
				<frame memberName="frame14_anim" frameDelay="60"/>
				<frame memberName="frame15_anim" frameDelay="60"/>
				<frame memberName="frame16_anim" frameDelay="60"/>
				<frame memberName="frame17_anim" frameDelay="60"/>
				<frame memberName="frame18_anim" frameDelay="60"/>
				<frame memberName="frame19_anim" frameDelay="60"/>
			</frames>
		</animation>
		
		<animation name="DavidAnim" type="once" zpos="200" crossfade="1">
			<frames>
				<frame memberName="d1_anim" frameDelay="500"/>
				<frame memberName="d2_anim" frameDelay="500"/>
				<frame memberName="d3_anim" frameDelay="500"/>
			</frames>
		</animation>
	</animations>
	
	<zoomWindows>
		<zoomWindow name="FrontGrateWindow" file="ZoomWindows\SewerPipes_Z1.dir" visible="0" hotspot="point(410, 470)"/>
		<zoomWindow name="SideGrateWindow" file="ZoomWindows\SewerPipes_Z2.dir" visible="0" hotspot="point(165, 532)"/>
	</zoomWindows>
	
	<locks>
		<lock name="ExitLock">
			<parts>
				<part name="ValvePart" state="locked"/>
				<part name="LightPart" state="locked"/>
			</parts>
			<onUnlocked>
				<action target="DoorChecker" name="SetState" param="openable"/>
			</onUnlocked>
		</lock>		
	</locks>
	
	<objects>			
		<object name="Ambience">
			<states>
				<state name="Ambience">
					<onStateEnter>
						<action target="Scene" name="StartAnimation" param="WaterAnim"/>
						<action target="Scene" name="PlaySound" param="S-31"/>
					</onStateEnter>
				</state>
			</states>
		</object>

		<object name="FrontGrateWindow">
			<clickStrategy type="rect" left="350" top="430" right="470" bottom="510"/>
			<states>
				<state name="notAvailable">
					<onEvent name="reveal">
						<action target="Scene" name="RevealHotspot" param="FrontGrateWindow"/>
						<action target="FrontGrateWindow" name="SetState" param="clickable"/>
					</onEvent>
				</state>
				
				<state name="clickable">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>

					<onClick>
						<action target="Scene" name="OpenWindow" param="FrontGrateWindow"/>
					</onClick>
				</state>
				
				<state name="done">
				</state>
			</states>
		</object>
		
		<object name="SideGrateWindow">
			<clickStrategy type="rect" left="120" top="440" right="210" bottom="625"/>
			<states>
				<state name="notAvailable">
					<onEvent name="reveal">
						<action target="Scene" name="RevealHotspot" param="SideGrateWindow"/>
						<action target="SideGrateWindow" name="SetState" param="clickable"/>
					</onEvent>
				</state>
				
				<state name="clickable">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>

					<onClick>
						<action target="Scene" name="OpenWindow" param="SideGrateWindow"/>
					</onClick>
				</state>
				
				<state name="done">
				</state>
			</states>
		</object>
		
		<object name="Valve">
			<clickStrategy type="alpha" layer="valve completed"/>
			<states>
				<state name="noValve">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="valve completed"/>
						<action target="Scene" name="HideLayer" param="valve pipe"/>
						<action target="Scene" name="HideLayer" param="valve closed"/>
						<action target="Scene" name="StartAnimation" param="GasAnim"/>
						<!--<action target="Scene" name="PlaySound" param="p-111_2"/>-->
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="valve_click"/>
						<action target="FrontGrateWindow" name="SendEvent" param="reveal"/>
					</onClick>
					
					<onUseObject name="Wheel">
						<action target="Scene" name="RemoveFromInventory" param="Wheel"/>
						<action target="Valve" name="SetState" param="withWheel"/>
						<action target="Scene" name="PlaySound" param="p-112"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="withWheel">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="valve completed"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="valve_hanging"/>
						<action target="FrontGrateWindow" name="SendEvent" param="reveal"/>
					</onClick>
					
					<onUseObject name="Bolt">
						<action target="Scene" name="RemoveFromInventory" param="Bolt"/>
						<action target="Valve" name="SetState" param="complete"/>
						<action target="Scene" name="PlaySound" param="p-114"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="complete">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="valve_stuck"/>
						<action target="FrontGrateWindow" name="SendEvent" param="reveal"/>
					</onClick>
					
					<onUseObject name="Pipe">
						<action target="Scene" name="RemoveFromInventory" param="Pipe"/>
						<action target="ExitLock" name="UnlockPart" param="ValvePart"/>
						<action target="Valve" name="SetState" param="turned"/>
						<action target="Scene" name="StopAnimation" param="GasAnim"/>
						<!--<action target="Scene" name="StopSound" param="p-111_2"/>-->
						<action target="Door" name="SendEvent" param="fire_out"/>
						<action target="Scene" name="PlaySound" param="p-113"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="turned">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="valve completed"/>
						<action target="Scene" name="ShowLayer" param="valve pipe"/>
						<action target="Scene" name="HideLayer" param="valve pipe" delay="1000"/>
						<action target="Scene" name="ShowLayer" param="valve closed" delay="1000"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Pipe">
			<clickStrategy type="alpha" layer="pipe place"/>
			<states>
				<state name="inPlace">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="pipe_click"/>
						<action target="SideGrateWindow" name="SendEvent" param="reveal"/>
					</onClick>
					
					<onUseObject name="Wrench">
						<action target="Scene" name="RemoveFromInventory" param="Wrench"/>
						<action target="Scene" name="AddToInventory" param="Pipe"/>
						<action target="Pipe" name="SetState" param="acquired"/>
						<action target="Scene" name="PlaySound" param="p-115"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="acquired">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="pipe place"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Light">
			<clickStrategy type="alpha" layer="light exit fixed"/>
			<states>
				<state name="broken">
					<onStateEnter>
						<action target="Scene" name="StartAnimation" param="SparkAnim"/>
						<action target="Scene" name="HideLayer" param="light exit on"/>
						<action target="Scene" name="HideLayer" param="light exit fixed"/>
						<action target="Scene" name="HideLayer" param="light exit glow"/>
					</onStateEnter>
				
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="light_click"/>
					</onClick>
					
					<onUseObject name="Tape">
						<action target="Scene" name="RemoveFromInventory" param="Tape"/>
						<action target="ExitLock" name="UnlockPart" param="LightPart"/>
						<action target="Light" name="SetState" param="fixed"/>
						<action target="Scene" name="StopAnimation" param="SparkAnim"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="fixed">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="light exit fixed"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Door">
			<clickStrategy type="alpha" layer="door closed unlock"/>
			<states>
				<state name="unreachable">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="door closed unlock"/>
						<action target="Scene" name="HideLayer" param="door open"/>
					</onStateEnter>
					
					<onEvent name="fire_out">
						<action target="Door" name="SetState" param="locked"/>
					</onEvent>
				</state>
				
				<state name="locked">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="puzzle"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="door_click"/>
					</onClick>
					
					<onUseObject name="Key">
						<action target="Scene" name="RemoveFromInventory" param="Key"/>
						<action target="Door" name="SetState" param="open"/>
						<action target="Scene" name="StepComplete" param=""/>
					</onUseObject>
				</state>
				
				<state name="open">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="door closed unlock"/>
						<action target="Scene" name="HideLayer" param="door closed unlock" delay="1000"/>
						<action target="Scene" name="ShowLayer" param="door open" delay="1000"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="exit"/>
					</onMouseOver>
					
					<onClick>
						<action target="DoorChecker" name="SendEvent" param="attempt_exit"/>
					</onClick>
				</state>
				
				<state name="done">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="door open"/>
					</onStateEnter>
				</state>
				
				<state name="replayExit">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="door open"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="exit"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ReplayExit" param=""/>
					</onClick>
				</state>
			</states>
		</object>
		
		<object name="DoorChecker">
			<states>
				<state name="noExit">
					<onEvent name="attempt_exit">
						<action target="Scene" name="ShowDialog" param="noExit"/>
					</onEvent>
				</state>
				
				<state name="openable">
					<onEvent name="attempt_exit">
						<action target="DoorChecker" name="SetState" param="done"/>
						<action target="Scene" name="StartAnimation" param="DavidAnim"/>
						<action target="Scene" name="RegisterVictoryCondition" param="" delay="1500"/>
					</onEvent>
				</state>
				
				<state name="done">
				</state>
			</states>
		</object>
	</objects>
</scene>