# usage:
## set_temp_variable = { monument_id = 1 }
## start_monument_construction = yes
start_monument_construction = {
	custom_effect_tooltip = START_MONUMENT_CONSTRUCTION_TT
	hidden_effect = {
		set_variable = { monument_construction_id = monument_id }
		set_variable = { monument_construction_country = ROOT.id }
		if = {
			limit = {
				calculate_monument_construction_cost = yes
			}
			multiply_temp_variable = { monument_construction_cost_temp = -1 }
			ROOT = {
				add_political_power = monument_construction_cost_temp
			}
		}
		if = {
			limit = {
				calculate_monument_construction_time = yes
			}
			set_variable = { monument_construction_time = monument_construction_time_temp }
		}
		ROOT = {
			if = {
				limit = {
					NOT = { has_variable = monument_construction_state_1 }
				}
				set_variable = { monument_construction_state_1 = PREV.id }
				activate_mission = monument_construction_mission_1
			}
			else_if = {
				limit = {
					NOT = { has_variable = monument_construction_state_2 }
				}
				set_variable = { monument_construction_state_2 = PREV.id }
				activate_mission = monument_construction_mission_2
			}
			else_if = {
				limit = {
					NOT = { has_variable = monument_construction_state_3 }
				}
				set_variable = { monument_construction_state_3 = PREV.id }
				activate_mission = monument_construction_mission_3
			}
			else_if = {
				limit = {
					NOT = { has_variable = monument_construction_state_4 }
				}
				set_variable = { monument_construction_state_4 = PREV.id }
				activate_mission = monument_construction_mission_4
			}
			else_if = {
				limit = {
					NOT = { has_variable = monument_construction_state_5 }
				}
				set_variable = { monument_construction_state_5 = PREV.id }
				activate_mission = monument_construction_mission_5
			}
		}
	}
}

# usage:
## set_temp_variable = { show_popup = 1 } # optional
## cancel_monument_construction = yes
cancel_monument_construction = {
	custom_effect_tooltip = CANCEL_MONUMENT_CONSTRUCTION_TT
	hidden_effect = {
		var:monument_construction_country = {
			if = {
				limit = {
					is_ai = no
					check_variable = { show_popup > 0 }
					NOT = { is_in_array = { monument_alert_popup_canceled_array = PREV.monument_construction_id } }
				}
				add_to_array = { monument_alert_popup_canceled_array = PREV.monument_construction_id }
				update_monument_alert_popup_window = yes
				scoped_sound_effect = "Resistance_Notifcation_Low_Resource_For_Laws"
			}
		}
		clear_variable = monument_construction_id
		clear_variable = monument_construction_time
		var:monument_construction_country = {
			if = {
				limit = {
					check_variable = { monument_construction_state_1 = PREV.id }
				}
				remove_mission = monument_construction_mission_1
				activate_mission = monument_construction_mission_1
				remove_mission = monument_construction_mission_1
				clear_variable = monument_construction_state_1
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_2 = PREV.id }
				}
				remove_mission = monument_construction_mission_2
				activate_mission = monument_construction_mission_2
				remove_mission = monument_construction_mission_2
				clear_variable = monument_construction_state_2
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_3 = PREV.id }
				}
				remove_mission = monument_construction_mission_3
				activate_mission = monument_construction_mission_3
				remove_mission = monument_construction_mission_3
				clear_variable = monument_construction_state_3
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_4 = PREV.id }
				}
				remove_mission = monument_construction_mission_4
				activate_mission = monument_construction_mission_4
				remove_mission = monument_construction_mission_4
				clear_variable = monument_construction_state_4
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_5 = PREV.id }
				}
				remove_mission = monument_construction_mission_5
				activate_mission = monument_construction_mission_5
				remove_mission = monument_construction_mission_5
				clear_variable = monument_construction_state_5
			}
		}
		clear_variable = monument_construction_country
	}
}

