##############################
# Interlink Faction
##############################

interlink = {
	election_header = "GFX_faction_header_yellow"
	guiding_ethic = ethic_gestalt_consciousness
	use_guiding_ethic_as_pop_filter = no
	use_guiding_ethic_as_growth_factor = no
	visual_ethic = "interlink_visual_ethic"

	unique = yes
	support_multiplier = 1

	resources = {
		category = pop_factions
		produces = {
			trigger = {
				owner = {
					NOT = { has_valid_civic = civic_media_conglomerate }
					NOR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
			}
			unity = @faction_improved_output
		}
		produces = {
			trigger = {
				owner = {
					has_valid_civic = civic_media_conglomerate
					NOR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
			}
			trade = @faction_improved_output
			mult = @media_conglomerate_multiplier
		}
		produces = {
			trigger = {
				owner = {
					OR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
			}
			physics_research = @faction_base_output
			engineering_research = @faction_major_output
			mult = @crowdsourcing_multiplier
		}
	}

	extortion_resource = {
		category = pop_factions
		produces = {
			trigger = {
				owner = {
					NOR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
			}
			physics_research = @faction_base_output
			mult = @faction_extortion_research_ratio
		}
		produces = {
			trigger = {
				owner = {
					OR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
			}
			physics_research = @faction_major_output
			engineering_research = @faction_minor_output
			mult = @faction_extortion_crowdsourcing_ratio
		}
	}

	#Note: number of potential or actual members is checked by POP_FACTION_MIN_POTENTIAL_MEMBERS define
	is_potential = {
		owner = {
			is_democratic_authority = yes
			has_country_flag = cyber_collectivist
		}
	}

	can_join_pre_triggers = {
		is_enslaved = no
		is_being_purged = no
	}

	can_join_faction = {
		custom_tooltip_icon = {
			fail_text = POP_CAN_THINK
			can_think = yes
		}
		has_trait = trait_cybernetic
	}

	attraction = {
		base = 200
	}

	leader = {
		base = 100
	}

	demand = {
		title = "INTERLINK_NO_DEMANDS"
		unfulfilled_title = "INTERLINK_NO_DEMANDS"
		desc = "INTERLINK_NO_DEMANDS_DESC"

		fulfilled_effect = 0
		unfulfilled_effect = 0

		potential = {
			exists = owner
		}

		trigger = {
			always = yes
		}
	}

	on_create = {
	}

	on_destroy = {
	}

	actions = {
		# Faction Extortion Buttons
		extort_faction = {
			title = "EXTORT_FACTION"
			description = "EXTORT_FACTION_DESC"

			potential = {
				exists = owner
				owner = {
					is_oligarchic_authority = yes
					has_country_flag = cyber_collectivist
					NOR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
				is_faction_extorted = no
			}

			effect = {
				set_faction_extorted = yes
				custom_tooltip = physics_research_extortion_tt
				custom_tooltip = ONLY_ONE_EXTORTED_FACTION_TT
			}

			ai_weight = {
				base = 0
			}
		}
		extort_faction_crowdsourcing = { #Crowdsourcing version
			title = "EXTORT_FACTION"
			description = "EXTORT_FACTION_DESC"

			potential = {
				exists = owner
				owner = {
					is_oligarchic_authority = yes
					has_country_flag = cyber_collectivist
					OR = {
						has_valid_civic = civic_crowdsourcing
						has_valid_civic = civic_corporate_crowdsourcing
					}
				}
				is_faction_extorted = no
			}

			effect = {
				set_faction_extorted = yes
				custom_tooltip = crowdsourced_extortion_tt
				custom_tooltip = ONLY_ONE_EXTORTED_FACTION_TT
			}

			ai_weight = {
				base = 0
			}
		}
		cancel_extort_faction = {
			title = "CANCEL_EXTORT_FACTION"
			description = "CANCEL_EXTORT_FACTION_DESC"

			potential = {
				exists = owner
				owner = {
					is_oligarchic_authority = yes
					has_country_flag = cyber_collectivist
				}
				is_faction_extorted = yes
			}

			effect = {
				set_faction_extorted = no
			}

			ai_weight = {
				base = 0
			}
		}
	}
}
