﻿bailiff = {
	audio_tier = 2
	is_foreign = no
	max_levels = 1
	pop_type = bureaucrats
	
	employment_size = 0.250
	category = government_category
	
	rural_settlement = yes
	expensive = yes
	build_time = rural_build_time
	
	forbidden_for_estates = yes
	
	location_potential = {
		is_overseas_for_owner = no
	}
	
	allow = {
		trigger_if = {
			limit = {
				scope:actor = {
					modifier:num_bailiffs <= 0
				}
			}
			custom_tooltip = {
				text = no_local_bailiff_tt
				always = no
			}
		}
		trigger_else = {
			custom_tooltip = {
				text = local_bailiff_tt
				scope:actor = {
					total_building_levels_including_construction:bailiff < modifier:num_bailiffs
				}
			}
		}
		owner = scope:actor #not in subjects
	}
	
	
	unique_production_methods = {
		bailiff_input = {
			icon_type = goods
			icon = paper
			paper = 0.1
			tools = 0.15
			weaponry = 0.25
			stone = 0.1
			category = building_maintenance
		}
	}

	modifier = {
		local_peasant_enfranchisment = -0.25
		local_bureaucrats_desired_pop_scaled = 0.0025

	}
	
	
}

fishing_village = {
	audio_tier = 1
	is_foreign = no
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	pop_type = peasants
	
	is_village = yes

	category = village_category
	employment_size = village_employment_size
	
	rural_settlement = yes
	
	AI_optimization_flag_coastal = yes
	location_potential = {
		is_coastal = yes
	}
	
		
	
	build_time = village_build_time

	possible_production_methods = {
		fishing_village_maintenance
		arctic_fishing_village_maintenance
		coastal_boatyard
		rural_pottery_maker
	}

	construction_demand = village_construction

	modifier = {
		local_merchant_capacity = 0.25
		local_peasants_estate_power = 0.25		#25% higher here.
		local_food_capacity = 50
		local_peasant_enfranchisment = 0.01

		local_maritime_presence = 0.01

		harbor_suitability = 0.02

		local_sailors = 0.001



	}
	raw_modifier = {
		local_laborers_desired_pop = 0.1
		local_soldiers_desired_pop = 0.05
	}
}

farming_village = {
	audio_tier = 1
	is_foreign = no
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	pop_type = peasants
	
	is_village = yes
	
	category = village_category
	employment_size = village_employment_size
	
	rural_settlement = yes
	
	location_potential = {
		OR = {
			raw_material = goods:wheat
			raw_material = goods:maize
			raw_material = goods:rice
			raw_material = goods:millet
			raw_material = goods:legumes
			raw_material = goods:potato
			raw_material = goods:livestock
			raw_material = goods:olives
			raw_material = goods:fruit
			raw_material = goods:wool
		}
	}
	
		
	
	build_time = village_build_time
	
	unique_production_methods = {
		farming_village_maintenance = {
			icon_type = goods
			icon = tools
			tools = 0.0267
			clay = 1.0896
			
			output = 0.5
			
			produced = livestock
			
			debug_max_profit = rural_profit_margin
	
			category = building_maintenance
		}
	}

	construction_demand = village_construction

	modifier = {
		local_food_capacity = 100
		local_raw_material_output = 0.025
		local_peasants_estate_power = 0.25		#25% higher here.
		local_peasant_enfranchisment = 0.01

	}
	raw_modifier = {
		local_laborers_desired_pop = 0.1
		local_soldiers_desired_pop = 0.05
	}
}

forest_village = {
	audio_tier = 1
	is_foreign = no
	is_village = yes
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	pop_type = peasants
	
	category = village_category
	employment_size = village_employment_size
	

	rural_settlement = yes
	
	location_potential = {
		OR = {
			raw_material = goods:wild_game
			vegetation = forest
			vegetation = woods
			vegetation = jungle
		}
	}
	
		
	
	build_time = village_build_time


	possible_production_methods = {
		forest_tannery
		hunting_lodges
		rural_weaponmaker
		rural_blacksmith
	}


	construction_demand = village_construction

	modifier = {
		local_monthly_food = 1.0
		local_peasants_estate_power = 0.25		#25% higher here.
		local_peasant_enfranchisment = 0.01

	}
	raw_modifier = {
		local_laborers_desired_pop = 0.1
		local_soldiers_desired_pop = 0.05
	}
}

