#################
#	Nanotech	#
#################

building_rg_nanolab_1 = {
	base_buildtime = @b2_time
	icon = building_nanolab_1

	category = research

	potential = {
		exists = owner
		OR = {
			#uses_district_set = rg_station
			owner = { has_tradition = tr_rg_nanotech_1 }
		}
		#owner = { has_tradition = tr_nanotech_adopt }
	}

	allow = {
		always = yes
		#owner = { has_tradition = tr_nanotech_adopt }
	}

	# destroy_trigger = {
	# 	exists = owner
	# 	OR = {
	# 		NOT = { owner = { has_tradition = tr_nanotech_adopt } }
	# 		has_modifier = slave_colony
	# 		has_modifier = resort_colony
	# 	}
	# }

	resources = {
		category = planet_buildings
		cost = {
			minerals = @b3_minerals
			nanites = @b2_rare_cost
		}
		upkeep = {
			energy = @b3_upkeep
			nanites = @b2_rare_upkeep
		}
	}

	# triggered_planet_modifier = {
	# 	potential = {
	# 		exists = owner
	# 		owner = {
	# 			is_machine_empire = yes
	# 		}
	# 	}
	# 	job_nanotech_research_unit_add = 3
	# }

	triggered_planet_modifier = {
		potential = {
			always = yes
			# exists = owner
			# owner = {
			# 	is_individual_machine = yes
			# }
		}
		job_nanotech_researcher_add = 800
	}

	# triggered_desc = {
	# 	trigger = {
	# 		exists = owner
	# 		owner = {
	# 			is_machine_empire = yes
	# 		}
	# 	}
	# 	text = job_nanotech_research_unit_effect_desc
	# }

	triggered_desc = {
		trigger = {
			always = yes
			#exists = owner
			#owner = {
			#	is_individual_machine = yes
			#}
		}
		text = job_nanotech_researcher_effect_desc
	}

	upgrades = {
		"building_rg_nanolab_2"
	}

	custom_storm_ai_weight = {  }
}

building_rg_nanolab_2 = {
	base_buildtime = @b3_time
	icon = building_nanolab_2
	can_build = no
	

	category = research

	potential = {
		exists = owner
		OR = {
			#uses_district_set = rg_station
			owner = { has_tradition = tr_rg_nanotech_1 }
		}
		# owner = { has_tradition = tr_nanotech_1 }
	}

	allow = {
		has_upgraded_capital = yes
	}

	# destroy_trigger = {
	# 	exists = owner
	# 	OR = {
	# 		NOT = { owner = { has_tradition = tr_nanotech_1 } }
	# 		has_modifier = slave_colony
	# 		has_modifier = resort_colony
	# 	}
	# }

	resources = {
		category = planet_buildings
		cost = {
			minerals = @b4_minerals
			nanites = @b3_rare_cost
		}
		upkeep = {
			energy = @b4_upkeep
			nanites = @b3_rare_upkeep
		}
	}


	# triggered_planet_modifier = {
	# 	potential = {
	# 		exists = owner
	# 		owner = {
	# 			is_machine_empire = yes
	# 		}
	# 	}
	# 	job_nanotech_research_unit_add = 6
	# }

	triggered_planet_modifier = {
		potential = {
			always = yes
			# exists = owner
			# owner = {
			# 	is_individual_machine = yes
			# }
		}
		job_nanotech_researcher_add = 1500
	}

	# triggered_desc = {
	# 	trigger = {
	# 		exists = owner
	# 		owner = {
	# 			is_machine_empire = yes
	# 		}
	# 	}
	# 	text = job_nanotech_research_unit_effect_desc
	# }

	triggered_desc = {
		trigger = {
			always = yes
			# exists = owner
			# owner = {
			# 	is_individual_machine = yes
			# }
		}
		text = job_nanotech_researcher_effect_desc
	}

	custom_storm_ai_weight = {  }
}

building_rg_nanotech_cauldron = {
	base_buildtime = @b2_time
	icon = building_nanotech_cauldron

	category = manufacturing

	potential = {
		exists = owner
		OR = {
			#uses_district_set = rg_station
			owner = { has_tradition = tr_rg_nanotech_1 }
		}
		# NOT = { has_modifier = resort_colony }
		# NOT = { has_modifier = slave_colony }
	}

	allow = {
		always = yes
	}

	# destroy_trigger = {
	# 	exists = owner
	# 	OR = {
	# 		NOT = { owner = { has_tradition = tr_nanotech_2 } }
	# 		has_modifier = slave_colony
	# 		has_modifier = resort_colony
	# 	}
	# }

	resources = {
		category = planet_buildings
		cost = {
			minerals = 1000
		}
		produces = {
			trigger = {
				owner = {
					NOT = {
						has_deficit = nanites
					}
				}
			}
			alloys = 60
			consumer_goods = 40
		}
		upkeep = {
			trigger = {
				owner = {
					NOT = {
						has_deficit = nanites
					}
				}
			}
			nanites = 25
		}
	}

	custom_storm_ai_weight = {  }
}

building_rg_nanite_transmuter = {
	base_buildtime = @b3_time
	icon = building_nanite_transmuter

	category = manufacturing

	potential = {
		exists = owner
		OR = {
			#uses_district_set = rg_station
			owner = { has_tradition = tr_rg_nanotech_1 }
		}
		# owner = { has_tradition = tr_nanotech_2 }
		# NOT = { has_modifier = resort_colony }
		# NOT = { has_modifier = slave_colony }
	}

	allow = {
		has_upgraded_capital = yes
	}

	resources = {
		category = planet_buildings
		cost = {
			minerals = 1000
		}
		produces = {
			trigger = {
				owner = {
					NOT = {
						has_deficit = minerals
					}
				}
			}
			nanites = 40
			rare_crystals = 2
			volatile_motes = 2
			exotic_gases = 2
		}
		upkeep = {
			trigger = {
				owner = {
					NOT = {
						has_deficit = minerals
					}
				}
			}
			minerals = 50
		}
	}

	ai_resource_production = {
		rare_crystals = @b3_rare_upkeep
		volatile_motes = @b3_rare_upkeep
		exotic_gases = @b3_rare_upkeep
		trigger = {
			always = yes
		}
	}

	custom_storm_ai_weight = {  }
}
