# Xenomorph custom zones.
# Additive, themed alternatives to the vanilla zones, gated to Xeno hives.
# Each writes its own body (no inline full-zone script, to avoid duplicate-key conflicts),
# reuses the vanilla zone JOB script for its base output, and adds one distinctive modifier.
# convert_to points at the vanilla equivalent so a captured/converted world degrades gracefully.

# slot_xenomorph_hive : Brood Hollow — pop assembly + brood housing
zone_xenomorph_brood_hollow = {
	icon = GFX_district_xenomorph_brood_nest
	base_buildtime = @zone_buildtime

	potential = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}
	unlock = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	included_building_sets = {
		urban
		urban_automation
	}

	convert_to = {
		zone_spawning_hive
	}

	zone_sets = {
		hive
	}

	triggered_district_planet_modifier = {
		potential = {
			exists = owner
			owner = { is_hive_empire = yes }
		}
		job_spawning_drone_add = 50
	}

	max_buildings = 1

	planet_modifier = {
		zone_building_slots_add = 1
		planet_housing_add = 100
	}

	ai_priority = 12
}

# slot_energy : Bioelectric Sump — energy + bioelectric output bonus
zone_xenomorph_bioelectric_sump = {
	icon = GFX_district_specialization_energy
	base_buildtime = @zone_buildtime

	potential = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}
	unlock = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	included_building_sets = {
		generator
		generator_automation
	}

	convert_to = {
		zone_energy
	}

	zone_sets = {
		energy
	}

	inline_script = {
		script = jobs/zone_technicians_add
		AMOUNT = @scaling_district_1_job
	}

	planet_modifier = {
		zone_building_slots_add = 3
		planet_jobs_energy_produces_mult = 0.05
	}

	ai_priority = 5
}

# slot_food : Biomass Trench — food + biomass output bonus
zone_xenomorph_biomass_trench = {
	icon = GFX_district_xenomorph_biomass_feeding
	base_buildtime = @zone_buildtime

	potential = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}
	unlock = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	included_building_sets = {
		farming
		farming_automation
	}

	convert_to = {
		zone_food
	}

	zone_sets = {
		food
	}

	inline_script = {
		script = jobs/zone_farmers_add
		AMOUNT = @scaling_district_1_job
	}

	planet_modifier = {
		zone_building_slots_add = 3
		planet_jobs_food_produces_mult = 0.05
	}

	ai_priority = 5
}

# slot_minerals : Resin Vein — minerals + resin output bonus
zone_xenomorph_resin_vein = {
	icon = GFX_district_xenomorph_resin_production
	base_buildtime = @zone_buildtime

	potential = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}
	unlock = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	included_building_sets = {
		mining
		mining_automation
	}

	convert_to = {
		zone_minerals
	}

	zone_sets = {
		minerals
	}

	inline_script = {
		script = jobs/zone_miner_add
		AMOUNT = @scaling_district_1_job
	}

	planet_modifier = {
		zone_building_slots_add = 3
		planet_jobs_minerals_produces_mult = 0.05
	}

	ai_priority = 5
}

# slot_polytechnic : Genome Vault — research + society-research bonus
zone_xenomorph_genome_vault = {
	icon = GFX_district_specialization_research
	base_buildtime = @zone_buildtime

	potential = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}
	unlock = {
		exists = owner
		owner = { xeno_is_xenomorph_hive_country = yes }
	}

	resources = {
		category = planet_zones
		inline_script = {
			script = buildings/nomadic_cost_switcher
			REGULAR_RESOURCE = minerals
			NOMADIC_RESOURCE = alloys
			COST = @zone_cost
			NOMADIC_COST_MULT = 0.5
		}
	}

	included_building_sets = {
		research
		urban_automation
	}

	convert_to = {
		zone_research
	}

	zone_sets = {
		polytechnic
	}

	inline_script = {
		script = jobs/zone_researchers_add
		AMOUNT = @scaling_district_3_jobs
	}

	planet_modifier = {
		zone_building_slots_add = 3
		planet_jobs_society_research_produces_mult = 0.05
	}

	ai_priority = 5
}
