#建筑在下，模块在上

# Tier 1

advanced_forge_orbital_accessory = {
	icon = "GFX_build_advanced_forge_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_forge = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		planet_metallurgists_alloys_produces_add = @plnmg_sm_res_add
		planet_jobs_alloys_produces_mult = @plnmg_sm_res_mult
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		produces = {
			alloys = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		upkeep = { minerals = 15 }
	}

	#custom_tooltip = advanced_forge_orbital_accessory_effect

	ai_weight = {
		weight = 10
	}
}

great_laboratory_orbital_accessory = {
	icon = "GFX_build_great_laboratory_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_lab = yes }
	}

	planet_modifier = {
		planet_housing_add = 10
		planet_researchers_upkeep_mult = -0.05
	}

	triggered_planet_modifier = {
		planet_jobs_physics_research_produces_mult = @plnmg_sm_res_mult
		planet_jobs_society_research_produces_mult = @plnmg_sm_res_mult
		planet_jobs_engineering_research_produces_mult = @plnmg_sm_res_mult
		planet_physicists_physics_research_produces_add = @plnmg_sm_res_add
		planet_biologists_society_research_produces_add = @plnmg_sm_res_add
		planet_engineers_engineering_research_produces_add = @plnmg_sm_res_add
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			physics_research = 6
			society_research = 6
			engineering_research = 6
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = 5 }
		upkeep = {
			trigger = { owner? = { is_gestalt = no } }
			consumer_goods = 5
		}
		upkeep = {
			trigger = { owner? = { is_gestalt = yes } }
			energy = 5
		}
	}

	#custom_tooltip = great_laboratory_orbital_accessory_effect

	ai_weight = {
		weight = 10
	}
}

heaven_colossal_orbital_accessory = {
	icon = "GFX_build_heaven_colossal_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_heaven = yes }
	}

	planet_modifier = {
		planet_housing_add = @plnmg_sm_house
		pop_amenities_usage_mult = -0.2
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_gestalt = no } }
		job_entertainer_add = 500
		mult = planet.value:sv_plnmg_get_more_jobs
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_gestalt = no } }
		planet_jobs_unity_produces_mult = @plnmg_sm_res_mult
		planet_amenities_add = 1000
		planet_amenities_mult = @plnmg_sm_res_mult
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			unity = 10
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = 5 }
	}

	ai_weight = {
		weight = 10
	}
}

giant_power_battery_orbital_accessory = {
	icon = "GFX_build_giant_power_battery_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_generator = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		planet_jobs_energy_produces_mult = @plnmg_sm_res_mult
		planet_technician_energy_produces_add = @plnmg_sm_res_add
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			energy = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		produces = {
			trigger = { owner? = { is_hive_empire = no } }
			energy = -5
		}
		upkeep = {
			trigger = { owner? = { is_hive_empire = yes } }
			food = 5
		}
	}

	ai_weight = {
		weight = 10
	}
}

commercial_shikara_orbital_accessory = {
	icon = "GFX_build_commercial_shikara_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_commerce = yes }
	}

	planet_modifier = {
		planet_amenities_add = 500
		planet_housing_add = @plnmg_sm_house
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_gestalt = no } }
		job_trader_add = 300
	}

	triggered_planet_modifier = {
		potential = {
			owner? = { has_corporate_government = yes }
			planet = { has_deposit = d_commercial_shikara }
		}
		job_politician_add = 100
		planet_amenities_add = 1000
	}

	# triggered_planet_modifier = {
	# 	trade_value_mult = 0.15
	# 	mult = planet.value:scripted_modifier_mult|MODIFIER|planet_jobs_productive_mega_produces_mult|
	# }

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			trigger = { owner? = { is_gestalt = no } }
			unity = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = {
			trigger = { owner? = { is_gestalt = no } }
			consumer_goods = @plnmg_sm_upkeep
		}
	}

	ai_weight = {
		weight = 10
	}
}