# usage:
## complete_monument_construction = yes
complete_monument_construction = {
	set_temp_variable = { monument_id = monument_construction_id }
	upgrade_monument = yes
	hidden_effect = {
		clear_variable = monument_construction_id
		clear_variable = monument_construction_time
		ROOT = {
			if = {
				limit = {
					check_variable = { monument_construction_state_1 = PREV.id }
				}
				remove_mission = monument_construction_mission_1
				activate_mission = monument_construction_mission_1
				remove_mission = monument_construction_mission_1
				clear_variable = monument_construction_state_1
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_2 = PREV.id }
				}
				remove_mission = monument_construction_mission_2
				activate_mission = monument_construction_mission_2
				remove_mission = monument_construction_mission_2
				clear_variable = monument_construction_state_2
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_3 = PREV.id }
				}
				remove_mission = monument_construction_mission_3
				activate_mission = monument_construction_mission_3
				remove_mission = monument_construction_mission_3
				clear_variable = monument_construction_state_3
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_4 = PREV.id }
				}
				remove_mission = monument_construction_mission_4
				activate_mission = monument_construction_mission_4
				remove_mission = monument_construction_mission_4
				clear_variable = monument_construction_state_4
			}
			else_if = {
				limit = {
					check_variable = { monument_construction_state_5 = PREV.id }
				}
				remove_mission = monument_construction_mission_5
				activate_mission = monument_construction_mission_5
				remove_mission = monument_construction_mission_5
				clear_variable = monument_construction_state_5
			}
		}
		clear_variable = monument_construction_country
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## upgrade_monument = yes
upgrade_monument = {
	if = {
		limit = {
			meta_trigger = {
				text = {
					set_temp_variable = { level = monument_[ID]_level }
				}
				ID = "[?monument_id]"
			}
		}
		add_to_temp_variable = { level = 1 }
	}
	set_temp_variable = { level_temp = level }
	if = {
		limit = {
			check_variable = { level > 0 }
		}
		if = {
			limit = {
				check_variable = { level = 1 }
			}
			monument_on_build_effect = yes
		}
		else = {
			monument_on_upgrade_effect = yes
		}
	}
	set_temp_variable = { level = level_temp }
	set_monument_level = yes
	hidden_effect = {
		ROOT = {
			if = {
				limit = {
					is_ai = no
					NOT = { is_in_array = { monument_alert_popup_built_array = monument_id } }
				}
				add_to_array = { monument_alert_popup_built_array = monument_id }
				update_monument_alert_popup_window = yes
				scoped_sound_effect = "complete_focus"
			}
			if = {
				limit = {
					has_global_flag = monuments_debug
				}
				log = "[GetDateText]: [This.GetMonumentNameOtherContext] ([?monument_id]) was upgraded by [Root.GetName]."
			}
		}
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## downgrade_monument = yes
downgrade_monument = {
	if = {
		limit = {
			meta_trigger = {
				text = {
					set_temp_variable = { level = monument_[ID]_level }
				}
				ID = "[?monument_id]"
			}
		}
		set_temp_variable = { current_level_temp = level }
		subtract_from_temp_variable = { level = 1 }
	}
	set_monument_level = yes
	hidden_effect = {
		if = {
			limit = {
				set_scope_for_monument_bonus_receiver = yes
			}
			var:bonus_target = {
				if = {
					limit = {
						is_ai = no
						check_variable = { current_level_temp > 0 }
						NOT = { is_in_array = { monument_alert_popup_downgrade_array = monument_id } }
					}
					add_to_array = { monument_alert_popup_downgrade_array = monument_id }
					update_monument_alert_popup_window = yes
					scoped_sound_effect = "Resistance_Notifcation_Low_Resource_For_Laws"
				}
			}
		}
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## set_temp_variable = { level = 1 }
## set_monument_level = yes
set_monument_level = {
	clamp_temp_variable = {
		var = level
		min = 0
		max = 3
	}
	custom_effect_tooltip = SET_MONUMENT_LEVEL_TT
	meta_effect = {
		text = {
			set_variable = { monument_[ID]_level = level }
		}
		ID = "[?monument_id]"
	}
	set_monument_effects = yes
}

# usage:
## set_temp_variable = { monument_id = 1 }
## set_monument_effects = yes
set_monument_effects = {
	hidden_effect = {
		meta_effect = {
			text = {
				set_temp_variable = { current_level = monument_[ID]_level }
				if = {
					limit = {
						check_variable = { current_level > 0 }
						NOT = { has_state_flag = monument_[ID]_existed }
					}
					set_state_flag = monument_[ID]_existed
				}
			}
			ID = "[?monument_id]"
		}
		set_temp_variable = { monument_state_temp = THIS.id }
		set_temp_variable = { monument_id_temp = monument_id }
		if = {
			limit = {
				set_scope_for_monument_bonus_receiver = yes
			}
			var:bonus_target = {
				country_event = { id = monuments_events.1000 } # remove ideas and dynamic modifiers
			}
		}
		set_temp_variable = { monument_id = monument_id_temp }
		if = {
			limit = {
				can_use_monument_bonuses = yes
				set_scope_for_monument_bonus_receiver = yes
			}
			meta_effect = {
				text = {
					add_dynamic_modifier = { modifier = monument_[ID]_level_[LEVEL]_modifier }
					var:bonus_target = {
						add_ideas = monument_[ID]_level_[LEVEL]_idea
					}
				}
				ID = "[?monument_id]"
				LEVEL = "[?current_level]"
			}
		}
		every_country = {
			limit = {
				is_ai = no
				has_variable = show_global_monuments_list_window
			}
			set_global_monuments_window_states = yes
		}
		update_monument_mapmode = yes
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## remove_monument_effects = yes
remove_monument_effects = {
	if = {
		limit = {
			NOT = { check_variable = { monument_id = 0 } }
		}
		meta_effect = {
			text = {
				if = {
					limit = {
						set_scope_for_monument_bonus_receiver = yes
						OR = {
							NOT = { can_use_monument_bonuses = yes }
							AND = {
								has_dynamic_modifier = { modifier = monument_[ID]_level_0_modifier }
								set_temp_variable = { level = 1 }
								has_at_least_monument_level = yes
							}
							AND = {
								has_dynamic_modifier = { modifier = monument_[ID]_level_1_modifier }
								OR = {
									AND = {
										set_temp_variable = { level = 2 }
										has_at_least_monument_level = yes
									}
									AND = {
										set_temp_variable = { level = 1 }
										has_less_monument_level = yes
									}
								}
							}
							AND = {
								has_dynamic_modifier = { modifier = monument_[ID]_level_2_modifier }
								OR = {
									AND = {
										set_temp_variable = { level = 3 }
										has_at_least_monument_level = yes
									}
									AND = {
										set_temp_variable = { level = 2 }
										has_less_monument_level = yes
									}
								}
							}
							AND = {
								has_dynamic_modifier = { modifier = monument_[ID]_level_3_modifier }
								set_temp_variable = { level = 3 }
								has_less_monument_level = yes
							}
							var:bonus_target = {
								any_other_country = {
									OR = {
										has_idea = monument_[ID]_level_0_idea
										has_idea = monument_[ID]_level_1_idea
										has_idea = monument_[ID]_level_2_idea
										has_idea = monument_[ID]_level_3_idea
									}
								}
							}
						}
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_0_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_0_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_1_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_1_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_2_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_2_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_3_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_3_modifier }
					}
					every_country = {
						limit = {
							OR = {
								has_idea = monument_[ID]_level_0_idea
								has_idea = monument_[ID]_level_1_idea
								has_idea = monument_[ID]_level_2_idea
								has_idea = monument_[ID]_level_3_idea
							}
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_0_idea
							}
							remove_ideas = monument_[ID]_level_0_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_1_idea
							}
							remove_ideas = monument_[ID]_level_1_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_2_idea
							}
							remove_ideas = monument_[ID]_level_2_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_3_idea
							}
							remove_ideas = monument_[ID]_level_3_idea
						}
					}
				}
				var:bonus_target = {
					every_other_country = {
						limit = {
							OR = {
								has_idea = monument_[ID]_level_0_idea
								has_idea = monument_[ID]_level_1_idea
								has_idea = monument_[ID]_level_2_idea
								has_idea = monument_[ID]_level_3_idea
							}
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_0_idea
							}
							remove_ideas = monument_[ID]_level_0_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_1_idea
							}
							remove_ideas = monument_[ID]_level_1_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_2_idea
							}
							remove_ideas = monument_[ID]_level_2_idea
						}
						if = {
							limit = {
								has_idea = monument_[ID]_level_3_idea
							}
							remove_ideas = monument_[ID]_level_3_idea
						}
					}
				}
			}
			ID = "[?monument_id]"
		}
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## set_temp_variable = { level = 1 }
## add_monument_to_state = yes
add_monument_to_state = {
	if = {
		limit = {
			has_not_monument = yes
			NOT = {
				any_state = {
					has_monument = yes
				}
			}
		}
		custom_effect_tooltip = ADD_MONUMENT_TO_STATE_TT
		if = {
			limit = {
				check_variable = { level = 0 }
			}
			custom_effect_tooltip = ADD_MONUMENT_TO_STATE_TT_LVL_0
		}
		else_if = {
			limit = {
				check_variable = { level = 1 }
			}
			custom_effect_tooltip = ADD_MONUMENT_TO_STATE_TT_LVL_1
		}
		else_if = {
			limit = {
				check_variable = { level = 2 }
			}
			custom_effect_tooltip = ADD_MONUMENT_TO_STATE_TT_LVL_2
		}
		else_if = {
			limit = {
				check_variable = { level = 3 }
			}
			custom_effect_tooltip = ADD_MONUMENT_TO_STATE_TT_LVL_3
		}
		hidden_effect = {
			add_to_array = { state_monuments_array = monument_id }
			set_monument_level = yes
		}
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## remove_monument_from_state = yes
remove_monument_from_state = {
	if = {
		limit = {
			has_monument = yes
		}
		custom_effect_tooltip = REMOVE_MONUMENT_FROM_STATE_TT
		hidden_effect = {
			meta_effect = {
				text = {
					clr_state_flag = monument_[ID]_existed
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_0_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_0_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_1_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_1_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_2_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_2_modifier }
					}
					if = {
						limit = {
							has_dynamic_modifier = { modifier = monument_[ID]_level_3_modifier }
						}
						remove_dynamic_modifier = { modifier = monument_[ID]_level_3_modifier }
					}
					every_country = {
						limit = {
							OR = {
								has_idea = monument_[ID]_level_0_idea
								has_idea = monument_[ID]_level_1_idea
								has_idea = monument_[ID]_level_2_idea
								has_idea = monument_[ID]_level_3_idea
							}
						}
						remove_ideas = {
							monument_[ID]_level_0_idea
							monument_[ID]_level_1_idea
							monument_[ID]_level_2_idea
							monument_[ID]_level_3_idea
						}
					}
				}
				ID = "[?monument_id]"
			}
			remove_from_array = { state_monuments_array = monument_id }
			every_country = {
				limit = {
					is_ai = no
					has_variable = show_global_monuments_list_window
				}
				set_global_monuments_window_states = yes
			}
			update_monument_mapmode = yes
		}
	}
}

