# REPLACED BUILDINGS
# Automobiles Industry (REPLACE NEEDED TO REMOVE pmg_aeroplanes)
REPLACE:building_automotive_industry = {
	building_group = bg_heavy_industry
	icon = "gfx/interface/icons/building_icons/vehicles_industry.dds"
	city_type = city
	levels_per_mesh = 50
	unlocking_technologies = {
		combustion_engine
	}
	production_method_groups = {
		pmg_automobile_production
		pmg_tanks
		pmg_automation_building_automotive_industry
		pmg_data_optimization_heavy_industry_algorithmic_dispatch
	}
	required_construction = construction_cost_very_high
	possible = {
		owner = {
			NOT = {
				OR = {
					has_law_or_variant = law_type:law_industry_banned
					has_law_or_variant = law_type:law_extraction_economy
				}
			}
		}
	}
	ownership_type = self
	background = "gfx/interface/icons/building_icons/backgrounds/building_panel_bg_heavy_industry.dds"
}

# Synthetics Plants (REPLACE NEEDED TO REMOVE pmg_synthetic_dyes and pmg_synthetic_silk)
REPLACE:building_synthetics_plant = {
	aliases = {
		building_synthetics_plants
	}
	building_group = bg_heavy_industry
	icon = "gfx/interface/icons/building_icons/synthetics_plants.dds"
	city_type = city
	levels_per_mesh = 50
	unlocking_technologies = {
		distillation
	}
	production_method_groups = {
		pmg_cosmetics
		pmg_automation_building_synthetics_plant
		pmg_data_optimization_heavy_industry
	}
	required_construction = construction_cost_very_high
	possible = {
		owner = {
			NOT = {
				OR = {
					has_law_or_variant = law_type:law_industry_banned
					has_law_or_variant = law_type:law_extraction_economy
				}
			}
		}
	}
	ownership_type = self
	background = "gfx/interface/icons/building_icons/backgrounds/building_panel_bg_heavy_industry.dds"
}

# Power Plant (REPLACE NEEDED TO ADJUST AI VALUE)
REPLACE:building_power_plant = {
	building_group = bg_power
	icon = "gfx/interface/icons/building_icons/power_plant.dds"
	levels_per_mesh = 50
	city_type = city
	unlocking_technologies = {
		electrical_generation
	}
	production_method_groups = {
		pmg_base_building_power_plant
		pmg_refining_building_power_plant
		pmg_automation_building_power_plant
		pmg_power_transmission
	}
	required_construction = construction_cost_medium
	ai_value = {
		value = 1000
		# Need 1 level of Power Plants everywhere as its a local good and a prerequisite to enabling electricity PMs to begin with
		if = {
			limit = {
				NOR = {
					has_building = building_power_plant
					any_scope_building = {
						is_building_type = building_power_plant
						is_under_construction = yes
					}
				}
			}
			add = 4000
		}
		if = {
			limit = {
				owner = {
					OR = {
						# Leader Producers of Oil and Gas, or rich oil middle east countries will still use traditional power plants more
						NOR = {
							leading_producer_of = g:oil
							leading_producer_of = g:gas
							# Some countries also
							is_in_geographic_region = geographic_region_middle_east
							c:VNZ ?= this
							c:RUS ?= this
						}
						OR = {
							AND = {
								has_technology_researched = wind_turbines
								NOT = {
									has_law_or_variant = law_type:law_no_protection
								}
							}
							has_technology_researched = urban_sustainability
						}
					}
				}
			}
			add = -1000
		}
	}
	possible = {
		owner = {
			NOR = {
				has_law_or_variant = law_type:law_industry_banned
				has_law_or_variant = law_type:law_active_restoration
			}
		}
	}
	ownership_type = self
	background = "gfx/interface/icons/building_icons/backgrounds/building_panel_bg_monuments.dds"
}

# INJECTED BUILDINGS
#Railway
INJECT:building_railway = {
	production_method_groups = {
		pmg_transport_infrastructure_building_railway
		pmg_data_optimization_light_industry_no_shopkeepers
	}
}

# Port
INJECT:building_port = {
	production_method_groups = {
		pmg_base_building_water_desalination
	}
}

# Urban Center
INJECT:building_urban_center = {
	production_method_groups = {
		pmg_urban_center_healtcare
		pmg_recycling_center
		#pmg_carbon_capture_building_urban_center
	}
}

# Coal Mine
INJECT:building_coal_mine = {
	production_method_groups = {
		pmg_selective_mineral_extraction_coal_mine
		pmg_data_optimization_primary_sector
	}
	possible = {
		owner = {
			NOT = {
				OR = {
					has_law_or_variant = law_type:law_mining_restrict_hazardous
					has_law_or_variant = law_type:law_mining_strategic
					has_law_or_variant = law_type:law_polluting_mining_banned
				}
			}
		}
	}
}

# Iron Mine
INJECT:building_iron_mine = {
	production_method_groups = {
		pmg_selective_mineral_extraction_iron_mine
		pmg_data_optimization_primary_sector
	}
	possible = {
		owner = {
			NOT = {
				has_law_or_variant = law_type:law_polluting_mining_banned
			}
		}
	}
}

# Lead Mine
INJECT:building_lead_mine = {
	production_method_groups = {
		pmg_selective_mineral_extraction_lead_mine
		pmg_data_optimization_primary_sector
	}
	possible = {
		owner = {
			NOT = {
				OR = {
					has_law_or_variant = law_type:law_mining_restrict_hazardous
					has_law_or_variant = law_type:law_mining_strategic
					has_law_or_variant = law_type:law_polluting_mining_banned
				}
			}
		}
	}
}

# Sulfur Mine
INJECT:building_sulfur_mine = {
	production_method_groups = {
		pmg_selective_mineral_extraction_sulfur_mine
		pmg_data_optimization_primary_sector
	}
	possible = {
		owner = {
			NOT = {
				OR = {
					has_law_or_variant = law_type:law_mining_restrict_hazardous
					has_law_or_variant = law_type:law_mining_strategic
					has_law_or_variant = law_type:law_polluting_mining_banned
				}
			}
		}
	}
}

#SteelMill
INJECT:building_steel_mill = {
	production_method_groups = {
		pmg_direct_reduced_iron_steelmaking
		pmg_data_optimization_heavy_industry
	}
}

# Food Industry
INJECT:building_food_industry = {
	production_method_groups = {
		pmg_delivery_building_food_industry
		pmg_data_optimization_light_industry
	}
}

# Munitions Industry
INJECT:building_munition_plant = {
	production_method_groups = {
		pmg_missiles_building_munition_plant
		pmg_data_optimization_heavy_industry
	}
}

# Livestock Ranch
INJECT:building_livestock_ranch = {
	production_method_groups = {
		pmg_breeding_livestock_ranch
		pmg_data_optimization_primary_sector
	}
}

# Chemical Plants
INJECT:building_chemical_plant = {
	production_method_groups = {
		pmg_synthetic_dyes
		pmg_synthetic_silk
		pmg_chemical_plant_automation
		pmg_data_optimization_light_industry
	}
}

# Electrics
INJECT:building_electrics_industry = {
	production_method_groups = {
		pmg_automation_building_electrics_industry
		pmg_data_optimization_heavy_industry
	}
}

# Explosives Factory
INJECT:building_explosives_factory = {
	production_method_groups = {
		pmg_explosives_factory_automation
		pmg_data_optimization_heavy_industry
	}
}
