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

district_rg_city = {
	icon = district_rw_city
	base_buildtime = 30
	is_capped_by_modifier = no
	exempt_from_ai_planet_specialization = yes

	# TODO_CD: change to real slots
	zone_slots = {
		slot_city_government
		slot_rg_city_01
		slot_rg_city_02
	}

	show_on_uncolonized = {
		exists = from
		from = { is_regular_empire = yes }
		uses_district_set = rg_station
	}

	potential = {
		exists = owner
		owner = { is_regular_empire = yes }
		uses_district_set = rg_station
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rg_nexus
		district_rg_hive
	}

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

	planet_modifier = {
		planet_housing_add = 3000
		job_enforcer_add = @base_district_jobs
		zone_building_slots_add = 2
	}

	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
			}
		}
		modifier = {
			job_clerk_add = 300
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				is_fallen_empire = no
				has_active_tradition = tr_virtuality_4
			}
		}
		modifier = {
			job_clerk_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_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_city }
			}
		}
		text = arcane_generator_upkeep_desc
	}

	triggered_desc = {
		trigger = {
			exists = owner
			owner = { is_regular_empire = yes }
		}
		text = job_clerk_effect_desc
	}
}

district_rg_hive = {
	icon = district_rw_hive
	base_buildtime = 30
	is_capped_by_modifier = no
	exempt_from_ai_planet_specialization = yes

	# TODO_CD: change to real slots
	zone_slots = {
		slot_city_government
		slot_rg_city_01
		slot_rg_city_02
	}

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

	potential = {
		exists = owner
		owner = { is_hive_empire = yes }
		uses_district_set = rg_station
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rg_nexus
		district_rg_city
	}

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

	planet_modifier = {
		planet_housing_add = 3000
		# job_synapse_drone_add = 2
		zone_building_slots_add = 2
	}

	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
			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_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_hive }
			}
		}
		text = arcane_generator_upkeep_desc
	}
}

district_rg_nexus = {
	icon = district_rw_nexus
	base_buildtime = 30
	is_capped_by_modifier = no
	exempt_from_ai_planet_specialization = yes

	# TODO_CD: change to real slots
	zone_slots = {
		slot_city_government
		slot_rg_city_01
		slot_rg_city_02
	}

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

	potential = {
		exists = owner
		owner = { is_machine_empire = yes }
		uses_district_set = rg_station
	}

	conversion_ratio = 0.5
	convert_to = {
		district_rg_hive
		district_rg_city
	}

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

	planet_modifier = {
		planet_housing_add = 3000
		job_technician_drone_add = @base_district_jobs
		zone_building_slots_add = 2
	}

	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_desc = {
		trigger = {
			planet = {
				has_deposit = d_arcane_generator
				NOT = { has_district = district_rw_nexus }
			}
		}
		text = arcane_generator_upkeep_desc
	}
}

district_rg_generator = {
	icon = district_rw_generator
	base_buildtime = 30
	is_capped_by_modifier = no

	# TODO_CD: change to real slots
	zone_slots = {
		slot_rg_city_01
	}

	show_on_uncolonized = {
		uses_district_set = rg_station
		exists = from
	}

	potential = {
		exists = owner
		uses_district_set = rg_station
	}

	convert_to = {
		# district_rw_commercial
	}

	resources = {
		category = planet_districts
		cost = {
			minerals = @rw_cost
		}
		produces = {
			energy = 50
			minerals = 50
			food = 50
		}
	}

	triggered_planet_modifier = {
		planet_housing_add = 1000
	}
}

# district_rg_mining = {
# 	icon = district_hab_mining
# 	base_buildtime = 30
# 	is_capped_by_modifier = no
# 
# 	zone_slots = {
# 		slot_minerals
# 	}
# 
# 	show_on_uncolonized = {
# 		uses_district_set = rg_station
# 		exists = from
# 	}
# 
# 	potential = {
# 		exists = owner
# 		uses_district_set = rg_station
# 	}
# 
# 	convert_to = {
# 	}
# 
# 	resources = {
# 		category = planet_districts
# 		cost = {
# 			minerals = @rw_cost
# 		}
# 		upkeep = {
# 			energy = 5
# 		}
# 		produces = {
# 			minerals = 50
# 		}
# 	}
# 
# 	triggered_planet_modifier = {
# 		planet_housing_add = 1000
# 	}
# }

#district_rg_farming = {
#	icon = district_rw_farming
#	base_buildtime = 30
#	is_capped_by_modifier = no
#
#	# TODO_CD: change to real slots
#	zone_slots = {
#		slot_food
#	}
#
#	show_on_uncolonized = { uses_district_set = rg_station }
#
#	potential = {
#		uses_district_set = rg_station
#		exists = owner
#		NOT = {
#			AND = {
#				owner = { is_ai = yes }
#				owner = { country_uses_food = no }
#			}
#		}
#	}
#
#	resources = {
#		category = planet_districts
#		cost = {
#			minerals = @rw_cost
#		}
#		upkeep = {
#			energy = 5
#		}
#		produces = {
#			food = 50
#		}
#	}
#
#	# triggered for tooltip formatting purposes
#	triggered_planet_modifier = {
#		modifier = {
#			planet_housing_add = 1000
#		}
#	}
#}

