
tech_plnmg_space_mega_enigmatic_res = {
	cost = @tier5cost3
	area = engineering
	is_rare = yes
	category = { industry }
	icon = tech_mega_engineering
	tier = 5
	prerequisites = { "tech_planetmega_enigmatic_res" "tech_mega_engineering" }
	weight = @tier5weight3

	weight_modifier = {
		modifier = {
			is_variable_set = num_researched_cosmogenesis_techs
			factor = num_researched_cosmogenesis_techs
		}
		modifier = {
			factor = 1.25
			has_ascension_perk = ap_enigmatic_engineering
		}
		inline_script = technologies/tech_plnmg_cosmogenesis_factor
	}

	modifier = {
		megastructures_produces_mult = 0.35
		megastructures_upkeep_mult = 0.25
	}

	ai_weight = { weight = 1000 }
}

tech_plnmg_space_mega_cosmogenesis = {
	cost = @fallentechcost
	area = engineering
	is_rare = yes
	is_dangerous = yes
	category = { industry }
	icon = tech_mega_engineering
	tier = 5
	prerequisites = { "tech_plnmg_space_mega_enigmatic_res" "tech_planetmega_cosmogenesis" }
	weight = @tier5weight3

	weight_modifier = {
		modifier = {
			is_variable_set = num_researched_cosmogenesis_techs
			factor = num_researched_cosmogenesis_techs
		}
		inline_script = technologies/tech_plnmg_cosmogenesis_factor
		modifier = {
			factor = 0
			or = {
				has_global_flag = AOW_installed
				has_gigastructures = yes
			}
		}
	}

	modifier = {
		megastructures_produces_mult = 0.65
		megastructures_upkeep_mult = 0.5
		country_megastructure_build_cap_add = 1
	}

	ai_weight = { weight = 1000 }
}

tech_plnmg_more_biomass_1 = {
    cost = 7500
    area = society
    icon = tech_wilderness_terraform
    category = { biology }
    tier = 3
    prerequisites = {
        or = {
            tech_plnmg_rebuild_the_abandoned
            tech_ground_megastructure
        }
    }
    potential = { is_wilderness_empire = yes }
    modifier = { planetmega_biomass_produces_add = 25 }
    weight = @tier3weight3
    ai_weight = { weight = @tier3weight1 }
}
tech_plnmg_more_biomass_2 = {
    cost = 15000
    area = society
    icon = tech_wilderness_terraform
    category = { biology }
    tier = 4
    prerequisites = {
        tech_plnmg_more_biomass_1
        or = {
            tech_planetmega_efficiency
            tech_planetmega_administration
            tech_planetmega_refinery
            tech_planetmega_enigmatic_res
        }
    }
    potential = { is_wilderness_empire = yes }
    modifier = { planetmega_biomass_produces_add = 50 }
    weight = @tier4weight2
    ai_weight = { weight = @tier4weight1 }
}
tech_plnmg_more_biomass_3 = {
	cost = 30000
	area = society
	icon = tech_wilderness_terraform
	category = { biology }
	tier = 5
	prerequisites = {
		tech_plnmg_more_biomass_2
		tech_planetmega_omnipotence_engineering
	}
	modifier = { planetmega_biomass_produces_add = 100 }
	weight = @tier5weight2
	ai_weight = { weight = @tier5weight1 }
}

