@base_cost = 300
@city_cost = 500

@hab_cost = 150
@hab_maintenance = 2
@low_hab_maintenance = 0.25
@hab_time = 360

@rw_cost = 1000
@rw_cost_sr = 50
@rw_maintenance = 5
@rw_maintenance_sr = 2
@rw_district_buildtime = 360

@biomass_cost = 50

@wilderness_district_build_long = 480
@wilderness_district_build_short = 240

# standard
district_city = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	default_starting_district = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = {
			is_regular_empire = yes
		}
		OR = {
			uses_district_set = standard
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
			uses_district_set = volcanic_world
		}
		is_special_colony_type = no
	}

	potential = {
		OR = {
			NOT = { exists = owner } #this condition is needed for galaxy generation
			AND = {
				exists = owner
				owner = {
					OR = {
						is_regular_empire = yes
						AND = {
							is_country_type = primitive
							is_hive_empire = no
						}
					}
				}
			}
		}
		NOT = { has_deposit = d_crashed_slaver_ship }
		OR = {
			uses_district_set = district_resort
			uses_district_set = standard
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
			uses_district_set = volcanic_world
		}
		is_special_colony_type = no

		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}

	}

	allow = {
		hidden_trigger = { is_special_colony_type = no }
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_crashed_slaver_ship
		district_arcology_housing
		district_rw_city
		district_nexus
		district_hive
		district_prison
		district_craglands
		district_mindlink
		district_crashed_slaver_ship
		district_resort
		district_slave
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
			trigger = {
				NOT = { has_modifier = wooden_planet }
			}
		}
		cost = {
			food = @city_cost
			trigger = {
				has_modifier = wooden_planet
			}
		}
		upkeep = {
			energy = 2
			trigger = {
				NOT = { has_modifier = wooden_planet }
			}
		}
		upkeep = {
			food = 2
			trigger = {
				has_modifier = wooden_planet
			}
		}
	}

	planet_modifier = {
		planet_housing_add = 1000
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 200
		}
	}

	inline_script = {
		script = districts/district_triggered_name_urban
	}

	inline_script = {
		script = districts/district_triggered_flavor_desc_urban
	}
	
	inline_script = {
		script = districts/ai_urban_district_extra_weighting
	}
}

#resort
district_resort = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_trade

	zone_slots = {
		slot_city_government
		slot_resort_01
		slot_resort_02
		slot_resort_03_clamor
		slot_resort_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_regular_empire = yes }
		has_modifier = resort_colony
	}

	potential = {
		exists = owner
		owner = { is_regular_empire = yes }
		has_modifier = resort_colony
	}

	allow = {
		hidden_trigger = {
			NOT = { has_modifier = slave_colony }
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_city
		district_arcology_housing
		district_rw_city
		district_nexus
		district_hive
		district_craglands
		district_mindlink
		district_crashed_slaver_ship
		district_prison
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
			trigger = {
				NOT = { has_modifier = wooden_planet }
			}
		}
		cost = {
			food = @city_cost
			trigger = {
				has_modifier = wooden_planet
			}
		}
		upkeep = {
			energy = 2
			trigger = {
				NOT = { has_modifier = wooden_planet }
			}
		}
		upkeep = {
			food = 2
			trigger = {
				has_modifier = wooden_planet
			}
		}
	}

	planet_modifier = {
		planet_housing_add = 500
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
			}
		}
		modifier = {
			job_resort_worker_add = @special_district_jobs
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
			}
		}
		modifier = {
			job_resort_worker_add = @base_district_jobs
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	triggered_name = {
		text = resort_default
	}

	triggered_flavor_desc = {
		text = district_resort_desc
	}
}

district_prison = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	icon = district_city
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_regular_empire = yes }
		has_modifier = penal_colony
	}

	potential = {
		exists = owner
		owner = { is_regular_empire = yes }
		has_modifier = penal_colony
	}

	allow = {
		hidden_trigger = {
			has_modifier = penal_colony
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_city
		district_arcology_housing
		district_rw_city
		district_nexus
		district_hive
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
		}
		upkeep = {
			energy = 2
		}
	}

	planet_modifier = {
		planet_housing_add = 300
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_gestalt = no
				is_fallen_empire_spiritualist = no
			}
		}
		modifier = {
			job_enforcer_add = @base_district_jobs
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}
}

