<scene name="Room31" numVictoryConditions="1">
	<inventory>
		<object name="Crowbar" memberName="HUD_crowbar" acquired="0" visible="1"/>
		<object name="Knob" memberName="HUD_standTop" acquired="0" visible="1"/>
		<object name="Filter" memberName="HUD_filter" acquired="0" visible="1">
			<onUseObject name="FilterSlot">
				<action target="Scene" name="RemoveFromInventory" param="FilterSlot"/>
				<action target="Scene" name="RemoveFromInventory" param="Filter"/>
				<action target="Scene" name="AddToInventory" param="SlotWithFilter"/>
			</onUseObject>
		</object>
		<object name="FilterSlot" memberName="HUD_filterSlot" acquired="0" visible="1">
			<onUseObject name="Filter">
				<action target="Scene" name="RemoveFromInventory" param="FilterSlot"/>
				<action target="Scene" name="RemoveFromInventory" param="Filter"/>
				<action target="Scene" name="AddToInventory" param="SlotWithFilter"/>
			</onUseObject>
		</object>
		<object name="SlotWithFilter" memberName="HUD_filterAndSlot" acquired="0" visible="0"/>
	</inventory>
	
	<finalStates>
		<finalState objName="Crate" state="noCrowbar"/>
		<finalState objName="Knob" state="acquired"/>
		<finalState objName="Pipe" state="straight"/>
		<finalState objName="MaintenanceDoor" state="noFilter"/>
		<finalState objName="VentilationDoor" state="withSlot"/>
		<finalState objName="Smoke" state="noSmoke"/>
		<finalState objName="Door" state="open"/>
	</finalStates>
	
	<zoomWindows>
		<zoomWindow name="CrateWindow" file="ZoomWindows\Room31_CrateWindow.dir" x="170" y="410" visible="0"/>
		<zoomWindow name="MaintenanceDoorWindow" file="ZoomWindows\Room31_MaintenanceDoorWindow.dir" x="200" y="250" visible="0"/>
		<zoomWindow name="VentilationDoorWindow" file="ZoomWindows\Room31_VentilationDoorWindow.dir" x="280" y="415" visible="0"/>
	</zoomWindows>
	
	<objects>
		<object name="Crate">
			<clickStrategy type="alpha" layer="CrateOpen"/>
			<states>
				<state name="closed">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="CrateOpen"/>
						<action target="Scene" name="PlaySound" param="indoor_small"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="CrateWindow"/>
						<action target="Crate" name="SetState" param="open"/>
					</onClick>
				</state>
				
				<state name="open">
					<onStateEnter><action target="Scene" name="ShowLayer" param="CrateOpen"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick><action target="Scene" name="OpenWindow" param="CrateWindow"/></onClick>
				</state>
				
				<state name="noCrowbar">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="CrateWindow" delay="60"/>
						<action target="Scene" name="ShowLayer" param="CrateOpen"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Metal_small"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Knob">
			<clickStrategy type="alpha" layer="StandTopOff"/>
			<states>
				<state name="clickable">
					<onStateEnter><action target="Scene" name="HideLayer" param="StandTopOff"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="AddToInventory" param="Knob"/>
						<action target="Knob" name="SetState" param="acquired"/>
						<action target="Scene" name="ShowDialog" param="pickup_knob"/>
					</onClick>
				</state>
				
				<state name="acquired">
					<onStateEnter><action target="Scene" name="ShowLayer" param="StandTopOff"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Pipe">
			<clickStrategy type="alpha" layer="Pipe"/>
			<states>
				<state name="bent">
					<onStateEnter><action target="Scene" name="HideLayer" param="Pipe"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onUseObject name="Crowbar">
						<action target="Scene" name="RemoveFromInventory" param="Crowbar"/>
						<action target="Pipe" name="SetState" param="straight"/>
						<action target="MaintenanceDoor" name="SendEvent" param="pipeStraightened"/>
						<action target="Scene" name="PlaySound" param="use_crowbar_on_pipe"/>
					</onUseObject>
				</state>
				
				<state name="straight">
					<onStateEnter><action target="Scene" name="ShowLayer" param="Pipe"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="MaintenanceDoor">
			<clickStrategy type="rect" left="500" top="170" right="535" bottom="540"/>
			<states>
				<state name="blocked">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="MaintenanceKnobMounted"/>
						<action target="Scene" name="HideLayer" param="MaintenanceOpen"/>	
						<action target="Scene" name="HideLayer" param="MaintenanceNoFilter"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="door_click"/>
					</onClick>

					<onUseObject name="Knob">
						<action target="Scene" name="ShowDialog" param="bent_pipe"/>
						<action target="Scene" name="PlaySound" param="use_top_of_stand_on_lock"/>
					</onUseObject>
					
					<onEvent name="pipeStraightened">
						<action target="MaintenanceDoor" name="SetState" param="noKnob"/>
					</onEvent>
				</state>
				
				<state name="noKnob">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="MaintenanceKnobMounted"/>
						<action target="Scene" name="HideLayer" param="MaintenanceOpen"/>	
						<action target="Scene" name="HideLayer" param="MaintenanceNoFilter"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="MaintenanceDoorWindow"/>
						<action target="Scene" name="ShowDialog" param="door_click"/>
					</onClick>
					
					<onUseObject name="Knob">
						<action target="Scene" name="OpenWindow" param="MaintenanceDoorWindow"/>
						<action target="MaintenanceDoor" name="SetState" param="withKnob"/>
						<action target="Scene" name="ShowDialog" param="ooh_filters"/>
					</onUseObject>
				</state>
				
				<state name="withKnob">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="MaintenanceKnobMounted"/>
						<action target="Scene" name="ShowLayer" param="MaintenanceOpen"/>						
						<action target="Scene" name="HideLayer" param="MaintenanceNoFilter"/>
						<action target="Scene" name="PlaySound" param="open_maintenance_cabinet"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick><action target="Scene" name="OpenWindow" param="MaintenanceDoorWindow"/></onClick>
				</state>
				
				<state name="noFilter">
					<onStateEnter>						
						<action target="Scene" name="CloseWindow" param="MaintenanceDoorWindow" delay="60"/>
						<action target="Scene" name="HideLayer" param="MaintenanceKnobMounted"/>
						<action target="Scene" name="HideLayer" param="MaintenanceOpen"/>						
						<action target="Scene" name="HideLayer" param="MaintenanceNoFilter"/>
						<action target="Scene" name="PlaySound" param="take_the_filter"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="VentilationDoor">
			<clickStrategy type="rect" left="550" top="85" right="620" bottom="600"/>
			<states>
				<state name="noKnob">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="VentilationKnobMounted"/>
						<action target="Scene" name="HideLayer" param="VentilationOpen"/>
						<action target="Scene" name="HideLayer" param="VentilationOpenFilter"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/>
						<action target="Scene" name="ShowDialog" param="door_click"/>
					</onClick>
					
					<onUseObject name="Knob">
						<action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/>
						<action target="VentilationDoor" name="SetState" param="withKnob"/>
						<action target="Scene" name="PlaySound" param="use_top_of_stand_on_lock"/>
					</onUseObject>
				</state>
				
				<state name="withKnob">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="VentilationKnobMounted"/>
						<action target="Scene" name="ShowLayer" param="VentilationOpen"/>
						<action target="Scene" name="HideLayer" param="VentilationOpenFilter"/>
						<action target="Scene" name="PlaySound" param="open_ventilation_door"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick><action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/></onClick>
				</state>
				
				<state name="noSlot">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="VentilationDoorWindow" delay="60"/>
						<action target="Scene" name="HideLayer" param="VentilationKnobMounted"/>
						<action target="Scene" name="HideLayer" param="VentilationOpen"/>
						<action target="Scene" name="HideLayer" param="VentilationOpenFilter"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
				
					<onClick><action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/></onClick>
					
					<onUseObject name="Knob">
						<action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/>
						<action target="VentilationDoor" name="SetState" param="openNoSlot"/>
					</onUseObject>
				</state>
				
				<state name="openNoSlot">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="VentilationKnobMounted"/>
						<action target="Scene" name="ShowLayer" param="VentilationOpen"/>
						<action target="Scene" name="HideLayer" param="VentilationOpenFilter"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick><action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/></onClick>
					
					<onUseObject name="SlotWithFilter">
						<action target="Scene" name="OpenWindow" param="VentilationDoorWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="SlotWithFilter"/>
						<action target="VentilationDoor" name="SetState" param="withSlot"/>
						<action target="Smoke" name="SendEvent" param="ventilationOn"/>
						<action target="Scene" name="PlaySound" param="turn_ventilation_on"/>
						<action target="Scene" name="PlaySound" param="ventilation_start"/>
						<action target="Scene" name="PlaySound" param="ventilation_loop"/>
						
					</onUseObject>
				</state>
				
				<state name="withSlot">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="VentilationKnobMounted"/>
						<action target="Scene" name="HideLayer" param="VentilationOpen"/>
						<action target="Scene" name="HideLayer" param="VentilationOpenFilter"/>
						<action target="Scene" name="PlaySound" param="use_filter_on_ventilation"/>
						<action target="Scene" name="CloseWindow" param="VentilationDoorWindow" delay="60"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Smoke">
			<states>
				<state name="smokey">
					<onStateEnter><action target="Scene" name="ShowLayer" param="SmokeColor"/></onStateEnter>
					<onEvent name="ventilationOn">
						<action target="Smoke" name="SetState" param="noSmoke"/>
						<action target="Door" name="SendEvent" param="smokeCleared"/>
					</onEvent>
				</state>
				
				<state name="noSmoke">
					<onStateEnter><action target="Scene" name="HideLayer" param="SmokeColor"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Door">
			<clickStrategy type="rect" left="295" top="190" right="400" bottom="416"/>
			<states>
				<state name="hidden">
					<onStateEnter><action target="Scene" name="HideLayer" param="ExitOpen"/></onStateEnter>
					<onEvent name="smokeCleared">
						<action target="Door" name="SetState" param="visible"/>
					</onEvent>
				</state>
				
				<state name="visible">
					<onStateEnter><action target="Scene" name="HideLayer" param="ExitOpen"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>				
					
					<onClick><action target="Door" name="SetState" param="open"/></onClick>
				</state>
				
				<state name="open">
					<onStateEnter><action target="Scene" name="ShowLayer" param="ExitOpen"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="exit"/>
					</onMouseOver>				
					
					<onClick><action target="Scene" name="RegisterVictoryCondition" param=""/></onClick>
				</state>

			</states>
		</object>
	</objects>
</scene>