market_village = {
	audio_tier = 1
	is_foreign = no
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	pop_type = peasants
	
	is_village = yes
	
	employment_size = village_employment_size
	
	rural_settlement = yes
	
	category = village_category
	
		
	
	build_time = village_build_time

	construction_demand = village_construction


	possible_production_methods = {
		rural_blacksmith
		rural_millet_brewery
		rural_weaponmaker
		rural_jewelry_carver
		rural_pottery_maker
	}

	modifier = {
		local_merchant_capacity = 0.10
		local_merchant_power = 0.10
		local_market_access = 0.005

		local_food_capacity = 50
		local_peasants_estate_power = 0.25
		local_peasant_enfranchisment = 0.01

	}
	raw_modifier = {
		local_burghers_desired_pop = 0.01
		local_laborers_desired_pop = 0.1
		local_soldiers_desired_pop = 0.05
	}
}

rural_glassmaker = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = guild_max_level
	startup_ramp_target = rural_startup_ramp_target

	forbidden_for_estates = yes

	category = basic_industry_category

	employment_size = rural_peasant_produce_employment

	rural_settlement = yes

	town = no
	city = no

	location_potential = {
		is_produced_in_location_market = goods:sand
	}

	build_time = rural_build_time

	unique_production_methods = {
		rural_glassmaker_maintenance = {
			icon_type = goods
			icon = sand
			sand = 1.0

			produced = glass
			output = 0.2

			debug_max_profit = rural_profit_margin
			category = guild_input
		}
	}

	construction_demand = village_construction

	modifier = {
	}
}

rural_clothmaker = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = guild_max_level
	startup_ramp_target = rural_startup_ramp_target

	forbidden_for_estates = yes
	
	category = consumer_goods_category
	
	employment_size = rural_peasant_produce_employment
	
	rural_settlement = yes
	
	
	town =  no
	city =  no

	


	build_time = rural_build_time
	
	unique_production_methods = {
	
	
			
		rural_wool_clothmaker = {
			icon_type = goods
			icon = wool
			wool = 0.5

			produced = cloth
			output = 0.5

			debug_max_profit = rural_profit_margin
			category = guild_input
		}

		rural_cotton_clothmaker = {
			icon_type = goods
			icon = cotton
			cotton = 0.417

			produced = cloth
			output = 0.5

			debug_max_profit = rural_profit_margin
			category = guild_input
		}

		rural_fiber_clothmaker = {
			icon_type = goods
			icon = fiber_crops
			fiber_crops = 0.5

			produced = cloth
			output = 0.4

			debug_max_profit = rural_profit_margin
			category = guild_input
		}

		
	}

	construction_demand = village_construction
	
	modifier = {
	}
}

charcoal_maker = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	
	employment_size = rural_peasant_produce_employment
	
	
	category = rgo_building_category
	
	rural_settlement = yes
	
	

	build_time = rural_build_time
	
	unique_production_methods = {
		char_coal_maintenance = {
			icon_type = goods
			icon = lumber
			produced = coal
			output = 0.8

			debug_max_profit = rural_profit_margin
		
			lumber = 0.8889
			category = guild_input
		}

	}

	construction_demand = guild_construction
}

improved_charcoal_maker = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	
	employment_size = rural_peasant_produce_employment
	obsolete = charcoal_maker
	
	category = rgo_building_category
	
	rural_settlement = yes
	town = yes
	city = yes
	megalopolis = yes
	
	

	build_time = rural_build_time
	
	unique_production_methods = {
		improved_char_coal_maintenance = {
			icon_type = goods
			icon = lumber
			produced = coal
			output = 1.2

			debug_max_profit = rural_profit_margin
		
			lumber = 1.3333
			category = guild_input
		}

	}

	construction_demand = guild_construction
}

elephant_hunting_grounds = {
	audio_tier = 1
	is_foreign = no
	max_levels = {
		value = rural_building_cap
		if = {
			limit = {
				owner ?= {
					has_variable = ori_double_elephant_hunting_ground_level_flag
				}
			}
			add = {
				desc = "INCREASED_MAX_LEVEL_ELEPHANT_HUNTING_GROUND"
				value = 2
			}
		}
	}
	startup_ramp_target = rural_startup_ramp_target
	pop_type = peasants
	
	category = rgo_building_category
	employment_size = elephant_hunting_grounds_employment
	
	rural_settlement = yes
	
	country_potential = {
		produced_in_country:elephants > 0
	}
	
	location_potential = {
		raw_material = goods:elephants
	}
	
		
	
	build_time = rural_build_time
	

	unique_production_methods = {
		elephant_hunting_grounds_maintenance = {
			icon_type = goods
			icon = tools
			produced = ivory
			output = 1

			tools = 0.208
			weaponry = 0.208
			elephants = 0.417
			debug_max_profit = rural_profit_margin
			category = guild_input
		}

	}

	modifier = {
		local_monthly_food_modifier = -0.05
	}
	raw_modifier = {
		local_nobles_desired_pop = 0.010
	}


	construction_demand = village_construction

}