# usage:
## open_global_monuments_window = yes
open_global_monuments_window = {
	set_variable = { show_global_monuments_list_window = 1 }
	set_variable = { global_monuments_country = ROOT.id }
	set_global_monuments_window_states = yes
}

# usage:
## set_global_monuments_window_states = yes
set_global_monuments_window_states = {
	set_variable = { total_num_of_shown_monuments = 0 }
	clear_array = global_monuments_states_array
	clear_array = global_monuments_states_monuments_array
	every_state = {
		limit = {
			state_has_any_monument = yes
			OR = {
				PREV = {
					NOT = { has_country_flag = show_only_owned_monuments }
				}
				is_owned_by = var:PREV.global_monuments_country
			}
			OR = {
				PREV = {
					NOT = { has_country_flag = show_only_controlled_monuments }
				}
				is_controlled_by = var:PREV.global_monuments_country
			}
			OR = {
				PREV = {
					NOT = { has_country_flag = show_only_monuments_under_construction }
				}
				has_monument_construction = yes
			}
			OR = {
				PREV = {
					NOT = { has_country_flag = show_only_possible_monuments_constructions }
				}
				any_of = {
					array = state_monuments_array
					set_temp_variable = { monument_id = v }
					OR = {
						AND = {
							monument_build_potential_trigger = yes
							monument_build_trigger = yes
						}
						AND = {
							monument_upgrade_potential_trigger = yes
							monument_upgrade_trigger = yes
						}
					}
				}
			}
			OR = {
				AND = {
					PREV = {
						NOT = { has_country_flag = global_monument_status_selection_hide_active }
					}
					any_of = {
						array = state_monuments_array
						set_temp_variable = { monument_id = v }
						are_monument_bonuses_active = yes
					}
				}
				AND = {
					PREV = {
						NOT = { has_country_flag = global_monument_status_selection_hide_inactive }
					}
					any_of = {
						array = state_monuments_array
						set_temp_variable = { monument_id = v }
						NOT = { are_monument_bonuses_active = yes }
					}
				}
			}
			OR = {
				AND = {
					PREV = {
						NOT = { has_country_flag = global_monument_type_selection_hide_nature }
					}
					any_of = {
						array = state_monuments_array
						set_temp_variable = { monument_id = v }
						NOT = { monument_can_downgrade = yes }
					}
				}
				AND = {
					PREV = {
						NOT = { has_country_flag = global_monument_type_selection_hide_architecture }
					}
					any_of = {
						array = state_monuments_array
						set_temp_variable = { monument_id = v }
						monument_can_downgrade = yes
					}
				}
			}
			OR = {
				NOT = { state_is_on_continent_europe = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_europe }
				}
			}
			OR = {
				NOT = { state_is_on_continent_north_america = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_north_america }
				}
			}
			OR = {
				NOT = { state_is_on_continent_south_america = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_south_america }
				}
			}
			OR = {
				NOT = { state_is_on_continent_australia = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_australia }
				}
			}
			OR = {
				NOT = { state_is_on_continent_africa = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_africa }
				}
			}
			OR = {
				NOT = { state_is_on_continent_asia = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_asia }
				}
			}
			OR = {
				NOT = { state_is_on_continent_middle_east = yes }
				PREV = {
					NOT = { has_country_flag = global_monument_continent_selection_hide_middle_east }
				}
			}
			OR = {
				PREV = {
					NOT = { has_country_flag = global_monument_level_selection_hide_0 }
					NOT = { has_country_flag = global_monument_level_selection_hide_1 }
					NOT = { has_country_flag = global_monument_level_selection_hide_2 }
					NOT = { has_country_flag = global_monument_level_selection_hide_3 }
				}
				any_of = {
					array = state_monuments_array
					set_temp_variable = { monument_id = v }
					OR = {
						AND = {
							PREV = {
								NOT = { has_country_flag = global_monument_level_selection_hide_0 }
							}
							set_temp_variable = { level = 0 }
							has_at_least_monument_level = yes
							set_temp_variable = { level = 1 }
							has_less_monument_level = yes
						}
						AND = {
							PREV = {
								NOT = { has_country_flag = global_monument_level_selection_hide_1 }
							}
							set_temp_variable = { level = 1 }
							has_at_least_monument_level = yes
							set_temp_variable = { level = 2 }
							has_less_monument_level = yes
						}
						AND = {
							PREV = {
								NOT = { has_country_flag = global_monument_level_selection_hide_2 }
							}
							set_temp_variable = { level = 2 }
							has_at_least_monument_level = yes
							set_temp_variable = { level = 3 }
							has_less_monument_level = yes
						}
						AND = {
							PREV = {
								NOT = { has_country_flag = global_monument_level_selection_hide_3 }
							}
							set_temp_variable = { level = 3 }
							has_at_least_monument_level = yes
						}
					}
				}
			}
		}
		set_temp_variable = { state_monuments_array_length_temp = 0 }
		for_each_loop = {
			array = state_monuments_array
			set_temp_variable = { monument_id = v }
			if = {
				limit = {
					is_monument_valid_for_global_list = yes
				}
				add_to_temp_variable = { state_monuments_array_length_temp = 1 }
			}
		}
		PREV = {
			add_to_array = { global_monuments_states_array = PREV.id }
			add_to_array = { global_monuments_states_monuments_array = state_monuments_array_length_temp }
			add_to_variable = { total_num_of_shown_monuments = state_monuments_array_length_temp }
		}
	}
	# Update GUI:
	update_global_monuments_gui = yes
}