district_slave = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	icon = district_city
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_regular_empire = yes }
		has_modifier = slave_colony
	}

	potential = {
		exists = owner
		owner = { is_regular_empire = yes }
		has_modifier = slave_colony
	}

	allow = {
		hidden_trigger = {
			has_modifier = slave_colony
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_arcology_housing
		district_rw_city
		district_nexus
		district_hive
		district_city
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
		}
		upkeep = {
			energy = 2
		}
	}

	planet_modifier = {
		planet_housing_add = 1000
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 200
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_gestalt = no
				is_fallen_empire_spiritualist = no
			}
		}
		modifier = {
			job_slave_overseer_add = @base_district_jobs
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}
}

# machine
district_nexus = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = {
			is_machine_empire = yes
		}
		OR = {
			uses_district_set = standard
			uses_district_set = volcanic_world
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
		}
	}

	potential = {
		exists = owner
		owner = {
			is_machine_empire = yes
		}
		OR = {
			uses_district_set = standard
			uses_district_set = volcanic_world
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
		}
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	allow = {
		hidden_trigger = {
			NOT = { has_modifier = resort_colony }
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_arcology_housing
		district_rw_nexus
		district_city
		district_hive
		district_craglands
		district_mindlink
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
		}
		upkeep = {
			energy = 2
		}
	}

	planet_modifier = {
		planet_housing_add = 1100
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_1 }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_2 }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_optimized_nexus }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	inline_script = {
		script = districts/district_triggered_name_machine
	}

	inline_script = {
		script = districts/district_triggered_flavor_desc_machine
	}

	inline_script = {
		script = districts/ai_urban_district_extra_weighting
	}
}

#hive
district_hive = {
	base_buildtime = 480

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_hive_empire = yes }
		OR = {
			uses_district_set = standard
			uses_district_set = volcanic_world
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
		}
		exists = from
		from = { is_wilderness_empire = no }
	}

	potential = {
		exists = owner
		owner = {
			is_hive_empire = yes
			is_wilderness_empire = no
		}
		OR = {
			uses_district_set = standard
			uses_district_set = volcanic_world
			uses_district_set = hive_world
			uses_district_set = machine_world
			uses_district_set = shattered_ring_world
		}
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	allow = {
		hidden_trigger = {
			NOT = { has_modifier = resort_colony }
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_arcology_housing
		district_rw_hive
		district_nexus
		district_city
		district_craglands
		district_mindlink
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = @city_cost
		}
		upkeep = {
			energy = 2
		}
	}

	planet_modifier = {
		planet_housing_add = 1200
	}

	triggered_planet_modifier = {
		potential = {
			is_planet_class = pc_hive
		}
		modifier = {
			planet_housing_add = 600
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_1 }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_2 }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_extended_hives }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	inline_script = {
		script = districts/district_triggered_name_hive
	}

	inline_script = {
		script = districts/district_triggered_flavor_desc_hive
	}

	inline_script = {
		script = districts/ai_urban_district_extra_weighting
	}
}

# ecumenopolis
district_arcology_housing = {
	base_buildtime = 600

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_wilderness_empire = no }
		uses_district_set = city_world
	}

	potential = {
		uses_district_set = city_world
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	conversion_ratio = 1
	convert_to = {
		district_city
		district_nexus
		district_hive
		district_mindlink
	}

	resources = {
		category = planet_districts
		cost = {
			alloys = 500
		}
		upkeep = {
			energy = 5
		}
	}

	planet_modifier = {
		planet_housing_add = 1500
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_tankbound_empire = yes
			}
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}
}

