dofile('data/Scripts/Scenes/Common.lua');
dofile('data/Scripts/Scenes/Animations/06_AtCollapsedAirship_Animations.lua');

------------------------------------------------------------------------------
--
function OnSceneLoad(restoringFromSave)
	InitGameState();

	play_field = playField;
    LoadData();
	play_field = nil;

	playField:GetObject('trexAnimation'):SetZ(playField:GetObject('trexAnimation'):GetZ() + 10.0);

    RootZoomZone = CreateZoomZone('RootZoomZone', nil, 
                                   nil, 0.0, 
                                   nil, 0.0,
							{'RootBackground',

							 'actZoneWaterHeatingDevice',

							 'actZoneSteam1',
							 'actZoneSteam2',
							 'actZoneSteam3',
							 'actZoneSteam4',
							 'actZoneSteam5',
							 'actZoneSteam6',
							 'actZoneSteam7',
							 'actZoneSteam8',

							 'LayerOverBigSteam',
							 'LayerOver01',
							 'LayerOver02',
							 'LayerOverBunchOfKeys',
							 'LayerOverCactus',
							 'LayerOverCompass',
							 'LeyerOverKey',

							 'actZoneMinigame',
							 'actZoneShutter',

							 'grid',

							 'Key',
							 'FuelCan',
							 'Handle',
							 'OilCan',
							 'Shutter',
							 'WaterCan',

							 'Handle_onPlace',
							 'Shutter_onPlace',

							 'apple',
							 'balance',
							 'basket',
							 'bone',
							 'books',
							 'bottle',
							 'box',
							 'bunchOfKeys',
							 'bust',
							 'cactus',
							 'catStatuette',
							 'chain',
							 'compass',
							 'crown',
							 'diamond',
							 'eagle',
							 'fotoFrame',
							 'frogStatuette',
							 'jug',
							 'lantern',
							 'leaf',
							 'mask',
							 'orange',
							 'padlock',
							 'pearl',
							 'pendant',
							 'plant',
							 'rose',
							 'ship',
							 'spear',
							 'telescope',
							 'typewriter',
							 'vase',
							 'watermelon'},

							{'Shutter_onPlace',
							 'Handle_onPlace'},

							{'trexAnimation'});

    WaterHeatingDeviceZoomZone = CreateZoomZone('WaterHeatingDeviceZoomZone', RootZoomZone, 
                                   'actZoneWaterHeatingDevice', 0.0, 
                                   nil, 0.0,
							{'ZoomWaterHeatingDeviceBackground',

							 'actZoneFuel',
							 'actZoneWater',
							 'actZoneOil',
							 'actZoneKey',
							 'mechanismAnimation',
							 'Key_onPlace'},

							{'Key_onPlace'});

