# Example of a scripted action, to be enabled by a ship component via the scripted_action field
#
# scripted_action_1 = {
#	user_scope = fleet/megastructure	# defines the type of the action user (therefore the scope of the button_visible/clickable triggers,
#										# as well as the from scope of the performed action or on_cancel action)
#                                       # MUST BE the first param
# 	scope = galactic_object/planet/fleet/self	# defines the target of the action (therefore the scope of the possible and finished triggers,
#											    # as well as the scope of the performed action or on_cancel action)
#                                               # MUST be the second param
# 	# the resulting scopes and behaviors are:
# 	# For scope = fleet:
# 	#	scope: target fleet (can be the triggering user if scope = self)
# 	#	from: triggering user
# 	#	starts immediately if scope = self, else when in range specified by fleet_action_range (otherwise moves beforehand)
# 	# For scope = planet:
# 	#	scope: target planet
# 	#	from: triggering user
# 	#	starts when in orbit of target planet (otherwise moves beforehand)
# 	# For scope = galactic_object:
# 	#	scope: target system
# 	#	from: triggering user
# 	#	starts when in orbit of target system's primary star (otherwise moves beforehand)
# 	possible = {}	# trigger. evaluates if action is possible
# 				  	# if not specified, action is always considered possible
# 	finished = {}	# trigger. evaluates if action is finished
# 				  	# if not specified, action is always considered finished as soon as it is started
# 	hide_from_context_menu = {} 	# trigger. evaluates if action should be shown in the right-click context menu orders
# 	 	 	 	 	 	 	 	 	# if not specified, action will always be shown if button is visible
# 	button_clickable = {}	# trigger. scope: triggering fleet. evaluates if scripted action button is clickable
# 	button_visible = {}		# trigger. scope: triggering fleet. evaluates if scripted action button is visible
#							# (also used for context menu options if hide_from_context_menu is not used)
#
# 	on_completed = on_completed_action_name             # name of the on_action to perform when scripted action completes its progress
#   on_queued = on_queued_action_name                   # name of the on_action to perform when scripted action is queued
#                                                       # not supported by megastructure users
#   on_started = on_started_action_name                 # name of the on_action to perform when scripted action starts
#                                                       # this action will take place even if the user still needs to travel to the target
#   on_progress_start = on_progress_start_action_name   # name of the on_action to perform when scripted action starts its progress
#                                                       # not supported by megastructure users
# 	on_cancelled = on_cancelled_action_name             # name of the on_action to perform when scripted action is cancelled
#
#	automation = {					# optional. groups all of this action's automation settings.
#		priority = 1				# if set, the action shows up in the automation order settings (lower = higher priority)
#									# only affects UI ordering; actual target selection uses ai weights.
#									# RESERVED SLOT: the built-in Special Projects toggle is inserted at a fixed priority
#									# set by the SPECIAL_PROJECTS_AUTOMATION_PRIORITY define in unchecked_defines/00_interface.txt.
#									# It appears after the last action with priority <= that value.
#		default_on = no				# whether the automation checkbox is checked by default. default = no
#		tooltip = AUTOMATION_SURVEY_TT	# optional. tooltip shown on this action's row in the automation menu
#		parent = arkship_explore	# optional. nests this action's row indented under the named action in the menu.
#									# the child greys out and is skipped from the automation order unless the parent
#									# action is checked (e.g. arkship_survey nests under arkship_explore).
#									# a parented action must NOT declare its own options{}; if it does, the parent is
#									# ignored and it renders as a normal top-level row instead.
#		also_automate = { logistic_drop_off_stockpile }	# when this action's automation is enabled, the listed actions are also
#									# included in the automation order even if they are not checked separately.
#									# useful for support actions (e.g. drop-off) that multiple automations depend on.
#		options = {					# optional. player-toggleable sub-settings shown indented under the action in the menu (the menu list scrolls).
#			option = {				# author each option's effect in this action's ai.weight / possible{} via the
#				automation_setting = waystation_systems	# fleet-scoped trigger: FROM = { has_automation_setting = <automation_setting> }
#				default = no					# player checkbox default
#				name = AUTOMATION_OPT_WAYSTATION_SYSTEMS		# label shown in the menu
#				tooltip = AUTOMATION_OPT_WAYSTATION_SYSTEMS_TT	# optional. tooltip shown on the option row
#				ai_weight = { base = 1 }		# evaluated in fleet scope (This = acting fleet); the AI enables the setting iff > 0
#			}
#		}
#	}
#	# The automation menu is a scrolling list, so any number of actions and options can be declared.
#	# Option settings are scoped per action. The same automation_setting may be declared by several actions
#	# (for example via a shared inline_script), but each action is evaluated against only its own checked
#	# options, so enabling a setting on one action does not affect another. Players configure, and the AI
#	# weights, each action's options independently.
#	# has_automation_setting is only meaningful during automated target selection (an action's ai.weight or
#	# possible block). The active-setting set is transient and empty everywhere else, so the trigger returns
#	# false in events and other contexts. It cannot be used to query how a fleet's automation is configured.
#
#   # Note: the automation button icon can be customized per ship size via the automation_icon field
#   # in the ship_sizes definition. If set, the automation button will use the specified GFX sprite
#   # and its _selected variant (e.g. GFX_my_icon and GFX_my_icon_selected).
#   # If not set, defaults to GFX_fleet_order_automate / GFX_fleet_order_automate_selected.
#   # Example (in ship_sizes):
#   #   automation_icon = GFX_fleet_order_auto_construct
#
# 	context_menu_name = menu_loc_key	# loc key for option label in drop down menu
# 	tooltip = tooltip_loc_key			# button tooltip
# 	icon = "GFX_icon_1"					# button icon
# 	on_click_sound = "sound_clip_1"				# sound clip to play when the button is clicked (or the target, if required)
# 	on_execution_sound = "sound_clip_2"			# sound clip to play when the on_action specified by field "name" is executed
# 	activity_key = activity_loc_key				# loc key for the activity string to show on fleet UI. "NAME" loc parameter gives target localized name
# 	progress_activity_key = progress_loc_key	# loc key for the progress string to show on fleet UI. "PROGRESS" loc parameter gives current progress percentage
# 	required_progress = 2.0		# required progress (number of ticks) to start performing scripted action. default = 0.0
# 					  			# progress starts counting at 1.0, so the minimum value for required_progress to make the action not instant is 2.0
#								# accepts variable values, with scope this : target object and from : user object
#	required_progress_key		# Optional: Loc key for the required progress.
# 	cooldown = 10				# number of days of cooldown before the action can be triggered again. default = 0
#								# accepts variable values, with scope this : target object and from : user object
# 	cost = { energy = 5000 }	# resources needed to enable the action. will be deducted from controller country on action finish. default = no cost
#								# accepts triggered costs, with scope this : target object and from : user object
# 	fleet_action_range = 10.0	# only used when scope = fleet. max range from the target fleet tolerated to perform the action
# 					  			# if too far, the fleet will chase the target fleet until it's inside the desired range
# 					   			# default = 1.0
# 	wait = no					# If yes, waits for the ships in the fleet to be still before starting the scripted action
# 								# default = yes
# 								# For AI: always no
# 	ai = {					# Info concerning AI using this particular scripted order
#		weight = {
#			base = 0
#			modifier = {
#				weight = 1
#				is_planet_class = pc_frozen
#			}
#		}
#		# if weight is 0 or lower AI will not perform the action, otherwise AI will prioritize actions with higher weight
#		# Weight modifier triggers support these scopes
#		# This - Target - Target Type depends on the action.
#		# From - Acting user (fleet or megastructure).
#
#		ai_minister = interior	# none/interior/military, default none.
#								# Determines whether it is the interior or military ai minister that is responsible for this action.
#								# Affects order prioritization during and outside of war.
#								# if set to none - AI ignores it.
# 		war = yes				# Only checked by military minister. If yes, AI will be able to use during war. default = yes.
# 		enemy = yes				# Only checked by military minister. Only applicable when scope = fleet. If yes, the targeted fleet will be pulled from hostile fleets (see below)
# 								# default: yes
#		max_jumps = 10			# Checked by interior minister and player automation for scope = planet/galactic_object.
#								# Limits how far (in hyperlane jumps) the AI/automation will search for targets from the fleet's current system.
#								# Note: the interior minister always evaluates systems containing active points of interest regardless of max_jumps.
#								# Player automation does not consider points of interest automatically and applies max_jumps to all systems.
#								# default: -1 (unlimited - checks every system in the galaxy, which can be expensive!)
#		target_owned_starbases = yes	# If yes, only considers systems where the fleet's controller has a starbase.
#								# Replaces max_jumps filtering - no jump-distance computation needed.
#								# default: no
#		good_enough_weight = 5	# Checked by interior minister and player automation for scope = planet/galactic_object.
#								# If a target's weight reaches this threshold, the AI stops searching and picks it immediately.
#								# When set, targets are evaluated from closest to farthest (by hyperlane jumps from the fleet),
#								# so the AI naturally prefers nearby targets that meet the threshold.
#								# Useful for avoiding unnecessary iteration when a sufficiently good target has already been found.
#								# default: -1 (disabled - always evaluates all candidates within max_jumps range)
# 		# Depending on the scripted action scope, the target candidates will be:
# 		# scope = self # triggering fleet as usual
# 		# scope = planet # planets in the fleet's current system when AI is deciding on the fleet's next mission
# 		# scope = fleet AND enemy = yes # hostile fleets
# 		# scope = fleet AND enemy = no # fleets own by the AI country
# 		# In order for AI to decide on using a scripted action, all regular conditions apply: possible trigger, cost, cooldown
# 		# Military AI minister will prioritize using scripted actions over regular orders when possible
# 		# Interior AI minister will deprioritize uing scripted actions and only consider them when other actions are not available.
# 	}
#	context_menu_ordering = distance/weight	# Only used for scope = planet. Controls the order targets are queued when the
#									# action is issued on a whole solar system from the right-click context menu
#									# (which targets every valid planet in the system).
#									# distance (default): nearest-neighbor travel order, minimizing fleet movement.
#									#                     every valid planet (per the possible trigger) is queued.
#									# weight: descending ai = { weight = { ... } } evaluated per planet, ties broken by
#									# proximity to the fleet. Lets the same priorities the AI uses drive the manual order.
#									# Note: like the AI, this only queues planets whose weight evaluates above 0.
#									# A valid planet whose weight is 0 or lower is skipped entirely, not just ordered last.
# 	shortcut = "R"				# Keyboard shortcut for the scripted action button
# 								# Usual combinations like "CTRL+R" are also accepted
# 					  			# if the same shortcut is used for more than one simultaneously possible action on the same fleet,
# 					  			# the shortcut will only work for one of them
# 					  			# Same if the same shortcut is already used for any other already present button
# 	slot = 1					# For hero ships (determined by ship size) UI
# 					  			# If 0, the scripted action button will be located on the regular permanent orders bar
# 					  			# If > 0, the scripted action button will be located on the custom orders bar, sorted by slot number
# 					  			# Default: 0
# 	begin_anim_state = "working"	# Trigger specific NON-LOOPING animation state on the user performing the order at the moment the order is started
# 					  				# This overrides regular animation states
# 					  				# Atm this is only used for megastructure users
# 	progress_anim_state = "moving"	# Trigger specific animation state on the user performing the order while the order is in progress
# 					  				# This overrides own weapon projectile induced animations, as well as regular animation states
# 									# This is ignored if scope=self because the order is instant in that case (no progress)
# 	finish_anim_state = "rage"		# Trigger specific NON-LOOPING animation state on the user performing the order at the moment the order is finished/executed
# 					  				# This overrides own weapon projectile induced animations, as well as regular animation states
#                                   # NOTE: Using too many scritpted actions with custom animations may cause performance issues.
#
#	specific_behavior = <behavior>	# Adds a special handling to that action, using code support
#									# If any effect of the on_action raised by on_completed = on_action_name somehow deletes the fleet order,
#									# any execution effect of the specific behavior may be lost
#									# Handled behaviors:
#										# scripted_catapult_order
#											# user_scope = fleet, scope = galactic_object
#											# This changes the behavior of the action to act like a quantum catapult
#											# This requires the on_ship_<action_key> and on_fleet_<action_key> on_actions
#											# The usual on_action raised by on_completed = on_action_name will happen but the target will be the original one,
#											# not the actual destination after spread
#										# scripted_survey_order
#											# user_scope = fleet, scope = planet
#											# This is an override of the survey order to allow more custom handling of the button's visibility and clickability
#											# Only the button is custom, then the rest of the behavior is the normal survey one
# 											# ie no custom on_action will be raised
#										# scripted_build_megastructure_order
#											# user_scope = fleet, scope = self
#											# This is an override of the build megastructure order to allow more custom handling of the button's visibility and clickability
#											# Only the button is custom, then the rest of the behavior is the normal build one
# 											# ie no custom on_action will be raised
# 											# Note: the button is always clickable even if the country has no known megastructures.
# 												# This could be improved with a new trigger to check that, but atm it doesn't exist
#	category = harvest_resources	# Arbitrary identifier grouping actions for category_limit purposes.
#									# If omitted, the action has no category and is never counted against any limit.
#	category_limit = 1				# Maximum number of concurrent actions of the same category that one country's
#									# fleets may perform on the same target simultaneously. Default: uncapped (omit field).
#									# Only counts fleets belonging to the same country — cross-country actions are unaffected.
#									# Both active (in-progress) and queued orders on other fleets are counted.
#									# Example: category = harvest_resources and category_limit = 1 on all harvest-type
#									# actions ensures at most one such action per target per country at a time.
#	category_limit_fail_text = my_loc_key	# Optional loc key for the category_limit tooltip. Scopes: This = target, From = acting user.
#											# Falls back to SCRIPTED_ACTION_CATEGORY_LIMIT_REACHED if omitted.
#	important = no/yes	#Default no. If yes, UI will prevent accidental cancelation of this action
#	overrides_gained_resources = no/yes #Default no. If yes, then when targeting planets with this action
#								 UI displays the add_resource and add_resource_to_local_stockpile effect results instead of default deposit amounts.
#								 Useful to display the expected resources gained from the scripted action.
#								 When combined with completion_message_type, resource details are appended to the completion message automatically.
#								 Only immediate effect from events are checked. No support for "option" effects, or "after" effects.
#								 Does not support any effects that depend on random values (random_events, random_list).
#	completion_message_type = MESSAGE_TYPE_KEY	# If set, a message is sent to the acting unit's controller when the action
#								 completes (human players only).
#								 The following variables are set automatically:
#									user_scope = fleet:			FLEET			= acting fleet name
#									user_scope = megastructure:	MEGASTRUCTURE	= acting megastructure name
#									scope = planet:				TARGET_PLANET	= target planet name
#									scope = galactic_object:	TARGET_SYSTEM	= target system name
#									scope = fleet (not self):	TARGET_FLEET	= target fleet name
#								 If overrides_gained_resources = yes, gained resource details are also appended to the message.
#								 Note: resource details are only supported for user_scope = fleet with scope = planet. Other combinations
#								 produce the message without resource details.
#	completion_message_localization = LOC_KEY	# Localization key for the completion message body (required if completion_message_type is set).
#	completion_message_days = 60				# How many days the notification message stays visible. Default: NOTIFICATION_MESSAGE_DURATION_STANDARD.
#												# Note: this has no effect when completion_message_type is a toast. Toasts always use MINIMUM_TOAST_DURATION.
#
#   uses_vfx_type = survey_effect/harvest_effect    # If specified, uses the specified vfx while performing the scripted action
# }