war_headquarter_orbital_accessory = {
	icon = "GFX_build_war_headquarter_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = {
			has_technology = tech_ground_megastructure
			is_wilderness_empire = no
		}
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		not = { has_starbase_building = planetmega_defense_transmitter }
		planet = { has_plnmg_any_fortress = yes }
	}

	equipped_component = PLNMG_MAGINOT_NEXUS_STB_COMP

	planet_modifier = { planet_housing_add = @plnmg_sm_house }

	triggered_country_modifier = {
		#potential = { planet = { has_deposit = d_war_headquarter } }
		country_naval_cap_add = 25
		command_limit_add = 5
		mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
	}

	triggered_country_modifier = {
		potential = { planet = { has_deposit = d_plnmg_maginot_nexus } }
		country_naval_cap_add = 50
		command_limit_add = 10
		mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_gestalt = no } }
		planet_stability_add = 10
		planet_army_build_speed_mult = 0.5
		pop_amenities_usage_mult = -0.1
		planet_orbital_bombardment_damage = -0.15
		job_soldier_add = 200
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_machine_empire = yes } }
		planet_stability_add = 5
		planet_army_build_speed_mult = 0.25
		pop_amenities_usage_mult = -0.05
		planet_orbital_bombardment_damage = -0.15
		job_warrior_drone_add = 200
	}

	station_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_damage = 0.1
		ship_armor_regen_add_perc = 0.1
		ship_shield_regen_add_perc = 0.15
	}
	triggered_station_modifier = {
		potential = { planet = { has_deposit = d_plnmg_maginot_nexus } }
		ship_fire_rate_mult = 0.2
		ship_tracking_add = 10
		ship_weapon_range_mult = 10
		ship_engagement_range_mult = 10
		ship_damage_reduction_mult = 0.1
		ship_target_weight_mult = 0.5
	}

	defense_platform_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_damage = 0.15
		ship_hull_mult = 0.05
		ship_armor_mult = 0.1
		ship_shield_mult = 0.15
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			unity = 10
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = @plnmg_sm_upkeep }
	}

	ai_weight = {
		weight = 10
	}
}

fighter_organ_orbital_accessory = {
	icon = "GFX_starbase_plnmg_hive_fortress_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = {
			has_technology = tech_ground_megastructure
			is_wilderness_empire = yes
		}
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		not = { has_starbase_building = planetmega_defense_transmitter }
		planet = { has_plnmg_any_fortress = yes }
	}

	equipped_component = PLNMG_MAGINOT_NEXUS_STB_COMP
	on_finished = { hidden_effect = { planet = { plnmg_wilderness_biomass_spender = { value = 100 } } } }

	planet_modifier = {
		planet_housing_add = @plnmg_sm_house
	}

	triggered_country_modifier = {
		potential = { planet = { has_deposit = d_resistance_organ } }
		country_naval_cap_add = 25
		command_limit_add = 5
		mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
	}

	triggered_country_modifier = {
		potential = { planet = { has_deposit = d_plnmg_maginot_nexus } }
		country_naval_cap_add = 50
		command_limit_add = 10
		mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
	}

	triggered_planet_modifier = {
		potential = { owner? = { is_hive_empire = yes } }
		planet_stability_add = 10
		planet_army_build_speed_mult = 0.5
		pop_amenities_usage_mult = -0.1
		planet_orbital_bombardment_damage = -0.15
		job_warrior_drone_add = 200
	}

	station_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_damage = 0.1
		ship_armor_regen_add_perc = 0.1
		ship_shield_regen_add_perc = 0.15
	}
	triggered_station_modifier = {
		potential = { planet = { has_deposit = d_plnmg_maginot_nexus } }
		ship_fire_rate_mult = 0.2
		ship_tracking_add = 10
		ship_weapon_range_mult = 10
		ship_engagement_range_mult = 10
		ship_damage_reduction_mult = 0.1
		ship_target_weight_mult = 0.5
	}

	defense_platform_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_damage = 0.15
		ship_hull_mult = 0.05
		ship_armor_mult = 0.1
		ship_shield_mult = 0.15
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 150
			minerals = 200
			food = 350
			mult = value:plnmg_starbase_building_estimate_mult
		}
		cost = {
			trigger = { owner? = { is_wilderness_empire = yes } }
			biomass = 100
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			unity = 10
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = @plnmg_sm_upkeep }
	}

	ai_weight = { weight = 10 }
}