# usage:
## update_global_monuments_gui = yes
update_global_monuments_gui = {
	if = {
		limit = {
			has_variable = show_global_monuments_list_window
		}
		if = {
			limit = {
				check_variable = { show_global_monuments_list_window > 1000 }
			}
			set_variable = { show_global_monuments_list_window = 1 }
		}
		else = {
			add_to_variable = { show_global_monuments_list_window = 1 }
		}
	}
}

# usage:
## set_temp_variable = { keep_filters = 1 } # optional
## clear_global_monuments_window_variables = yes
clear_global_monuments_window_variables = {
	if = {
		limit = {
			NOT = { check_variable = { keep_filters = 1 } }
		}
		clr_country_flag = show_only_owned_monuments
		clr_country_flag = show_only_controlled_monuments
		clr_country_flag = show_only_monuments_under_construction
		clr_country_flag = show_only_possible_monuments_constructions
		clr_country_flag = global_monument_type_selection_hide_architecture
		clr_country_flag = global_monument_type_selection_hide_nature
		clr_country_flag = global_monument_status_selection_hide_active
		clr_country_flag = global_monument_status_selection_hide_inactive
		clr_country_flag = global_monument_level_selection_hide_0
		clr_country_flag = global_monument_level_selection_hide_1
		clr_country_flag = global_monument_level_selection_hide_2
		clr_country_flag = global_monument_level_selection_hide_3
		clear_global_monuments_window_continent_filters = yes
	}
	clear_array = global_monuments_states_array
	clear_array = global_monuments_states_monuments_array
	clear_variable = total_num_of_shown_monuments
	clear_variable = global_monuments_country
	clear_variable = show_global_monuments_list_window
	clear_variable = show_global_monuments_filter_selection_window
	clear_variable = show_global_monuments_list_help_window
}