if (restoringFromSave == false) then
    AddRandomTasks(true, MISC_TASK_COUNT_24,
		CreateTask('apple'),
		CreateTask('balance'),
		CreateTask('basket'),
		CreateTask('bone'),
		CreateTask('books'),
		CreateTask('bottle'),
		CreateTask('box'),
		CreateTask('bunchOfKeys'),
		CreateTask('bust'),
		CreateTask('cactus'),
		CreateTask('catStatuette'),
		CreateTask('chain'),
		CreateTask('compass'),
		CreateTask('crown'),
		CreateTask('diamond'),
		CreateTask('eagle'),
		CreateTask('fotoFrame'),
		CreateTask('frogStatuette'),
		CreateTask('jug'),
		CreateTask('lantern'),
		CreateTask('leaf'),
		CreateTask('mask'),
		CreateTask('orange'),
		CreateTask('padlock'),
		CreateTask('pearl'),
		CreateTask('pendant'),
		CreateTask('plant'),
		CreateTask('rose'),
		CreateTask('ship'),
		CreateTask('spear'),
		CreateTask('telescope'),
		CreateTask('typewriter'),
		CreateTask('vase'),
		CreateTask('watermelon')
	);

    playField:GetLevelScreen():AddTaskSafe(CreateTask('FuelCan'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Handle'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('OilCan'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Shutter'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('WaterCan'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Key'));
end

	CreateToolMap(	{'FuelCan', 	'actZoneFuel'},
					{'Handle', 		'actZoneMinigame'},
					{'OilCan', 		'actZoneOil'},
					{'Shutter',		'actZoneShutter'},
					{'Key',			'actZoneKey'},
					{'WaterCan',	'actZoneWater'});

	SetIconForGameObject(playField:GetObject('apple'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/apple_icon.png');
	SetIconForGameObject(playField:GetObject('balance'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/balance_icon.png');
	SetIconForGameObject(playField:GetObject('basket'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/basket_icon.png');
	SetIconForGameObject(playField:GetObject('bone'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bone_icon.png');
	SetIconForGameObject(playField:GetObject('books'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/books_icon.png');
	SetIconForGameObject(playField:GetObject('bottle'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bottle_icon.png');
	SetIconForGameObject(playField:GetObject('box'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/box_icon.png');
	SetIconForGameObject(playField:GetObject('bunchOfKeys'),'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bunchOfKeys_icon.png');
	SetIconForGameObject(playField:GetObject('bust'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bust_icon.png');
	SetIconForGameObject(playField:GetObject('cactus'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/cactus_icon.png');
	SetIconForGameObject(playField:GetObject('catStatuette'),'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/catStatuette_icon.png');
	SetIconForGameObject(playField:GetObject('chain'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/chain_icon.png');
	SetIconForGameObject(playField:GetObject('compass'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/compass_icon.png');
	SetIconForGameObject(playField:GetObject('crown'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/crown_icon.png');
	SetIconForGameObject(playField:GetObject('diamond'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/diamond_icon.png');
	SetIconForGameObject(playField:GetObject('eagle'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/eagle_icon.png');
	SetIconForGameObject(playField:GetObject('fotoFrame'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/fotoFrame_icon.png');
	SetIconForGameObject(playField:GetObject('frogStatuette'),'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/frogStatuette_icon.png');
	SetIconForGameObject(playField:GetObject('jug'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/jug_icon.png');
	SetIconForGameObject(playField:GetObject('lantern'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/lantern_icon.png');
	SetIconForGameObject(playField:GetObject('leaf'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/leaf_icon.png');
	SetIconForGameObject(playField:GetObject('mask'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/mask_icon.png');
	SetIconForGameObject(playField:GetObject('orange'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/orange_icon.png');
	SetIconForGameObject(playField:GetObject('padlock'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/padlock_icon.png');
	SetIconForGameObject(playField:GetObject('pearl'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/pearl_icon.png');
	SetIconForGameObject(playField:GetObject('pendant'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/pendant_icon.png');
	SetIconForGameObject(playField:GetObject('plant'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/plant_icon.png');
	SetIconForGameObject(playField:GetObject('rose'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/rose_icon.png');
	SetIconForGameObject(playField:GetObject('ship'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/ship_icon.png');
	SetIconForGameObject(playField:GetObject('spear'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/spear_icon.png');
	SetIconForGameObject(playField:GetObject('telescope'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/telescope_icon.png');
	SetIconForGameObject(playField:GetObject('typewriter'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/typewriter_icon.png');
	SetIconForGameObject(playField:GetObject('vase'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/vase_icon.png');
	SetIconForGameObject(playField:GetObject('watermelon'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/watermelon_icon.png');

	SetIconForGameObject(playField:GetObject('FuelCan'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/FuelCan_icon.png');
	SetIconForGameObject(playField:GetObject('Handle'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Handle_icon.png');
	SetIconForGameObject(playField:GetObject('OilCan'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/OilCan_icon.png');
	SetIconForGameObject(playField:GetObject('Shutter'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/Shutter_icon.png');
	SetIconForGameObject(playField:GetObject('WaterCan'),	'data/Texture/Scenes/06_AtCollapsedAirship/Items/WaterCan_icon.png');
	SetIconForGameObject(playField:GetObject('Key'),		'data/Texture/Scenes/06_AtCollapsedAirship/Items/Key_icon.png');

	playField:GetObject('trexAnimation'):SetZ(playField:GetObject('trexAnimation'):GetZ() - 10.0);
	
if (restoringFromSave == false) then
	gameState.isLeftLeg = true;
	gameState.screenShakeTimePeriod = 0.0;
	gameState.steamActivationPeriod = 0.0;
	gameState.steams = {};
	gameState.bigSteam = nil;
	gameState.hatchInitX = playField:GetObject('grid'):GetX();
	gameState.hatchShift = -100.0;

	gameState.waterUsed = false;
	gameState.fuelUsed = false;
	gameState.oilUsed = false;
	gameState.keyOnPlace = false;
	gameState.shutterOnPlace = false;
	gameState.handleUsed = false;

	gameState.hatchIsMoving = false;
	gameState.hatchMoved = false;
	gameState.minigameWasRun = false;

	gameState.allToolsApplied = false;
    gameState.levelCompleted = false;
end

	AssignActiveZonesGlow({function() return gameState.fuelUsed; end,		'actZoneFuel',			'FuelCan_ghost'},
						  {function() return gameState.handleUsed; end,		'actZoneMinigame',		'Handle_ghost'},
					      {function() return gameState.oilUsed; end,		'actZoneOil',			'OilCan_ghost'},
						  {function() return gameState.shutterOnPlace; end,	'actZoneShutter',		'Shutter_ghost'},
						  {function() return gameState.keyOnPlace;end,		'actZoneKey',			'Key_ghost'},
						  {function() return gameState.waterUsed; end,		'actZoneWater',			'WaterCan_ghost'});

    ApplyLevelDump(restoringFromSave);
	SetZoneVisible(RootZoomZone, true, false);

	auxSceneInit(restoringFromSave);
	auxProcessToolObjectStateAnCursorType();
end

------------------------------------------------------------------------------
--
function OnSceneFree()
    FreeData();
    StopSound('L06S10');
    StopSound('L06S11');
    StopSound('L06S12');
    StopSound('L06S14');
    StopSound('L06S15');
    StopSound('L06S16');
    StopSound('L06S17');
    StopSound('L06S18');
    StopSound('L06S19');
end

--// Local auxiliary functions - - - - - - - - - - - - - - - - - - - - - - - -
function auxSceneInit(restoringFromSave)
    local initialActions = function()
		ShowLevelIntro(06);
    end
	local regularActions = function()
	    SetSoundVolume('L06S10', 1.0);
		if (not gameState.shutterOnPlace) then
		    PlaySound('L06S10', true);
		else
			StopSound('L06S10');
		end

		if (gameState.fuelUsed == true and gameState.waterUsed == true and 
			gameState.oilUsed == true and gameState.handleUsed == true) then

			gameState.customCursors['actZoneWaterHeatingDevice'] = nil;
			gameState.lockedObjects['actZoneWaterHeatingDevice'] = true;
		else
			gameState.customCursors['actZoneWaterHeatingDevice'] = {'CursorZoom'};
			gameState.lockedObjects['actZoneWaterHeatingDevice'] = nil;
		end

		auxStopAnimation('Key_onPlace', HGEANIM_FWD);
		auxStopAnimation('mechanismAnimation', HGEANIM_FWD + HGEANIM_LOOP);

	    playField:IgnoreOnTestPoint('actZoneSteam1');
	    playField:IgnoreOnTestPoint('actZoneSteam2');
	    playField:IgnoreOnTestPoint('actZoneSteam3');
	    playField:IgnoreOnTestPoint('actZoneSteam4');
	    playField:IgnoreOnTestPoint('actZoneSteam5');
	    playField:IgnoreOnTestPoint('actZoneSteam6');
	    playField:IgnoreOnTestPoint('actZoneSteam7');
	    playField:IgnoreOnTestPoint('actZoneSteam8');

		auxCreateAtCollapsedAirshipAnimations(playField:GetObject('RootBackground'));
		auxPlayAtCollapsedAirshipAnimation('Spider2');
		auxPlayAtCollapsedAirshipAnimation('Dust');
		auxPlayAtCollapsedAirshipAnimation('Spider1');
		auxPlayAtCollapsedAirshipAnimation('Light1');
		auxPlayAtCollapsedAirshipAnimation('Light2');

		auxInitSteams();
		auxCreateDinoMovement();

		assert(playField:HasObject('Handle_onPlace') == true and playField:HasObject('grid') == true);
		auxAttachInPlace(playField:GetObject('Handle_onPlace'), playField:GetObject('grid'));

		gameState.hatchIsMoving = false;
	end

    if (restoringFromSave == false) then
        initialActions();
	else
    end	
    regularActions();

	if (gameState.levelCompleted == true) then
		gameState.levelCompleted = false;
		auxTestLevelCompleteCondition();
	end
end

function auxProcessToolObjectStateAnCursorType()
    assert(gameState.waterUsed ~= nil and
		   gameState.fuelUsed ~= nil and
		   gameState.oilUsed ~= nil and
		   gameState.keyOnPlace ~= nil and
		   gameState.shutterOnPlace ~= nil and
		   gameState.handleUsed ~= nil and
		   gameState.minigameWasRun ~= nil and
		   true);

	if (gameState.waterUsed == true) then
		gameState.customCursors['actZoneWater'] = nil;
	else
		gameState.customCursors['actZoneWater'] = {'CursorArms'};
	end

	if (gameState.fuelUsed == true) then
		gameState.customCursors['actZoneFuel'] = nil;
	else
		gameState.customCursors['actZoneFuel'] = {'CursorArms'};
	end

	if (gameState.oilUsed == true) then
		gameState.customCursors['actZoneOil'] = nil;
	else
		gameState.customCursors['actZoneOil'] = {'CursorArms'};
	end

	if (gameState.shutterOnPlace == true) then
		RootZoomZone.UnhideObject('Shutter_onPlace');
		gameState.bigSteam:SetGeneration(false);
		gameState.customCursors['actZoneShutter'] = nil;
	else
		RootZoomZone.HideObject('Shutter_onPlace');
		gameState.bigSteam:SetGeneration(true);
		gameState.customCursors['actZoneShutter'] = {'CursorArms'};
	end

	if (gameState.handleUsed == true) then
		RootZoomZone.UnhideObject('Handle_onPlace');
	else
		RootZoomZone.HideObject('Handle_onPlace');
	end
	if (gameState.hatchIsMoving == false) then
		if (gameState.hatchMoved == true) then
			playField:GetObject('grid'):SetX(gameState.hatchInitX + gameState.hatchShift);
		else
			playField:GetObject('grid'):SetX(gameState.hatchInitX);
		end
	end

	if (gameState.handleUsed == true and gameState.minigameWasRun == false) then
		if (gameState.hatchMoved == true) then
			gameState.customCursors['actZoneMinigame'] = {'CursorNavigation', 90.0 /180.0*M_PI};
		else
			gameState.customCursors['actZoneMinigame'] = {'CursorArms'};
		end
	else
		if (gameState.handleUsed == true) then
			gameState.customCursors['actZoneMinigame'] = nil;
		else
			gameState.customCursors['actZoneMinigame'] = {'CursorArms'};
		end
	end

	if (gameState.keyOnPlace == true) then
		WaterHeatingDeviceZoomZone.UnhideObject('Key_onPlace');
		gameState.customCursors['actZoneKey'] = nil;
	else
		WaterHeatingDeviceZoomZone.HideObject('Key_onPlace');
		gameState.customCursors['actZoneKey'] = {'CursorArms'};
	end
	
	if (gameState.oilUsed == true and gameState.keyOnPlace == true and
        not playField:GetObject('mechanismAnimation'):GetAnimation():IsPlaying()) then
		playField:GetObject('mechanismAnimation'):GetAnimation():Play();
	else
		playField:GetObject('mechanismAnimation'):GetAnimation():Stop();
	end

	if (gameState.fuelUsed == true and gameState.waterUsed == true and 
		gameState.oilUsed == true and gameState.handleUsed == true) then

		gameState.lockedObjects['actZoneWaterHeatingDevice'] = true;
		gameState.customCursors['actZoneWaterHeatingDevice'] = nil;
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxCreateShakeEffector(object, amplitudeFactor)
	local duration = 0.75;
	local objY = object:GetY();
	local objX = object:GetX();

	local amplitude = 5.0 * amplitudeFactor;
	local fadeSpeed = 5.0;
	local offset = amplitude > 0.0 and 0.8 or 0.0;

	eff = CreateAnimationEffector();
	eff:AttachTo(object);

    local time = 0.0;
    local pointCount = 6;
    local dT = duration / pointCount;
    local xScale = 0.25;
    while time <= duration do
        local value = 1.0/math.exp(fadeSpeed*time);
    	eff:SetKey(_TRACK_Y, time, 	        objY + amplitude * value + offset);
    	eff:SetKey(_TRACK_Y, time + dT/2.0, objY);
    	eff:SetKey(_TRACK_X, time, 	        objX + xScale * amplitude * value + offset);
    	eff:SetKey(_TRACK_X, time + dT/2.0, objX);
    	time = time + dT;
    end
	eff:Play();
	
	if amplitudeFactor > 0 then
	    local soundName = (gameState.isLeftLeg == true) and 'L06S14' or 'L06S15';
	    SetSoundVolume(soundName, amplitudeFactor);
	    PlaySound(soundName);
	    
	    gameState.isLeftLeg = not gameState.isLeftLeg;
	end
end
function auxCreateDinoMovement()
	local dinoObj = playField:GetObject('trexAnimation');
	local dinoX = dinoObj:GetX();
	local dinoY = dinoObj:GetY();
	local movementDistance = 5000.0;
	local movementDuration = 45.0;

	gameState.dinoInitialX = dinoX;

	eff = CreateAnimationEffector();
	eff:AttachTo(dinoObj);
	eff:SetMode(_ANIM_LOOP);

	eff:SetKey(_TRACK_X,  0.0, 			   			dinoX + movementDistance / 2.0);
	eff:SetKey(_TRACK_SX, 0.0, 			   			1.0);
	eff:SetKey(_TRACK_X,  movementDuration,			dinoX - movementDistance / 2.0);
	eff:SetKey(_TRACK_SX, 0.99 * movementDuration,	1.0);
	eff:SetKey(_TRACK_SX, movementDuration, 		-1.0);
	eff:SetKey(_TRACK_X,  2.0 * movementDuration,	dinoX + movementDistance / 2.0);
	eff:SetKey(_TRACK_SX, 1.99 * movementDuration,	-1.0);

	eff:Play();
	dinoEffector = eff;
end
function auxUpdateDinoMovement(dt)
--// periodic screen share effect
    local SCREEN_SHAKE_TIME_PERIOD = 13.0/7.0/2.0;
	gameState.screenShakeTimePeriod = gameState.screenShakeTimePeriod + dt;
	if (gameState.screenShakeTimePeriod > SCREEN_SHAKE_TIME_PERIOD) then
		gameState.screenShakeTimePeriod = gameState.screenShakeTimePeriod - SCREEN_SHAKE_TIME_PERIOD;
		assert(gameState.dinoInitialX);
		local dinoLocation = playField:GetObject('trexAnimation'):GetX();
		local distanceToDino = math.abs(gameState.dinoInitialX - dinoLocation);
		local amplitudeFactor = 1.0 / math.exp(distanceToDino/600.0);
		auxCreateShakeEffector(playField, amplitudeFactor > 0.1 and amplitudeFactor or 0.0);
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxInitSteams()
--// initialize steam objects
	assert(gameState.steams ~= nil);

	gameState.bigSteam = auxCreateSteam(20.0, -20.0, playField:GetObject('actZoneShutter'), false, 3.6);

	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam1'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam2'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam3'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam4'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam5'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam6'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam7'), false));
	table.insert(gameState.steams, auxCreateSteam(0.0, 0.0, playField:GetObject('actZoneSteam8'), false));
end
function auxCreateSteam(x,y, parentObject, enableParticleGeneration, scale)
    enableParticleGeneration = (enableParticleGeneration ~= nil and enableParticleGeneration or false);
    scale = (scale ~= nil and scale or 1.0);

	local steamPS = CreateParticleSystemEntity('data/ParticleSystem/Steam.psi', 'SmokeParticle');
	steamPS:AttachTo(parentObject);
	steamPS:SetXY(x,y);	
	steamPS:SetZ(1.0);
	steamPS:SetScale(scale);
	steamPS:SetGeneration(enableParticleGeneration);
	steamPS:AffectedByParentAngleAndScale(true);
	return steamPS;
end
function auxEnableSteam(steamIndex, state)
    if (gameState ~= nil and gameState.steams ~= nil and table.getn(gameState.steams) >= steamIndex) then
        gameState.steams[steamIndex]:SetGeneration(state);
    end
end
function auxUpdateSteames(dt)
    local STEAM_ACTIVATION_PERIOD = 3.0;
	gameState.steamActivationPeriod = gameState.steamActivationPeriod + dt;
	if (gameState.levelCompleted == false and
        gameState.steams ~= nil and table.getn(gameState.steams) > 0 and
        gameState.steamActivationPeriod > STEAM_ACTIVATION_PERIOD) then
		gameState.steamActivationPeriod = gameState.steamActivationPeriod - STEAM_ACTIVATION_PERIOD;

		local steamRandomIndex = math.random(table.getn(gameState.steams));
		local steamActivity = 1.5 * math.random();
		auxEnableSteam(steamRandomIndex, true);
		TimerDoString('auxEnableSteam('..steamRandomIndex..', false)', steamActivity, playField:GetTimer());
		
		if math.random(2) == 1 then
		    StopSound('L06S11');
            PlaySound('L06S11');
		else
		    StopSound('L06S12');
            PlaySound('L06S12');
		end
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxDisableHatchMovingFlag()
	gameState.hatchIsMoving = false;
end
function auxPlayHatchMovementAnimation()
	local duration = 1.0;

	gameState.hatchMoved = true;
	gameState.hatchIsMoving = true;
	TimerDoString('auxDisableHatchMovingFlag();', duration, playField:GetTimer());

	RootZoomZone.UnhideObject('Handle_onPlace');
	local objHatch = playField:GetObject('grid');
	objHatch:SetX(gameState.hatchInitX);
	objHatch:Move(gameState.hatchShift, 0.0, duration);

	gameState.customCursors['actZoneMinigame'] = {'CursorNavigation', 90.0 /180.0*M_PI};
	PlaySound('L06S19');
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxTestLevelCompleteCondition()
	if (gameState.allToolsApplied == true and
		gameState.minigameWasRun == true and
		gameState.levelCompleted == false and
		playField:GetLevelScreen():HasUncompletedTask() == false) then

		gameState.levelCompleted = true;
		TimerDoString('OnWin();', 2.0, playField:GetTimer());
	end
end
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

------------------------------------------------------------------------------
--
function OnDialogButtonPress(name, param)
    if (param == 'MSG_MINIGAME_SKIPPED' or param == 'MSG_MINIGAME_DONE') then
        SetSoundVolume('L06S10', 1.0);
        SetSoundVolume('L06S11', 1.0);
        SetSoundVolume('L06S12', 1.0);
    end
end

------------------------------------------------------------------------------
--
function OnUpdate(dt)
	auxUpdateDinoMovement(dt);
	auxUpdateSteames(dt);

    DefaultOnUpdate(dt);
end

------------------------------------------------------------------------------
--
function OnWin()
	DefaultOnWin();
end

------------------------------------------------------------------------------
--
function OnObjectMouseEnter(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseEnter(object);
	ActivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseLeave(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseLeave(object);
    DeactivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseDown(object)
    local objectName = object:GetName();
    local isWrongClick = true;

	assert(gameState.activeZone ~= nil and gameState.locker:GetNReferences() > 0);

    if (gameState.lockedObjects[objectName] ~= true) then
        if (gameState.activeZone.HasObject(objectName)) then
            isWrongClick = DefaultOnZoomZoneActiveObjectClick(objectName);

			--// ...
			if (objectName == 'actZoneMinigame' and 
                gameState.hatchIsMoving == false and 
                gameState.handleUsed == true and
                gameState.levelCompleted == false ) then

                if (gameState.hatchMoved == false) then
				    auxPlayHatchMovementAnimation();
				elseif (gameState.minigameWasRun == false) then
					gameState.minigameWasRun = true;
    				auxTestLevelCompleteCondition();
--// run minigame
					SetSoundVolume('L06S10', 0.3);
					SetSoundVolume('L06S11', 0.3);
					SetSoundVolume('L06S12', 0.3);

					playField:GetLevelScreen():RunMiniGame('data/Scripts/Minigames/Pipes.lua');
    		    end
				auxProcessToolObjectStateAnCursorType();
                isWrongClick = false;
			end

	        if (isWrongClick == true and playField:GetLevelScreen():IsTaskObject(objectName)) then
	            auxAttachInPlace(object, playField);
				object:ResetClippingRect();
				--// remove object from zoom-zone which contents it
				assert(gameState.activeZone.objects[objectName] ~= nil);
				gameState.activeZone.objects[objectName] = nil;

                playField:OnObjectFound(object);
                isWrongClick = false;
            end
        else
--			assert(gameState.activeZone ~= RootZoomZone and 
--				   gameState.locker:GetNReferences() > 1 and
--				   'Attempt to close root scene - you have clicked on an object which hasn`t been added to any zoom-zone');
            if (gameState.activeZone ~= RootZoomZone and gameState.locker:GetNReferences() > 1) then
                if (gameState.lockedObjects[gameState.activeZone.activeObject] == nil) then
                    SetZoneVisible(gameState.activeZone, false);
                end
            else
                Log('Lua: OnObjectMouseDown(\''..objectName..'\'): Was made click on object which hasn`t been attached to any zoom-zone');
            end
        end --// if (gameState.activeZone.HasObject(...
    end --// if (gameState.lockedObjects[...

	--// Tips - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	if (objectName == 'actZoneShutter' and gameState.shutterOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_STEAM_TIP1'), GetTextString('LEVEL6_STEAM_TIP1'));
	elseif (objectName == 'actZoneOil' and gameState.oilUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_OIL_TIP1'), GetTextString('LEVEL6_OIL_TIP2'));
	elseif (objectName == 'actZoneFuel' and gameState.fuelUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_FUEL_TIP1'), GetTextString('LEVEL6_FUEL_TIP2'));
	elseif (objectName == 'actZoneWater' and gameState.waterUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_WATER_TIP1'), GetTextString('LEVEL6_WATER_TIP2'));
	elseif (objectName == 'actZoneKey' and gameState.keyOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_KEY_TIP'));
	elseif (objectName == 'actZoneMinigame' and gameState.minigameWasRun == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL6_HANDLE_TIP1'), GetTextString('LEVEL6_HANDLE_TIP2'));
	else
	    playField:GetLevelScreen():HideTip();
	end
	--//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    DefaultOnObjectClick(object, isWrongClick, not playField:GetLevelScreen():IsTipShown());
    DefaultOnObjectMouseEnter(object);
end

------------------------------------------------------------------------------
--
function OnObjectMouseUp(object)
end

------------------------------------------------------------------------------
--
function OnObjectFound(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	local objectMustBeHighlighted = DefaultOnObjectFound(object);
	return objectMustBeHighlighted;
end

------------------------------------------------------------------------------
--
function OnToolFound(tool)
end

------------------------------------------------------------------------------
--
function CanToolBeApplied(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local canToolBeApplied = true;
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	canToolBeApplied = DefaultCanToolBeApplied(tool, object);
	return canToolBeApplied;
end

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
function auxCloseWaterHeatingDeviceZoom()
	CloseAndBlockActiveZone();

	auxTestLevelCompleteCondition();
	auxProcessToolObjectStateAnCursorType();

	assert(gameState.activeZone == RootZoomZone);
end

------------------------------------------------------------------------------
--
function OnToolApply(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local toolApplied = false;

	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if (toolName == 'WaterCan' and objName == gameState.toolMap[toolName]) then
    	gameState.waterUsed = true;
		toolApplied = true;
		PlaySound('L06S18');
	end
	if (toolName == 'FuelCan' and objName == gameState.toolMap[toolName]) then
    	gameState.fuelUsed = true;
		toolApplied = true;
		PlaySound('L06S17');
	end
	if (toolName == 'OilCan' and objName == gameState.toolMap[toolName]) then
    	gameState.oilUsed = true;
		toolApplied = true;
		PlaySound('L06S16');
	end
	if (toolName == 'Shutter' and objName == gameState.toolMap[toolName]) then
    	gameState.shutterOnPlace = true;
		toolApplied = true;
		StopSound('L06S10');
	end
	if (toolName == 'Handle' and objName == gameState.toolMap[toolName]) then
    	gameState.handleUsed = true;
		toolApplied = true;
	end
	if (toolName == 'Key' and objName == gameState.toolMap[toolName]) then
    	gameState.keyOnPlace = true;
		toolApplied = true;
		playField:GetObject('Key_onPlace'):GetAnimation():Play();
	end
	if (not toolApplied) then
	    playField:GetLevelScreen():ShowTip(GetTextString('WRONG_ITEM_APPLIED_TIP1'),
										   GetTextString('WRONG_ITEM_APPLIED_TIP2'));
	end

    --// automatic zoom-zone hiding and blocking when all item have been used
	do
	    assert(gameState.activeZone ~= nil);

	    if (gameState.activeZone == WaterHeatingDeviceZoomZone and
			(toolName  == 'WaterCan' or toolName  == 'FuelCan' or toolName  == 'OilCan' or toolName == 'Key') and
			(gameState.waterUsed == true and gameState.fuelUsed == true and gameState.oilUsed == true and gameState.keyOnPlace == true)) then

			BlockZone(gameState.activeZone);
			TimerDoString('auxCloseWaterHeatingDeviceZoom();', 2.0, playField:GetTimer());
--			CloseAndBlockActiveZone();
	    end
	end

	if (gameState.waterUsed == true and
		gameState.fuelUsed == true and
		gameState.oilUsed == true and
		gameState.keyOnPlace == true and
		gameState.shutterOnPlace == true and
		gameState.handleUsed == true and
		gameState.allToolsApplied == false) then

		gameState.allToolsApplied = true;
		if (playField:GetLevelScreen():HasUncompletedTask() == true) then
		    playField:GetLevelScreen():ShowTip(GetTextString('HAVE_TO_FIND_ITEMS_MSG1'),
											   GetTextString('HAVE_TO_FIND_ITEMS_MSG2'));
		else
			auxTestLevelCompleteCondition();
		end
	end

	auxProcessToolObjectStateAnCursorType();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DefaultOnObjectMouseEnter(object);
	if (toolApplied == true) then
	    DeactivateActiveZoneDeactivatedGlow(object:GetName());
	end
	return toolApplied;
end

------------------------------------------------------------------------------
--
function OnObjectReachPanel(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	auxTestLevelCompleteCondition();
end

------------------------------------------------------------------------------
--
function OnButtonPress(zoneName)
    DefaultOnButtonPress(zoneName);
end

------------------------------------------------------------------------------
--
function OnMouseMove(prevMousePos, currentMousePos)
end

------------------------------------------------------------------------------
--
function OnSetTool(tool)
end

------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData()
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/background.png',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RootBackground',anim,512,384,99,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam1',anim,787,402,104,0,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam2',anim,814,406,104,-100,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam3',anim,791,353,104,-90,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam4',anim,974,381,104,20,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam5',anim,144,253,104,-150,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam6',anim,179,473,104,-90,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam7',anim,161,438,104,-135,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneSteam8',anim,172,391,104,180,0.4,0.4)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOverBigSteam.png',0,0,84,136,1,0)
	anim:SetHotSpot(42,68)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBigSteam',anim,916,203,109,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOver01.png',0,0,64,92,1,0)
	anim:SetHotSpot(32,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOver01',anim,217,433,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOver02.png',0,0,75,80,1,0)
	anim:SetHotSpot(37,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOver02',anim,282,420,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOverBunchOfKeys.png',0,0,48,55,1,0)
	anim:SetHotSpot(24,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBunchOfKeys',anim,898,489,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOverCactus.png',0,0,81,109,1,0)
	anim:SetHotSpot(40,54)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverCactus',anim,380,506,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LayerOverCompass.png',0,0,86,123,1,0)
	anim:SetHotSpot(43,61)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverCompass',anim,930,454,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneMinigame',anim,723,622,104,0,1.2,0.5)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneShutter',anim,904,199,107,0,0.5,0.5)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/grid.png',0,0,194,92,1,0)
	anim:SetHotSpot(97,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('grid',anim,724,606,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/FuelCan.png',0,0,213,154,1,0)
	anim:SetHotSpot(106,77)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('FuelCan',anim,851,695,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Handle.png',0,0,110,117,1,0)
	anim:SetHotSpot(55,56)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Handle',anim,461,87,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/OilCan.png',0,0,159,190,1,0)
	anim:SetHotSpot(79,95)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('OilCan',anim,545,669,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Shutter.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Shutter',anim,158,361,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Shutter_onPlace.png',0,0,106,95,1,0)
	anim:SetHotSpot(53,47)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Shutter_onPlace',anim,901,204,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/LeyerOverKey.png',0,0,118,92,1,0)
	anim:SetHotSpot(59,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LeyerOverKey',anim,861,197,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Key.png',0,0,71,93,1,0)
	anim:SetHotSpot(35,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Key',anim,861,174,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/WaterCan.png',0,0,142,203,1,0)
	anim:SetHotSpot(71,101)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('WaterCan',anim,841,595,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/apple.png',0,0,44,37,1,0)
	anim:SetHotSpot(22,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('apple',anim,966,627,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/balance.png',0,0,158,154,1,0)
	anim:SetHotSpot(79,77)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('balance',anim,272,694,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/basket.png',0,0,256,127,1,0)
	anim:SetHotSpot(67,63)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('basket',anim,761,701,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bone.png',0,0,78,112,1,0)
	anim:SetHotSpot(39,56)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bone',anim,648,533,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/books.png',0,0,170,107,1,0)
	anim:SetHotSpot(85,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('books',anim,946,668,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bottle.png',0,0,83,81,1,0)
	anim:SetHotSpot(22,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bottle',anim,589,530,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/box.png',0,0,132,89,1,0)
	anim:SetHotSpot(66,44)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('box',anim,889,616,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bunchOfKeys.png',0,0,41,70,1,0)
	anim:SetHotSpot(20,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bunchOfKeys',anim,901,526,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/bust.png',0,0,164,237,1,0)
	anim:SetHotSpot(82,118)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bust',anim,952,652,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/cactus.png',0,0,131,162,1,0)
	anim:SetHotSpot(65,81)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cactus',anim,454,511,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/catStatuette.png',0,0,154,170,1,0)
	anim:SetHotSpot(120,85)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('catStatuette',anim,216,668,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/chain.png',0,0,47,130,1,0)
	anim:SetHotSpot(23,65)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('chain',anim,210,493,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/compass.png',0,0,83,85,1,0)
	anim:SetHotSpot(41,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('compass',anim,910,461,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/crown.png',0,0,60,41,1,0)
	anim:SetHotSpot(30,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('crown',anim,563,392,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/diamond.png',0,0,44,38,1,0)
	anim:SetHotSpot(22,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('diamond',anim,292,402,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/eagle.png',0,0,81,77,1,0)
	anim:SetHotSpot(40,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('eagle',anim,635,218,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/fotoFrame.png',0,0,100,153,1,0)
	anim:SetHotSpot(50,76)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fotoFrame',anim,288,632,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/frogStatuette.png',0,0,82,78,1,0)
	anim:SetHotSpot(41,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('frogStatuette',anim,988,564,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/jug.png',0,0,81,134,1,0)
	anim:SetHotSpot(40,67)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('jug',anim,439,570,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/lantern.png',0,0,66,144,1,0)
	anim:SetHotSpot(33,72)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lantern',anim,456,270,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/leaf.png',0,0,56,52,1,0)
	anim:SetHotSpot(28,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('leaf',anim,217,384,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/mask.png',0,0,69,96,1,0)
	anim:SetHotSpot(34,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('mask',anim,750,553,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/orange.png',0,0,38,37,1,0)
	anim:SetHotSpot(19,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('orange',anim,197,251,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/padlock.png',0,0,50,70,1,0)
	anim:SetHotSpot(25,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('padlock',anim,284,288,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/pearl.png',0,0,32,32,1,0)
	anim:SetHotSpot(16,16)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pearl',anim,561,451,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/pendant.png',0,0,47,214,1,0)
	anim:SetHotSpot(23,107)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pendant',anim,314,242,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/plant.png',0,0,68,77,1,0)
	anim:SetHotSpot(34,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('plant',anim,228,288,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/rose.png',0,0,43,52,1,0)
	anim:SetHotSpot(21,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('rose',anim,808,535,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/ship.png',0,0,85,100,1,0)
	anim:SetHotSpot(42,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ship',anim,265,215,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/spear.png',0,0,43,209,1,0)
	anim:SetHotSpot(21,104)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('spear',anim,257,591,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/telescope.png',0,0,83,59,1,0)
	anim:SetHotSpot(41,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('telescope',anim,253,693,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/typewriter.png',0,0,121,102,1,0)
	anim:SetHotSpot(60,51)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('typewriter',anim,456,567,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/vase.png',0,0,93,75,1,0)
	anim:SetHotSpot(46,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vase',anim,827,582,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Misc/watermelon.png',0,0,110,66,1,0)
	anim:SetHotSpot(55,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('watermelon',anim,678,585,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneWaterHeatingDevice',anim,337,494,104,-20,1,1.4)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Zones/WaterHeatingDevice/Layers/background.jpg',0,0,640,480,1,0)
	anim:SetHotSpot(320,240)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	play_field:CreateObject('ZoomWaterHeatingDeviceBackground',anim,561,399,200,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneFuel',anim,381,319,204,0,0.6,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneWater',anim,614,317,204,0,0.6,0.7)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneOil',anim,712,520,203,0,0.8,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneKey',anim,711,429,204,0,0.8,0.5)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Handle_onPlace.png',0,0,57,47,1,0)
	anim:SetHotSpot(28,23)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	play_field:CreateObject('Handle_onPlace',anim,675,632,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Zones/WaterHeatingDevice/Layers/mechanismAnimation.png',0,0,102,134,6,6)
	anim:SetHotSpot(51,67)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	play_field:CreateObject('mechanismAnimation',anim,714,518,201,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Key_onPlace.png',0,0,128,136,9,8)
	anim:SetHotSpot(64,68)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	play_field:CreateObject('Key_onPlace',anim,678,430,203,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/trexAnimation.png',0,0,637,294,13,7)
	anim:SetHotSpot(300,300)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('trexAnimation',anim,686,577,98,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/FuelCan_ghost.png',0,0,119,127,1,0)
	anim:SetHotSpot(59,63)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('FuelCan_ghost',anim,311,288,210,45,-1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/OilCan_ghost.png',0,0,111,141,1,0)
	anim:SetHotSpot(55,70)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('OilCan_ghost',anim,691,502,210,45,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Shutter_ghost.png',0,0,106,95,1,0)
	anim:SetHotSpot(53,47)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Shutter_ghost',anim,899,205,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/WaterCan_ghost.png',0,0,103,133,1,0)
	anim:SetHotSpot(51,66)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('WaterCan_ghost',anim,657,312,210,0,-1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Handle_ghost.png',0,0,57,47,1,0)
	anim:SetHotSpot(28,23)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Handle_ghost',anim,675,632,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Items/Key_ghost.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Key_ghost',anim,677,417,210,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/06_AtCollapsedAirship/Layers/backgroundScene.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('backgroundScene',anim,512,384,97,0,1,1)
end

function FreeData()
end
-- CLEAR_ON_SAVE_END