planetmega_defense_transmitter = {
	icon = "GFX_starbase_planetmega_defense_transmitter"
	construction_days = 180

	potential = {
		is_normal_starbase = no
		nor = {
			has_starbase_building = war_headquarter_orbital_accessory
			has_starbase_building = fighter_organ_orbital_accessory
		}
	}
	possible = {
		solar_system = {
			any_starbase_in_system = {
				or = {
					has_starbase_building = war_headquarter_orbital_accessory
					has_starbase_building = fighter_organ_orbital_accessory
				}
			}
		}
	}

	on_finished = {
		hidden_effect = {
			fleet = {
				if = {
					limit = {
						root = { is_space_citadel = yes }
						not = { has_modifier = plnmg_maginot_nexus_dsc_buff }
					}
					add_modifier = { modifier = plnmg_maginot_nexus_dsc_buff }
				}
			}
		}
	}

	station_modifier = {
		ship_fire_rate_mult = 0.15
		ship_armor_regen_add_perc = 0.1
		ship_shield_regen_add_perc = 0.15
	}
	triggered_station_modifier = {
		potential = { is_orbital_ring = yes }
		ship_weapon_damage = 0.1
	}
	defense_platform_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_damage = 0.15
		ship_hull_mult = 0.05
		ship_armor_mult = 0.1
		ship_shield_mult = 0.15
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 150
			minerals = 50
		}
		upkeep = {
			energy = @plnmg_sm_upkeep
			mult = 0.5
		}
	}

	ai_weight = { weight = 10 }
}

centralized_manufactory_orbital_accessory = {
	icon = "GFX_build_centralized_manufactory_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_factory = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		potential = {
			owner? = {
				or = {
					country_uses_consumer_goods = yes
					has_civic = civic_machine_obsessional_directive
				}
			}
		}
		planet_artisans_consumer_goods_produces_add = @plnmg_sm_res_add
		planet_jobs_trade_produces_mult = @plnmg_sm_res_mult
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			consumer_goods = 10
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = {
			energy = 5
			minerals = @plnmg_sm_upkeep
		}
	}

	ai_weight = {
		weight = 10
	}
}

#已改为不限政体
primary_mind_pyramid_orbital_accessory = {
	icon = "GFX_build_primary_mind_pyramid_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_admin = yes }
	}

	planet_modifier = {
		planet_housing_add = @plnmg_sm_house
		planet_pops_upkeep_mult = -0.10
	}
	triggered_planet_modifier = {
		planet_stability_add = 10
		planet_researchers_produces_mult = 0.05
		planet_jobs_produces_mult = @plnmg_sm_res_mult
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			unity = 15
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = @plnmg_sm_upkeep }
	}

	ai_weight = {
		weight = 10
	}
}

matter_demodulator_orbital_accessory = {
	icon = "GFX_build_matter_demodulator_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = { has_technology = tech_ground_megastructure }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_mine = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		potential = {
			planet? = {
				or = {
					has_deposit = d_matter_demodulator
					and = {
						has_deposit = d_plnmg_singularity_generator
						not = { has_planet_flag = plnmg_all_energy_prod }
					}
				}
			}
		}
		planet_jobs_minerals_produces_mult = @plnmg_sm_res_mult
		planet_miners_minerals_produces_add = @plnmg_sm_res_add
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			minerals = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = @plnmg_sm_upkeep }
	}

	ai_weight = {
		weight = 10
	}
}

vertical_farm_edifice_orbital_accessory = {
	icon = "GFX_build_vertical_farm_edifice_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = {
			is_hive_empire = no
			has_technology = tech_ground_megastructure
		}
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_farm = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		planet_jobs_food_produces_mult = @plnmg_sm_res_mult
		planet_farmers_food_produces_add = @plnmg_sm_res_add
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	triggered_planet_modifier = {
		potential = {
			owner? = { is_gestalt = no }
			planet = { has_deposit = d_plnmg_advanced_agriculture_edifice }
		}
		bonus_pop_growth_mult = 0.05
		mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			food = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = 15 }
	}

	ai_weight = {
		weight = 10
	}
}