district_rg_industrial = {
	icon = district_rw_industrial
	base_buildtime = 30
	is_capped_by_modifier = no

	# TODO_CD: change to real slots
	zone_slots = {
		slot_rg_city_02
	}

	show_on_uncolonized = { uses_district_set = rg_station }

	potential = {
		uses_district_set = rg_station
	}

	resources = {
		category = planet_districts
		cost = {
			minerals = @rw_cost
		}
		upkeep = {
			energy = 5
			minerals = 50
		}
		produces = {
			nanites = 50
		}
	}

	triggered_planet_modifier = {
		planet_housing_add = 1000
	}

	inline_script = {
		script = jobs/industrial_districts_factory_add
		AMOUNT = 500
	}
	inline_script = {
		script = jobs/industrial_districts_foundry_add
		AMOUNT = 500
	}
}

district_rg_science = {
	icon = district_rw_science
	base_buildtime = 30
	is_capped_by_modifier = no

	# TODO_CD: change to real slots
	zone_slots = {
		slot_rg_city_03
	}

	show_on_uncolonized = { uses_district_set = rg_station }

	potential = { uses_district_set = rg_station }

	prerequisites = {
		tech_basic_science_lab_1
	}

	allow = {
		hidden_trigger = {
			OR = {
				NOT = { exists = owner }
				owner = {
					has_technology = tech_basic_science_lab_1
				}
			}
		}
	}

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

	triggered_planet_modifier = {
		planet_housing_add = 1000
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_regular_empire = yes }
		}
		modifier = {
			job_physicist_add = 1000
			job_biologist_add = 1000
			job_engineer_add = 1000
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_hive_empire = yes }
		}
		modifier = {
			job_calculator_physicist_add = 1000
			job_calculator_biologist_add = 1000
			job_calculator_engineer_add = 1000
		}
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_machine_empire = yes }
		}
		modifier = {
			job_calculator_physicist_add = 1000
			job_calculator_biologist_add = 1000
			job_calculator_engineer_add = 1000
		}
	}

	#Jobs from Virtuality ascension

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_regular_empire = yes
				has_active_tradition = tr_virtuality_4
			}
		}
		job_physicist_add = 500
		job_biologist_add = 500
		job_engineer_add = 500
	}

	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = {
				is_machine_empire = yes
				has_active_tradition = tr_virtuality_4
			}
		}
		job_calculator_physicist_add = 500
		job_calculator_biologist_add = 500
		job_calculator_engineer_add = 500
	}

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

	triggered_desc = {
		trigger = {
			exists = owner
			owner = { is_regular_empire = yes }
		}
		text = job_researcher_effect_desc
	}

	triggered_desc = {
		trigger = {
			exists = owner
			owner = { is_hive_empire = yes }
		}
		text = job_brain_drone_effect_desc
	}

	triggered_desc = {
		trigger = {
			exists = owner
			owner = { is_machine_empire = yes }
		}
		text = job_calculator_effect_desc
	}
}

# district_rg_nanites = {
# 	icon = district_rg_nanites
# 	base_buildtime = 30
# 	is_capped_by_modifier = no
# 
# 	# TODO_CD: change to real slots
# 	zone_slots = {
# 		slot_city_01
# 	}
# 
# 	show_on_uncolonized = {
# 		uses_district_set = rg_station
# 		exists = from
# 	}
# 
# 	potential = {
# 		exists = owner
# 		uses_district_set = rg_station
# 	}
# 
# 	convert_to = {
# 	}
# 
# 	resources = {
# 		category = planet_districts
# 		cost = {
# 			minerals = @rw_cost
# 		}
# 		upkeep = {
# 			energy = 5
# 			minerals = 40
# 		}
# 		produces = {
# 			nanites = 40
# 		}
# 	}
# 
# 	triggered_planet_modifier = {
# 		planet_housing_add = 1000
# 	}
# }

# district_rg_commercial = {
# 	icon = district_rw_commercial
# 	base_buildtime = 30
# 	is_capped_by_modifier = no
# 
# 	show_on_uncolonized = {
# 		uses_district_set = rg_station
# 		exists = from
# 		from = {
# 			is_gestalt = no
# 			is_fallen_empire = no
# 		}
# 	}
# 
# 	potential = {
# 		exists = owner
# 		owner = {
# 			is_gestalt = no
# 			is_fallen_empire = no
# 		}
# 		uses_district_set = rg_station
# 	}
# 
# 	convert_to = {
# 		district_rw_generator
# 	}
# 
# 	resources = {
# 		category = planet_districts
# 		cost = {
# 			minerals = @rw_cost
# 			rare_crystals = @rw_cost_sr
# 		}
# 		upkeep = {
# 			energy = @rw_maintenance
# 			rare_crystals = @rw_maintenance_sr
# 		}
# 	}
# 
# 	triggered_planet_modifier = {
# 		planet_housing_add = 10
# 		job_trader_add = 2
# 		job_clerk_add = 6
# 	}
# 
# 	triggered_planet_modifier = {
# 		potential = {
# 			exists = owner
# 			owner = {
# 				has_active_tradition = tr_mercantile_commercial_enterprise
# 			}
# 		}
# 		modifier = {
# 			job_trader_add = 2
# 		}
# 	}
# 
# 	triggered_planet_modifier = {
# 		potential = {
# 			exists = owner
# 			owner = { has_active_tradition = tr_virtuality_4 }
# 		}
# 		modifier = {
# 			job_clerk_add = 6
# 		}
# 	}
# 
# 	triggered_desc = {
# 		trigger = {
# 			planet = {
# 				has_deposit = d_arcane_generator
# 				NOT = { has_district = district_rw_commercial }
# 			}
# 		}
# 		text = arcane_generator_upkeep_desc
# 	}
# 
# 	triggered_desc = {
# 		text = job_trader_effect_desc
# 	}
# 
# 	triggered_desc = {
# 		text = job_clerk_effect_desc
# 	}
# }