# Dear Irony please fallback to simple parser

# Toggled code script
# Includes a generic code block if the toggle value is NOT zero

inline_script = {
	script = merger_of_rules/parts/switch
	file = merger_of_rules/parts/toggled_code_case_

	# This is equal to ceil( x^2 / (x^2+1) ), which returns 0 for a 0 input and 1 for anything else
	# Used to choose between toggled_code_case_0 (empty) and
	# toggled_code_case_1 (returns the passed code) to omit the entire block if count is 0
	value = @[ (-1 * ((-1 * (($toggle$*$toggle$) / (($toggle$*$toggle$)+1))) - ((((-1 * (($toggle$*$toggle$) / (($toggle$*$toggle$)+1))) % 1) + 1) % 1))) ]

	params = "code = \"$code$\"" # This is fine don't worry about it :)
}

# Example use:

# inline_script = {
#   script = merger_of_rules/toggled_code
#   code = "
#	   # Code here will only be included if the toggle value below is != 0
#   "
#   toggle = @some_mod_presence_scripted_variable
# }

# To AND two values:
# toggle = @[ variable_1 * variable_2 ]
# To OR two values, assuming they're 0/1, negatives would potentially break this, but we recommend a 1 for flag variables:
# toggle = @[ variable_1 + variable_2 ]
