# from = country
# this = species


military_service_full = {
	potential = {
		exists = from
		if = {
			limit = {
				from = { is_machine_empire = yes }
			}
			OR = {
				has_trait = trait_machine_unit
				has_trait = trait_mechanical
				has_trait = trait_cybernetic
			}
		}
		if = {
			limit = {
				has_citizenship_type = { country = from type = citizenship_shroud_touched }
			}
			from = {
				has_country_flag = finish_shroud_forged_liberation_flag
			}
		}
		is_disconnected_drone_pop = no
	}

	allow = {
		hidden_trigger = { exists = from }
		custom_tooltip = {
			fail_text = MACHINE_NO_PURE_ORGANIC_SOLDIERS
			if = {
				limit = {
					from = { is_machine_empire = yes }
				}
				OR = {
					has_trait = trait_mechanical
					has_trait = trait_machine_unit
					AND = {
						has_trait = trait_cybernetic
						from = {
							has_civic = civic_machine_assimilator
						}
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = is_undesirables_tooltip
			NOR = {
				has_citizenship_type = { country = from type = citizenship_purge_machine }
				has_citizenship_type = { country = from type = citizenship_purge }
			}
		}
		custom_tooltip = {
			fail_text = is_slaves_tooltip
			NOT = { has_citizenship_type = { country = from type = citizenship_slavery } }
		}
		custom_tooltip = {
			fail_text = is_serviles_tooltip
			NOT = { has_trait = trait_syncretic_proles }
		}
		custom_tooltip = {
			fail_text = is_servitude_tooltip
			NOT = { has_citizenship_type = { country = from type = citizenship_robot_servitude } }
		}
		custom_tooltip = {
			fail_text = too_alien
			OR = {
				is_same_species = from
				from = {
					AND = {
						has_valid_civic = civic_selective_kinship
						is_same_species_class = root
					}
				}
				from = {
					is_xenophobe = no
				}
				from = {
					has_origin = origin_synthetic_fertility
					root = { has_trait = trait_mechanical }
				}
			}
		}
		custom_tooltip = {
			fail_text = "HIVE_MIND_SPECIES_CITIZENS_ONLY"
			OR = {
				NOT = { from = { is_hive_empire = yes } }
				has_trait = trait_hive_mind
			}
		}
		custom_tooltip = {
			fail_text = NON_MACHINE_SPECIES_NEED_PREREQ_TECH
			if = {
				limit = {
					OR = {
						has_trait = trait_mechanical
						has_trait = trait_machine_unit
					}
				}
				from = {
					OR = {
						is_machine_empire = yes
						is_individual_machine = yes
						has_technology = tech_droid_workers
					}
				}
			}
		}
		custom_tooltip = {
			fail_text = nerve_stapled_cannot_lead_armies
			can_think = yes
		}
	}
	ai_will_do = {
		factor = 5
		modifier = {
			factor = 0
			from = { has_valid_ai_personality = no }
		}
		modifier = {
			factor = 0
			from = {
				has_valid_ai_personality = yes
				NOT = {
					has_ai_personality_behaviour = multispecies
				}
			}
		}
	}
}

military_service_limited = {
	potential = {
		from = { NOT = { has_ethic = ethic_gestalt_consciousness } }
	}

	allow = {
		hidden_trigger = { exists = from }
		custom_tooltip = {
			fail_text = same_species_disallowed
			NOT = { is_same_species = from }
		}
		custom_tooltip = {
			fail_text = species_is_being_purged
			NOR = {
				has_citizenship_type = { country = from type = citizenship_purge_machine }
				has_citizenship_type = { country = from type = citizenship_purge }
			}
		}
		custom_tooltip = {
			fail_text = NON_MACHINE_SPECIES_NEED_PREREQ_TECH
			if = {
				limit = {
					OR = {
						has_trait = trait_mechanical
						has_trait = trait_machine_unit
					}
				}
				from = {
					OR = {
						is_machine_empire = yes
						is_individual_machine = yes
						has_technology = tech_droid_workers
					}
				}
			}
		}
		if = {
			limit = {
				is_disconnected_drone_pop = yes
			}
			has_citizenship_type = {
				type = citizenship_exploited_drone
				country = from
			}
		}
		custom_tooltip = {
			fail_text = species_has_no_military_slavery
			OR = {
				has_slavery_type = { country = from type = slavery_military }
				is_shackled_robot_species_rights = yes
				NOT = { has_citizenship_type = { country = from type = citizenship_slavery } }
			}
		}
	}
	ai_will_do = {
		factor = 1
	}
}

military_service_none = {
	potential = {
		OR = {
			from = { is_hive_empire = no }
			NOT = { has_trait = trait_hive_mind }
		}
	}

	allow = {
		hidden_trigger = { exists = from }
		custom_tooltip = {
			fail_text = same_species_disallowed
			NOT = { is_same_species = from }
		}
		custom_tooltip = {
			fail_text = species_has_military_slavery
			NOT = {
				has_slavery_type = { country = from type = slavery_military }
			}
		}
		custom_tooltip = {
			fail_text = MACHINE_SPECIES_CANNOT_MACHINE
			if = {
				limit = {
					from = {
						is_machine_empire = yes
						NOT = { has_origin = origin_shroud_forged }
					}
				}
				OR = {
					NOR = {
						has_trait = trait_mechanical
						has_trait = trait_machine_unit
					}
					has_trait = trait_robot_suppressed
				}
			}
		}
		custom_tooltip = {
			fail_text = MECHANICAL_SPECIES_CANNOT_MACHINE
			if = {
				limit = {
					from = {
						has_authority = auth_machine_intelligence
						has_origin = origin_shroud_forged
					}
				}
				NOT = { has_trait = trait_machine_unit }
			}
		}
	}
	ai_will_do = {
		factor = 0
	}
}
