# Author(s): AngriestBird, TheBrokenDroid, Doolittle @prod_days_per_week = 7 @prod_math_max = 1000000 # Upper clamp on production days: large build orders (5000 units x 440 days) can exceed @prod_math_max @prod_days_math_max = 100000000 # var_*_system_idx is stored in model-index space; the 12-element stat arrays are indexed 0-11. # Convert with set__local_idx / store__local_idx, never by hand. @GNSS_sat_idx_base = 121 @GNSS_sat_idx_top = 132 @COM_sat_idx_base = 141 @COM_sat_idx_top = 152 @SPY_sat_idx_base = 161 @SPY_sat_idx_top = 172 @KILLSAT_sat_idx_base = 181 @KILLSAT_sat_idx_top = 190 @sat_system_tier_top = 11 ################################################# ### effects for gui / buttons / trigger / loc ### ################################################# set_prod_display_arrays = { if = { limit = { has_tech = GNSS1 } add_to_array = { prod_11_display_array = global.prod_11_array^0 } } if = { limit = { has_tech = GNSS2 } add_to_array = { prod_11_display_array = global.prod_11_array^1 } } if = { limit = { has_tech = GNSS3 } add_to_array = { prod_11_display_array = global.prod_11_array^2 } } if = { limit = { has_tech = GNSS4 } add_to_array = { prod_11_display_array = global.prod_11_array^3 } } if = { limit = { has_tech = GNSS5 } add_to_array = { prod_11_display_array = global.prod_11_array^4 } } if = { limit = { has_tech = GNSS6 } add_to_array = { prod_11_display_array = global.prod_11_array^5 } } if = { limit = { has_tech = GNSS7 } add_to_array = { prod_11_display_array = global.prod_11_array^6 } } if = { limit = { has_tech = GNSS8 } add_to_array = { prod_11_display_array = global.prod_11_array^7 } } if = { limit = { has_tech = GNSS9 } add_to_array = { prod_11_display_array = global.prod_11_array^8 } } if = { limit = { has_tech = GNSS10 } add_to_array = { prod_11_display_array = global.prod_11_array^9 } } if = { limit = { has_tech = GNSS11 } add_to_array = { prod_11_display_array = global.prod_11_array^10 } } if = { limit = { has_tech = GNSS12 } add_to_array = { prod_11_display_array = global.prod_11_array^11 } } if = { limit = { has_tech = COMSAT1 } add_to_array = { prod_12_display_array = global.prod_12_array^0 } } if = { limit = { has_tech = COMSAT2 } add_to_array = { prod_12_display_array = global.prod_12_array^1 } } if = { limit = { has_tech = COMSAT3 } add_to_array = { prod_12_display_array = global.prod_12_array^2 } } if = { limit = { has_tech = COMSAT4 } add_to_array = { prod_12_display_array = global.prod_12_array^3 } } if = { limit = { has_tech = COMSAT5 } add_to_array = { prod_12_display_array = global.prod_12_array^4 } } if = { limit = { has_tech = COMSAT6 } add_to_array = { prod_12_display_array = global.prod_12_array^5 } } if = { limit = { has_tech = COMSAT7 } add_to_array = { prod_12_display_array = global.prod_12_array^6 } } if = { limit = { has_tech = COMSAT8 } add_to_array = { prod_12_display_array = global.prod_12_array^7 } } if = { limit = { has_tech = COMSAT9 } add_to_array = { prod_12_display_array = global.prod_12_array^8 } } if = { limit = { has_tech = COMSAT10 } add_to_array = { prod_12_display_array = global.prod_12_array^9 } } if = { limit = { has_tech = COMSAT11 } add_to_array = { prod_12_display_array = global.prod_12_array^10 } } if = { limit = { has_tech = COMSAT12 } add_to_array = { prod_12_display_array = global.prod_12_array^11 } } if = { limit = { has_tech = SPYSAT1 } add_to_array = { prod_13_display_array = global.prod_13_array^0 } } if = { limit = { has_tech = SPYSAT2 } add_to_array = { prod_13_display_array = global.prod_13_array^1 } } if = { limit = { has_tech = SPYSAT3 } add_to_array = { prod_13_display_array = global.prod_13_array^2 } } if = { limit = { has_tech = SPYSAT4 } add_to_array = { prod_13_display_array = global.prod_13_array^3 } } if = { limit = { has_tech = SPYSAT5 } add_to_array = { prod_13_display_array = global.prod_13_array^4 } } if = { limit = { has_tech = SPYSAT6 } add_to_array = { prod_13_display_array = global.prod_13_array^5 } } if = { limit = { has_tech = SPYSAT7 } add_to_array = { prod_13_display_array = global.prod_13_array^6 } } if = { limit = { has_tech = SPYSAT8 } add_to_array = { prod_13_display_array = global.prod_13_array^7 } } if = { limit = { has_tech = SPYSAT9 } add_to_array = { prod_13_display_array = global.prod_13_array^8 } } if = { limit = { has_tech = SPYSAT10 } add_to_array = { prod_13_display_array = global.prod_13_array^9 } } if = { limit = { has_tech = SPYSAT11 } add_to_array = { prod_13_display_array = global.prod_13_array^10 } } if = { limit = { has_tech = SPYSAT12 } add_to_array = { prod_13_display_array = global.prod_13_array^11 } } if = { limit = { has_tech = KILLSAT1 } add_to_array = { prod_14_display_array = global.prod_14_array^0 } } if = { limit = { has_tech = KILLSAT2 } add_to_array = { prod_14_display_array = global.prod_14_array^1 } } if = { limit = { has_tech = KILLSAT3 } add_to_array = { prod_14_display_array = global.prod_14_array^2 } } if = { limit = { has_tech = KILLSAT4 } add_to_array = { prod_14_display_array = global.prod_14_array^3 } } if = { limit = { has_tech = KILLSAT5 } add_to_array = { prod_14_display_array = global.prod_14_array^4 } } if = { limit = { has_tech = KILLSAT6 } add_to_array = { prod_14_display_array = global.prod_14_array^5 } } if = { limit = { has_tech = KILLSAT7 } add_to_array = { prod_14_display_array = global.prod_14_array^6 } } if = { limit = { has_tech = KILLSAT8 } add_to_array = { prod_14_display_array = global.prod_14_array^7 } } if = { limit = { has_tech = KILLSAT9 } add_to_array = { prod_14_display_array = global.prod_14_array^8 } } if = { limit = { has_tech = KILLSAT10 } add_to_array = { prod_14_display_array = global.prod_14_array^9 } } if = { limit = { has_tech = OLV1 } add_to_array = { prod_10_display_array = global.prod_10_array^0 } } if = { limit = { has_tech = OLV2 } add_to_array = { prod_10_display_array = global.prod_10_array^1 } } if = { limit = { has_tech = OLV3 } add_to_array = { prod_10_display_array = global.prod_10_array^2 } } if = { limit = { has_tech = OLV4 } add_to_array = { prod_10_display_array = global.prod_10_array^3 } } if = { limit = { has_tech = OLV5 } add_to_array = { prod_10_display_array = global.prod_10_array^4 } } if = { limit = { has_tech = OLV6 } add_to_array = { prod_10_display_array = global.prod_10_array^5 } } if = { limit = { has_tech = OLV7 } add_to_array = { prod_10_display_array = global.prod_10_array^6 } } if = { limit = { has_tech = OLV8 } add_to_array = { prod_10_display_array = global.prod_10_array^7 } } if = { limit = { has_tech = OLV9 } add_to_array = { prod_10_display_array = global.prod_10_array^8 } } if = { limit = { has_tech = OLV10 } add_to_array = { prod_10_display_array = global.prod_10_array^9 } } if = { limit = { has_tech = OLV11 } add_to_array = { prod_10_display_array = global.prod_10_array^10 } } if = { limit = { has_tech = OLV12 } add_to_array = { prod_10_display_array = global.prod_10_array^11 } } } clear_prod_display_arrays = { clr_country_flag = missile_production_type_10 clr_country_flag = missile_production_type_11 clr_country_flag = missile_production_type_12 clr_country_flag = missile_production_type_13 clr_country_flag = missile_production_type_14 clear_array = prod_10_display_array clear_array = prod_11_display_array clear_array = prod_12_display_array clear_array = prod_13_display_array clear_array = prod_14_display_array } # function: calculate_production_vars_10 # purpose: This function correlates to the production of ICBMs so it is slot 1 # parameters/variables: # - var_gui_prod_1_amount = the total number of missile to be built # - var_gui_prod_1_CIC_use = the total number of civilian industry to be used for building the missile # - var_gui_prod_1_price_total = the total unit cost of the missile # - var_gui_prod_1_CIC_total = Total assigned CIC # - var_gui_prod_1_CIC_days = The total days for the production mission # - var_gui_prod_1_days_unit = The default number of days for this type of ICBM (Basic: 60) # -------- # How to convert to money fully: # 1. Take the price and amplify that. You can find this in common/scripted_effects/00_missiles_models.txt under set_all_prod_arrays # 2. Remove all of the references to the CIC variable for the current production type # - look up the variable name 1_CIC and you should be able to find all references # 3. Change increase_CIC_1_button_click to allow you to change the amount of money you're throwing at the missile production # 4. Localization needs to be updated to show the display change (UI as well but Bird can help with this) refer to line 33 in MD_missiles_gui_l_english # # ---- # TODO: If you have the gumption the arrays need to be culled because there's about three dozen or so of them that aren't needed ### OLV calculate_production_vars_10 = { clamp_variable = { var = var_gui_prod_10_amount min = 1 max = 5000 } clamp_variable = { var = prod_10_multiplier min = 1 max = var_gui_prod_10_amount } # Initial Price of Production set_variable = { var_gui_prod_10_price_total = { value = var_gui_prod_10_price_unit multiply = { value = var_gui_prod_10_amount add = prod_10_multiplier } multiply = { value = 1 add = modifier@olv_production_cost_modifier } clamp = { min = var_gui_prod_10_price_unit max = @prod_math_max } } } # Days set_variable = { var_gui_prod_10_days = { value = var_gui_prod_10_amount multiply = var_gui_prod_10_days_unit divide = prod_10_multiplier multiply = { value = 1 subtract = modifier@olv_production_speed_modifier } round = yes clamp = { min = 1 max = @prod_days_math_max } } } set_variable = { var_space_week_10 = { value = var_gui_prod_10_price_total divide = { value = var_gui_prod_10_days divide = @prod_days_per_week clamp = { min = 1 max = @prod_math_max } } } } } ### GNSS calculate_production_vars_11 = { clamp_variable = { var = var_gui_prod_11_amount min = 1 max = 5000 } clamp_variable = { var = prod_11_multiplier min = 1 max = var_gui_prod_11_amount } # Initial Price of Production set_variable = { var_gui_prod_11_price_total = { value = var_gui_prod_11_price_unit multiply = { value = var_gui_prod_11_amount add = prod_11_multiplier } multiply = { value = 1 add = modifier@gnss_production_cost_modifier } clamp = { min = var_gui_prod_11_price_unit max = @prod_math_max } } } # Days set_variable = { var_gui_prod_11_days = { value = var_gui_prod_11_amount multiply = var_gui_prod_11_days_unit divide = prod_11_multiplier multiply = { value = 1 subtract = modifier@gnss_production_speed_modifier } round = yes clamp = { min = 1 max = @prod_days_math_max } } } set_variable = { var_space_week_11 = { value = var_gui_prod_11_price_total divide = { value = var_gui_prod_11_days divide = @prod_days_per_week clamp = { min = 1 max = @prod_math_max } } } } } ### COMSAT calculate_production_vars_12 = { clamp_variable = { var = var_gui_prod_12_amount min = 1 max = 5000 } clamp_variable = { var = prod_12_multiplier min = 1 max = var_gui_prod_12_amount } # Initial Price of Production set_variable = { var_gui_prod_12_price_total = { value = var_gui_prod_12_price_unit multiply = { value = var_gui_prod_12_amount add = prod_12_multiplier } multiply = { value = 1 add = modifier@comsat_production_cost_modifier } clamp = { min = var_gui_prod_12_price_unit max = @prod_math_max } } } # Days set_variable = { var_gui_prod_12_days = { value = var_gui_prod_12_amount multiply = var_gui_prod_12_days_unit divide = prod_12_multiplier multiply = { value = 1 subtract = modifier@comsat_production_speed_modifier } round = yes clamp = { min = 1 max = @prod_days_math_max } } } set_variable = { var_space_week_12 = { value = var_gui_prod_12_price_total divide = { value = var_gui_prod_12_days divide = @prod_days_per_week clamp = { min = 1 max = @prod_math_max } } } } } ### SPYSAT calculate_production_vars_13 = { clamp_variable = { var = var_gui_prod_13_amount min = 1 max = 5000 } clamp_variable = { var = prod_13_multiplier min = 1 max = var_gui_prod_13_amount } # Initial Price of Production set_variable = { var_gui_prod_13_price_total = { value = var_gui_prod_13_price_unit multiply = { value = var_gui_prod_13_amount add = prod_13_multiplier } multiply = { value = 1 add = modifier@spysat_production_cost_modifier } clamp = { min = var_gui_prod_13_price_unit max = @prod_math_max } } } # Days set_variable = { var_gui_prod_13_days = { value = var_gui_prod_13_amount multiply = var_gui_prod_13_days_unit divide = prod_13_multiplier multiply = { value = 1 subtract = modifier@spysat_production_speed_modifier } round = yes clamp = { min = 1 max = @prod_days_math_max } } } set_variable = { var_space_week_13 = { value = var_gui_prod_13_price_total divide = { value = var_gui_prod_13_days divide = @prod_days_per_week clamp = { min = 1 max = @prod_math_max } } } } } ### KILLSAT calculate_production_vars_14 = { clamp_variable = { var = var_gui_prod_14_amount min = 1 max = 5000 } clamp_variable = { var = prod_14_multiplier min = 1 max = var_gui_prod_14_amount } # Initial Price of Production set_variable = { var_gui_prod_14_price_total = { value = var_gui_prod_14_price_unit multiply = { value = var_gui_prod_14_amount add = prod_14_multiplier } multiply = { value = 1 add = modifier@killsat_production_cost_modifier } clamp = { min = var_gui_prod_14_price_unit max = @prod_math_max } } } # Days set_variable = { var_gui_prod_14_days = { value = var_gui_prod_14_amount multiply = var_gui_prod_14_days_unit divide = prod_14_multiplier multiply = { value = 1 subtract = modifier@killsat_production_speed_modifier } round = yes clamp = { min = 1 max = @prod_days_math_max } } } set_variable = { var_space_week_14 = { value = var_gui_prod_14_price_total divide = { value = var_gui_prod_14_days divide = @prod_days_per_week clamp = { min = 1 max = @prod_math_max } } } } } ###################### ### satellites gui ### ###################### set_satellites_gui = { set_GNSS_satellites = yes set_COM_satellites = yes set_SPY_satellites = yes set_KILL_satellites = yes } set_GNSS_satellites = { set_temp_variable = { tot = 0 } for_each_loop = { array = GNSS_satellite_array value = v add_to_temp_variable = { tot = v } } set_variable = { var_GNSS_sat_total = tot } } set_COM_satellites = { set_temp_variable = { tot = 0 } for_each_loop = { array = COM_satellite_array value = v add_to_temp_variable = { tot = v } } set_variable = { var_COM_sat_total = tot } } set_SPY_satellites = { set_temp_variable = { tot = 0 } for_each_loop = { array = SPY_satellite_array value = v add_to_temp_variable = { tot = v } } set_variable = { var_SPY_sat_total = tot } } set_KILL_satellites = { set_temp_variable = { tot = 0 } for_each_loop = { array = KILL_satellite_array value = v add_to_temp_variable = { tot = v } } set_variable = { var_KILL_sat_total = tot } } ### satellite systems set_GNSS_mil_systems = { clear_array = GNSS_mil_systems_array add_to_array = { GNSS_mil_systems_array = 121 } add_to_array = { GNSS_mil_systems_array = 122 } add_to_array = { GNSS_mil_systems_array = 123 } add_to_array = { GNSS_mil_systems_array = 124 } add_to_array = { GNSS_mil_systems_array = 125 } add_to_array = { GNSS_mil_systems_array = 126 } add_to_array = { GNSS_mil_systems_array = 127 } add_to_array = { GNSS_mil_systems_array = 128 } add_to_array = { GNSS_mil_systems_array = 129 } add_to_array = { GNSS_mil_systems_array = 130 } add_to_array = { GNSS_mil_systems_array = 131 } add_to_array = { GNSS_mil_systems_array = 132 } } set_GNSS_civ_systems = { clear_array = GNSS_civ_systems_array add_to_array = { GNSS_civ_systems_array = 121 } add_to_array = { GNSS_civ_systems_array = 122 } add_to_array = { GNSS_civ_systems_array = 123 } add_to_array = { GNSS_civ_systems_array = 124 } add_to_array = { GNSS_civ_systems_array = 125 } add_to_array = { GNSS_civ_systems_array = 126 } add_to_array = { GNSS_civ_systems_array = 127 } add_to_array = { GNSS_civ_systems_array = 128 } add_to_array = { GNSS_civ_systems_array = 129 } add_to_array = { GNSS_civ_systems_array = 130 } add_to_array = { GNSS_civ_systems_array = 131 } add_to_array = { GNSS_civ_systems_array = 132 } } set_COM_mil_systems = { clear_array = COM_mil_systems_array add_to_array = { COM_mil_systems_array = 141 } add_to_array = { COM_mil_systems_array = 142 } add_to_array = { COM_mil_systems_array = 143 } add_to_array = { COM_mil_systems_array = 144 } add_to_array = { COM_mil_systems_array = 145 } add_to_array = { COM_mil_systems_array = 146 } add_to_array = { COM_mil_systems_array = 147 } add_to_array = { COM_mil_systems_array = 148 } add_to_array = { COM_mil_systems_array = 149 } add_to_array = { COM_mil_systems_array = 150 } add_to_array = { COM_mil_systems_array = 151 } add_to_array = { COM_mil_systems_array = 152 } } set_COM_civ_systems = { clear_array = COM_civ_systems_array add_to_array = { COM_civ_systems_array = 141 } add_to_array = { COM_civ_systems_array = 142 } add_to_array = { COM_civ_systems_array = 143 } add_to_array = { COM_civ_systems_array = 144 } add_to_array = { COM_civ_systems_array = 145 } add_to_array = { COM_civ_systems_array = 146 } add_to_array = { COM_civ_systems_array = 147 } add_to_array = { COM_civ_systems_array = 148 } add_to_array = { COM_civ_systems_array = 149 } add_to_array = { COM_civ_systems_array = 150 } add_to_array = { COM_civ_systems_array = 151 } add_to_array = { COM_civ_systems_array = 152 } } set_SPY_mil_systems = { clear_array = SPY_mil_systems_array add_to_array = { SPY_mil_systems_array = 161 } add_to_array = { SPY_mil_systems_array = 162 } add_to_array = { SPY_mil_systems_array = 163 } add_to_array = { SPY_mil_systems_array = 164 } add_to_array = { SPY_mil_systems_array = 165 } add_to_array = { SPY_mil_systems_array = 166 } add_to_array = { SPY_mil_systems_array = 167 } add_to_array = { SPY_mil_systems_array = 168 } add_to_array = { SPY_mil_systems_array = 169 } add_to_array = { SPY_mil_systems_array = 170 } add_to_array = { SPY_mil_systems_array = 171 } add_to_array = { SPY_mil_systems_array = 172 } } set_SPY_civ_systems = { clear_array = SPY_civ_systems_array add_to_array = { SPY_civ_systems_array = 161 } add_to_array = { SPY_civ_systems_array = 162 } add_to_array = { SPY_civ_systems_array = 163 } add_to_array = { SPY_civ_systems_array = 164 } add_to_array = { SPY_civ_systems_array = 165 } add_to_array = { SPY_civ_systems_array = 166 } add_to_array = { SPY_civ_systems_array = 167 } add_to_array = { SPY_civ_systems_array = 168 } add_to_array = { SPY_civ_systems_array = 169 } add_to_array = { SPY_civ_systems_array = 170 } add_to_array = { SPY_civ_systems_array = 171 } add_to_array = { SPY_civ_systems_array = 172 } } set_COM_sat_receiver_tech_array = { add_to_array = { COM_sat_receiver_tech_array = 10 } add_to_array = { COM_sat_receiver_tech_array = 20 } add_to_array = { COM_sat_receiver_tech_array = 30 } add_to_array = { COM_sat_receiver_tech_array = 40 } add_to_array = { COM_sat_receiver_tech_array = 50 } add_to_array = { COM_sat_receiver_tech_array = 60 } add_to_array = { COM_sat_receiver_tech_array = 70 } add_to_array = { COM_sat_receiver_tech_array = 80 } add_to_array = { COM_sat_receiver_tech_array = 90 } add_to_array = { COM_sat_receiver_tech_array = 100 } add_to_array = { COM_sat_receiver_tech_array = 110 } add_to_array = { COM_sat_receiver_tech_array = 120 } } update_sat_systems_stats = { check_sat_systems_min_sat_num = yes set_satellites_gui = yes update_GNSS_system_stats = yes update_COM_system_stats = yes update_SPY_system_stats = yes calculate_GNSS_mil_gui_vars = yes calculate_GNSS_civ_gui_vars = yes calculate_COM_mil_gui_vars = yes calculate_COM_civ_gui_vars = yes calculate_SPY_mil_gui_vars = yes calculate_SPY_civ_gui_vars = yes add_access_GNSS_mil_vars = yes add_access_GNSS_civ_vars = yes add_access_COM_mil_vars = yes add_access_COM_civ_vars = yes add_access_SPY_mil_vars = yes add_access_SPY_civ_vars = yes } # Model-index space (var_*_system_idx) to tier space (0-11) and back. # Clamped because tags created after on_startup never ran the seeding pass and read 0. set_GNSS_local_idx = { set_temp_variable = { temp_GNSS_mil_idx = { value = var_GNSS_mil_system_idx subtract = @GNSS_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } set_temp_variable = { temp_GNSS_civ_idx = { value = var_GNSS_civ_system_idx subtract = @GNSS_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } } store_GNSS_local_idx = { set_variable = { var_GNSS_mil_system_idx = { value = temp_GNSS_mil_idx add = @GNSS_sat_idx_base } } set_variable = { var_GNSS_civ_system_idx = { value = temp_GNSS_civ_idx add = @GNSS_sat_idx_base } } } set_COM_local_idx = { set_temp_variable = { temp_COM_mil_idx = { value = var_COM_mil_system_idx subtract = @COM_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } set_temp_variable = { temp_COM_civ_idx = { value = var_COM_civ_system_idx subtract = @COM_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } } store_COM_local_idx = { set_variable = { var_COM_mil_system_idx = { value = temp_COM_mil_idx add = @COM_sat_idx_base } } set_variable = { var_COM_civ_system_idx = { value = temp_COM_civ_idx add = @COM_sat_idx_base } } } set_SPY_local_idx = { set_temp_variable = { temp_SPY_mil_idx = { value = var_SPY_mil_system_idx subtract = @SPY_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } set_temp_variable = { temp_SPY_civ_idx = { value = var_SPY_civ_system_idx subtract = @SPY_sat_idx_base clamp = { min = 0 max = @sat_system_tier_top } } } } store_SPY_local_idx = { set_variable = { var_SPY_mil_system_idx = { value = temp_SPY_mil_idx add = @SPY_sat_idx_base } } set_variable = { var_SPY_civ_system_idx = { value = temp_SPY_civ_idx add = @SPY_sat_idx_base } } } check_sat_systems_min_sat_num = { set_GNSS_local_idx = yes set_COM_local_idx = yes set_SPY_local_idx = yes #GNSS if = { limit = { check_variable = { GNSS_satellite_array^temp_GNSS_mil_idx < global.GNSS_sat_system_min_array^temp_GNSS_mil_idx } check_variable = { var_GNSS_mil_system_idx > @GNSS_sat_idx_base } } subtract_from_variable = { var_GNSS_mil_system_idx = 1 } ROOT = { news_event = satellites.2 } } if = { limit = { check_variable = { GNSS_satellite_array^temp_GNSS_civ_idx < global.GNSS_sat_system_min_array^temp_GNSS_civ_idx } check_variable = { var_GNSS_civ_system_idx > @GNSS_sat_idx_base } } subtract_from_variable = { var_GNSS_civ_system_idx = 1 } ROOT = { news_event = satellites.3 } } #COM if = { limit = { check_variable = { COM_satellite_array^temp_COM_mil_idx < global.COM_sat_system_min_array^temp_COM_mil_idx } check_variable = { var_COM_mil_system_idx > @COM_sat_idx_base } } subtract_from_variable = { var_COM_mil_system_idx = 1 } ROOT = { news_event = satellites.4 } } if = { limit = { check_variable = { COM_satellite_array^temp_COM_civ_idx < global.COM_sat_system_min_array^temp_COM_civ_idx } check_variable = { var_COM_civ_system_idx > @COM_sat_idx_base } } subtract_from_variable = { var_COM_civ_system_idx = 1 } ROOT = { news_event = satellites.5 } } #SPY if = { limit = { check_variable = { SPY_satellite_array^temp_SPY_mil_idx < global.SPY_sat_system_min_array^temp_SPY_mil_idx } check_variable = { var_SPY_mil_system_idx > @SPY_sat_idx_base } } subtract_from_variable = { var_SPY_mil_system_idx = 1 } ROOT = { news_event = satellites.6 } } if = { limit = { check_variable = { SPY_satellite_array^temp_SPY_civ_idx < global.SPY_sat_system_min_array^temp_SPY_civ_idx } check_variable = { var_SPY_civ_system_idx > @SPY_sat_idx_base } } subtract_from_variable = { var_SPY_civ_system_idx = 1 } ROOT = { news_event = satellites.7 } } } update_GNSS_system_stats = { set_GNSS_local_idx = yes ### GNSS mil system set_variable = { var_GNSS_mil_sat_system_num = { value = GNSS_satellite_array^temp_GNSS_mil_idx min = var_GNSS_mil_sat_system_max } } set_variable = { var_GNSS_mil_coverage = { value = var_GNSS_mil_sat_system_num divide = { value = var_GNSS_mil_sat_system_max max = 0.001 } min = 1 } } set_variable = { var_GNSS_mil_SBAS_num = 0 } set_variable = { var_GNSS_mil_SBAS_bonus = 0 } if = { limit = { check_variable = { var_GNSS_mil_sat_system_max > 0 } } update_GNSS_SBAS = yes } set_variable = { var_GNSS_mil_sat_system_bonus = { value = var_GNSS_mil_coverage add = var_GNSS_mil_SBAS_bonus add = antarctica_lab_effects_from_mil_satellites clamp = { min = 0 max = @prod_math_max } } } ### GNSS civ system set_variable = { var_GNSS_civ_sat_system_num = { value = GNSS_satellite_array^temp_GNSS_civ_idx min = var_GNSS_civ_sat_system_max } } set_variable = { var_GNSS_civ_coverage = { value = var_GNSS_civ_sat_system_num divide = { value = var_GNSS_civ_sat_system_max max = 0.001 } min = 1 } } set_variable = { var_GNSS_civ_SBAS_num = 0 } set_variable = { var_GNSS_civ_SBAS_bonus = 0 } if = { limit = { check_variable = { var_GNSS_civ_sat_system_max > 0 } } update_GNSS_SBAS = yes } set_variable = { var_GNSS_civ_sat_system_bonus = { value = var_GNSS_civ_coverage add = var_GNSS_civ_SBAS_bonus add = antarctica_lab_effects_from_civ_satellites clamp = { min = 0 max = @prod_math_max } } } } update_GNSS_SBAS = { ### GNSS mil set_variable = { var_GNSS_mil_SBAS_num = { value = var_GNSS_sat_total subtract = var_GNSS_mil_sat_system_num } } set_variable = { var_GNSS_mil_SBAS_bonus = { value = var_GNSS_mil_SBAS_num multiply = 0.01 min = { value = 1 subtract = var_GNSS_mil_coverage } } } ###GNSS civ set_variable = { var_GNSS_civ_SBAS_num = { value = var_GNSS_sat_total subtract = var_GNSS_civ_sat_system_num } } set_variable = { var_GNSS_civ_SBAS_bonus = { value = var_GNSS_civ_SBAS_num multiply = 0.01 min = { value = 1 subtract = var_GNSS_civ_coverage } } } } update_COM_system_stats = { set_COM_local_idx = yes set_variable = { var_COM_mil_sat_system_num = 0 } set_variable = { var_COM_mil_receiver_cap = 0 } set_variable = { var_COM_civ_sat_system_num = 0 } set_variable = { var_COM_civ_receiver_cap = 0 } for_each_loop = { array = COM_satellite_array ### COM mil system if = { limit = { OR = { check_variable = { i = temp_COM_mil_idx } check_variable = { i > temp_COM_mil_idx } } } add_to_variable = { var_COM_mil_sat_system_num = COM_satellite_array^i } add_to_variable = { var = var_COM_mil_receiver_cap value = { value = COM_satellite_array^i multiply = COM_sat_receiver_tech_array^i } } } ### COM civ system if = { limit = { OR = { check_variable = { i = temp_COM_civ_idx } check_variable = { i > temp_COM_civ_idx } } } add_to_variable = { var_COM_civ_sat_system_num = COM_satellite_array^i } add_to_variable = { var = var_COM_civ_receiver_cap value = { value = COM_satellite_array^i multiply = COM_sat_receiver_tech_array^i } } } } set_variable = { var_COM_mil_coverage = { value = 0 if = { limit = { value = var_COM_mil_sat_system_max greater_than = 0 } add = { value = var_COM_mil_sat_system_num divide = var_COM_mil_sat_system_max } } min = 1 } } # Satellite Communication System - Military set_variable = { var_COM_mil_receiver_num = { value = num_battalions add = num_ships add = num_deployed_planes } } add_treaty_COM_mil_receiver_num = yes set_variable = { var_sat_network_traffic_mil = { value = 0 if = { limit = { value = var_COM_mil_receiver_cap greater_than = 0 } add = { value = var_COM_mil_receiver_num divide = var_COM_mil_receiver_cap } } } } set_variable = { var_COM_mil_sat_system_bonus = { value = 0 if = { limit = { value = var_COM_mil_receiver_cap greater_than = 0 } add = var_COM_mil_coverage if = { limit = { value = var_sat_network_traffic_mil greater_than = 1 } subtract = { value = var_sat_network_traffic_mil subtract = 1 } } } } } set_variable = { var_COM_mil_sat_system_bonus = { value = var_COM_mil_sat_system_bonus add = antarctica_lab_effects_from_mil_satellites clamp = { min = 0 max = @prod_math_max } } } # Satellite Communication System - Civilian set_variable = { var_COM_civ_coverage = { value = 0 if = { limit = { value = var_COM_civ_sat_system_max greater_than = 0 } add = { value = var_COM_civ_sat_system_num divide = var_COM_civ_sat_system_max } } min = 1 } } set_variable = { var_COM_civ_receiver_num = { value = num_controlled_states multiply = 100 } } add_treaty_COM_civ_receiver_num = yes set_variable = { var_sat_network_traffic_civ = { value = 0 if = { limit = { value = var_COM_civ_receiver_cap greater_than = 0 } add = { value = var_COM_civ_receiver_num divide = var_COM_civ_receiver_cap } } } } set_variable = { var_COM_civ_sat_system_bonus = { value = 0 if = { limit = { value = var_COM_civ_receiver_cap greater_than = 0 } add = var_COM_civ_coverage if = { limit = { value = var_sat_network_traffic_civ greater_than = 1 } subtract = { value = var_sat_network_traffic_civ subtract = 1 } } } } } set_variable = { var_COM_civ_sat_system_bonus = { value = var_COM_civ_sat_system_bonus add = antarctica_lab_effects_from_civ_satellites clamp = { min = 0 max = @prod_math_max } } } } ### receiver from treaties (access granted) add_treaty_COM_mil_receiver_num = { set_variable = { var_treaty_COM_mil_receiver_num = 0 } for_each_scope_loop = { array = COM_mil_treaty_array add_to_variable = { var = PREV.var_treaty_COM_mil_receiver_num value = { value = THIS.num_battalions add = THIS.num_ships add = THIS.num_deployed_planes } } } add_to_variable = { var_COM_mil_receiver_num = var_treaty_COM_mil_receiver_num } } add_treaty_COM_civ_receiver_num = { set_variable = { var_treaty_COM_civ_receiver_num = 0 } for_each_scope_loop = { array = COM_civ_treaty_array add_to_variable = { var = PREV.var_treaty_COM_civ_receiver_num value = { value = THIS.num_controlled_states multiply = 100 } } } add_to_variable = { var_COM_civ_receiver_num = var_treaty_COM_civ_receiver_num } } # Effect: update_SPY_system_stats # Purpose: Updates the Reconnaissance Satellite System variables and values update_SPY_system_stats = { set_SPY_local_idx = yes ### SPY mil system set_variable = { var_SPY_mil_sat_system_num = { value = SPY_satellite_array^temp_SPY_mil_idx min = var_SPY_mil_sat_system_max } } set_variable = { var_SPY_mil_coverage = { value = var_SPY_mil_sat_system_num divide = { value = var_SPY_mil_sat_system_max max = 0.001 } min = 1 } } set_variable = { var_SPY_mil_sat_system_bonus = { value = var_SPY_mil_coverage add = antarctica_lab_effects_from_mil_satellites clamp = { min = 0 max = @prod_math_max } } } update_SPY_mission_num = yes ### SPY civ system set_variable = { var_SPY_civ_sat_system_num = { value = SPY_satellite_array^temp_SPY_civ_idx min = var_SPY_civ_sat_system_max } } set_variable = { var_SPY_civ_coverage = { value = var_SPY_civ_sat_system_num divide = { value = var_SPY_civ_sat_system_max max = 0.001 } min = 1 } } set_variable = { var_SPY_civ_sat_system_bonus = { value = var_SPY_civ_coverage add = antarctica_lab_effects_from_civ_satellites clamp = { min = 0 max = @prod_math_max } } } update_SPY_mission_num = yes } update_SPY_mission_num = { set_variable = { var_SPY_mission_active_sat = 0 } for_each_loop = { array = ROOT.spy_mission_sat_num_array add_to_variable = { var_SPY_mission_active_sat = v } } set_variable = { var_SPY_mission_num_total = { value = var_SPY_sat_total subtract = var_SPY_mil_sat_system_num } } if = { limit = { NOT = { check_variable = { var_SPY_mil_system_idx = var_SPY_civ_system_idx } } } subtract_from_variable = { var_SPY_mission_num_total = var_SPY_civ_sat_system_num } } set_variable = { var_SPY_mission_num_available = { value = var_SPY_mission_num_total subtract = var_SPY_mission_active_sat } } update_SPY_mission_start_button = yes } update_SPY_mission_start_button = { # refresh the coverage ratio the same way the +/- buttons do update_SPY_mission_plus_minus_button = yes } update_SPY_mission_plus_minus_button = { if = { limit = { check_variable = { orbit_selected_TAG > 0 } } var:orbit_selected_TAG = { set_variable = { ROOT.var_SPY_mission_intel_ratio = { value = 0 if = { limit = { value = num_controlled_states greater_than = 0 } add = { value = ROOT.var_SPY_mission_num_gui divide = num_controlled_states } } } } } } else = { set_variable = { ROOT.var_SPY_mission_intel_ratio = 0 } } set_variable = { ROOT.var_SPY_mission_intel_add = { value = ROOT.var_SPY_mission_intel_ratio multiply = 30 } } } calculate_GNSS_mil_gui_vars = { set_GNSS_local_idx = yes set_variable = { var_GNSS_mil_army_speed_factor_base = { value = global.GNSS_mil_army_speed_factor_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_army_speed_factor_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } #air_cas_efficiency set_variable = { var_GNSS_mil_air_cas_efficiency_base = { value = global.GNSS_mil_air_cas_efficiency_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_air_cas_efficiency_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } #air_nav_efficiency set_variable = { var_GNSS_mil_air_nav_efficiency_base = { value = global.GNSS_mil_air_nav_efficiency_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_air_nav_efficiency_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } #air_strategic_bomber_bombing_factor set_variable = { var_GNSS_mil_air_strategic_bomber_bombing_factor_base = { value = global.GNSS_mil_air_strategic_bomber_bombing_factor_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_air_strategic_bomber_bombing_factor_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } #positioning set_variable = { var_GNSS_mil_positioning_base = { value = global.GNSS_mil_positioning_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_positioning_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } #naval_hit_chance set_variable = { var_GNSS_mil_naval_hit_chance_base = { value = global.GNSS_mil_naval_hit_chance_max_array^temp_GNSS_mil_idx multiply = var_GNSS_mil_sat_system_bonus clamp = { min = global.GNSS_mil_naval_hit_chance_min_array^temp_GNSS_mil_idx max = @prod_math_max } } } } calculate_GNSS_civ_gui_vars = { set_GNSS_local_idx = yes set_variable = { var_GNSS_civ_production_speed_buildings_factor_base = { value = global.GNSS_civ_production_speed_buildings_factor_max_array^temp_GNSS_civ_idx multiply = var_GNSS_civ_sat_system_bonus clamp = { min = global.GNSS_civ_production_speed_buildings_factor_min_array^temp_GNSS_civ_idx max = @prod_math_max } } } #production_speed_infrastructure_factor set_variable = { var_GNSS_civ_production_speed_infrastructure_factor_base = { value = global.GNSS_civ_production_speed_infrastructure_factor_max_array^temp_GNSS_civ_idx multiply = var_GNSS_civ_sat_system_bonus clamp = { min = global.GNSS_civ_production_speed_infrastructure_factor_min_array^temp_GNSS_civ_idx max = @prod_math_max } } } #local_resources_factor set_variable = { var_GNSS_civ_local_resources_factor_base = { value = global.GNSS_civ_local_resources_factor_max_array^temp_GNSS_civ_idx multiply = var_GNSS_civ_sat_system_bonus clamp = { min = global.GNSS_civ_local_resources_factor_min_array^temp_GNSS_civ_idx max = @prod_math_max } } } } calculate_COM_mil_gui_vars = { set_COM_local_idx = yes # Command Power set_variable = { var_COM_mil_max_command_power_base = { value = global.COM_mil_max_command_power_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_max_command_power_min_array^temp_COM_mil_idx max = @prod_math_max } } } #army_org_factor set_variable = { var_COM_mil_army_org_factor_base = { value = global.COM_mil_army_org_factor_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_army_org_factor_min_array^temp_COM_mil_idx max = @prod_math_max } } } #planning_speed set_variable = { var_COM_mil_planning_speed_base = { value = global.COM_mil_planning_speed_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_planning_speed_min_array^temp_COM_mil_idx max = @prod_math_max } } } #air_escort_efficiency set_variable = { var_COM_mil_air_escort_efficiency_base = { value = global.COM_mil_air_escort_efficiency_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_air_escort_efficiency_min_array^temp_COM_mil_idx max = @prod_math_max } } } #air_intercept_efficiency set_variable = { var_COM_mil_air_intercept_efficiency_base = { value = global.COM_mil_air_intercept_efficiency_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_air_intercept_efficiency_min_array^temp_COM_mil_idx max = @prod_math_max } } } #naval_coordination set_variable = { var_COM_mil_naval_coordination_base = { value = global.COM_mil_naval_coordination_max_array^temp_COM_mil_idx multiply = var_COM_mil_sat_system_bonus clamp = { min = global.COM_mil_naval_coordination_min_array^temp_COM_mil_idx max = @prod_math_max } } } } calculate_COM_civ_gui_vars = { set_COM_local_idx = yes #political_power_factor set_variable = { var_COM_civ_political_power_factor_base = { value = global.COM_civ_political_power_factor_max_array^temp_COM_civ_idx multiply = var_COM_civ_sat_system_bonus clamp = { min = global.COM_civ_political_power_factor_min_array^temp_COM_civ_idx max = @prod_math_max } } } #decryption_factor set_variable = { var_COM_civ_decryption_factor_base = { value = global.COM_civ_decryption_factor_max_array^temp_COM_civ_idx multiply = var_COM_civ_sat_system_bonus clamp = { min = global.COM_civ_decryption_factor_min_array^temp_COM_civ_idx max = @prod_math_max } } } #encryption_factor set_variable = { var_COM_civ_encryption_factor_base = { value = global.COM_civ_encryption_factor_max_array^temp_COM_civ_idx multiply = var_COM_civ_sat_system_bonus clamp = { min = global.COM_civ_encryption_factor_min_array^temp_COM_civ_idx max = @prod_math_max } } } #intel_network_gain_factor set_variable = { var_COM_civ_intel_network_gain_factor_base = { value = global.COM_civ_intel_network_gain_factor_max_array^temp_COM_civ_idx multiply = var_COM_civ_sat_system_bonus clamp = { min = global.COM_civ_intel_network_gain_factor_min_array^temp_COM_civ_idx max = @prod_math_max } } } #operation_outcome set_variable = { var_COM_civ_operation_outcome_base = { value = global.COM_civ_operation_outcome_max_array^temp_COM_civ_idx multiply = var_COM_civ_sat_system_bonus clamp = { min = global.COM_civ_operation_outcome_min_array^temp_COM_civ_idx max = @prod_math_max } } } } calculate_SPY_mil_gui_vars = { set_SPY_local_idx = yes ### SPY mil #max_planning_factor set_variable = { var_SPY_mil_max_planning_factor_base = { value = global.SPY_mil_max_planning_factor_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_max_planning_factor_min_array^temp_SPY_mil_idx max = @prod_math_max } } } #recon_factor set_variable = { var_SPY_mil_recon_factor_base = { value = global.SPY_mil_recon_factor_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_recon_factor_min_array^temp_SPY_mil_idx max = @prod_math_max } } } #air_weather_penalty set_variable = { var_SPY_mil_air_weather_penalty_base = { value = global.SPY_mil_air_weather_penalty_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_air_weather_penalty_min_array^temp_SPY_mil_idx max = @prod_math_max } } } #spotting_chance set_variable = { var_SPY_mil_spotting_chance_base = { value = global.SPY_mil_spotting_chance_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_spotting_chance_min_array^temp_SPY_mil_idx max = @prod_math_max } } } #convoy_raiding_efficiency_factor set_variable = { var_SPY_mil_convoy_raiding_efficiency_factor_base = { value = global.SPY_mil_convoy_raiding_efficiency_factor_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_convoy_raiding_efficiency_factor_min_array^temp_SPY_mil_idx max = @prod_math_max } } } #convoy_escort_efficiency set_variable = { var_SPY_mil_convoy_escort_efficiency_base = { value = global.SPY_mil_convoy_escort_efficiency_max_array^temp_SPY_mil_idx multiply = var_SPY_mil_sat_system_bonus clamp = { min = global.SPY_mil_convoy_escort_efficiency_min_array^temp_SPY_mil_idx max = @prod_math_max } } } } calculate_SPY_civ_gui_vars = { set_SPY_local_idx = yes ### SPY civ #research_speed_factor set_variable = { var_SPY_civ_research_speed_factor_base = { value = global.SPY_civ_research_speed_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_research_speed_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } #civilian_intel_factor set_variable = { var_SPY_civ_civilian_intel_factor_base = { value = global.SPY_civ_civilian_intel_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_civilian_intel_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } #army_intel_factor set_variable = { var_SPY_civ_army_intel_factor_base = { value = global.SPY_civ_army_intel_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_army_intel_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } #navy_intel_factor set_variable = { var_SPY_civ_navy_intel_factor_base = { value = global.SPY_civ_navy_intel_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_navy_intel_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } #airforce_intel_factor set_variable = { var_SPY_civ_airforce_intel_factor_base = { value = global.SPY_civ_airforce_intel_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_airforce_intel_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } #root_out_resistance_effectiveness_factor set_variable = { var_SPY_civ_root_out_resistance_effectiveness_factor_base = { value = global.SPY_civ_root_out_resistance_effectiveness_factor_max_array^temp_SPY_civ_idx multiply = var_SPY_civ_sat_system_bonus clamp = { min = global.SPY_civ_root_out_resistance_effectiveness_factor_min_array^temp_SPY_civ_idx max = @prod_math_max } } } ### } add_access_GNSS_mil_vars = { # Rebuild access arrays so stale country scopes cannot survive into scope loops. clear_array = temp_GNSS_mil_access_array for_each_loop = { array = GNSS_mil_access_array value = v if = { limit = { NOT = { check_variable = { v = 0 } } var:v = { exists = yes } NOT = { is_in_array = { array = temp_GNSS_mil_access_array value = v } } } add_to_array = { array = temp_GNSS_mil_access_array value = v } } } clear_array = GNSS_mil_access_array clear_array = GNSS_mil_access_system_idx_array for_each_loop = { array = temp_GNSS_mil_access_array value = v add_to_array = { array = GNSS_mil_access_array value = v } var:v = { add_to_array = { array = ROOT.GNSS_mil_access_system_idx_array value = var_GNSS_mil_system_idx } } } clear_array = temp_GNSS_mil_access_array set_temp_variable = { temp_GNSS_mil_access_system_highest_idx = 0 } set_variable = { var_GNSS_mil_army_speed_factor = var_GNSS_mil_army_speed_factor_base } set_variable = { var_GNSS_mil_air_cas_efficiency = var_GNSS_mil_air_cas_efficiency_base } set_variable = { var_GNSS_mil_air_nav_efficiency = var_GNSS_mil_air_nav_efficiency_base } set_variable = { var_GNSS_mil_air_strategic_bomber_bombing_factor = var_GNSS_mil_air_strategic_bomber_bombing_factor_base } set_variable = { var_GNSS_mil_positioning = var_GNSS_mil_positioning_base } set_variable = { var_GNSS_mil_naval_hit_chance = var_GNSS_mil_naval_hit_chance_base } for_each_loop = { array = GNSS_mil_access_system_idx_array if = { limit = { check_variable = { GNSS_mil_access_system_idx_array^i > temp_GNSS_mil_access_system_highest_idx } } set_temp_variable = { temp_GNSS_mil_access_system_highest_idx = GNSS_mil_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_GNSS_mil_system_idx < temp_GNSS_mil_access_system_highest_idx } check_variable = { ROOT.var_GNSS_mil_system_idx = temp_GNSS_mil_access_system_highest_idx } } } for_each_scope_loop = { array = GNSS_mil_access_array if = { limit = { OR = { check_variable = { ROOT.var_GNSS_mil_system_idx < THIS.var_GNSS_mil_system_idx } check_variable = { ROOT.var_GNSS_mil_system_idx = THIS.var_GNSS_mil_system_idx } } } add_to_variable = { ROOT.var_GNSS_mil_army_speed_factor = THIS.var_GNSS_mil_army_speed_factor_base } add_to_variable = { ROOT.var_GNSS_mil_air_cas_efficiency = THIS.var_GNSS_mil_air_cas_efficiency_base } add_to_variable = { ROOT.var_GNSS_mil_air_nav_efficiency = THIS.var_GNSS_mil_air_nav_efficiency_base } add_to_variable = { ROOT.var_GNSS_mil_air_strategic_bomber_bombing_factor = THIS.var_GNSS_mil_air_strategic_bomber_bombing_factor_base } add_to_variable = { ROOT.var_GNSS_mil_positioning = THIS.var_GNSS_mil_positioning_base } add_to_variable = { ROOT.var_GNSS_mil_naval_hit_chance = THIS.var_GNSS_mil_naval_hit_chance_base } } } if = { limit = { check_variable = { ROOT.GNSS_mil_access_array^num > 0 } } subtract_from_temp_variable = { temp_GNSS_mil_access_system_highest_idx = @GNSS_sat_idx_base } #army_speed_factor clamp_variable = { var = ROOT.var_GNSS_mil_army_speed_factor max = global.GNSS_mil_army_speed_factor_max_array^temp_GNSS_mil_access_system_highest_idx } #air_cas_efficiency clamp_variable = { var = ROOT.var_GNSS_mil_air_cas_efficiency max = global.GNSS_mil_air_cas_efficiency_max_array^temp_GNSS_mil_access_system_highest_idx } #air_nav_efficiency clamp_variable = { var = ROOT.var_GNSS_mil_air_nav_efficiency max = global.GNSS_mil_air_nav_efficiency_max_array^temp_GNSS_mil_access_system_highest_idx } #air_strategic_bomber_bombing_factor clamp_variable = { var = ROOT.var_GNSS_mil_air_strategic_bomber_bombing_factor max = global.GNSS_mil_air_strategic_bomber_bombing_factor_max_array^temp_GNSS_mil_access_system_highest_idx } #positioning clamp_variable = { var = ROOT.var_GNSS_mil_positioning max = global.GNSS_mil_positioning_max_array^temp_GNSS_mil_access_system_highest_idx } #naval_hit_chance clamp_variable = { var = ROOT.var_GNSS_mil_naval_hit_chance max = global.GNSS_mil_naval_hit_chance_max_array^temp_GNSS_mil_access_system_highest_idx } } } } add_access_GNSS_civ_vars = { # Rebuild access arrays so stale country scopes cannot survive into scope loops. clear_array = temp_GNSS_civ_access_array for_each_loop = { array = GNSS_civ_access_array value = v if = { limit = { NOT = { check_variable = { v = 0 } } var:v = { exists = yes } NOT = { is_in_array = { array = temp_GNSS_civ_access_array value = v } } } add_to_array = { array = temp_GNSS_civ_access_array value = v } } } clear_array = GNSS_civ_access_array clear_array = GNSS_civ_access_system_idx_array for_each_loop = { array = temp_GNSS_civ_access_array value = v add_to_array = { array = GNSS_civ_access_array value = v } var:v = { add_to_array = { array = ROOT.GNSS_civ_access_system_idx_array value = var_GNSS_civ_system_idx } } } clear_array = temp_GNSS_civ_access_array set_temp_variable = { temp_GNSS_civ_access_system_highest_idx = 0 } set_variable = { var_GNSS_civ_production_speed_buildings_factor = var_GNSS_civ_production_speed_buildings_factor_base } set_variable = { var_GNSS_civ_production_speed_infrastructure_factor = var_GNSS_civ_production_speed_infrastructure_factor_base } set_variable = { var_GNSS_civ_local_resources_factor = var_GNSS_civ_local_resources_factor_base } for_each_loop = { array = GNSS_civ_access_system_idx_array if = { limit = { check_variable = { GNSS_civ_access_system_idx_array^i > temp_GNSS_civ_access_system_highest_idx } } set_temp_variable = { temp_GNSS_civ_access_system_highest_idx = GNSS_civ_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_GNSS_civ_system_idx < temp_GNSS_civ_access_system_highest_idx } check_variable = { ROOT.var_GNSS_civ_system_idx = temp_GNSS_civ_access_system_highest_idx } } } for_each_scope_loop = { array = GNSS_civ_access_array if = { limit = { OR = { check_variable = { ROOT.var_GNSS_civ_system_idx < THIS.var_GNSS_civ_system_idx } check_variable = { ROOT.var_GNSS_civ_system_idx = THIS.var_GNSS_civ_system_idx } } } add_to_variable = { ROOT.var_GNSS_civ_production_speed_buildings_factor = THIS.var_GNSS_civ_production_speed_buildings_factor_base } add_to_variable = { ROOT.var_GNSS_civ_production_speed_infrastructure_factor = THIS.var_GNSS_civ_production_speed_infrastructure_factor_base } add_to_variable = { ROOT.var_GNSS_civ_local_resources_factor = THIS.var_GNSS_civ_local_resources_factor_base } } } # Clamp variables for the GNSS satellites to the maximum value if = { limit = { check_variable = { ROOT.GNSS_civ_access_array^num > 0 } } subtract_from_temp_variable = { temp_GNSS_civ_access_system_highest_idx = @GNSS_sat_idx_base } #production_speed_buildings_factor clamp_variable = { var = ROOT.var_GNSS_civ_production_speed_buildings_factor max = global.GNSS_civ_production_speed_buildings_factor_max_array^temp_GNSS_civ_access_system_highest_idx } #production_speed_infrastructure_factor clamp_variable = { var = ROOT.var_GNSS_civ_production_speed_infrastructure_factor max = global.GNSS_civ_production_speed_infrastructure_factor_max_array^temp_GNSS_civ_access_system_highest_idx } #local_resources_factor clamp_variable = { var = ROOT.var_GNSS_civ_local_resources_factor max = global.GNSS_civ_local_resources_factor_max_array^temp_GNSS_civ_access_system_highest_idx } } } } add_access_COM_mil_vars = { set_temp_variable = { temp_COM_mil_access_system_highest_idx = 0 } set_variable = { var_COM_mil_max_command_power = var_COM_mil_max_command_power_base } set_variable = { var_COM_mil_army_org_factor = var_COM_mil_army_org_factor_base } set_variable = { var_COM_mil_planning_speed = var_COM_mil_planning_speed_base } set_variable = { var_COM_mil_air_escort_efficiency = var_COM_mil_air_escort_efficiency_base } set_variable = { var_COM_mil_air_intercept_efficiency = var_COM_mil_air_intercept_efficiency_base } set_variable = { var_COM_mil_naval_coordination = var_COM_mil_naval_coordination_base } for_each_loop = { array = COM_mil_access_system_idx_array if = { limit = { check_variable = { COM_mil_access_system_idx_array^i > temp_COM_mil_access_system_highest_idx } } set_temp_variable = { temp_COM_mil_access_system_highest_idx = COM_mil_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_COM_mil_system_idx < temp_COM_mil_access_system_highest_idx } check_variable = { ROOT.var_COM_mil_system_idx = temp_COM_mil_access_system_highest_idx } } } for_each_scope_loop = { array = COM_mil_access_array if = { limit = { OR = { check_variable = { ROOT.var_COM_mil_system_idx < THIS.var_COM_mil_system_idx } check_variable = { ROOT.var_COM_mil_system_idx = THIS.var_COM_mil_system_idx } } } add_to_variable = { ROOT.var_COM_mil_max_command_power = THIS.var_COM_mil_max_command_power_base } add_to_variable = { ROOT.var_COM_mil_army_org_factor = THIS.var_COM_mil_army_org_factor_base } add_to_variable = { ROOT.var_COM_mil_planning_speed = THIS.var_COM_mil_planning_speed_base } add_to_variable = { ROOT.var_COM_mil_air_escort_efficiency = THIS.var_COM_mil_air_escort_efficiency_base } add_to_variable = { ROOT.var_COM_mil_air_intercept_efficiency = THIS.var_COM_mil_air_intercept_efficiency_base } add_to_variable = { ROOT.var_COM_mil_naval_coordination = THIS.var_COM_mil_naval_coordination_base } } } if = { limit = { check_variable = { ROOT.COM_mil_access_array^num > 0 } } subtract_from_temp_variable = { temp_COM_mil_access_system_highest_idx = @COM_sat_idx_base } #max_command_power clamp_variable = { var = ROOT.var_COM_mil_max_command_power max = global.COM_mil_max_command_power_max_array^temp_COM_mil_access_system_highest_idx } #army_org_factor clamp_variable = { var = ROOT.var_COM_mil_army_org_factor max = global.COM_mil_army_org_factor_max_array^temp_COM_mil_access_system_highest_idx } #planning_speed clamp_variable = { var = ROOT.var_COM_mil_planning_speed max = global.COM_mil_planning_speed_max_array^temp_COM_mil_access_system_highest_idx } #air_escort_efficiency clamp_variable = { var = ROOT.var_COM_mil_air_escort_efficiency max = global.COM_mil_air_escort_efficiency_max_array^temp_COM_mil_access_system_highest_idx } #air_intercept_efficiency clamp_variable = { var = ROOT.var_COM_mil_air_intercept_efficiency max = global.COM_mil_air_intercept_efficiency_max_array^temp_COM_mil_access_system_highest_idx } #naval_coordination clamp_variable = { var = ROOT.var_COM_mil_naval_coordination max = global.COM_mil_naval_coordination_max_array^temp_COM_mil_access_system_highest_idx } } } } add_access_COM_civ_vars = { set_temp_variable = { temp_COM_civ_access_system_highest_idx = 0 } set_variable = { var_COM_civ_political_power_factor = var_COM_civ_political_power_factor_base } set_variable = { var_COM_civ_decryption_factor = var_COM_civ_decryption_factor_base } set_variable = { var_COM_civ_encryption_factor = var_COM_civ_encryption_factor_base } set_variable = { var_COM_civ_intel_network_gain_factor = var_COM_civ_intel_network_gain_factor_base } set_variable = { var_COM_civ_operation_outcome = var_COM_civ_operation_outcome_base } for_each_loop = { array = COM_civ_access_system_idx_array if = { limit = { check_variable = { COM_civ_access_system_idx_array^i > temp_COM_civ_access_system_highest_idx } } set_temp_variable = { temp_COM_civ_access_system_highest_idx = COM_civ_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_COM_civ_system_idx < temp_COM_civ_access_system_highest_idx } check_variable = { ROOT.var_COM_civ_system_idx = temp_COM_civ_access_system_highest_idx } } } for_each_scope_loop = { array = COM_civ_access_array if = { limit = { OR = { check_variable = { ROOT.var_COM_civ_system_idx < THIS.var_COM_civ_system_idx } check_variable = { ROOT.var_COM_civ_system_idx = THIS.var_COM_civ_system_idx } } } add_to_variable = { ROOT.var_COM_civ_political_power_factor = THIS.var_COM_civ_political_power_factor_base } add_to_variable = { ROOT.var_COM_civ_decryption_factor = THIS.var_COM_civ_decryption_factor_base } add_to_variable = { ROOT.var_COM_civ_encryption_factor = THIS.var_COM_civ_encryption_factor_base } add_to_variable = { ROOT.var_COM_civ_intel_network_gain_factor = THIS.var_COM_civ_intel_network_gain_factor_base } add_to_variable = { ROOT.var_COM_civ_operation_outcome = THIS.var_COM_civ_operation_outcome_base } } } if = { limit = { check_variable = { ROOT.COM_civ_access_array^num > 0 } } subtract_from_temp_variable = { temp_COM_civ_access_system_highest_idx = @COM_sat_idx_base } #political_power_factor clamp_variable = { var = ROOT.var_COM_civ_political_power_factor max = global.COM_civ_political_power_factor_max_array^temp_COM_civ_access_system_highest_idx } #decryption_factor clamp_variable = { var = ROOT.var_COM_civ_decryption_factor max = global.COM_civ_decryption_factor_max_array^temp_COM_civ_access_system_highest_idx } #encryption_factor clamp_variable = { var = ROOT.var_COM_civ_encryption_factor max = global.COM_civ_encryption_factor_max_array^temp_COM_civ_access_system_highest_idx } #intel_network_gain_factor clamp_variable = { var = ROOT.var_COM_civ_intel_network_gain_factor max = global.COM_civ_intel_network_gain_factor_max_array^temp_COM_civ_access_system_highest_idx } #operation_outcome clamp_variable = { var = ROOT.var_COM_civ_operation_outcome max = global.COM_civ_operation_outcome_max_array^temp_COM_civ_access_system_highest_idx } } } } add_access_SPY_mil_vars = { set_temp_variable = { temp_SPY_mil_access_system_highest_idx = 0 } set_variable = { var_SPY_mil_max_planning_factor = var_SPY_mil_max_planning_factor_base } set_variable = { var_SPY_mil_recon_factor = var_SPY_mil_recon_factor_base } set_variable = { var_SPY_mil_air_weather_penalty = var_SPY_mil_air_weather_penalty_base } set_variable = { var_SPY_mil_spotting_chance = var_SPY_mil_spotting_chance_base } set_variable = { var_SPY_mil_convoy_raiding_efficiency_factor = var_SPY_mil_convoy_raiding_efficiency_factor_base } set_variable = { var_SPY_mil_convoy_escort_efficiency = var_SPY_mil_convoy_escort_efficiency_base } for_each_loop = { array = SPY_mil_access_system_idx_array if = { limit = { check_variable = { SPY_mil_access_system_idx_array^i > temp_SPY_mil_access_system_highest_idx } } set_temp_variable = { temp_SPY_mil_access_system_highest_idx = SPY_mil_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_SPY_mil_system_idx < temp_SPY_mil_access_system_highest_idx } check_variable = { ROOT.var_SPY_mil_system_idx = temp_SPY_mil_access_system_highest_idx } } } for_each_scope_loop = { array = SPY_mil_access_array if = { limit = { OR = { check_variable = { ROOT.var_SPY_mil_system_idx < THIS.var_SPY_mil_system_idx } check_variable = { ROOT.var_SPY_mil_system_idx = THIS.var_SPY_mil_system_idx } } } add_to_variable = { ROOT.var_SPY_mil_max_planning_factor = THIS.var_SPY_mil_max_planning_factor_base } add_to_variable = { ROOT.var_SPY_mil_recon_factor = THIS.var_SPY_mil_recon_factor_base } add_to_variable = { ROOT.var_SPY_mil_air_weather_penalty = THIS.var_SPY_mil_air_weather_penalty_base } add_to_variable = { ROOT.var_SPY_mil_spotting_chance = THIS.var_SPY_mil_spotting_chance_base } add_to_variable = { ROOT.var_SPY_mil_convoy_raiding_efficiency_factor = THIS.var_SPY_mil_convoy_raiding_efficiency_factor_base } add_to_variable = { ROOT.var_SPY_mil_convoy_escort_efficiency = THIS.var_SPY_mil_convoy_escort_efficiency_base } } } if = { limit = { check_variable = { ROOT.SPY_mil_access_array^num > 0 } } subtract_from_temp_variable = { temp_SPY_mil_access_system_highest_idx = @SPY_sat_idx_base } #max_planning_factor clamp_variable = { var = ROOT.var_SPY_mil_max_planning_factor max = global.SPY_mil_max_planning_factor_max_array^temp_SPY_mil_access_system_highest_idx } #recon_factor clamp_variable = { var = ROOT.var_SPY_mil_recon_factor max = global.SPY_mil_recon_factor_max_array^temp_SPY_mil_access_system_highest_idx } #air_weather_penalty clamp_variable = { var = ROOT.var_SPY_mil_air_weather_penalty max = global.SPY_mil_air_weather_penalty_max_array^temp_SPY_mil_access_system_highest_idx } #spotting_chance clamp_variable = { var = ROOT.var_SPY_mil_spotting_chance max = global.SPY_mil_spotting_chance_max_array^temp_SPY_mil_access_system_highest_idx } #convoy_raiding_efficiency_factor clamp_variable = { var = ROOT.var_SPY_mil_convoy_raiding_efficiency_factor max = global.SPY_mil_convoy_raiding_efficiency_factor_max_array^temp_SPY_mil_access_system_highest_idx } #convoy_escort_efficiency clamp_variable = { var = ROOT.var_SPY_mil_convoy_escort_efficiency max = global.SPY_mil_convoy_escort_efficiency_max_array^temp_SPY_mil_access_system_highest_idx } } } } add_access_SPY_civ_vars = { set_temp_variable = { temp_SPY_civ_access_system_highest_idx = 0 } set_variable = { var_SPY_civ_research_speed_factor = var_SPY_civ_research_speed_factor_base } set_variable = { var_SPY_civ_civilian_intel_factor = var_SPY_civ_civilian_intel_factor_base } set_variable = { var_SPY_civ_army_intel_factor = var_SPY_civ_army_intel_factor_base } set_variable = { var_SPY_civ_navy_intel_factor = var_SPY_civ_navy_intel_factor_base } set_variable = { var_SPY_civ_airforce_intel_factor = var_SPY_civ_airforce_intel_factor_base } set_variable = { var_SPY_civ_root_out_resistance_effectiveness_factor = var_SPY_civ_root_out_resistance_effectiveness_factor_base } for_each_loop = { array = SPY_civ_access_system_idx_array if = { limit = { check_variable = { SPY_civ_access_system_idx_array^i > temp_SPY_civ_access_system_highest_idx } } set_temp_variable = { temp_SPY_civ_access_system_highest_idx = SPY_civ_access_system_idx_array^i } } } if = { limit = { OR = { check_variable = { ROOT.var_SPY_civ_system_idx < temp_SPY_civ_access_system_highest_idx } check_variable = { ROOT.var_SPY_civ_system_idx = temp_SPY_civ_access_system_highest_idx } } } for_each_scope_loop = { array = SPY_civ_access_array if = { limit = { OR = { check_variable = { ROOT.var_SPY_civ_system_idx < THIS.var_SPY_civ_system_idx } check_variable = { ROOT.var_SPY_civ_system_idx = THIS.var_SPY_civ_system_idx } } } add_to_variable = { ROOT.var_SPY_civ_research_speed_factor = THIS.var_SPY_civ_research_speed_factor_base } add_to_variable = { ROOT.var_SPY_civ_civilian_intel_factor = THIS.var_SPY_civ_civilian_intel_factor_base } add_to_variable = { ROOT.var_SPY_civ_army_intel_factor = THIS.var_SPY_civ_army_intel_factor_base } add_to_variable = { ROOT.var_SPY_civ_navy_intel_factor = THIS.var_SPY_civ_navy_intel_factor_base } add_to_variable = { ROOT.var_SPY_civ_airforce_intel_factor = THIS.var_SPY_civ_airforce_intel_factor_base } add_to_variable = { ROOT.var_SPY_civ_root_out_resistance_effectiveness_factor = THIS.var_SPY_civ_root_out_resistance_effectiveness_factor_base } } } if = { limit = { check_variable = { ROOT.SPY_civ_access_array^num > 0 } } subtract_from_temp_variable = { temp_SPY_civ_access_system_highest_idx = @SPY_sat_idx_base } #research_speed_factor clamp_variable = { var = ROOT.var_SPY_civ_research_speed_factor max = global.SPY_civ_research_speed_factor_max_array^temp_SPY_civ_access_system_highest_idx } #civilian_intel_factor clamp_variable = { var = ROOT.var_SPY_civ_civilian_intel_factor max = global.SPY_civ_civilian_intel_factor_max_array^temp_SPY_civ_access_system_highest_idx } #army_intel_factor clamp_variable = { var = ROOT.var_SPY_civ_army_intel_factor max = global.SPY_civ_army_intel_factor_max_array^temp_SPY_civ_access_system_highest_idx } #navy_intel_factor clamp_variable = { var = ROOT.var_SPY_civ_navy_intel_factor max = global.SPY_civ_navy_intel_factor_max_array^temp_SPY_civ_access_system_highest_idx } #airforce_intel_factor clamp_variable = { var = ROOT.var_SPY_civ_airforce_intel_factor max = global.SPY_civ_airforce_intel_factor_max_array^temp_SPY_civ_access_system_highest_idx } #root_out_resistance_effectiveness_factor clamp_variable = { var = ROOT.var_SPY_civ_root_out_resistance_effectiveness_factor max = global.SPY_civ_root_out_resistance_effectiveness_factor_max_array^temp_SPY_civ_access_system_highest_idx } } } } ######################## ### spy sat missions ### ROOT.spy_mission_array^num ######################## clear_spy_sat_mission_arrays = { for_each_loop = { array = ROOT.spy_mission_array var:ROOT.spy_mission_array^i = { if = { limit = { NOT = { has_country_flag = spy_sat_mission_from_@ROOT } } remove_from_array = { array = ROOT.spy_mission_array index = i } remove_from_array = { array = ROOT.spy_mission_sat_num_array index = i } } } } } ##################### ### space launch ### #################### set_OLV_display_array = { resize_array = { OLV_display_array = 0 } resize_array = { sat_payload_display_array = 0 } resize_array = { spp_payload_display_array = 0 } resize_array = { ASAT_display_array = 0 } resize_array = { KILLSAT_display_array = 0 } ### OLV1 add_to_array = { OLV_display_array = 101 } ### OLV2 add_to_array = { OLV_display_array = 102 } ### OLV3 add_to_array = { OLV_display_array = 103 } ### OLV4 add_to_array = { OLV_display_array = 104 } ### OLV5 add_to_array = { OLV_display_array = 105 } ### OLV6 add_to_array = { OLV_display_array = 106 } ### OLV7 add_to_array = { OLV_display_array = 107 } ### OLV8 add_to_array = { OLV_display_array = 108 } ### OLV9 add_to_array = { OLV_display_array = 109 } ### OLV10 add_to_array = { OLV_display_array = 110 } ### OLV11 add_to_array = { OLV_display_array = 111 } ### OLV12 add_to_array = { OLV_display_array = 112 } } set_sat_payload_display_array = { resize_array = { OLV_display_array = 0 } resize_array = { sat_payload_display_array = 0 } resize_array = { spp_payload_display_array = 0 } resize_array = { ASAT_display_array = 0 } resize_array = { KILLSAT_display_array = 0 } ### GNSS1 add_to_array = { sat_payload_display_array = 121 } ### GNSS2 add_to_array = { sat_payload_display_array = 122 } ### GNSS3 add_to_array = { sat_payload_display_array = 123 } ### GNSS4 add_to_array = { sat_payload_display_array = 124 } ### GNSS5 add_to_array = { sat_payload_display_array = 125 } ### GNSS6 add_to_array = { sat_payload_display_array = 126 } ### GNSS7 add_to_array = { sat_payload_display_array = 127 } ### GNSS8 add_to_array = { sat_payload_display_array = 128 } ### GNSS9 add_to_array = { sat_payload_display_array = 129 } ### GNSS10 add_to_array = { sat_payload_display_array = 130 } ### GNSS11 add_to_array = { sat_payload_display_array = 131 } ### GNSS12 add_to_array = { sat_payload_display_array = 132 } ### COMSAT1 add_to_array = { sat_payload_display_array = 141 } ### COMSAT2 add_to_array = { sat_payload_display_array = 142 } ### COMSAT3 add_to_array = { sat_payload_display_array = 143 } ### COMSAT4 add_to_array = { sat_payload_display_array = 144 } ### COMSAT5 add_to_array = { sat_payload_display_array = 145 } ### COMSAT6 add_to_array = { sat_payload_display_array = 146 } ### COMSAT7 add_to_array = { sat_payload_display_array = 147 } ### COMSAT8 add_to_array = { sat_payload_display_array = 148 } ### COMSAT9 add_to_array = { sat_payload_display_array = 149 } ### COMSAT10 add_to_array = { sat_payload_display_array = 150 } ### COMSAT11 add_to_array = { sat_payload_display_array = 151 } ### COMSAT12 add_to_array = { sat_payload_display_array = 152 } ### SPYSAT1 add_to_array = { sat_payload_display_array = 161 } ### SPYSAT2 add_to_array = { sat_payload_display_array = 162 } ### SPYSAT3 add_to_array = { sat_payload_display_array = 163 } ### SPYSAT4 add_to_array = { sat_payload_display_array = 164 } ### SPYSAT5 add_to_array = { sat_payload_display_array = 165 } ### SPYSAT6 add_to_array = { sat_payload_display_array = 166 } ### SPYSAT7 add_to_array = { sat_payload_display_array = 167 } ### SPYSAT8 add_to_array = { sat_payload_display_array = 168 } ### SPYSAT9 add_to_array = { sat_payload_display_array = 169 } ### SPYSAT11 add_to_array = { sat_payload_display_array = 170 } ### SPYSAT11 add_to_array = { sat_payload_display_array = 171 } ### SPYSAT12 add_to_array = { sat_payload_display_array = 172 } ### KILLSAT1 add_to_array = { sat_payload_display_array = 181 } ### KILLSAT2 add_to_array = { sat_payload_display_array = 182 } ### KILLSAT3 add_to_array = { sat_payload_display_array = 183 } ### KILLSAT4 add_to_array = { sat_payload_display_array = 184 } ### KILLSAT5 add_to_array = { sat_payload_display_array = 185 } ### KILLSAT6 add_to_array = { sat_payload_display_array = 186 } ### KILLSAT7 add_to_array = { sat_payload_display_array = 187 } ### KILLSAT8 add_to_array = { sat_payload_display_array = 188 } ### KILLSAT9 add_to_array = { sat_payload_display_array = 189 } ### KILLSAT10 add_to_array = { sat_payload_display_array = 190 } } set_spp_payload_display_array = { resize_array = { OLV_display_array = 0 } resize_array = { sat_payload_display_array = 0 } resize_array = { spp_payload_display_array = 0 } resize_array = { ASAT_display_array = 0 } resize_array = { KILLSAT_display_array = 0 } ### SPP0 add_to_array = { spp_payload_display_array = 1000 } ### SPP1 add_to_array = { spp_payload_display_array = 1001 } ### SPP2 add_to_array = { spp_payload_display_array = 1002 } } set_ASAT_display_array = { resize_array = { OLV_display_array = 0 } resize_array = { sat_payload_display_array = 0 } resize_array = { spp_payload_display_array = 0 } resize_array = { ASAT_display_array = 0 } resize_array = { KILLSAT_display_array = 0 } } set_KILLSAT_display_array = { resize_array = { OLV_display_array = 0 } resize_array = { sat_payload_display_array = 0 } resize_array = { spp_payload_display_array = 0 } resize_array = { ASAT_display_array = 0 } resize_array = { KILLSAT_display_array = 0 } ### KILLSAT1 add_to_array = { KILLSAT_display_array = 181 } ### KILLSAT2 add_to_array = { KILLSAT_display_array = 182 } ### KILLSAT3 add_to_array = { KILLSAT_display_array = 183 } ### KILLSAT4 add_to_array = { KILLSAT_display_array = 184 } ### KILLSAT5 add_to_array = { KILLSAT_display_array = 185 } ### KILLSAT6 add_to_array = { KILLSAT_display_array = 186 } ### KILLSAT7 add_to_array = { KILLSAT_display_array = 187 } ### KILLSAT8 add_to_array = { KILLSAT_display_array = 188 } ### KILLSAT9 add_to_array = { KILLSAT_display_array = 189 } ### KILLSAT10 add_to_array = { KILLSAT_display_array = 190 } } clear_payload_types = { ROOT = { clear_variable = var_launch_mass clear_array = payload_types_array add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } } } ################## ### OLV launch ### ################## launch_OLV = { clear_array = payload_array subtract_from_variable = { missile_inventory_array^var_OLV_type = ROOT.var_OLV_flights } while_loop_effect = { limit = { check_variable = { var_OLV_flights > 0 } check_variable = { var_OLV_inventory > 0 } } subtract_from_variable = { ROOT.var_OLV_flights = 1 } subtract_from_variable = { ROOT.var_OLV_inventory = 1 } add_to_variable = { var_orbital_launch_total = 1 } randomize_variable = { # Random roll for OLV launch success check var = var_OLV_trajectory distribution = uniform min = 0 max = 1 } if = { limit = { OR = { check_variable = { ROOT.var_OLV_reliability > ROOT.var_OLV_trajectory } check_variable = { ROOT.var_OLV_reliability = ROOT.var_OLV_trajectory } } } add_to_variable = { ROOT.var_orbital_launch_success = 1 } for_each_loop = { array = payload_types_array if = { limit = { check_variable = { payload_types_array^i > 999 } } if = { limit = { check_variable = { spp_inventory_array^i > 0 } } subtract_from_variable = { spp_inventory_array^i = 1 } add_to_variable = { ROOT.var_spp_payload_delivered = 1 } set_temp_variable = { temp_sppID = { value = payload_types_array^i subtract = 1000 } } add_to_variable = { ROOT.spp_orbit_array^temp_sppID = 1 } } } else_if = { limit = { NOT = { check_variable = { payload_types_array^i = 1 } } } if = { limit = { set_temp_variable = { temp1 = payload_types_array^i } check_variable = { missile_inventory_array^temp1 > 0 } } subtract_from_variable = { missile_inventory_array^temp1 = 1 } add_to_array = { payload_array = temp1 } add_to_variable = { ROOT.var_sat_payload_delivered = 1 } } } } } else = { add_to_variable = { ROOT.var_orbital_launch_fail = 1 } for_each_loop = { array = payload_types_array if = { limit = { check_variable = { payload_types_array^i > 999 } } if = { limit = { check_variable = { spp_inventory_array^i > 0 } } subtract_from_variable = { spp_inventory_array^i = 1 } add_to_variable = { ROOT.var_spp_payload_lost = 1 } } } else_if = { limit = { NOT = { check_variable = { payload_types_array^i = 1 } } } if = { limit = { set_temp_variable = { temp1 = payload_types_array^i } check_variable = { missile_inventory_array^temp1 > 0 } } subtract_from_variable = { missile_inventory_array^payload_types_array^i = 1 } add_to_variable = { ROOT.var_sat_payload_lost = 1 } } } } } } resize_array = { payload_array = ROOT.var_sat_payload_delivered } add_satellite_from_payload = yes clear_payload_types = yes } ######################## ### satellite launch ### ######################## add_satellite_from_payload = { resize_array = { GNSS_satellite_array = 12 } resize_array = { COM_satellite_array = 12 } resize_array = { SPY_satellite_array = 12 } resize_array = { KILL_satellite_array = 10 } set_satellites_gui = yes set_temp_variable = { sat_active_total = { value = var_GNSS_sat_total add = var_COM_sat_total add = var_SPY_sat_total add = var_KILL_sat_total } } set_temp_variable = { sat_limit_reported = 0 } for_each_loop = { array = payload_array set_temp_variable = { payload_id = payload_array^i } if = { limit = { check_variable = { sat_active_total < 3000 } } if = { limit = { check_variable = { payload_id > 120 } check_variable = { payload_id < 133 } } set_temp_variable = { sat_idx = { value = payload_id subtract = @GNSS_sat_idx_base } } add_to_variable = { GNSS_satellite_array^sat_idx = 1 } add_to_array = { orbit_array = payload_id } set_variable = { var_orbit_display_ID = { value = orbit_array^num subtract = 1 } } add_new_satellite_to_orbit = yes add_to_temp_variable = { sat_active_total = 1 } } else_if = { limit = { check_variable = { payload_id > 140 } check_variable = { payload_id < 153 } } set_temp_variable = { sat_idx = { value = payload_id subtract = @COM_sat_idx_base } } add_to_variable = { COM_satellite_array^sat_idx = 1 } add_to_array = { orbit_array = payload_id } set_variable = { var_orbit_display_ID = { value = orbit_array^num subtract = 1 } } add_new_satellite_to_orbit = yes add_to_temp_variable = { sat_active_total = 1 } } else_if = { limit = { check_variable = { payload_id > 160 } check_variable = { payload_id < 173 } } set_temp_variable = { sat_idx = { value = payload_id subtract = @SPY_sat_idx_base } } add_to_variable = { SPY_satellite_array^sat_idx = 1 } add_to_array = { orbit_array = payload_id } set_variable = { var_orbit_display_ID = { value = orbit_array^num subtract = 1 } } add_new_satellite_to_orbit = yes add_to_temp_variable = { sat_active_total = 1 } } else_if = { limit = { check_variable = { payload_id > 180 } check_variable = { payload_id < 191 } } set_temp_variable = { sat_idx = { value = payload_id subtract = @KILLSAT_sat_idx_base } } add_to_variable = { KILL_satellite_array^sat_idx = 1 } add_to_array = { orbit_array = payload_id } set_variable = { var_orbit_display_ID = { value = orbit_array^num subtract = 1 } } add_new_satellite_to_orbit = yes add_to_temp_variable = { sat_active_total = 1 } } } else_if = { limit = { check_variable = { sat_limit_reported = 0 } } ROOT = { news_event = satellites.8 } set_temp_variable = { sat_limit_reported = 1 } } } set_satellites_gui = yes clear_array = payload_array refresh_bulk_deorbit_state = yes } ################################### ### MD_satellite_orbit_view_gui ### ################################### set_sat_orbit_startup = { set_temp_variable = { temp1 = 0 } while_loop_effect = { limit = { check_variable = { temp1 < 180 } } add_to_array = { sat_1_array = -1 } add_to_temp_variable = { temp1 = 1 } } set_temp_variable = { temp2 = 0 } while_loop_effect = { limit = { check_variable = { temp2 < 400 } } add_to_array = { sat_2_array = -1 } add_to_temp_variable = { temp2 = 1 } } set_temp_variable = { temp3 = 0 } while_loop_effect = { limit = { check_variable = { temp3 < 336 } } add_to_array = { sat_3_array = -1 } add_to_temp_variable = { temp3 = 1 } } set_temp_variable = { temp4 = 0 } while_loop_effect = { limit = { check_variable = { temp4 < 400 } } add_to_array = { sat_4_array = -1 } add_to_temp_variable = { temp4 = 1 } } set_temp_variable = { temp5 = 0 } while_loop_effect = { limit = { check_variable = { temp5 < 180 } } add_to_array = { sat_5_array = -1 } add_to_temp_variable = { temp5 = 1 } } } add_new_satellite_to_orbit = { if = { limit = { OR = { check_variable = { var_orbit = 3 } check_variable = { var_orbit = 0 } } } if = { limit = { any_of = { array = sat_3_array check_variable = { v = -1 } } check_variable = { sat_3_array^num > 335 } check_variable = { sat_6_array^num > 0 } } set_variable = { sat_3_array^i = var_orbit_display_ID } } else_if = { limit = { all_of = { array = sat_3_array check_variable = { v > -1 } } check_variable = { sat_3_array^num > 335 } } add_new_satellite_to_orbit_6 = yes } else = { add_new_satellite_to_orbit_3 = yes } set_variable = { var_orbit = 2 } } else_if = { limit = { check_variable = { var_orbit = 2 } } if = { limit = { any_of = { array = sat_2_array check_variable = { v = -1 } } check_variable = { sat_2_array^num > 399 } check_variable = { sat_6_array^num > 0 } } set_variable = { sat_2_array^i = var_orbit_display_ID } } else_if = { limit = { all_of = { array = sat_2_array check_variable = { v > -1 } } check_variable = { sat_2_array^num > 399 } } add_new_satellite_to_orbit_6 = yes } else = { add_new_satellite_to_orbit_2 = yes } set_variable = { var_orbit = 4 } } else_if = { limit = { check_variable = { var_orbit = 4 } } if = { limit = { any_of = { array = sat_4_array check_variable = { v = -1 } } check_variable = { sat_4_array^num > 399 } check_variable = { sat_6_array^num > 0 } } set_variable = { sat_4_array^i = var_orbit_display_ID } } else_if = { limit = { all_of = { array = sat_4_array check_variable = { v > -1 } } check_variable = { sat_4_array^num > 399 } } add_new_satellite_to_orbit_6 = yes } else = { add_new_satellite_to_orbit_4 = yes } set_variable = { var_orbit = 1 } } else_if = { limit = { check_variable = { var_orbit = 1 } } if = { limit = { any_of = { array = sat_1_array check_variable = { v = -1 } } check_variable = { sat_1_array^num > 179 } check_variable = { sat_6_array^num > 0 } } set_variable = { sat_1_array^i = var_orbit_display_ID } } else_if = { limit = { all_of = { array = sat_1_array check_variable = { v > -1 } } check_variable = { sat_1_array^num > 179 } } add_new_satellite_to_orbit_6 = yes } else = { add_new_satellite_to_orbit_1 = yes } set_variable = { var_orbit = 5 } } else_if = { limit = { check_variable = { var_orbit = 5 } } if = { limit = { any_of = { array = sat_5_array check_variable = { v = -1 } } check_variable = { sat_5_array^num > 179 } check_variable = { sat_6_array^num > 0 } } set_variable = { sat_5_array^i = var_orbit_display_ID } } else_if = { limit = { all_of = { array = sat_5_array check_variable = { v > -1 } } check_variable = { sat_5_array^num > 179 } } add_new_satellite_to_orbit_6 = yes } else = { add_new_satellite_to_orbit_5 = yes } set_variable = { var_orbit = 3 } } } add_new_satellite_to_orbit_1 = { if = { limit = { check_variable = { add_minus_X1 < add_plus_X1 } } add_to_variable = { add_minus_X1 = 1 } set_temp_variable = { temp1 = { value = 90 subtract = add_minus_X1 } } } else = { set_temp_variable = { temp1 = { value = 90 add = add_plus_X1 } } add_to_variable = { add_plus_X1 = 1 } } set_variable = { sat_1_array^temp1 = var_orbit_display_ID } } add_new_satellite_to_orbit_2 = { if = { limit = { check_variable = { add_minus_X2 < add_plus_X2 } } add_to_variable = { add_minus_X2 = 1 } set_temp_variable = { temp2 = { value = 180 subtract = add_minus_X2 } } } else = { set_temp_variable = { temp2 = { value = 180 add = add_plus_X2 } } add_to_variable = { add_plus_X2 = 1 } } set_variable = { sat_2_array^temp2 = var_orbit_display_ID } } add_new_satellite_to_orbit_3 = { if = { limit = { check_variable = { add_minus_X3 < add_plus_X3 } } add_to_variable = { add_minus_X3 = 1 } set_temp_variable = { temp3 = { value = 147 subtract = add_minus_X3 } } } else = { set_temp_variable = { temp3 = { value = 147 add = add_plus_X3 } } add_to_variable = { add_plus_X3 = 1 } } set_variable = { sat_3_array^temp3 = var_orbit_display_ID } } add_new_satellite_to_orbit_4 = { if = { limit = { check_variable = { add_minus_X4 < add_plus_X4 } } add_to_variable = { add_minus_X4 = 1 } set_temp_variable = { temp4 = { value = 180 subtract = add_minus_X4 } } } else = { set_temp_variable = { temp4 = { value = 180 add = add_plus_X4 } } add_to_variable = { add_plus_X4 = 1 } } set_variable = { sat_4_array^temp4 = var_orbit_display_ID } } add_new_satellite_to_orbit_5 = { if = { limit = { check_variable = { add_minus_X5 < add_plus_X5 } } add_to_variable = { add_minus_X5 = 1 } set_temp_variable = { temp5 = { value = 90 subtract = add_minus_X5 } } } else = { set_temp_variable = { temp5 = { value = 90 add = add_plus_X5 } } add_to_variable = { add_plus_X5 = 1 } } set_variable = { sat_5_array^temp5 = var_orbit_display_ID } } add_new_satellite_to_orbit_6 = { if = { limit = { all_of = { array = sat_6_array check_variable = { v > 0 } } check_variable = { sat_6_array^num > 1503 } } ROOT = { news_event = satellites.8 } } else = { add_to_array = { sat_6_array = var_orbit_display_ID } #add_to_array = { sat_6_array = 1 } } } ############################## ### anti satellite weapons ### ############################## remove_satellite_from_orbit = { for_each_loop = { array = THIS.sat_1_array if = { limit = { check_variable = { sat_1_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_1_array^i = -1 } } } for_each_loop = { array = THIS.sat_2_array if = { limit = { check_variable = { sat_2_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_2_array^i = -1 } } } for_each_loop = { array = THIS.sat_3_array if = { limit = { check_variable = { sat_3_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_3_array^i = -1 } } } for_each_loop = { array = THIS.sat_4_array if = { limit = { check_variable = { sat_4_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_4_array^i = -1 } } } for_each_loop = { array = THIS.sat_5_array if = { limit = { check_variable = { sat_5_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_5_array^i = -1 } } } for_each_loop = { array = THIS.sat_6_array if = { limit = { check_variable = { sat_6_array^i = var_sat_ID } } set_variable = { orbit_array^var_sat_ID = 0 } set_variable = { sat_6_array^i = -1 } } } } remove_satellite_from_system = { var:tempTAG = { set_temp_variable = { sat_id = orbit_array^var_sat_ID } if = { limit = { check_variable = { sat_id > 120 } check_variable = { sat_id < 133 } } set_temp_variable = { sat_idx = { value = sat_id subtract = @GNSS_sat_idx_base } } subtract_from_variable = { GNSS_satellite_array^sat_idx = 1 } } else_if = { limit = { check_variable = { sat_id > 140 } check_variable = { sat_id < 153 } } set_temp_variable = { sat_idx = { value = sat_id subtract = @COM_sat_idx_base } } subtract_from_variable = { COM_satellite_array^sat_idx = 1 } } else_if = { limit = { check_variable = { sat_id > 160 } check_variable = { sat_id < 173 } } set_temp_variable = { sat_idx = { value = sat_id subtract = @SPY_sat_idx_base } } subtract_from_variable = { SPY_satellite_array^sat_idx = 1 } } else_if = { limit = { check_variable = { sat_id > 180 } check_variable = { sat_id < 191 } } set_temp_variable = { sat_idx = { value = sat_id subtract = @KILLSAT_sat_idx_base } } subtract_from_variable = { KILL_satellite_array^sat_idx = 1 } } } } remove_deorbited_satellite_target_references = { for_each_loop = { array = global.countries value = targeting_country var:targeting_country = { set_temp_variable = { target_index = { value = sat_target_array^num subtract = 1 } } while_loop_effect = { limit = { check_variable = { target_index > -1 } } set_temp_variable = { target_slot = sat_target_array^target_index } if = { limit = { check_variable = { sat_target_TAG_array^target_index = ROOT.id } OR = { AND = { check_variable = { ROOT.MD_remove_all_zeroed_deorbit_targets = 0 } check_variable = { target_slot = ROOT.var_sat_ID } } AND = { check_variable = { ROOT.MD_remove_all_zeroed_deorbit_targets = 1 } check_variable = { ROOT.orbit_array^target_slot = 0 } } } } remove_from_array = { array = sat_target_TAG_array index = target_index } remove_from_array = { array = sat_target_array index = target_index } } subtract_from_temp_variable = { target_index = 1 } } } } } remove_deorbited_satellite_target_reference = { set_temp_variable = { MD_remove_all_zeroed_deorbit_targets = 0 } remove_deorbited_satellite_target_references = yes } remove_bulk_deorbited_satellite_target_references = { set_temp_variable = { MD_remove_all_zeroed_deorbit_targets = 1 } remove_deorbited_satellite_target_references = yes } clear_bulk_deorbit_state = { clear_variable = MD_bulk_deorbit_model clear_variable = MD_bulk_deorbit_count clr_country_flag = MD_confirm_bulk_deorbit_satellites } clear_satellite_deorbit_state = { clear_variable = var_deorbit_sat_ID clr_country_flag = MD_confirm_deorbit_satellite clear_bulk_deorbit_state = yes clr_country_flag = MD_satellite_orbit_selection_active } start_satellite_deorbit_selection = { clear_satellite_deorbit_state = yes set_country_flag = MD_satellite_orbit_selection_active } finish_satellite_deorbit = { clear_variable = var_selected_sat clear_satellite_deorbit_state = yes country_event = satellites.9 } refresh_bulk_deorbit_state = { if = { limit = { has_country_flag = MD_confirm_bulk_deorbit_satellites } set_variable = { MD_bulk_deorbit_count = 0 } for_each_loop = { array = orbit_array if = { limit = { check_variable = { v = MD_bulk_deorbit_model } check_variable = { v > 0 } } add_to_variable = { MD_bulk_deorbit_count = 1 } } } if = { limit = { check_variable = { MD_bulk_deorbit_count < 1 } } clear_bulk_deorbit_state = yes } international_systems_update = yes } } deorbit_selected_satellite = { set_variable = { tempTAG = ROOT.id } set_variable = { var_sat_ID = var_deorbit_sat_ID } remove_satellite_from_system = yes remove_satellite_from_orbit = yes remove_deorbited_satellite_target_reference = yes finish_satellite_deorbit = yes } stage_bulk_deorbit_selected_model = { set_variable = { MD_bulk_deorbit_model = orbit_array^var_selected_sat } set_country_flag = MD_confirm_bulk_deorbit_satellites clr_country_flag = MD_confirm_deorbit_satellite refresh_bulk_deorbit_state = yes } bulk_deorbit_selected_model = { refresh_bulk_deorbit_state = yes if = { limit = { check_variable = { MD_bulk_deorbit_count > 0 } OR = { check_variable = { MD_bulk_deorbit_model < @SPY_sat_idx_base } check_variable = { MD_bulk_deorbit_model > @SPY_sat_idx_top } check_variable = { var = MD_bulk_deorbit_count value = var_SPY_mission_num_available compare = less_than_or_equals } } } set_variable = { tempTAG = ROOT.id } for_each_loop = { array = orbit_array if = { limit = { check_variable = { v = MD_bulk_deorbit_model } check_variable = { v > 0 } } set_variable = { var_sat_ID = i } remove_satellite_from_system = yes remove_satellite_from_orbit = yes } } remove_bulk_deorbited_satellite_target_references = yes } finish_satellite_deorbit = yes } advanced_filter_effect = { if = { limit = { check_variable = { sat_disp_num = 1 } } if = { limit = { check_variable = { spec_filter = 0 } } set_variable = { spec_filter = @GNSS_sat_idx_base } } else = { add_to_variable = { spec_filter = 1 } if = { limit = { check_variable = { spec_filter > @GNSS_sat_idx_top } } set_variable = { spec_filter = 0 } } } } if = { limit = { check_variable = { sat_disp_num = 2 } } if = { limit = { check_variable = { spec_filter = 0 } } set_variable = { spec_filter = @COM_sat_idx_base } } else = { add_to_variable = { spec_filter = 1 } if = { limit = { check_variable = { spec_filter > @COM_sat_idx_top } } set_variable = { spec_filter = 0 } } } } if = { limit = { check_variable = { sat_disp_num = 3 } } if = { limit = { check_variable = { spec_filter = 0 } } set_variable = { spec_filter = @SPY_sat_idx_base } } else = { add_to_variable = { spec_filter = 1 } if = { limit = { check_variable = { spec_filter > @SPY_sat_idx_top } } set_variable = { spec_filter = 0 } } } } } target_all_filtered_sats = { var:orbit_selected_TAG = { if = { limit = { check_variable = { ROOT.sat_disp_num = 0 } } target_all_sats = yes } if = { limit = { check_variable = { ROOT.sat_disp_num = 1 } } set_temp_variable = { target_range_min = 120 } set_temp_variable = { target_range_max = 139 } target_sat_type = yes } if = { limit = { check_variable = { ROOT.sat_disp_num = 2 } } set_temp_variable = { target_range_min = 140 } set_temp_variable = { target_range_max = 159 } target_sat_type = yes } if = { limit = { check_variable = { ROOT.sat_disp_num = 3 } } set_temp_variable = { target_range_min = 160 } set_temp_variable = { target_range_max = 179 } target_sat_type = yes } } } target_sat_type = { for_each_loop = { array = sat_1_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } for_each_loop = { array = sat_2_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } for_each_loop = { array = sat_3_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } for_each_loop = { array = sat_4_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } for_each_loop = { array = sat_5_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } for_each_loop = { array = sat_6_array value = v if = { limit = { check_variable = { ROOT.spec_filter = 0 } } set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx > target_range_min } check_variable = { orbit_array^gfx_idx < target_range_max } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } else = { set_temp_variable = { gfx_idx = v } if = { limit = { check_variable = { orbit_array^gfx_idx = ROOT.spec_filter } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } } target_all_sats = { for_each_loop = { array = sat_1_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } for_each_loop = { array = sat_2_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } for_each_loop = { array = sat_3_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } for_each_loop = { array = sat_4_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } for_each_loop = { array = sat_5_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } for_each_loop = { array = sat_6_array value = v index = i if = { limit = { NOT = { check_variable = { v = -1 } } } add_to_array = { ROOT.sat_target_array = v } add_to_array = { ROOT.sat_target_TAG_array = orbit_selected_TAG } } } } anti_satellite_weapon_use = { for_each_loop = { array = sat_target_array set_variable = { ROOT.var_sat_orbit = 0 } set_variable = { tempTAG = ROOT.sat_target_TAG_array^i } while_loop_effect = { limit = { check_variable = { ROOT.var_anti_satellite_weapon_num > 0 } check_variable = { ROOT.sat_target_array^i > 0 } } randomize_variable = { var = ROOT.var_sat_orbit distribution = uniform min = 0 max = 1 } subtract_from_variable = { ROOT.var_anti_satellite_weapon_num = 1 } if = { limit = { OR = { check_variable = { ROOT.var_anti_sat_accuracy > ROOT.var_sat_orbit } check_variable = { ROOT.var_anti_sat_accuracy = ROOT.var_sat_orbit } } } add_to_variable = { ROOT.var_sat_hit = 1 } var:tempTAG = { set_variable = { var_sat_ID = ROOT.sat_target_array^i } remove_satellite_from_system = yes remove_satellite_from_orbit = yes set_variable = { ROOT.sat_target_array^i = 0 } add_to_variable = { var_sat_lost = 1 } } } else = { add_to_variable = { ROOT.var_sat_miss = 1 } } } var:tempTAG = { refresh_bulk_deorbit_state = yes country_event = satellites.9 } } clear_array = ROOT.sat_target_array clear_array = ROOT.sat_target_TAG_array if = { limit = { check_variable = { ROOT.var_anti_satellite_weapon_num > 0 } } add_to_variable = { ROOT.var_sat_miss = ROOT.var_anti_satellite_weapon_num } set_variable = { ROOT.var_anti_satellite_weapon_num = 0 } } } #remove used killer satellites remove_killsat_used = { while_loop_effect = { limit = { check_variable = { ROOT.var_KILLSAT_salvo > 0 } } for_each_loop = { array = orbit_array if = { limit = { check_variable = { ROOT.orbit_array^i = ROOT.var_KILLSAT_type } } set_variable = { ROOT.var_killsat_fired = i } } } set_variable = { tempTAG = ROOT.id } ROOT = { set_variable = { var_sat_ID = ROOT.var_killsat_fired } remove_satellite_from_system = yes remove_satellite_from_orbit = yes } subtract_from_variable = { ROOT.var_KILLSAT_salvo = 1 } } set_satellites_gui = yes set_variable = { var_KILLSAT_orbit = KILL_satellite_array^var_KILLSAT_type } refresh_bulk_deorbit_state = yes } ### right container # sat access arrays set_sat_access_arrays_selected_TAG = { clear_array = selected_TAG_GNSS_mil_access_array clear_array = selected_TAG_GNSS_civ_access_array clear_array = selected_TAG_COM_mil_access_array clear_array = selected_TAG_COM_civ_access_array clear_array = selected_TAG_SPY_mil_access_array clear_array = selected_TAG_SPY_civ_access_array var:orbit_selected_TAG = { for_each_loop = { array = GNSS_mil_access_array add_to_array = { ROOT.selected_TAG_GNSS_mil_access_array = v } } for_each_loop = { array = GNSS_civ_access_array add_to_array = { ROOT.selected_TAG_GNSS_civ_access_array = v } } for_each_loop = { array = COM_mil_access_array add_to_array = { ROOT.selected_TAG_COM_mil_access_array = v } } for_each_loop = { array = COM_civ_access_array add_to_array = { ROOT.selected_TAG_COM_civ_access_array = v } } for_each_loop = { array = SPY_mil_access_array add_to_array = { ROOT.selected_TAG_SPY_mil_access_array = v } } for_each_loop = { array = SPY_civ_access_array add_to_array = { ROOT.selected_TAG_SPY_civ_access_array = v } } } } # set_temp_variable = { tag_to_grab = TAG.id } update_missile_satellite_inventory = { for_each_loop = { array = missile_inventory_array value = v index = i add_to_variable = { missile_inventory_array^i = var:tag_to_grab.missile_inventory_array^i } } for_each_loop = { array = GNSS_satellite_array value = v index = i add_to_variable = { GNSS_satellite_array^i = var:tag_to_grab.GNSS_satellite_array^i } } for_each_loop = { array = COM_satellite_array value = v index = i add_to_variable = { COM_satellite_array^i = var:tag_to_grab.COM_satellite_array^i } } for_each_loop = { array = SPY_satellite_array value = v index = i add_to_variable = { SPY_satellite_array^i = var:tag_to_grab.SPY_satellite_array^i } } } # Documentation on how the Nuclear Production System works # Notable Variables: # var_enrichment_grade_factor: This is used to control how many civilian industry is required per enrichment level # var_enrichment_nuclear_energy_prod_factor: This is used to determine how much Reactor-grade produced per tick # var_enrichment_nuclear_material_prod_factor: This is used to determine how much Weapons-grade produced per tick # Function: nuclear_reactor_fuel_consumption # Purpose: This subtracts reactor grade material from the stockpile based on number of reactors nuclear_reactor_fuel_consumption = { #consumption calculated in energy effects set_variable = { var_reactor_material_stockpile = { value = var_reactor_material_stockpile subtract = nuclear_fuel_consumption clamp = { min = 0 max = 20000000 } add = total_nuclear_reactor_fuel_production clamp = { min = 0 max = 20000000 } } } } # Utilities add_missile_building_level = { set_temp_variable = { num_launcher_set_temp = { value = num_launchers_set add = 1 } } set_temp_variable = { num_launcher_set_temp_total = { value = num_launcher_set_temp multiply = 50 } } custom_effect_tooltip = add_missile_building_level_tt hidden_effect = { add_to_variable = { num_launchers_set = 1 } if = { limit = { check_variable = { num_launchers_set = 1 } } set_technology = { hid_tech_missile_1 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 2 } } set_technology = { hid_tech_missile_2 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 3 } } set_technology = { hid_tech_missile_3 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 4 } } set_technology = { hid_tech_missile_4 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 5 } } set_technology = { hid_tech_missile_5 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 6 } } set_technology = { hid_tech_missile_6 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 7 } } set_technology = { hid_tech_missile_7 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 8 } } set_technology = { hid_tech_missile_8 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 9 } } set_technology = { hid_tech_missile_9 = 1 popup = no } } if = { limit = { check_variable = { num_launchers_set = 10 } } set_technology = { hid_tech_missile_10 = 1 popup = no } } } } setup_missile_configuration_effect = { if = { limit = { NOT = { has_country_flag = setup_missiles } } set_country_flag = setup_missiles set_variable = { orbit_selected_TAG = THIS.id } set_variable = { total_nuclear_reactor_fuel_production = 0 } resize_array = { missile_inventory_array = 191 } add_dynamic_modifier = { modifier = satellite_system } set_sat_orbit_startup = yes # Configuration for Starting Payload Types clear_variable = var_launch_mass clear_array = payload_types_array add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } add_to_array = { payload_types_array = 1 } add_to_array = { array = spp_inventory_array value = 1 index = 0 } add_to_array = { array = spp_inventory_array value = 30 index = 1 } add_to_array = { array = spp_inventory_array value = 1 index = 2 } # Init the Systems GNSS_mil_button_update = yes GNSS_civ_button_update = yes COM_mil_button_update = yes COM_civ_button_update = yes SPY_mil_button_update = yes SPY_civ_button_update = yes #for testing network traffic set_COM_sat_receiver_tech_array = yes } international_systems_update = yes } GNSS_mil_button_update = { set_variable = { var_GNSS_mil_system_idx = GNSS_mil_systems_array^i } set_variable = { var_GNSS_mil_sat_system_max = global.GNSS_sat_system_max_array^i } set_variable = { var_GNSS_mil_army_speed_factor = GNSS_mil_army_speed_factor_array^i } set_variable = { var_GNSS_mil_air_cas_efficiency = GNSS_mil_air_cas_efficiency_array^i } set_variable = { var_GNSS_mil_air_nav_efficiency = GNSS_mil_air_nav_efficiency_array^i } set_variable = { var_GNSS_mil_air_strategic_bomber_bombing_factor = GNSS_mil_air_strategic_bomber_bombing_factor_array^i } set_variable = { var_GNSS_mil_positioning = GNSS_mil_positioning_array^i } set_variable = { var_GNSS_mil_naval_hit_chance = GNSS_mil_naval_hit_chance_array^i } update_GNSS_system_stats = yes calculate_GNSS_mil_gui_vars = yes clear_array = GNSS_mil_systems_array } GNSS_civ_button_update = { set_variable = { var_GNSS_civ_system_idx = GNSS_civ_systems_array^i } set_variable = { var_GNSS_civ_sat_system_max = global.GNSS_sat_system_max_array^i } set_variable = { var_GNSS_civ_production_speed_buildings_factor = GNSS_civ_production_speed_buildings_factor_array^i } set_variable = { var_GNSS_civ_production_speed_infrastructure_factor = GNSS_civ_production_speed_infrastructure_factor_array^i } set_variable = { var_GNSS_civ_local_resources_factor = GNSS_civ_local_resources_factor_array^i } update_GNSS_system_stats = yes calculate_GNSS_civ_gui_vars = yes clear_array = GNSS_civ_systems_array } COM_mil_button_update = { set_variable = { var_COM_mil_system_idx = COM_mil_systems_array^i } set_variable = { var_COM_mil_sat_system_max = global.COM_sat_system_max_array^i } set_variable = { var_COM_mil_max_command_power = COM_mil_max_command_power_array^i } set_variable = { var_COM_mil_army_org_factor = COM_mil_army_org_factor_array^i } set_variable = { var_COM_mil_planning_speed = COM_mil_planning_speed_array^i } set_variable = { var_COM_mil_air_escort_efficiency = COM_mil_air_escort_efficiency_array^i } set_variable = { var_COM_mil_air_intercept_efficiency = COM_mil_air_intercept_efficiency_array^i } set_variable = { var_COM_mil_naval_coordination = COM_mil_naval_coordination_array^i } update_COM_system_stats = yes calculate_COM_mil_gui_vars = yes clear_array = COM_mil_systems_array } COM_civ_button_update = { set_variable = { var_COM_civ_system_idx = COM_civ_systems_array^i } set_variable = { var_COM_civ_sat_system_max = global.COM_sat_system_max_array^i } set_variable = { var_COM_civ_political_power_factor = COM_civ_political_power_factor_array^i } set_variable = { var_COM_civ_decryption_factor = COM_civ_decryption_factor_array^i } set_variable = { var_COM_civ_encryption_factor = COM_civ_encryption_factor_array^i } set_variable = { var_COM_civ_intel_network_gain_factor = COM_civ_intel_network_gain_factor_array^i } set_variable = { var_COM_civ_operation_outcome = COM_civ_operation_outcome_array^i } update_COM_system_stats = yes calculate_COM_civ_gui_vars = yes clear_array = COM_civ_systems_array } SPY_mil_button_update = { set_variable = { var_SPY_mil_system_idx = SPY_mil_systems_array^i } set_variable = { var_SPY_mil_sat_system_max = global.SPY_sat_system_max_array^i } set_variable = { var_SPY_mil_max_planning_factor = SPY_mil_max_planning_factor_array^i } set_variable = { var_SPY_mil_recon_factor = SPY_mil_recon_factor_array^i } set_variable = { var_SPY_mil_air_weather_penalty = SPY_mil_air_weather_penalty_array^i } set_variable = { var_SPY_mil_spotting_chance = SPY_mil_spotting_chance_array^i } set_variable = { var_SPY_mil_convoy_raiding_efficiency_factor = SPY_mil_convoy_raiding_efficiency_factor_array^i } set_variable = { var_SPY_mil_convoy_escort_efficiency = SPY_mil_convoy_escort_efficiency_array^i } update_SPY_system_stats = yes calculate_SPY_mil_gui_vars = yes clear_array = SPY_mil_systems_array } SPY_civ_button_update = { set_variable = { var_SPY_civ_system_idx = SPY_civ_systems_array^i } set_variable = { var_SPY_civ_sat_system_max = global.SPY_sat_system_max_array^i } set_variable = { var_SPY_civ_research_speed_factor = SPY_civ_research_speed_factor_array^i } set_variable = { var_SPY_civ_civilian_intel_factor = SPY_civ_civilian_intel_factor_array^i } set_variable = { var_SPY_civ_army_intel_factor = SPY_civ_army_intel_factor_array^i } set_variable = { var_SPY_civ_navy_intel_factor = SPY_civ_navy_intel_factor_array^i } set_variable = { var_SPY_civ_airforce_intel_factor = SPY_civ_airforce_intel_factor_array^i } set_variable = { var_SPY_civ_root_out_resistance_effectiveness_factor = SPY_civ_root_out_resistance_effectiveness_factor_array^i } update_SPY_system_stats = yes calculate_SPY_civ_gui_vars = yes clear_array = SPY_civ_systems_array } update_space_system_values = { update_sat_systems_stats = yes clear_spy_sat_mission_arrays = yes update_SPY_mission_num = yes international_systems_update = yes }