ws_initialize = { if = { limit = { NOT = { has_country_flag = ws_initialized } } set_country_flag = ws_initialized set_variable = { ws_reserve_multiplier = 1 } set_variable = { ws_mode = 0 } set_variable = { ws_auto_cursor = 0 } set_variable = { ws_resource_scale = 1 } set_variable = { ws_iron = 0 } set_variable = { ws_alloy = 0 } set_variable = { ws_parts = 0 } set_variable = { ws_total_processed = 0 } set_variable = { ws_total_refurbished = 0 } set_variable = { ws_last_removed = 0 } set_variable = { ws_last_iron = 0 } set_variable = { ws_last_alloy = 0 } set_variable = { ws_last_parts = 0 } set_variable = { ws_last_pending = 0 } # v1.6.0: this flag distinguishes a genuinely new install from an existing save # that already had ws_initialized before the update. Migration uses it to choose # the new Standard Auto profile only for fresh games. set_country_flag = ws_v160_fresh_install } } ws_migrate = { ws_initialize = yes if = { limit = { NOT = { has_country_flag = ws_version_101 } } set_country_flag = ws_version_101 set_variable = { ws_auto_cursor = 0 } set_variable = { ws_month_removed = 0 } } if = { limit = { NOT = { has_country_flag = ws_version_160 } } set_country_flag = ws_version_160 if = { limit = { has_country_flag = ws_v160_fresh_install } clr_country_flag = ws_v160_fresh_install ws_v160_set_profile_standard = yes } else = { # Existing v1.5.x saves keep their exact settings. They enter Manual mode # until the player explicitly opts into one of the new automatic profiles. set_country_flag = ws_auto_profile_manual } } if = { limit = { NOT = { has_country_flag = ws_version_161 } } set_country_flag = ws_version_161 if = { limit = { has_country_flag = ws_auto_profile_manual } set_country_flag = ws_ui_advanced } else = { clr_country_flag = ws_ui_advanced } } if = { limit = { NOT = { has_country_flag = ws_version_166 } } set_country_flag = ws_version_166 clr_country_flag = ws_runtime_ready } if = { limit = { NOT = { has_country_flag = ws_version_174 } } set_country_flag = ws_version_174 set_variable = { ws_resource_scale = 1 } } } ws_reset_last = { set_variable = { ws_last_removed = 0 } set_variable = { ws_last_iron = 0 } set_variable = { ws_last_alloy = 0 } set_variable = { ws_last_parts = 0 } set_variable = { ws_last_pending = 0 } } ws_remove_rifles = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 500 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 2000 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@infantry_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@infantry_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@infantry_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.02 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.04 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0.04 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.08 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0.005 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@infantry_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = infantry_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@infantry_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_rifles = { ws_reset_last = yes if = { limit = { ws_can_rifles = yes } ws_remove_rifles = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_rifles days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.02 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_rifles = ws_removed } multiply_variable = { ws_pending_rifles = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_rifles = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_rifles = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_rifles = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_rifles = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_rifles clamp_variable = { var = ws_pending_rifles min = 1 max = 500 } set_variable = { ws_last_pending = ws_pending_rifles } set_country_flag = ws_busy_rifles country_event = { id = war_salvage.100 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.08 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.02 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_support = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 100 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 300 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@support_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@support_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@support_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.12 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.09 } set_variable = { ws_unit_gain_alloy = 0.02 } set_variable = { ws_unit_gain_parts = 0.24 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.18 } set_variable = { ws_unit_gain_alloy = 0.04 } set_variable = { ws_unit_gain_parts = 0.03 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@support_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = support_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@support_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_support = { ws_reset_last = yes if = { limit = { ws_can_support = yes } ws_remove_support = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_support days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.12 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_support = ws_removed } multiply_variable = { ws_pending_support = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_support = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_support = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_support = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_support = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_support clamp_variable = { var = ws_pending_support min = 1 max = 100 } set_variable = { ws_last_pending = ws_pending_support } set_country_flag = ws_busy_support country_event = { id = war_salvage.101 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.18 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.04 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.12 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_artillery = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 50 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 150 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@artillery_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@artillery_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@artillery_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.16 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.4 } set_variable = { ws_unit_gain_alloy = 0.06 } set_variable = { ws_unit_gain_parts = 0.32 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.8 } set_variable = { ws_unit_gain_alloy = 0.12 } set_variable = { ws_unit_gain_parts = 0.04 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@artillery_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = artillery_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@artillery_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_artillery = { ws_reset_last = yes if = { limit = { ws_can_artillery = yes } ws_remove_artillery = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_artillery days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.16 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_artillery = ws_removed } multiply_variable = { ws_pending_artillery = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_artillery = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_artillery = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_artillery = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_artillery = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_artillery clamp_variable = { var = ws_pending_artillery min = 1 max = 50 } set_variable = { ws_last_pending = ws_pending_artillery } set_country_flag = ws_busy_artillery country_event = { id = war_salvage.102 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.8 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.12 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.16 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_aa = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 50 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@anti_air_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@anti_air_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@anti_air_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.35 } set_variable = { ws_unit_gain_alloy = 0.05 } set_variable = { ws_unit_gain_parts = 0.4 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.7 } set_variable = { ws_unit_gain_alloy = 0.1 } set_variable = { ws_unit_gain_parts = 0.05 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@anti_air_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = anti_air_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@anti_air_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_aa = { ws_reset_last = yes if = { limit = { ws_can_aa = yes } ws_remove_aa = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_aa days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.2 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_aa = ws_removed } multiply_variable = { ws_pending_aa = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_aa = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_aa = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_aa = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_aa = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_aa clamp_variable = { var = ws_pending_aa min = 1 max = 50 } set_variable = { ws_last_pending = ws_pending_aa } set_country_flag = ws_busy_aa country_event = { id = war_salvage.103 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.7 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.1 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.2 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_at = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 50 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@anti_tank_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@anti_tank_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@anti_tank_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.16 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.325 } set_variable = { ws_unit_gain_alloy = 0.1 } set_variable = { ws_unit_gain_parts = 0.32 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.65 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 0.04 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@anti_tank_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = anti_tank_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@anti_tank_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_at = { ws_reset_last = yes if = { limit = { ws_can_at = yes } ws_remove_at = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_at days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.16 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_at = ws_removed } multiply_variable = { ws_pending_at = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_at = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_at = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_at = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_at = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_at clamp_variable = { var = ws_pending_at min = 1 max = 50 } set_variable = { ws_last_pending = ws_pending_at } set_country_flag = ws_busy_at country_event = { id = war_salvage.104 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.65 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.2 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.16 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_trucks = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 100 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 500 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@motorized_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@motorized_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@motorized_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.25 } set_variable = { ws_unit_gain_alloy = 0.04 } set_variable = { ws_unit_gain_parts = 0.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.5 } set_variable = { ws_unit_gain_alloy = 0.08 } set_variable = { ws_unit_gain_parts = 0.075 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@motorized_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = motorized_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@motorized_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_trucks = { ws_reset_last = yes if = { limit = { ws_can_trucks = yes } ws_remove_trucks = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_trucks days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_trucks = ws_removed } multiply_variable = { ws_pending_trucks = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_trucks = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_trucks = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_trucks = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_trucks = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_trucks clamp_variable = { var = ws_pending_trucks min = 1 max = 100 } set_variable = { ws_last_pending = ws_pending_trucks } set_country_flag = ws_busy_trucks country_event = { id = war_salvage.105 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.5 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.08 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.3 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_mech = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 50 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 200 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@mechanized_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@mechanized_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@mechanized_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.6 } set_variable = { ws_unit_gain_alloy = 0.06 } set_variable = { ws_unit_gain_parts = 1 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 1.2 } set_variable = { ws_unit_gain_alloy = 0.12 } set_variable = { ws_unit_gain_parts = 0.125 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@mechanized_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = mechanized_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@mechanized_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_mech = { ws_reset_last = yes if = { limit = { ws_can_mech = yes } ws_remove_mech = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_mech days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_mech = ws_removed } multiply_variable = { ws_pending_mech = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_mech = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_mech = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_mech = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_mech = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_mech clamp_variable = { var = ws_pending_mech min = 1 max = 50 } set_variable = { ws_last_pending = ws_pending_mech } set_country_flag = ws_busy_mech country_event = { id = war_salvage.106 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 1.2 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.12 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.5 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_trains = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 10 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 50 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@train_equipment } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@train_equipment } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@train_equipment } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_unit_cost = 1 } if = { limit = { tag = GER } multiply_variable = { ws_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_unit_cost = 0.8823529 } } set_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_cost } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_cost } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 2 } set_variable = { ws_unit_gain_alloy = 0.1 } set_variable = { ws_unit_gain_parts = 2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 4 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 0.25 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 1 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@train_equipment } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = train_equipment amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@train_equipment } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_trains = { ws_reset_last = yes if = { limit = { ws_can_trains = yes } ws_remove_trains = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_trains days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } if = { limit = { check_variable = { ws_mode = 1 } } set_variable = { ws_charge = ws_removed } multiply_variable = { ws_charge = 1 } if = { limit = { tag = GER } multiply_variable = { ws_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_charge } set_variable = { ws_pending_trains = ws_removed } multiply_variable = { ws_pending_trains = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_pending_trains = 1.125 } } if = { limit = { tag = ENG } multiply_variable = { ws_pending_trains = 1.0625 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_pending_trains = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_pending_trains = 1.0588235 } } # Round to the nearest whole returned item; successful one-item batches are clamped to at least one. round_variable = ws_pending_trains clamp_variable = { var = ws_pending_trains min = 1 max = 10 } set_variable = { ws_last_pending = ws_pending_trains } set_country_flag = ws_busy_trains country_event = { id = war_salvage.107 days = 7 } } else = { set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 4 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.2 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 1 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } } ws_remove_light = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@light_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.8 } set_variable = { ws_unit_gain_alloy = 0.1 } set_variable = { ws_unit_gain_parts = 1 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 1.6 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 0.125 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@light_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@light_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_light = { ws_reset_last = yes if = { limit = { ws_can_light = yes } ws_remove_light = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_light days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 1.6 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.2 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.5 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_medium = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 1.4 } set_variable = { ws_unit_gain_alloy = 0.15 } set_variable = { ws_unit_gain_parts = 1.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 2.8 } set_variable = { ws_unit_gain_alloy = 0.3 } set_variable = { ws_unit_gain_parts = 0.2 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@medium_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_medium = { ws_reset_last = yes if = { limit = { ws_can_medium = yes } ws_remove_medium = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_medium days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 2.8 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.3 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.8 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_heavy = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 20 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 80 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 2 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 4 } set_variable = { ws_unit_gain_alloy = 0.4 } set_variable = { ws_unit_gain_parts = 0.25 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@heavy_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@heavy_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_heavy = { ws_reset_last = yes if = { limit = { ws_can_heavy = yes } ws_remove_heavy = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_heavy days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 4 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.4 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 1 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_light_old = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@light_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.8 } set_variable = { ws_unit_gain_alloy = 0.1 } set_variable = { ws_unit_gain_parts = 1 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 1.6 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 0.125 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@light_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@light_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_light_old = { ws_reset_last = yes if = { limit = { ws_can_light_old = yes } ws_remove_light_old = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_light_old days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 1.6 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.2 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.5 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_medium_old = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 1.4 } set_variable = { ws_unit_gain_alloy = 0.15 } set_variable = { ws_unit_gain_parts = 1.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 2.8 } set_variable = { ws_unit_gain_alloy = 0.3 } set_variable = { ws_unit_gain_parts = 0.2 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@medium_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_medium_old = { ws_reset_last = yes if = { limit = { ws_can_medium_old = yes } ws_remove_medium_old = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_medium_old days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 2.8 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.3 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.8 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_heavy_old = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 20 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 80 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 2 } set_variable = { ws_unit_gain_alloy = 0.2 } set_variable = { ws_unit_gain_parts = 2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 4 } set_variable = { ws_unit_gain_alloy = 0.4 } set_variable = { ws_unit_gain_parts = 0.25 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@heavy_tank_chassis } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@heavy_tank_chassis } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_heavy_old = { ws_reset_last = yes if = { limit = { ws_can_heavy_old = yes } ws_remove_heavy_old = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_heavy_old days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 4 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 0.4 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 1 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_small_air = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@small_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.15 } set_variable = { ws_unit_gain_alloy = 0.5 } set_variable = { ws_unit_gain_parts = 0.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.3 } set_variable = { ws_unit_gain_alloy = 1 } set_variable = { ws_unit_gain_parts = 0.075 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@small_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_small_air = { ws_reset_last = yes if = { limit = { ws_can_small_air = yes } ws_remove_small_air = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_small_air days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.3 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 1 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.3 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_medium_air = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 20 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 80 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.25 } set_variable = { ws_unit_gain_alloy = 0.9 } set_variable = { ws_unit_gain_parts = 1.2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.5 } set_variable = { ws_unit_gain_alloy = 1.8 } set_variable = { ws_unit_gain_parts = 0.15 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@medium_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@medium_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_medium_air = { ws_reset_last = yes if = { limit = { ws_can_medium_air = yes } ws_remove_medium_air = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_medium_air days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.5 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 1.8 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.6 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_large_air = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 10 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 40 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@large_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.4 } set_variable = { ws_unit_gain_alloy = 1.5 } set_variable = { ws_unit_gain_parts = 2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.8 } set_variable = { ws_unit_gain_alloy = 3 } set_variable = { ws_unit_gain_parts = 0.25 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@large_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@large_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_large_air = { ws_reset_last = yes if = { limit = { ws_can_large_air = yes } ws_remove_large_air = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_large_air days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.8 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 3 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 1 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_fighters = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@small_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.15 } set_variable = { ws_unit_gain_alloy = 0.5 } set_variable = { ws_unit_gain_parts = 0.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.3 } set_variable = { ws_unit_gain_alloy = 1 } set_variable = { ws_unit_gain_parts = 0.075 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@small_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_fighters = { ws_reset_last = yes if = { limit = { ws_can_fighters = yes } ws_remove_fighters = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_fighters days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.3 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 1 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.3 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_cas = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 25 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 100 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@small_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.15 } set_variable = { ws_unit_gain_alloy = 0.5 } set_variable = { ws_unit_gain_parts = 0.6 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.3 } set_variable = { ws_unit_gain_alloy = 1 } set_variable = { ws_unit_gain_parts = 0.075 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@small_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_cas = { ws_reset_last = yes if = { limit = { ws_can_cas = yes } ws_remove_cas = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_cas days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.3 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 1 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.3 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_tac = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 20 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 80 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.25 } set_variable = { ws_unit_gain_alloy = 0.9 } set_variable = { ws_unit_gain_parts = 1.2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.5 } set_variable = { ws_unit_gain_alloy = 1.8 } set_variable = { ws_unit_gain_parts = 0.15 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@medium_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@medium_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_tac = { ws_reset_last = yes if = { limit = { ws_can_tac = yes } ws_remove_tac = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_tac days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.5 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 1.8 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 0.6 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_remove_strat = { # v1.7.2: Resource Recovery processes twice the normal per-category batch. set_variable = { ws_batch_cap = 10 } if = { limit = { has_country_flag = ws_auto_profile_resource } multiply_variable = { ws_batch_cap = 2 } } set_variable = { ws_protected = 40 } multiply_variable = { ws_protected = ws_reserve_multiplier } set_variable = { ws_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_shortfall min = 0 max = 1000000 } add_to_variable = { ws_protected = ws_shortfall } set_variable = { ws_remaining = num_equipment@large_plane_airframe } subtract_from_variable = { ws_remaining = ws_protected } clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } set_variable = { ws_removed = 0 } if = { limit = { OR = { check_variable = { ws_mode = 2 } check_variable = { ws_mode = 3 } } } set_variable = { ws_unit_gain_iron = 0 } set_variable = { ws_unit_gain_alloy = 0 } set_variable = { ws_unit_gain_parts = 0 } if = { limit = { check_variable = { ws_mode = 2 } } set_variable = { ws_unit_gain_iron = 0.4 } set_variable = { ws_unit_gain_alloy = 1.5 } set_variable = { ws_unit_gain_parts = 2 } if = { limit = { tag = GER } multiply_variable = { ws_unit_gain_parts = 1.10 } } } else = { set_variable = { ws_unit_gain_iron = 0.8 } set_variable = { ws_unit_gain_alloy = 3 } set_variable = { ws_unit_gain_parts = 0.25 } if = { limit = { tag = JAP } multiply_variable = { ws_unit_gain_iron = 1.25 } multiply_variable = { ws_unit_gain_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_unit_gain_iron = 1.12 } multiply_variable = { ws_unit_gain_alloy = 1.12 } } } if = { limit = { check_variable = { ws_unit_gain_iron > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_iron } set_variable = { ws_room_cap = ws_unit_gain_iron } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_iron } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_alloy > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_alloy } set_variable = { ws_room_cap = ws_unit_gain_alloy } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_alloy } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } if = { limit = { check_variable = { ws_unit_gain_parts > 0 } } set_variable = { ws_room = 1000000 } subtract_from_variable = { ws_room = ws_parts } set_variable = { ws_room_cap = ws_unit_gain_parts } multiply_variable = { ws_room_cap = ws_batch_cap } clamp_variable = { var = ws_room min = 0 max = ws_room_cap } divide_variable = { ws_room = ws_unit_gain_parts } clamp_variable = { var = ws_remaining min = 0 max = ws_room } } } subtract_from_variable = { ws_remaining = 0.5 } round_variable = ws_remaining clamp_variable = { var = ws_remaining min = 0 max = ws_batch_cap } if = { limit = { check_variable = { ws_mode = 1 } check_variable = { ws_remaining < 2 } } set_variable = { ws_remaining = 0 } } if = { limit = { check_variable = { ws_remaining > 0 } } every_possible_country = { limit = { OR = { NOT = { tag = PREV } PREV = { has_country_flag = ws_all_producers } } } PREV = { if = { limit = { check_variable = { ws_remaining > 0 } } set_variable = { ws_before = num_equipment@large_plane_airframe } set_variable = { ws_take = ws_remaining } multiply_variable = { ws_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe amount = ws_take producer = PREV } set_variable = { ws_delta = ws_before } subtract_from_variable = { ws_delta = num_equipment@large_plane_airframe } clamp_variable = { var = ws_delta min = 0 max = ws_remaining } add_to_variable = { ws_removed = ws_delta } subtract_from_variable = { ws_remaining = ws_delta } } } } } } ws_process_strat = { ws_reset_last = yes if = { limit = { ws_can_strat = yes } ws_remove_strat = yes if = { limit = { check_variable = { ws_removed > 0 } } set_country_flag = { flag = ws_cool_strat days = 7 } set_variable = { ws_last_removed = ws_removed } add_to_variable = { ws_total_processed = ws_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_gain_iron = ws_removed } multiply_variable = { ws_gain_iron = 0.8 } set_variable = { ws_gain_alloy = ws_removed } multiply_variable = { ws_gain_alloy = 3 } set_variable = { ws_gain_parts = ws_removed } multiply_variable = { ws_gain_parts = 1 } if = { limit = { check_variable = { ws_mode = 2 } } multiply_variable = { ws_gain_iron = 0.5 } multiply_variable = { ws_gain_alloy = 0.5 } multiply_variable = { ws_gain_parts = 2 } } else = { multiply_variable = { ws_gain_parts = 0.25 } } # v1.5 national doctrines affect ordinary salvage as well. if = { limit = { check_variable = { ws_mode = 3 } tag = JAP } multiply_variable = { ws_gain_iron = 1.25 } multiply_variable = { ws_gain_alloy = 1.25 } } if = { limit = { check_variable = { ws_mode = 3 } tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_gain_iron = 1.12 } multiply_variable = { ws_gain_alloy = 1.12 } } if = { limit = { check_variable = { ws_mode = 2 } tag = GER } multiply_variable = { ws_gain_parts = 1.10 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_gain_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_gain_iron } set_variable = { ws_last_iron = ws_gain_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_gain_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_gain_alloy } set_variable = { ws_last_alloy = ws_gain_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_gain_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_gain_parts } set_variable = { ws_last_parts = ws_gain_parts } } } } ws_auto_slot_rifles = { if = { limit = { ws_auto_capacity_available = yes ws_can_rifles = yes } ws_process_rifles = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 1 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_support = { if = { limit = { ws_auto_capacity_available = yes ws_can_support = yes } ws_process_support = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 2 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_artillery = { if = { limit = { ws_auto_capacity_available = yes ws_can_artillery = yes } ws_process_artillery = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 3 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_aa = { if = { limit = { ws_auto_capacity_available = yes ws_can_aa = yes } ws_process_aa = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 4 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_at = { if = { limit = { ws_auto_capacity_available = yes ws_can_at = yes } ws_process_at = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 5 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_trucks = { if = { limit = { ws_auto_capacity_available = yes ws_can_trucks = yes } ws_process_trucks = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 6 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_mech = { if = { limit = { ws_auto_capacity_available = yes ws_can_mech = yes } ws_process_mech = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 7 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_trains = { if = { limit = { ws_auto_capacity_available = yes ws_can_trains = yes } ws_process_trains = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 8 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_light = { if = { limit = { ws_auto_capacity_available = yes ws_can_light = yes } ws_process_light = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 9 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_medium = { if = { limit = { ws_auto_capacity_available = yes ws_can_medium = yes } ws_process_medium = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 10 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_heavy = { if = { limit = { ws_auto_capacity_available = yes ws_can_heavy = yes } ws_process_heavy = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 11 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_light_old = { if = { limit = { ws_auto_capacity_available = yes ws_can_light_old = yes } ws_process_light_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 12 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_medium_old = { if = { limit = { ws_auto_capacity_available = yes ws_can_medium_old = yes } ws_process_medium_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 13 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_heavy_old = { if = { limit = { ws_auto_capacity_available = yes ws_can_heavy_old = yes } ws_process_heavy_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 14 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_small_air = { if = { limit = { ws_auto_capacity_available = yes ws_can_small_air = yes } ws_process_small_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 15 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_medium_air = { if = { limit = { ws_auto_capacity_available = yes ws_can_medium_air = yes } ws_process_medium_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 16 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_large_air = { if = { limit = { ws_auto_capacity_available = yes ws_can_large_air = yes } ws_process_large_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 17 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_fighters = { if = { limit = { ws_auto_capacity_available = yes ws_can_fighters = yes } ws_process_fighters = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 18 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_cas = { if = { limit = { ws_auto_capacity_available = yes ws_can_cas = yes } ws_process_cas = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 19 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_tac = { if = { limit = { ws_auto_capacity_available = yes ws_can_tac = yes } ws_process_tac = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 20 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_auto_slot_strat = { if = { limit = { ws_auto_capacity_available = yes ws_can_strat = yes } ws_process_strat = yes if = { limit = { check_variable = { ws_last_removed > 0 } } add_to_variable = { ws_auto_lots = 1 } set_variable = { ws_auto_cursor = 0 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_iron = ws_last_iron } add_to_variable = { ws_month_alloy = ws_last_alloy } add_to_variable = { ws_month_parts = ws_last_parts } add_to_variable = { ws_month_pending = ws_last_pending } } } } # ----------------------------------------------------------------------------- # v1.6.0 automatic operating profiles # ----------------------------------------------------------------------------- ws_v160_clear_profiles = { clr_country_flag = ws_auto_profile_safe clr_country_flag = ws_auto_profile_standard clr_country_flag = ws_auto_profile_resource clr_country_flag = ws_auto_profile_manual } ws_v160_detect_core_shortage = { set_variable = { ws_v160_shortage_count = 0 } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@infantry_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@infantry_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@support_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@support_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@artillery_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@artillery_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@anti_air_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@anti_air_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@anti_tank_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@anti_tank_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@motorized_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@motorized_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@mechanized_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@mechanized_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } set_variable = { ws_v160_shortfall = num_target_equipment_in_armies@train_equipment } subtract_from_variable = { ws_v160_shortfall = num_equipment_in_armies@train_equipment } if = { limit = { check_variable = { ws_v160_shortfall > 0 } } add_to_variable = { ws_v160_shortage_count = 1 } } } ws_v160_apply_profile = { # Safe Auto: foreign equipment only, very large reserve, refurbishment only. if = { limit = { has_country_flag = ws_auto_profile_safe } set_country_flag = ws_auto clr_country_flag = ws_all_producers set_variable = { ws_reserve_multiplier = 4 } set_variable = { ws_mode = 1 } } # Standard Auto: foreign equipment only. If any core fielded category is short, # protect four times the normal reserve and refurbish only. Otherwise keep a # two-times reserve and replenish parts when the internal parts stock is low. if = { limit = { has_country_flag = ws_auto_profile_standard } set_country_flag = ws_auto clr_country_flag = ws_all_producers ws_v160_detect_core_shortage = yes if = { limit = { check_variable = { ws_v160_shortage_count > 0 } } set_variable = { ws_reserve_multiplier = 4 } set_variable = { ws_mode = 1 } } else = { set_variable = { ws_reserve_multiplier = 2 } if = { limit = { check_variable = { ws_parts < 25 } } set_variable = { ws_mode = 2 } } else = { set_variable = { ws_mode = 1 } } } } # Resource Auto: process only foreign equipment, keep the normal reserve, # and prioritize metal recovery. Domestic modern equipment is never selected. if = { limit = { has_country_flag = ws_auto_profile_resource } set_country_flag = ws_auto clr_country_flag = ws_all_producers set_variable = { ws_reserve_multiplier = 1 } set_variable = { ws_mode = 3 } } } ws_v160_set_profile_safe = { ws_initialize = yes ws_v160_clear_profiles = yes set_country_flag = ws_auto_profile_safe set_country_flag = ws_version_160 set_country_flag = ws_version_161 clr_country_flag = ws_v160_fresh_install clr_country_flag = ws_ui_advanced ws_v160_apply_profile = yes } ws_v160_set_profile_standard = { ws_initialize = yes ws_v160_clear_profiles = yes set_country_flag = ws_auto_profile_standard set_country_flag = ws_version_160 set_country_flag = ws_version_161 clr_country_flag = ws_v160_fresh_install clr_country_flag = ws_ui_advanced ws_v160_apply_profile = yes } ws_v160_set_profile_resource = { ws_initialize = yes ws_v160_clear_profiles = yes set_country_flag = ws_auto_profile_resource set_country_flag = ws_version_160 set_country_flag = ws_version_161 clr_country_flag = ws_v160_fresh_install clr_country_flag = ws_ui_advanced ws_v160_apply_profile = yes } ws_v160_set_profile_manual = { ws_initialize = yes ws_v160_clear_profiles = yes set_country_flag = ws_auto_profile_manual set_country_flag = ws_version_160 set_country_flag = ws_version_161 clr_country_flag = ws_v160_fresh_install set_country_flag = ws_ui_advanced # Switching to Manual is intentionally conservative: automatic monthly # processing stops, while the current method/source/reserve settings remain. clr_country_flag = ws_auto } ws_v160_special_slot_light_tanks = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "No Step Back" NOT = { has_country_flag = ws_v15_busy_light_tanks } NOT = { has_country_flag = ws_v15_refurb_cd_light_tanks } ws_v15_refurb_stock_light_tanks = yes ws_v15_refurb_parts_light_tanks = yes } ws_v15_refurb_light_tanks = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_light_tanks days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 1 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_medium_tanks = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "No Step Back" NOT = { has_country_flag = ws_v15_busy_medium_tanks } NOT = { has_country_flag = ws_v15_refurb_cd_medium_tanks } ws_v15_refurb_stock_medium_tanks = yes ws_v15_refurb_parts_medium_tanks = yes } ws_v15_refurb_medium_tanks = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_medium_tanks days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 2 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_heavy_tanks = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "No Step Back" NOT = { has_country_flag = ws_v15_busy_heavy_tanks } NOT = { has_country_flag = ws_v15_refurb_cd_heavy_tanks } ws_v15_refurb_stock_heavy_tanks = yes ws_v15_refurb_parts_heavy_tanks = yes } ws_v15_refurb_heavy_tanks = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_heavy_tanks days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 3 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_light_tanks_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "No Step Back" } NOT = { has_country_flag = ws_v15_busy_light_tanks_old } NOT = { has_country_flag = ws_v15_refurb_cd_light_tanks_old } ws_v15_refurb_stock_light_tanks_old = yes ws_v15_refurb_parts_light_tanks_old = yes } ws_v15_refurb_light_tanks_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_light_tanks_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 4 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_medium_tanks_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "No Step Back" } NOT = { has_country_flag = ws_v15_busy_medium_tanks_old } NOT = { has_country_flag = ws_v15_refurb_cd_medium_tanks_old } ws_v15_refurb_stock_medium_tanks_old = yes ws_v15_refurb_parts_medium_tanks_old = yes } ws_v15_refurb_medium_tanks_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_medium_tanks_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 5 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_heavy_tanks_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "No Step Back" } NOT = { has_country_flag = ws_v15_busy_heavy_tanks_old } NOT = { has_country_flag = ws_v15_refurb_cd_heavy_tanks_old } ws_v15_refurb_stock_heavy_tanks_old = yes ws_v15_refurb_parts_heavy_tanks_old = yes } ws_v15_refurb_heavy_tanks_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_heavy_tanks_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 6 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_small_air = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "By Blood Alone" NOT = { has_country_flag = ws_v15_busy_small_air } NOT = { has_country_flag = ws_v15_refurb_cd_small_air } ws_v15_refurb_stock_small_air = yes ws_v15_refurb_parts_small_air = yes } ws_v15_refurb_small_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_small_air days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 7 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_medium_air = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "By Blood Alone" NOT = { has_country_flag = ws_v15_busy_medium_air } NOT = { has_country_flag = ws_v15_refurb_cd_medium_air } ws_v15_refurb_stock_medium_air = yes ws_v15_refurb_parts_medium_air = yes } ws_v15_refurb_medium_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_medium_air days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 8 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_large_air = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } has_dlc = "By Blood Alone" NOT = { has_country_flag = ws_v15_busy_large_air } NOT = { has_country_flag = ws_v15_refurb_cd_large_air } ws_v15_refurb_stock_large_air = yes ws_v15_refurb_parts_large_air = yes } ws_v15_refurb_large_air = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_large_air days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 9 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_fighter_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "By Blood Alone" } NOT = { has_country_flag = ws_v15_busy_fighter_old } NOT = { has_country_flag = ws_v15_refurb_cd_fighter_old } ws_v15_refurb_stock_fighter_old = yes ws_v15_refurb_parts_fighter_old = yes } ws_v15_refurb_fighter_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_fighter_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 10 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_cas_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "By Blood Alone" } NOT = { has_country_flag = ws_v15_busy_cas_old } NOT = { has_country_flag = ws_v15_refurb_cd_cas_old } ws_v15_refurb_stock_cas_old = yes ws_v15_refurb_parts_cas_old = yes } ws_v15_refurb_cas_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_cas_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 11 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_tac_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "By Blood Alone" } NOT = { has_country_flag = ws_v15_busy_tac_old } NOT = { has_country_flag = ws_v15_refurb_cd_tac_old } ws_v15_refurb_stock_tac_old = yes ws_v15_refurb_parts_tac_old = yes } ws_v15_refurb_tac_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_tac_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 12 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_special_slot_strat_old = { if = { limit = { check_variable = { ws_v160_special_done < 1 } NOT = { has_capitulated = yes } NOT = { has_dlc = "By Blood Alone" } NOT = { has_country_flag = ws_v15_busy_strat_old } NOT = { has_country_flag = ws_v15_refurb_cd_strat_old } ws_v15_refurb_stock_strat_old = yes ws_v15_refurb_parts_strat_old = yes } ws_v15_refurb_strat_old = yes if = { limit = { check_variable = { ws_last_removed > 0 } } set_country_flag = { flag = ws_v15_refurb_cd_strat_old days = 14 } set_variable = { ws_v160_special_done = 1 } set_variable = { ws_v160_refurb_cursor = 0 } add_to_variable = { ws_month_removed = ws_last_removed } add_to_variable = { ws_month_pending = ws_last_pending } } } } ws_v160_automatic_special_refurb = { set_variable = { ws_v160_special_done = 0 } set_variable = { ws_v160_refurb_start = ws_v160_refurb_cursor } if = { limit = { check_variable = { ws_v160_refurb_start < 1 } } ws_v160_special_slot_light_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 2 } } ws_v160_special_slot_medium_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 3 } } ws_v160_special_slot_heavy_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 4 } } ws_v160_special_slot_light_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 5 } } ws_v160_special_slot_medium_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 6 } } ws_v160_special_slot_heavy_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 7 } } ws_v160_special_slot_small_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 8 } } ws_v160_special_slot_medium_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 9 } } ws_v160_special_slot_large_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 10 } } ws_v160_special_slot_fighter_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 11 } } ws_v160_special_slot_cas_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 12 } } ws_v160_special_slot_tac_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start < 13 } } ws_v160_special_slot_strat_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 0 } } ws_v160_special_slot_light_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 1 } } ws_v160_special_slot_medium_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 2 } } ws_v160_special_slot_heavy_tanks = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 3 } } ws_v160_special_slot_light_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 4 } } ws_v160_special_slot_medium_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 5 } } ws_v160_special_slot_heavy_tanks_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 6 } } ws_v160_special_slot_small_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 7 } } ws_v160_special_slot_medium_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 8 } } ws_v160_special_slot_large_air = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 9 } } ws_v160_special_slot_fighter_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 10 } } ws_v160_special_slot_cas_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 11 } } ws_v160_special_slot_tac_old = yes } if = { limit = { check_variable = { ws_v160_refurb_start > 12 } } ws_v160_special_slot_strat_old = yes } } ws_automatic_month = { # v1.7.2 profile throughput: Safe 4, Standard 8, Resource Recovery 12 successful categories per month. set_variable = { ws_auto_lots = 0 } set_variable = { ws_auto_start = ws_auto_cursor } set_variable = { ws_month_removed = 0 } set_variable = { ws_month_iron = 0 } set_variable = { ws_month_alloy = 0 } set_variable = { ws_month_parts = 0 } set_variable = { ws_month_pending = 0 } if = { limit = { check_variable = { ws_auto_start < 1 } } ws_auto_slot_rifles = yes } if = { limit = { check_variable = { ws_auto_start < 2 } } ws_auto_slot_support = yes } if = { limit = { check_variable = { ws_auto_start < 3 } } ws_auto_slot_artillery = yes } if = { limit = { check_variable = { ws_auto_start < 4 } } ws_auto_slot_aa = yes } if = { limit = { check_variable = { ws_auto_start < 5 } } ws_auto_slot_at = yes } if = { limit = { check_variable = { ws_auto_start < 6 } } ws_auto_slot_trucks = yes } if = { limit = { check_variable = { ws_auto_start < 7 } } ws_auto_slot_mech = yes } if = { limit = { check_variable = { ws_auto_start < 8 } } ws_auto_slot_trains = yes } if = { limit = { check_variable = { ws_auto_start < 9 } } ws_auto_slot_light = yes } if = { limit = { check_variable = { ws_auto_start < 10 } } ws_auto_slot_medium = yes } if = { limit = { check_variable = { ws_auto_start < 11 } } ws_auto_slot_heavy = yes } if = { limit = { check_variable = { ws_auto_start < 12 } } ws_auto_slot_light_old = yes } if = { limit = { check_variable = { ws_auto_start < 13 } } ws_auto_slot_medium_old = yes } if = { limit = { check_variable = { ws_auto_start < 14 } } ws_auto_slot_heavy_old = yes } if = { limit = { check_variable = { ws_auto_start < 15 } } ws_auto_slot_small_air = yes } if = { limit = { check_variable = { ws_auto_start < 16 } } ws_auto_slot_medium_air = yes } if = { limit = { check_variable = { ws_auto_start < 17 } } ws_auto_slot_large_air = yes } if = { limit = { check_variable = { ws_auto_start < 18 } } ws_auto_slot_fighters = yes } if = { limit = { check_variable = { ws_auto_start < 19 } } ws_auto_slot_cas = yes } if = { limit = { check_variable = { ws_auto_start < 20 } } ws_auto_slot_tac = yes } if = { limit = { check_variable = { ws_auto_start < 21 } } ws_auto_slot_strat = yes } if = { limit = { check_variable = { ws_auto_start > 0 } } ws_auto_slot_rifles = yes } if = { limit = { check_variable = { ws_auto_start > 1 } } ws_auto_slot_support = yes } if = { limit = { check_variable = { ws_auto_start > 2 } } ws_auto_slot_artillery = yes } if = { limit = { check_variable = { ws_auto_start > 3 } } ws_auto_slot_aa = yes } if = { limit = { check_variable = { ws_auto_start > 4 } } ws_auto_slot_at = yes } if = { limit = { check_variable = { ws_auto_start > 5 } } ws_auto_slot_trucks = yes } if = { limit = { check_variable = { ws_auto_start > 6 } } ws_auto_slot_mech = yes } if = { limit = { check_variable = { ws_auto_start > 7 } } ws_auto_slot_trains = yes } if = { limit = { check_variable = { ws_auto_start > 8 } } ws_auto_slot_light = yes } if = { limit = { check_variable = { ws_auto_start > 9 } } ws_auto_slot_medium = yes } if = { limit = { check_variable = { ws_auto_start > 10 } } ws_auto_slot_heavy = yes } if = { limit = { check_variable = { ws_auto_start > 11 } } ws_auto_slot_light_old = yes } if = { limit = { check_variable = { ws_auto_start > 12 } } ws_auto_slot_medium_old = yes } if = { limit = { check_variable = { ws_auto_start > 13 } } ws_auto_slot_heavy_old = yes } if = { limit = { check_variable = { ws_auto_start > 14 } } ws_auto_slot_small_air = yes } if = { limit = { check_variable = { ws_auto_start > 15 } } ws_auto_slot_medium_air = yes } if = { limit = { check_variable = { ws_auto_start > 16 } } ws_auto_slot_large_air = yes } if = { limit = { check_variable = { ws_auto_start > 17 } } ws_auto_slot_fighters = yes } if = { limit = { check_variable = { ws_auto_start > 18 } } ws_auto_slot_cas = yes } if = { limit = { check_variable = { ws_auto_start > 19 } } ws_auto_slot_tac = yes } if = { limit = { check_variable = { ws_auto_start > 20 } } ws_auto_slot_strat = yes } if = { limit = { OR = { has_country_flag = ws_auto_profile_safe has_country_flag = ws_auto_profile_standard } check_variable = { ws_mode = 1 } } ws_v160_automatic_special_refurb = yes } set_variable = { ws_last_removed = ws_month_removed } set_variable = { ws_last_iron = ws_month_iron } set_variable = { ws_last_alloy = ws_month_alloy } set_variable = { ws_last_parts = ws_month_parts } set_variable = { ws_last_pending = ws_month_pending } } ws_start_steel = { if = { limit = { has_country_flag = ws_initialized NOT = { OR = { has_idea = ws_contract_steel has_idea = ws_contract_steel_8 has_idea = ws_contract_steel_16 has_idea = ws_contract_steel_32 has_idea = ws_contract_steel_64 } } NOT = { has_capitulated = yes } } if = { limit = { check_variable = { ws_resource_scale = 16 } check_variable = { ws_iron > 959.999 } } subtract_from_variable = { ws_iron = 960 } add_timed_idea = { idea = ws_contract_steel_64 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 8 } check_variable = { ws_iron > 479.999 } } subtract_from_variable = { ws_iron = 480 } add_timed_idea = { idea = ws_contract_steel_32 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 4 } check_variable = { ws_iron > 239.999 } } subtract_from_variable = { ws_iron = 240 } add_timed_idea = { idea = ws_contract_steel_16 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 2 } check_variable = { ws_iron > 119.999 } } subtract_from_variable = { ws_iron = 120 } add_timed_idea = { idea = ws_contract_steel_8 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 1 } check_variable = { ws_iron > 59.999 } } subtract_from_variable = { ws_iron = 60 } add_timed_idea = { idea = ws_contract_steel days = 30 } } } } ws_start_aluminium = { if = { limit = { has_country_flag = ws_initialized NOT = { OR = { has_idea = ws_contract_aluminium has_idea = ws_contract_aluminium_4 has_idea = ws_contract_aluminium_8 has_idea = ws_contract_aluminium_16 has_idea = ws_contract_aluminium_32 } } NOT = { has_capitulated = yes } } if = { limit = { check_variable = { ws_resource_scale = 16 } check_variable = { ws_alloy > 639.999 } } subtract_from_variable = { ws_alloy = 640 } add_timed_idea = { idea = ws_contract_aluminium_32 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 8 } check_variable = { ws_alloy > 319.999 } } subtract_from_variable = { ws_alloy = 320 } add_timed_idea = { idea = ws_contract_aluminium_16 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 4 } check_variable = { ws_alloy > 159.999 } } subtract_from_variable = { ws_alloy = 160 } add_timed_idea = { idea = ws_contract_aluminium_8 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 2 } check_variable = { ws_alloy > 79.999 } } subtract_from_variable = { ws_alloy = 80 } add_timed_idea = { idea = ws_contract_aluminium_4 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 1 } check_variable = { ws_alloy > 39.999 } } subtract_from_variable = { ws_alloy = 40 } add_timed_idea = { idea = ws_contract_aluminium days = 30 } } } } ws_start_tungsten = { if = { limit = { has_country_flag = ws_initialized NOT = { OR = { has_idea = ws_contract_tungsten has_idea = ws_contract_tungsten_2 has_idea = ws_contract_tungsten_4 has_idea = ws_contract_tungsten_8 has_idea = ws_contract_tungsten_16 } } NOT = { has_capitulated = yes } } if = { limit = { check_variable = { ws_resource_scale = 16 } check_variable = { ws_alloy > 959.999 } } subtract_from_variable = { ws_alloy = 960 } add_timed_idea = { idea = ws_contract_tungsten_16 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 8 } check_variable = { ws_alloy > 479.999 } } subtract_from_variable = { ws_alloy = 480 } add_timed_idea = { idea = ws_contract_tungsten_8 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 4 } check_variable = { ws_alloy > 239.999 } } subtract_from_variable = { ws_alloy = 240 } add_timed_idea = { idea = ws_contract_tungsten_4 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 2 } check_variable = { ws_alloy > 119.999 } } subtract_from_variable = { ws_alloy = 120 } add_timed_idea = { idea = ws_contract_tungsten_2 days = 30 } } else_if = { limit = { check_variable = { ws_resource_scale = 1 } check_variable = { ws_alloy > 59.999 } } subtract_from_variable = { ws_alloy = 60 } add_timed_idea = { idea = ws_contract_tungsten days = 30 } } } } ws_start_maintenance = { if = { limit = { has_country_flag = ws_initialized NOT = { has_idea = ws_contract_maintenance } NOT = { has_capitulated = yes } check_variable = { ws_parts > 39.999 } } subtract_from_variable = { ws_parts = 40 } add_timed_idea = { idea = ws_contract_maintenance days = 30 } } } ws_start_supply = { if = { limit = { has_country_flag = ws_initialized NOT = { has_idea = ws_contract_supply } NOT = { has_capitulated = yes } check_variable = { ws_parts > 59.999 } } subtract_from_variable = { ws_parts = 60 } add_timed_idea = { idea = ws_contract_supply days = 30 } } } ws_start_repair = { if = { limit = { has_country_flag = ws_initialized NOT = { has_idea = ws_contract_repair } NOT = { has_capitulated = yes } check_variable = { ws_iron > 29.999 } check_variable = { ws_parts > 29.999 } } subtract_from_variable = { ws_iron = 30 } subtract_from_variable = { ws_parts = 30 } add_timed_idea = { idea = ws_contract_repair days = 30 } } } ws_start_recovery = { if = { limit = { has_country_flag = ws_initialized NOT = { has_idea = ws_contract_recovery } NOT = { has_capitulated = yes } check_variable = { ws_parts > 49.999 } } subtract_from_variable = { ws_parts = 50 } add_timed_idea = { idea = ws_contract_recovery days = 30 } } }