windmill = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = 1
	
	employment_size = rural_peasant_enhance_employment
	
	
	category = rgo_building_category
	
	rural_settlement = yes

	location_potential = {
		OR = {
			raw_material = goods:wheat
			raw_material = goods:rice
			raw_material = goods:millet
			raw_material = goods:maize
		}
	}

	unique_production_methods = {

		grain_windmill_maintenance = {
			icon_type = goods
			icon = tools
			tools = 0.05
			lumber = 0.1
			cloth = 0.05
			category = building_maintenance
		}
	}

	modifier = {
		local_wheat_output_modifier = 0.50
		local_rice_output_modifier = 0.50
		local_millet_output_modifier = 0.50
		local_maize_output_modifier = 0.50
		local_food_capacity = 100
	}

	

	build_time = rural_build_time


	construction_demand = farm_constructions
}

local_smelters = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = 1
	
	employment_size = rural_peasant_enhance_employment
	
	
	category = rgo_building_category
	
	rural_settlement = yes

	location_potential = {
		OR = {
			raw_material = goods:iron
			raw_material = goods:copper
			raw_material = goods:tin
			raw_material = goods:lead
		}

	}

	unique_production_methods = {
		
		local_smelters_maintenance = {
			icon_type = goods
			icon = tools
			tools  = 0.025
			lumber = 0.05
			coal = 0.05
			category = building_maintenance
		}
	}

	modifier = {
		local_iron_output_modifier = 0.1
		local_copper_output_modifier = 0.1
		local_tin_output_modifier = 0.1
		local_lead_output_modifier = 0.1
	}

	

	build_time = rural_build_time


	construction_demand = farm_constructions
}

sawmill = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = 1
	
	employment_size = rural_peasant_enhance_employment
	
	forbidden_for_estates = yes
	
	category = rgo_building_category
	
	rural_settlement = yes

	location_potential = {
		OR = {
			vegetation = woods
			vegetation = forest
			vegetation = farmland
			vegetation = jungle
			raw_material = goods:lumber
		}
	}

	unique_production_methods = {
		
		sawmill_maintenance = {
			icon_type = goods
			icon = tools
			tools  = 0.05
			category = building_maintenance
		}
	}

	modifier = {
		local_lumber_output_modifier = 0.2
	}

	

	build_time = rural_build_time


	construction_demand = farm_constructions
}

sheep_farms = {
	audio_tier = 1
	is_foreign = no
	pop_type = laborers
	max_levels = rural_building_cap
	startup_ramp_target = rural_startup_ramp_target
	
	employment_size = rural_peasant_produce_employment
	
	
	category = rgo_building_category
	
	rural_settlement = yes

	location_potential = {
		OR = {
			vegetation = sparse
			vegetation = farmland
			vegetation = grasslands
		}
	}

	unique_production_methods = {
		
		sheep_farm_maintenance = {
			icon_type = goods
			icon = lumber
			produced = wool
			output = 0.5

			lumber = 0.496
			tools = 0.099
			debug_max_profit = rural_profit_margin
			category = building_maintenance
		}
	}

	modifier = {
	}

	

	build_time = rural_build_time


	construction_demand = farm_constructions
}

settlement_building = {
	audio_tier = 1
	is_foreign = no
	max_levels = 1
	pop_type = peasants

	
	category = infrastructure_category

	employment_size = tiny_rural_peasant_produce_employment
	
	
	rural_settlement = yes
	town = no
	city = no


	location_potential = {
		location_population_percentage < 0.05
	}	
	remove_if = {
		location = {
			location_population_percentage > 0.1
		}
	}
	

	possible_production_methods = {
		colony_maintenance
	}
	construction_demand = colony_construction

	
	build_time = village_build_time
	
	modifier = {
		local_migration_attraction = 1.0
		local_population_growth = 0.01
	}
	
}

kilwan_shipwrights = {
	audio_tier = 1
	is_special = yes
	is_foreign = no
	max_levels = 1
	pop_type = soldiers
	
	category = naval_category
	employment_size = dock_employment
	
	rural_settlement = yes
	town = no
	city = no
	
	location_potential = {
		is_port = yes
	}
	
	build_time = medium_port_building_time

	
	
	possible_production_methods = {
		kilwan_shipwrights_maintenance
	}

	construction_demand = port_building_construction
	

	modifier = {
		local_sailors = 0.01
		harbor_suitability = 0.05
	}
}