hive_farm_edifice_orbital_accessory = {
	icon = "GFX_build_hive_farm_edifice_icon"
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = {
			is_hive_empire = yes
			has_technology = tech_ground_megastructure
		}
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_farm = yes }
	}

	planet_modifier = { planet_housing_add = @plnmg_sm_house }
	triggered_planet_modifier = {
		potential = { owner? = { is_hive_empire = yes } }
		planet_jobs_food_produces_mult = @plnmg_sm_res_mult
		planet_farmers_food_produces_add = @plnmg_sm_res_add
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	triggered_planet_modifier = {
		potential = {
			owner? = { is_hive_empire = yes }
			planet = { has_deposit = d_plnmg_gene_farm_hive }
		}
		bonus_pop_growth_mult = 0.05
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			food = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = 15 }
	}

	ai_weight = {
		weight = 10
	}
}

# text should be improved afterwards
planetmega_orbital_sanatorium = {
	icon = "GFX_orbitalring_module_habitation" #temp
	construction_days = 360
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		owner? = {
			is_gestalt = no
			has_technology = tech_ground_megastructure
		}
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = { has_plnmg_any_admin = yes }
	}

	triggered_planet_modifier = {
		planet_bureaucrats_unity_produces_add = @plnmg_sm_res_add
		planet_bureaucrats_unity_produces_mult = @plnmg_sm_res_mult
		#planet_jobs_unity_produces_mult = 0.01
		mult = planet.value:scripted_modifier_mult|MODIFIER|jobs_about_planetmega_produces_mult|
	}

	resources = {
		category = starbase_buildings
		produces = {
			unity = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		upkeep = { energy = 20 }
	}

	ai_weight = {
		weight = 20
	}
}

# Tier 2

planetmega_management_center = {
	icon = "GFX_starbase_planetmega_management_center"
	construction_days = 900 #一坤年
	category = sm_economy_cat

	potential = {
		owner? = { has_technology = tech_planetmega_improved }
		is_normal_starbase = yes
	}

	show_in_tech = tech_planetmega_improved
	show_tech_unlock_if = { is_nomadic = no }

	possible = {
		custom_tooltip = {
			fail_text = requires_planetmega_inside_system
			solar_system = {
				any_system_planet_colony = {
					is_owned_by = root.owner
					has_plnmg_any_mega = yes
				}
				count_system_planet_colony = {
					count > 1
					limit = { is_owned_by = root.owner }
				}
			}
		}
	}

	triggered_station_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_fortress = yes } } }
	 	ship_hull_mult = 0.25
	 	ship_armor_mult = 0.25
	 	ship_shield_mult = 0.25
	 	ship_hull_damage_mult = 0.25
	}
	triggered_station_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_deposit = d_plnmg_maginot_nexus } } }
		ship_hull_add = 5000
		ship_hull_mult = 0.5
		ship_armor_add = 5000
		ship_armor_mult = 0.5
		ship_shield_add = 5000
		ship_shield_mult = 0.5
		ship_armor_hardening_add = 0.5
		ship_shield_hardening_add = 0.5
		ship_armor_penetration_mult = 0.5
		ship_shield_penetration_mult = 0.5
		ship_hull_damage_mult = 0.5
	}

	system_modifier = {
		planet_jobs_produces_mult = @plnmg_sm_res_mult
		planet_buildings_produces_mult = @plnmg_sm_res_mult
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_forge = yes } } }
		#planet_metallurgists_alloys_produces_add = 0.5
		planet_jobs_alloys_produces_mult = @plnmg_sm_res_mult
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_lab = yes } } }
		planet_jobs_physics_research_produces_mult = @plnmg_sm_res_mult
		planet_jobs_society_research_produces_mult = @plnmg_sm_res_mult
		planet_jobs_engineering_research_produces_mult = @plnmg_sm_res_mult
		planet_researchers_upkeep_mult = -0.05
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_unity_producer = yes } } }
		planet_jobs_unity_produces_mult = @plnmg_sm_res_mult
		planet_amenities_add = 500
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_generator = yes } } }
		planet_jobs_energy_produces_mult = @plnmg_sm_res_mult
		#planet_technician_energy_produces_add = 0.5
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_factory = yes } } }
		#planet_artisans_consumer_goods_produces_add = 0.5
		planet_jobs_consumer_goods_produces_mult = @plnmg_sm_res_mult
		planet_jobs_trade_produces_mult = @plnmg_sm_res_mult
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_pyramid = yes } } }
		planet_jobs_unity_produces_mult = @plnmg_sm_res_mult
		planet_researchers_produces_mult = @plnmg_sm_res_mult
		planet_stability_add = 5
		planet_pops_upkeep_mult = -0.05
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_mine = yes } } }
		planet_jobs_minerals_produces_mult = @plnmg_sm_res_mult
		#planet_miners_minerals_produces_add = 1
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_farm = yes } } }
		planet_jobs_food_produces_mult = @plnmg_sm_res_mult
		#planet_farmers_food_produces_add = 1
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_farm_t2 = yes } } }
		# bonus_pop_growth = 2
		bonus_pop_growth_mult = 0.1
	}

	triggered_system_modifier = {
		potential = { solar_system = { any_system_planet_colony = { has_plnmg_any_admin = yes } } }
		planet_jobs_unity_produces_mult = @plnmg_sm_res_mult
		empire_size_districts_mult = -0.1
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
			minerals = 1500
			mult = value:plnmg_starbase_building_estimate_mult
		}
		upkeep = { energy = @plnmg_base_upkeep_t2 }
	}

	ai_weight = { weight = 0 }
}

