on_actions = {
	
	on_daily = {
		effect = {
				add_to_variable = { treasury = treasury_rate }
				
				#Automated taking debt
				if = {
					limit = { check_variable = { treasury < 0 } }
					if = {
						limit = { num_of_civilian_factories < 5 }
						add_to_variable = { treasury = 0.2 }
						add_to_variable = { debt = 0.2 }
					}
					#intentionally cycles through all to add appropriate total amount
					if = {
						limit = { num_of_civilian_factories > 4 }
						add_to_variable = { treasury = 1 }
						add_to_variable = { debt = 1 }
					}
					if = {
						limit = { num_of_civilian_factories > 20 }
						add_to_variable = { treasury = 4 }
						add_to_variable = { debt = 4 }
					}
					if = {
						limit = { num_of_civilian_factories > 40 }
						add_to_variable = { treasury = 10 }
						add_to_variable = { debt = 10 }
					}
					if = {
						limit = { num_of_civilian_factories > 80 }
						add_to_variable = { treasury = 15 }
						add_to_variable = { debt = 15 }
					}
					if = {
						limit = { num_of_civilian_factories > 180 }
						add_to_variable = { treasury = 70 }
						add_to_variable = { debt = 70 }
					}
					ingame_calculate_size_modifier = yes
					update_military_rate = yes
					calculate_interest_rate = yes
					calculate_debt_rate = yes
				}
		}
	}
}