require( "scripts/objects/get_something_object.lua" );

local	indicator_pos_x = -5;
local	indicator_pos_y = -20;

local ObjectTable = GetObjectTable("grillcollectfoodtime");

grill2 = get_something_object:new{
	object_name="grill2",
	
	anchor_x=14,
	anchor_y=77,
	offset_x=-13,
	offset_y=0,
	indicator_ui_x=indicator_pos_x,
	indicator_ui_y=indicator_pos_y,
	dad_ui_x=indicator_pos_x+35,
	dad_ui_y=indicator_pos_y,
	mom_ui_x=indicator_pos_x+35,
	mom_ui_y=indicator_pos_y,
	
	texture="anim/objects/grill/grill2",
	animation_script="anim/objects/grill/grill2_animation_script.lua",
	glow_texture="anim/objects/grill/grill_glow2",
	glow_animation_script="anim/objects/default_glow_animation_script.lua",
	
	character_messing_animation = "doing_stuff_up",
	character_cleaning_animation = "doing_stuff_up",
	
	next_object_selected = "mesafora2";
	
	--next_object_selected = "mesajantar";
	--next_object_state = "set_click_me";
	
	stuff_name = "food_cooked";
	stuff_x = "20";
	stuff_y = "-50";
	stuff_layer = "1";
	
	parent_final_state = "holding_cooked_food";
	
	cleaning_state_time = 500,
	messing_state_time = 500,
	flipped_animation = true,
	
	complex_object = true;
	next_task_x = indicator_pos_x-5,
	next_task_y = indicator_pos_y-30,
	
	cleaning_timer_x = 0;
	cleaning_timer_y = -100;

	cleaning_state_time = ObjectTable["cleaning_time"],
	
}

function grill2:cleaning_update()
	if (GetCurrentTime() - self.new_state_start_time) > self.cleaning_state_time then
		if self.no_stress_power then
			HideNoStressIcon(self.object_name);
		end
		
		if self.parent_chosen == "dad" then
			ShowDadNextTaskIcon(self.next_object_selected);
		else
			ShowMomNextTaskIcon(self.next_object_selected);
		end
		
		self.no_stress_power = false;	
		PlayCharacterAnimation(self.parent_chosen, self.character_clean_animation);
		ShowCharacterStuff(self.parent_chosen, self.stuff_name, self.stuff_x, self.stuff_y, self.stuff_layer);
		SetCharacterState(self.parent_chosen, self.parent_final_state);
		--AddCharacterStress(self.parent_chosen, self.stress_inc);
		FinishCharacterTask(self.parent_chosen);
		
		PlayObjectAnimation(self.object_name, self.object_clean_animation);
		ChangeObjectState(self.object_name, self.clean_state_name);
		
		PlayObjectAnimation("churrasqueira1", "clean");
		ChangeObjectState("churrasqueira1", "clean");
		
		PlayObjectAnimation(self.next_object_selected, self.next_object_state);
		ChangeObjectState(self.next_object_selected, self.next_object_state);
				
		self.cleaning_state_time = self.previous_cleaning_state_time;
		
		if self.complex_object then
			HideNextTaskIcon(self.object_name);
			HideDadNextTaskIcon(self.object_name);
			HideMomNextTaskIcon(self.object_name);
		end
	end
end