# habitat
district_hab_housing = {
	base_buildtime = @hab_time

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_habitat_01
		slot_habitat_02
		slot_habitat_03_clamor
		slot_habitat_04_clamor
	}

	show_on_uncolonized = {
		uses_district_set = habitat
	}

	potential = {
		uses_district_set = habitat
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	convert_to = {
		district_mindlink
	}

	resources = {
		category = planet_districts_hab
		cost = {
			alloys = @hab_cost
		}
		upkeep = {
			energy = @hab_maintenance
			alloys = @low_hab_maintenance
		}
	}

	planet_modifier = {
		planet_housing_add = 1000
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_void_works }
		}
		modifier = {
			planet_housing_add = 100
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_tankbound_empire = yes
			}
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	inline_script = {
		script = districts/ai_urban_district_extra_weighting
	}
}

# ring-world
district_rw_city = {
	base_buildtime = @rw_district_buildtime

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_gestalt = no }
		uses_district_set = ring_world
	}

	potential = {
		exists = owner
		owner = { is_gestalt = no }
		uses_district_set = ring_world
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rw_nexus
		district_rw_hive
		district_mindlink
	}

	resources = {
		category = planet_districts
		cost = {
			minerals = @rw_cost
		}
		upkeep = {
			energy = @rw_maintenance
		}
	}

	planet_modifier = {
		planet_housing_add = 2500
		job_enforcer_add = @base_district_jobs
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				is_fallen_empire = no
				is_tankbound_empire = no
			}
		}
		modifier = {
			job_clerk_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				is_fallen_empire = no
				is_tankbound_empire = yes
			}
		}
		modifier = {
			job_production_overseer_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				is_fallen_empire = no
				has_active_tradition = tr_virtuality_4
				is_tankbound_empire = no
			}
		}
		modifier = {
			job_clerk_add = 600
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				is_fallen_empire = no
				has_active_tradition = tr_virtuality_4
				is_tankbound_empire = yes
			}
		}
		modifier = {
			job_production_overseer_add = 600
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_tankbound_empire = yes
			}
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	triggered_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_city }
			}
		}
		text = arcane_generator_upkeep_desc
	}
}

district_rw_hive = {
	base_buildtime = @rw_district_buildtime

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_hive_empire = yes }
		uses_district_set = ring_world
	}

	potential = {
		exists = owner
		owner = { is_hive_empire = yes }
		uses_district_set = ring_world
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rw_nexus
		district_rw_city
		district_mindlink
	}

	resources = {
		category = planet_districts
		cost = {
			minerals = @rw_cost
		}
		upkeep = {
			energy = @rw_maintenance
		}
	}

	planet_modifier = {
		planet_housing_add = 3000
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_1 }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_2 }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
		}
		modifier = {
			job_coordinator_add = @base_district_jobs
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_extended_hives }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	triggered_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_hive }
			}
		}
		text = arcane_generator_upkeep_desc
	}
}

district_rw_nexus = {
	base_buildtime = @rw_district_buildtime

	exempt_from_ai_planet_specialization = yes
	overlay_icon = GFX_district_government

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	show_on_uncolonized = {
		exists = from
		from = { is_machine_empire = yes }
		uses_district_set = ring_world
	}

	potential = {
		exists = owner
		owner = { is_machine_empire = yes }
		uses_district_set = ring_world
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rw_hive
		district_rw_city
		district_mindlink
	}

	resources = {
		category = planet_districts
		cost = {
			minerals = @rw_cost
		}
		upkeep = {
			energy = @rw_maintenance
		}
	}

	planet_modifier = {
		planet_housing_add = 2500
		job_technician_drone_add = @base_district_jobs
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_1 }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_technology = tech_housing_2 }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_optimized_nexus }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_tankbound_empire = yes }
		}
		modifier = {
			job_production_overseer_add = 100
		}
	}

	triggered_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_nexus }
			}
		}
		text = arcane_generator_upkeep_desc
	}
}