tech_plnmg_district_uncapper_farm = {
	icon = tech_pure_seed_farming
	cost = @pmtech_tier6cost2
	area = society
	category = { biology }
	tier = 5
	is_rare = yes
	prerequisites = { tech_planetmega_advanced }
	potential = { is_nomadic = no }
	weight = @pmtech_tier6weight2
	weight_modifier = {
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_plnmg_district_uncapper_farm
		}
		inline_script = {
			script = technologies/tech_t3base_plnmg_weight_modifiers
			TECH = tech_plnmg_district_uncapper_farm
		}
		modifier = {
			factor = 1.5
			has_menace_perk = menp_behemoth_food_1
		}
		modifier = {
			factor = 2
			or = {
				is_hive_empire = yes
				has_menace_perk = menp_behemoth_food_2
			}
		}
		modifier = {
			factor = 2.5
			or = {
				is_wilderness_empire = yes
				has_menace_perk = menp_behemoth_hatchling
			}
		}
		modifier = {
			factor = 3
			has_menace_perk = menp_behemoth_hatchling_2
		}
	}
	ai_weight = {
		weight = @pmtech_tier6weight2
		modifier = {
			factor = 2
			is_hive_empire = yes
		}
		modifier = {
			factor = 2.5
			or = {
				is_wilderness_empire = yes
				has_ascension_perk = ap_behemoths
			}
		}
	}
}
tech_plnmg_district_uncapper_mine = {
	icon = old_tech_icons/tech_mining_network_5
	cost = @pmtech_tier6cost2
	area = engineering
	category = { industry }
	tier = 5
	is_rare = yes
	prerequisites = { tech_planetmega_advanced tech_planetmega_singularity }
	potential = { is_nomadic = no }
	weight = @pmtech_tier6weight2
	weight_modifier = {
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_plnmg_district_uncapper_mine
		}
		inline_script = {
			script = technologies/tech_t3base_plnmg_weight_modifiers
			TECH = tech_plnmg_district_uncapper_mine
		}
		modifier = {
			factor = 2.5
			or = {
				is_lithoid_empire = yes
				has_menace_perk = menp_crisis_cruiser
			}
		}
		modifier = {
			factor = 2
			has_menace_perk = menp_crisis_destroyer
		}
		modifier = {
			factor = 1.5
			or = {
				is_infernal_empire = yes
				has_menace_perk = menp_crisis_corvette
			}
		}
	}
	ai_weight = {
		weight = @pmtech_tier6weight2
		modifier = {
			factor = 2.5
			has_ascension_perk = ap_become_the_crisis
		}
		modifier = {
			factor = 2
			is_lithoid_empire = yes
		}
		modifier = {
			factor = 1.5
			is_infernal_empire = yes
		}
	}
}
tech_plnmg_district_uncapper_generator = {
	icon = tech_wormhole_generation_3
	cost = @pmtech_tier6cost2
	area = physics
	category = { field_manipulation }
	tier = 5
	is_rare = yes
	prerequisites = { tech_planetmega_advanced }
	potential = { is_nomadic = no }
	weight = @pmtech_tier6weight2
	weight_modifier = {
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_plnmg_district_uncapper_generator
		}
		inline_script = {
			script = technologies/tech_t3base_plnmg_weight_modifiers
			TECH = tech_plnmg_district_uncapper_generator
		}
		modifier = {
			factor = 3.5
			has_menace_perk = menp_hyperthermia_harnessing
		}
		modifier = {
			factor = 1.25
			has_civic = civic_galvanic_symbiosis
		}
	}
	ai_weight = {
		weight = @pmtech_tier6weight2
		modifier = {
			factor = 2.5
			has_ascension_perk = ap_galactic_hyperthermia
		}
	}
}

# tech_dyson_gun_redirection = { # planning to move it to another mod
# 	cost = @tier5cost2
# 	area = physics
# 	category = { field_manipulation }
# 	tier = 5
# 	prerequisites = { tech_dyson_gun }
# 	potential = { always = no }
# 	weight = @tier5weight3
#
# 	prereqfor_desc = {
# 		custom = {
# 			title = "TECH_DYSON_GUN_REDIRECTION_EXTRA_TITLE"
# 			desc = "TECH_DYSON_GUN_REDIRECTION_EXTRA_DESC"
# 		}
# 	}
#
# 	ai_weight = {
# 		weight = @tier5weight3
# 	}
# }
# tech_dyson_gun_bypassing = { # planning to move it to another mod
# 	cost = @tier5cost2
# 	area = physics
# 	category = { field_manipulation }
# 	tier = 5
# 	prerequisites = { tech_planetmega_active_defense tech_planetmega_colossus }
# 	potential = { always = no }
# 	weight = @tier5weight3
#
# 	prereqfor_desc = {
# 		custom = {
# 			title = "TECH_DYSON_GUN_BYPASSING_EXTRA_TITLE"
# 			desc = "TECH_DYSON_GUN_BYPASSING_EXTRA_DESC"
# 		}
# 	}
# 	#modifier = { dyson_gun_damage_mult = 0.1 }
#
# 	ai_weight = {
# 		weight = @tier5weight3
# 	}
# }

tech_planetmega_dummy = {
	# no localisation since this will not appear in player view
	area = physics
	category = { particles }
	tier = 1
	cost = 1
	weight = 0
	potential = { always = no }
}

# tech_planetmega_test_1 = {
# 	area = physics
# 	category = { particles }
# 	tier = 1
# 	cost = {
# 		factor = @pmtech_tier6cost1
# 		modifier = {
# 			event_target:global_event_country = { is_variable_set = tech_costs_scale_compensation_mult }
# 			factor = event_target:global_event_country.tech_costs_scale_compensation_mult
# 		}
# 	}
# 	weight = 10000
# 	#potential = { always = no }
# }
# tech_planetmega_test_2 = {
# 	area = physics
# 	category = { particles }
# 	tier = 1
# 	cost = { #这TM和下面的有什么区别，但这个就是会溢出，鉴定为蠢驴神秘代码
# 		factor = @pmtech_tier6cost1
# 		factor = event_target:global_event_country.tech_costs_scale_compensation_mult
# 	}
# 	weight = 10000
# 	#potential = { always = no }
# }
# tech_planetmega_test_3 = {
# 	area = physics
# 	category = { particles }
# 	tier = 1
# 	cost = {
# 		factor = @pmtech_tier6cost1
# 		modifier = { factor = event_target:global_event_country.tech_costs_scale_compensation_mult }
# 	}
# 	weight = 10000
# 	#potential = { always = no }
# }

# tech_planetmega_test_4 = {
# 	area = physics
# 	category = { particles }
# 	tier = 2
# 	cost = 100
# 	weight = 0
# 	potential = { has_global_flag = tech_plnmg_test_4 }
# }
