#Mineral Building

eb_mineral = {
	base_buildtime = @b1_time
  can_build = no

	category = resource
  building_sets = {
    mining
    urban
  }

	destroy_trigger = {
		has_modifier = resort_colony
	}

	potential = no

	allow = { }
  
  inline_script = {
    script = jobs/miners_add
    AMOUNT = @b1_jobs
  }

	resources = {
		category = planet_buildings
		cost = {
			minerals = @b1_minerals
		}
		upkeep = {
			energy = @b1_upkeep
		}
	}

	prerequisites = no
	
	upgrades = {
		"eb_mineral2"
	}

	ai_resource_production = {
		minerals = 1
		trigger = {
			always = yes
		}
	}

	# Static jobs building
	ai_weight_coefficient = 0.0
}

building_mine_generic = {
	base_buildtime = @b1_time
	category = resource

	building_sets = {
		mining
	}

	potential = {
		exists = owner
		owner = {
			is_wilderness_empire = no
		}
		NOT = { has_modifier = resort_colony }
		planet = {
			planet_is_habitat_equivalent = no
			planet_is_ring_world_equivalent = no
		}
	}
	destroy_trigger = {
		exists = owner
		OR = {
			owner = {
				is_wilderness_empire = yes
			}
			planet = {
				planet_is_habitat_equivalent = no
				planet_is_ring_world_equivalent = no
				free_building_slots = 0
				owner = {
					is_ai = yes
					has_monthly_income = {
						resource = minerals
						value > 100
					}
				}
			}
		}
	}

	inline_script = {
		script = jobs/miners_add
    AMOUNT = @b1_jobs
	}

	resources = {
		category = planet_buildings
		cost = {
			minerals = @b1_minerals
		}
		upkeep = {
			energy = 2
		}
	}
	
	upgrades = {
		"eb_mineral2"
	}
  
	prerequisites = {
		"tech_mechanized_mining"
	}

	# Static jobs building
	ai_weight_coefficient = 0.0
}

#Energy Building

eb_energy = {
	base_buildtime = @b1_time
  can_build = no

	category = resource
  building_sets = {
    generator
    urban
  }

	destroy_trigger = {
		has_modifier = resort_colony
	}

	potential = no

	allow = { }
  
  inline_script = {
    script = jobs/technicians_add
    AMOUNT = @b1_jobs
  }
	
	resources = {
		category = planet_buildings
		cost = {
			minerals = @b1_minerals
		}
		upkeep = {
			energy = 2
		}
	}
	
	prerequisites = no
	
	upgrades = {
		"eb_energy2"
	}

	ai_resource_production = {
		energy = 1
		trigger = {
			always = yes
		}
	}

	# Static jobs building
	ai_weight_coefficient = 0.0
}

building_generator_generic = {
	base_buildtime = @b1_time
	category = resource

	building_sets = {
		generator
	}

	potential = {
		exists = owner
		owner = {
			is_wilderness_empire = no
		}
		NOT = { has_modifier = resort_colony }
	}
	destroy_trigger = {
		exists = owner
		OR = {
			owner = {
				is_wilderness_empire = yes
			}
			planet = {
				NOT = { is_planet_class = pc_habitat }
				free_building_slots = 0
				owner = {
					is_ai = yes
					has_monthly_income = {
						resource = energy
						value > 100
					}
				}
			}
		}
	}

	inline_script = {
		script = jobs/technicians_add
		AMOUNT = @b1_jobs
	}

	resources = {
		category = planet_buildings
		cost = {
			minerals = @b1_minerals
		}
		upkeep = {
			energy = 2
		}
	}
  
	prerequisites = {
		"tech_power_plant_1"
	}
	
	upgrades = {
		"eb_energy2"
	}

	# Static jobs building
	ai_weight_coefficient = 0.0
}