# usage:
## clear_global_monuments_window_continent_filters = yes
clear_global_monuments_window_continent_filters = {
	clr_country_flag = global_monument_continent_selection_hide_europe
	clr_country_flag = global_monument_continent_selection_hide_north_america
	clr_country_flag = global_monument_continent_selection_hide_south_america
	clr_country_flag = global_monument_continent_selection_hide_australia
	clr_country_flag = global_monument_continent_selection_hide_africa
	clr_country_flag = global_monument_continent_selection_hide_asia
	clr_country_flag = global_monument_continent_selection_hide_middle_east
}

# usage:
## set_temp_variable = { monument_id = 1 }
## activate_monument_effect = yes
activate_monument_effect = {
	ROOT = {
		add_political_power = -30
	}
	meta_effect = {
		text = {
			clr_state_flag = deactivated_monument_[ID]_@ROOT
			set_state_flag = { flag = activated_monument_[ID]_@ROOT days = 30 value = 1 }
		}
		ID = "[?monument_id]"
	}
	set_monument_effects = yes
}

# usage:
## set_temp_variable = { monument_id = 1 }
## deactivate_monument_effect = yes
deactivate_monument_effect = {
	ROOT = {
		add_political_power = -25
	}
	meta_effect = {
		text = {
			set_state_flag = deactivated_monument_[ID]_@ROOT
		}
		ID = "[?monument_id]"
	}
	set_monument_effects = yes
}