# effect is in events
colossus_assist_orbital_accessory = {
	icon = "GFX_starbase_colossus_assist_orbital_accessory"
	construction_days = 540
	starbase_type = orbital_ring
	category = sm_naval_support_cat

	potential = {
		owner? = { has_technology = tech_planetmega_advanced }
		is_orbital_ring = yes
	}
	possible = {
		hidden_trigger = { exists = planet }
		planet = {
			or = {
				has_deposit = d_plnmg_colossus_assist
				hidden_trigger = { has_planet_flag = planet_has_plnmg_colossus_assist }
			}
		}
	}

	planet_modifier = { planet_jobs_energy_produces_mult = @plnmg_sm_res_mult }
	system_modifier = { planet_jobs_energy_produces_mult = 0.01 }
	country_modifier = { planetmega_aeg_support_base = 0.25 }

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		produces = {
			energy = 5
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		produces = {
			trigger = { owner? = { has_menace_perk = menp_objectives } }
			menace = @plnmg_sm_produces
			mult = planet.value:scripted_modifier_mult|MODIFIER|planet_buildings_mega_produces_mult|
		}
		upkeep = { energy = @plnmg_base_upkeep_t2 }
	}

	ai_weight = { weight = 0 }
}

#暂缓，因为要重新构思这个
planetmega_yomagntho = {
	icon = "GFX_build_primary_mind_pyramid_icon" #temp
	construction_days = 540
	starbase_type = orbital_ring
	category = sm_colony_cat

	potential = {
		always = no
		# is_orbital_ring = yes
		# owner? = {
		# 	or = {
		# 		has_tradition = tr_pm_granchor_swap_3_orbit_deter
		# 		has_tradition = tr_pm_granchor_orbit_deter
		# 	}
		# }
	}
	# possible = {
	# 	planet? = {
	# 		or = {
	# 			has_plnmg_any_generator = yes
	# 			has_plnmg_any_fortress = yes
	# 		}
	# 	}
	# }

	planet_modifier = {
		custom_tooltip = fake_planetmega_yomagntho_modifier_tt
		show_only_custom_tooltip = yes
	}
	on_finished = {
		# if = {
		# 	limit = {
		# 		exists = planet
		# 		planet = { has_orbital_bombardment = yes }
		# 	}
		# 	planet = { planet_event = { id = planetmega_effect.151 } }
		# }
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = @plnmg_sm_alloys_cost
			minerals = @plnmg_sm_minerals_cost
			mult = value:plnmg_starbase_building_estimate_mult
		}
		upkeep = { energy = @plnmg_base_upkeep }
	}

	ai_weight = { weight = 0 }
}