#wilderness
# City (blue)
district_craglands = {
	base_buildtime = @wilderness_district_build_long

	overlay_icon = GFX_district_government

	show_on_uncolonized = {
		uses_district_set = standard
		exists = from
		from = { is_wilderness_empire = yes }
	}

	potential = {
		uses_district_set = standard
		exists = owner
		owner = { is_wilderness_empire = yes }
		NAND = {
			is_capital = yes
			owner = {
				has_menace_perk = menp_behemoth_mind_meld
			}
		}
	}

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	conversion_ratio = 1
	convert_to = {
		district_arcology_housing
		district_rw_city
		district_nexus
		district_hive
		district_city
		district_mindlink
	}

	resources = {
		category = planet_districts_cities
		cost = {
			minerals = 500
		}
		cost = {
			biomass = @biomass_cost
		}
		upkeep = {
			energy = 2
		}
	}

	planet_modifier = {
		planet_housing_add = 100
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_tradition = tr_domination_imperious_architecture
			}
		}
		planet_defense_armies_add = 1
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_tradition = tr_prosperity_public_works
			}
		}
		planet_housing_add = 50
	}

	inline_script = {
		script = buildings/on_all_wilderness_buildings_districts
	}

	ai_resource_production = {
		unity = 5
		trigger = {
			OR = {
				has_building = building_commensal_clearing_1
				has_building = building_commensal_clearing_2
				has_building = building_commensal_clearing_3
				has_building = building_commensal_clearing_4
			}
		}
	}

	exempt_from_ai_planet_specialization = yes
	ai_estimate_without_unemployment = yes
	additional_ai_weight = 10
}

#mindlink
district_mindlink = {
	overlay_icon = GFX_district_feral_insight
	base_buildtime = 720

	exempt_from_ai_planet_specialization = yes

	show_on_uncolonized = {
		always = no
	}

	potential = {
		exists = owner
		is_capital = yes
		owner = {
			has_menace_perk = menp_behemoth_mind_meld
		}
	}

	allow = {
		hidden_trigger = {
			NOR = {
				has_modifier = resort_colony
				has_modifier = penal_colony
				has_modifier = slave_colony
			}
		}
		custom_tooltip = {
			fail_text = arcology_project_construction_fail_tt
			NOT = { has_planet_flag = arcology_project_construction }
		}
	}

	zone_slots = {
		slot_city_government
		slot_city_01
		slot_city_02
		slot_city_03_clamor
		slot_city_04_clamor
	}

	conversion_ratio = 1
	convert_to = {
		district_arcology_housing
		district_rw_city
		district_rw_hive
		district_rw_nexus
		district_city
		district_nexus
		district_hive
		district_hab_housing
		district_crashed_slaver_ship
		district_craglands
	}

	resources = {
		category = planet_districts_cities
		cost = {
			food = 1500
		}
		cost = {
			trigger = {
				owner = { is_wilderness_empire = yes }
			}
			biomass = @biomass_cost
		}
		upkeep = {
			food = 2
		}
		produces = {
			trigger = {
				owner = { is_variable_set =  pops_transferred }
				owner = { is_wilderness_empire = no }
			}
			unity = 1.5
			physics_research = 0.5
			society_research = 0.5
			engineering_research = 0.5
			mult = owner.value:transferred_pops_district_percent
		}
		produces = {
			trigger = {
				owner = { is_variable_set =  pops_transferred }
				owner = { is_wilderness_empire = yes }
			}
			unity = 300
			physics_research = 100
			society_research = 100
			engineering_research = 100
			mult = owner.value:transferred_pops_district_percent
		}
	}

	inline_script = {
		script = buildings/on_all_wilderness_buildings_districts
	}

	planet_modifier = {
		planet_housing_add = 3000
	}

	triggered_planet_modifier = { #Regular modifiers
		potential = {
			exists = owner
			owner = { is_regular_empire = yes }
		}
		modifier = {
			job_transference_volunteer_add = 1500
		}
	}

	triggered_planet_modifier = { # Gestalt modifiers
		potential = {
			exists = owner
			owner = {
				is_gestalt = yes
			}
		}
		modifier = {
			planet_housing_add = 1000
			job_transference_drone_add = 1500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_valid_civic = civic_agrarian_idyll
			}
		}
		modifier = {
			planet_housing_add = -500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { has_active_tradition = tr_prosperity_public_works }
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_1
			}
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				has_technology = tech_housing_2
				NOT = { has_valid_civic = civic_agrarian_idyll }
			}
		}
		modifier = {
			planet_housing_add = 500
		}
	}

	triggered_desc = { #same as transference drone so everyone gets it
		trigger = {
			exists = owner
		}
		text = job_transference_volunteer_effect_desc
	}
}
