----------------------------------------------------------------------------------------------------
-- Proceed
----------------------------------------------------------------------------------------------------
function proceed()
    local actor = db.actor	
    
    if not has_alife_info("dar_document1") and
 		actor:object("dar_document1") then
 		actor:give_info_portion("dar_document1") 
	end
 	
	if not has_alife_info("dar_document2") and
 		actor:object("dar_document2") then
 		actor:give_info_portion("dar_document2") 
	end
 
	if not has_alife_info("dar_document3") and
 		actor:object("dar_document3") then
 		actor:give_info_portion("dar_document3")
	end
 	
	if not has_alife_info("dar_document4") and
 		actor:object("dar_document4") then
 		actor:give_info_portion("dar_document4") 
	end		
	
	if not has_alife_info("dar_document5") and
 		actor:object("dar_document5") then
 		actor:give_info_portion("dar_document5") 
	end	
	
	if has_alife_info("dar_ring_spawn2_1") and
		has_alife_info("dar_ring_spawn2_2") and
		not has_alife_info("dar_ring_spawn2")
	then
		actor:give_info_portion("dar_ring_spawn2")
	end
	
	if has_alife_info("dar_password_info1") and
		not has_alife_info("dar_password_info1_know") 
	then
		actor:give_info_portion("dar_password_info1_know")
		news_manager.send_tip(db.actor, "pass_to_1st_door")
	end
	
	if has_alife_info("dar_password_info2") and
		not has_alife_info("dar_password_info2_know") 
	then
		actor:give_info_portion("dar_password_info2_know")
		news_manager.send_tip(db.actor, "pass_to_2nd_door")
	end
	
end

----------------------------------------------------------------------------------------------------
-- Process info portions
----------------------------------------------------------------------------------------------------
function process_info_portion(info_id)
    if info_id == "val_sos_give_tip" then
		level_tasks.add_location(422, "val_sos_location")
	elseif info_id == "val_sos_actor_near_wounded" then
		level_tasks.remove_location(422, "val_sos_location")
	elseif info_id == "val_show_zones" then
		level_tasks.add_location(427, "crlc_big", "val_zone_bandits_hint")
		level_tasks.add_location(428, "crlc_big", "val_zone_monolith_hint")
		level_tasks.add_location(429, "crlc_mdl", "val_zone_robbers_hint")
		level_tasks.add_location(430, "crlc_small", "val_zone_south_gate_hint")
	elseif info_id == "val_show_pipe_zone" then
		level_tasks.add_location(431, "crlc_mdl", "val_zone_pipe_hint")
	elseif info_id == "val_show_farm_zone" then
		level_tasks.add_location(435, "crlc_big", "val_zone_farm_hint")
	else
        return false
	end

	return true
end

--function send_codedoor1_tip()
--    news_manager.send_tip(db.actor, "pass_to_1st_door")
--end


--function send_codedoor2_tip()
--    news_manager.send_tip(db.actor, "pass_to_2nd_door")
--end


----------------------------------------------------------------------------------------------------
-- Common functions
----------------------------------------------------------------------------------------------------
function has_darklab_key(task, objective)
	return db.actor:object("borov_flash") ~= nil
end

function has_darklab_documents(task, objective)
	return db.actor:object("dar_document4") ~= nil
end

function escort_task_done(task, objective)
       return not has_alife_info("val_escort_captive_dead") and
           has_alife_info("val_escort_guard1_dead") and
           has_alife_info("val_escort_guard2_dead") and
           has_alife_info("val_escort_actor_helped")
end

function escort_task_fail(task, objective)
    return has_alife_info("val_escort_captive_dead") or
           has_alife_info("val_escort_guard1_dead") and
           has_alife_info("val_escort_guard2_dead") and
           not has_alife_info("val_escort_actor_helped")
end