# usage:
## set_temp_variable = { monument_id = 1 }
## monument_on_build_effect = yes
monument_on_build_effect = {
	if = {
		limit = {
			set_scope_for_monument_bonus_receiver = yes
		}
		if = {
			limit = {
				check_variable = { monument_id = 28 }
			}
			if = {
				limit = {
					NOT = { has_dlc = "Waking the Tiger" }
				}
				custom_effect_tooltip = MONUMENT_ON_BUILD_EFFECT_TT
				set_province_name = { id = 6521 name = "Germania" }
				set_state_flag = monument_on_build_effect_28
			}
		}

		# Sub Mod Support
		else = {
			monument_on_build_effect_back_up = yes
		}
	}
}

# usage:
## set_temp_variable = { monument_id = 1 }
## set_temp_variable = { level = 1 }
## monument_on_upgrade_effect = yes
monument_on_upgrade_effect = {
	if = {
		limit = {
			set_scope_for_monument_bonus_receiver = yes
		}
		if = {
			limit = {
				check_variable = { monument_id = 28 }
			}
			if = {
				limit = {
					NOT = { has_dlc = "Waking the Tiger" }
					NOT = { has_state_flag = monument_on_build_effect_28 }
				}
				custom_effect_tooltip = MONUMENT_ON_UPGRADE_EFFECT_TT
				set_province_name = { id = 6521 name = "Germania" }
				set_state_flag = monument_on_build_effect_28
			}
		}

		# Sub Mod Support
		else = {
			monument_on_upgrade_effect_back_up = yes
		}
	}
}

# usage:
## update_monument_alert_popup_window = yes
update_monument_alert_popup_window = {
	if = {
		limit = {
			is_ai = no
			OR = {
				check_variable = { monument_alert_popup_built_array^num > 0 }
				check_variable = { monument_alert_popup_canceled_array^num > 0 }
				check_variable = { monument_alert_popup_downgrade_array^num > 0 }
			}
		}
		if = {
			limit = {
				OR = {
					NOT = { has_variable = show_monument_alert_popup_window }
					check_variable = { show_monument_alert_popup_window > 1000 }
				}
			}
			set_variable = { show_monument_alert_popup_window = 1 }
		}
		else = {
			add_to_variable = { show_monument_alert_popup_window = 1 }
		}
	}
	else = {
		clear_variable = show_monument_alert_popup_window
	}
}