# Comprehensive Sandbox Control - core scripted triggers
#
# Namespaced (csc_) access and capability checks. Adapter capability hooks
# default to "no" so the generic core is fully functional with no adapter
# present. Adapters flip csc_cap_* state via csc_hook_register_capabilities.

# CSC controls are available only to human-controlled countries.
csc_is_human_controlled = {
	NOT = { is_ai = yes }
}

# --- centralized game-rule checks ---
# Feature scripts call these instead of repeating raw has_game_rule blocks.

# Core cheat tools are enabled.
csc_core_enabled = {
	csc_is_human_controlled = yes
	has_game_rule = {
		rule = csc_core_mode
		option = ENABLED
	}
}

# Disruptive sandbox tools are available in any mode that is not Disabled.
csc_disruptive_enabled = {
	csc_is_human_controlled = yes
	NOT = {
		has_game_rule = {
			rule = csc_disruptive_mode
			option = DISABLED
		}
	}
}

# Disruptive tools run in single-player / unrestricted mode.
csc_disruptive_unrestricted = {
	has_game_rule = {
		rule = csc_disruptive_mode
		option = UNRESTRICTED
	}
}

# Disruptive tools run in cooperative consent mode.
csc_disruptive_coop_consent = {
	has_game_rule = {
		rule = csc_disruptive_mode
		option = COOP_CONSENT
	}
}

# True when the acting country has revealed the one-shot cheat decisions.
csc_cheats_visible = {
	has_country_flag = csc_cheats_shown
}

# --- adapter capability hooks (no-op defaults) ---

# True when any supported overhaul is detected. Detection lives in
# csc_adapter_detection.txt and is evaluated live.
csc_hook_any_adapter_active = {
	OR = {
		csc_detect_owb = yes
		csc_detect_md = yes
	}
}

# True when a detected overhaul provides a custom currency CSC can adjust:
# OWB caps or MD money. Both reached via parse-safe in-core paths.
csc_cap_has_custom_currency = {
	OR = {
		csc_detect_owb = yes
		csc_detect_md = yes
	}
}

# True when custom state resources are available. These ship in the per-overhaul
# companion sub-mod (e.g. "CSC - Old World Blues"), which sets this flag when
# loaded; core alone advertises none.
csc_cap_has_custom_resources = {
	has_global_flag = csc_owb_resources_loaded
}
