##################
#Forever Cruise Buildings
##################

building_passenger_dorms = {
	icon = building_organic_sanctuary
	base_buildtime = @b1_time

	category = unity

	building_sets = {
		ark_forever_cruise_passengers
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	convert_to = {
		building_luxury_residence
		building_communal_housing
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = rare_crystals
			COST = @b1_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		upkeep = {
			energy = @b1_upkeep
		}
	}

	planet_modifier = {
		planet_housing_add = 500
	}

	triggered_planet_modifier = {
		potential = {
			owner? = {
				NOT = { has_country_flag = suspended_passenger_services }
			}
		}
		job_cruise_passenger_add = 500
	}

	upgrades = {
		"building_passenger_paradise"
	}

	# We need to cheat here and tell AI that this will probably give some complex output since AI can not evaluate what this building does without the pops which it cant get without the building - chicken and egg
	ai_resource_production = {
		unity = 10
		physics_research = 10
		alloys = 5

		trigger = {
			NOT = { has_building = building_passenger_dorms }
		}
	}

	ai_weight_coefficient = 1.2

	# Here we try to adress the second issue that the AI cant evaluate the pop job output of the bio trophy given the happiness trigger that was put inplace to guard against players exploiting bio trophies

	#science
	ai_resource_production = {
		unity = 10
		physics_research = 10

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = physics_research
				value >= 100
				type = produces
			}
		}
	}

	#alloys
	ai_resource_production = {
		unity = 10
		alloys = 10

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = alloys
				value >= 100
				type = produces
			}
		}
	}

	#cgs
	ai_resource_production = {
		unity = 10
		consumer_goods = 10

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = consumer_goods
				value >= 100
				type = produces
			}
		}
	}
}

building_passenger_paradise = {
	base_buildtime = @b2_time
	can_build = no
	icon = building_paradise_dome

	category = unity

	building_sets = {
		ark_forever_cruise_passengers
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	convert_to = {
		building_paradise_dome
		building_communal_housing_large
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = rare_crystals
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			exotic_gases = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			exotic_gases = @b2_rare_upkeep
		}
	}

	planet_modifier = {
		planet_housing_add = 1500
	}

	triggered_planet_modifier = {
		potential = {
			owner? = {
				NOT = { has_country_flag = suspended_passenger_services }
			}
		}
		job_cruise_passenger_add = 1500
	}

	prerequisites = {
		"tech_paradise_dome"
	}

	show_tech_unlock_if = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	ai_weight_coefficient = 1.2

	#science
	ai_resource_production = {
		unity = 20
		physics_research = 20

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = physics_research
				value >= 100
				type = produces
			}
		}
	}

	#alloys
	ai_resource_production = {
		unity = 20
		alloys = 20

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = alloys
				value >= 100
				type = produces
			}
		}
	}

	#cgs
	ai_resource_production = {
		unity = 20
		consumer_goods = 20

		trigger = {
			any_owned_pop_group = {
				is_pop_category = cruise_passenger_unemployment
			}

			planet_resource_compare = {
				resource = consumer_goods
				value >= 100
				type = produces
			}
		}
	}
}

building_forever_cruise_passenger_unity = {
	base_buildtime = @b2_time
	planet_limit = 1
	category = unity

	building_sets = {
		ark_forever_cruise_passengers
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	prerequisites = {
		OR = {
			tech_autocurating_vault
			tech_transcendent_faith
		}
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = rare_crystals
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			rare_crystals = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			rare_crystals = @b2_rare_upkeep
		}
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	triggered_desc = {
		text = building_forever_cruise_passenger_unity_situation_effect_desc
	}

	planet_modifier = {
		planet_cruise_passengers_unity_produces_add = 0.5
		planet_cruise_passengers_consumer_goods_upkeep_add = 1
		pop_cat_cruise_passenger_happiness = 0.10
	}
}

building_forever_cruise_passenger_research = {
	base_buildtime = @b1_time
	planet_limit = 1
	category = unity

	building_sets = {
		ark_forever_cruise_passengers
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	prerequisites = {
		"tech_global_research_initiative"
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = exotic_gases
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			exotic_gases = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			exotic_gases = @b2_rare_upkeep
		}
	}

	planet_modifier = {
		planet_cruise_passengers_physics_research_produces_add = 0.5
		planet_cruise_passengers_engineering_research_produces_add = 0.5
		planet_cruise_passengers_society_research_produces_add = 0.5
		planet_cruise_passengers_consumer_goods_upkeep_add = 1
	}
}

building_forever_cruise_passenger_consumer_goods = {
	base_buildtime = @b1_time
	category = unity
	planet_limit = 1

	building_sets = {
		ark_forever_cruise_passengers
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	prerequisites = {
		tech_luxuries_2
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = volatile_motes
			COST = @b3_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			rare_crystals = @b4_rare_cost
		}
		upkeep = {
			energy = @b3_upkeep
			rare_crystals = @b4_rare_upkeep
		}
	}

	planet_modifier = {
		planet_cruise_passengers_consumer_goods_upkeep_mult = -0.10
		planet_artisans_upkeep_mult = -0.05
	}
}

building_forever_cruise_crew_resources = {
	base_buildtime = @b1_time
	category = unity
	planet_limit = 1

	building_sets = {
		ark_forever_cruise_crew
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	prerequisites = {
		"tech_global_production_strategy"
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = volatile_motes
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			volatile_motes = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			volatile_motes = @b2_rare_upkeep
		}
	}

	inline_script = {
		script = jobs/cruise_crew_overseers_add
		AMOUNT = @building_static_jobs
	}

	planet_modifier = {
		worker_and_simple_drone_cat_bonus_workforce_mult = 0.10
	}
}

building_forever_cruise_crew_industry = {
	base_buildtime = @b1_time
	category = unity
	planet_limit = 1

	building_sets = {
		ark_forever_cruise_crew
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	prerequisites = {
		"tech_global_production_strategy"
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = volatile_motes
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			volatile_motes = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			volatile_motes = @b2_rare_upkeep
		}
	}

	inline_script = {
		script = jobs/cruise_crew_overseers_add
		AMOUNT = @building_static_jobs
	}

	triggered_desc = {
		text = building_forever_cruise_crew_industry_situation_effect_desc
	}

	planet_modifier = {
		foundry_jobs_bonus_workforce_mult = 0.05
		artisan_jobs_bonus_workforce_mult = 0.05
	}
}

building_forever_cruise_crew_service = {
	base_buildtime = @b1_time
	category = unity
	planet_limit = 1

	building_sets = {
		ark_forever_cruise_crew
	}

	potential = {
		owner? = {
			has_origin = origin_forever_cruise
			NOT = { has_country_flag = forever_cruise_over }
		}
	}

	show_tech_unlock_if = {
		has_origin = origin_forever_cruise
	}

	destroy_trigger = {
		owner? = {
			OR = {
				NOT = { has_origin = origin_forever_cruise }
				has_country_flag = forever_cruise_over
			}
		}
	}

	prerequisites = {
		"tech_interstellar_economics"
	}

	resources = {
		category = planet_buildings
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = rare_crystals
			COST = @b2_minerals
			NOMADIC_COST_MULT = @nomadic_minerals_to_strategic_ratio
		}
		cost = {
			rare_crystals = @b2_rare_cost
		}
		upkeep = {
			energy = @b2_upkeep
			rare_crystals = @b2_rare_upkeep
		}
	}

	inline_script = {
		script = jobs/cruise_crew_overseers_add
		AMOUNT = @building_static_jobs
	}

	planet_modifier = {
		influential_jobs_bonus_workforce_mult = 0.05
	}
}
