# Author(s): Simone, AngriestBird # ------------- # Energy system scripted effects. # Owns the weekly Energy System recalculation: consumption, generation, balance, # fuel, alerts, UI refresh, and the supporting decision/event helpers. # Adjuster Variables # The following variable is used to adjust the balance of all consumption without adjusting the ratio of the sources @energy_use_balance_multiplier = 1.25 # The following variable is used to adjust the balance of the Population Energy Consumption @population_energy_use_balance_value = 28 # Effect: calculate_energy_use # Purpose: Orchestrates the weekly Energy System recalculation for a nation calculate_energy_use = { # Add the Dynamic Modifiers for the System in case they are not present if = { limit = { NOT = { has_dynamic_modifier = { modifier = energy_dynamic_modifier } } } add_dynamic_modifier = { modifier = energy_dynamic_modifier } } set_variable = { energy_seasonal_population_demand_factor = 0 } if = { limit = { OR = { check_variable = { global.month = 12 } check_variable = { global.month = 1 } check_variable = { global.month = 2 } check_variable = { global.month = 6 } check_variable = { global.month = 7 } check_variable = { global.month = 8 } } } set_variable = { energy_seasonal_population_demand_factor = 0.2 } } energy_calc_consumption = yes energy_calc_generation = yes energy_calc_balance = yes energy_calc_fuel = yes } # Effect: update_energy_policy_change # Purpose: Refreshes only the values affected by an Energy consumption policy update_energy_policy_change = { if = { limit = { has_country_flag = energy_state_bases_initialized } calculate_energy_use = yes } else = { update_state_variables = yes } calculate_tax_gain = yes update_display = yes if = { limit = { is_ai = no } update_money_dirty_variable = yes refresh_investment_gui = yes } } automation_energy_consumption_policy_weekly = { set_temp_variable = { automation_energy_net_ratio = 1 } if = { limit = { check_variable = { energy_consumption > 0.01 } } set_temp_variable = { automation_energy_net_ratio = { value = energy_consumption add = energy_balance divide = energy_consumption clamp = { min = 0 max = 999999999 } } } } set_temp_variable = { current_energy_consumption_policy = 0 } if = { limit = { has_idea = heavy_power_restrictions_spirit } set_temp_variable = { current_energy_consumption_policy = -2 } } else_if = { limit = { has_idea = some_power_restrictions_spirit } set_temp_variable = { current_energy_consumption_policy = -1 } } else_if = { limit = { has_idea = some_additional_consumption_spirit } set_temp_variable = { current_energy_consumption_policy = 1 } } else_if = { limit = { has_idea = heavy_additional_consumption_spirit } set_temp_variable = { current_energy_consumption_policy = 2 } } set_temp_variable = { desired_energy_consumption_policy = current_energy_consumption_policy } set_temp_variable = { automation_energy_storage_threshold = { value = max_stored_energy multiply = 0.95 } } if = { limit = { check_variable = { automation_energy_net_ratio < 0.95 } check_variable = { current_energy_consumption_policy > -2 } } subtract_from_temp_variable = { desired_energy_consumption_policy = 1 } } else_if = { limit = { check_variable = { automation_energy_net_ratio > 1.10 } check_variable = { current_energy_consumption_policy < 0 } } add_to_temp_variable = { desired_energy_consumption_policy = 1 } } else_if = { limit = { check_variable = { automation_energy_net_ratio > 1.10 } check_variable = { current_energy_consumption_policy > -1 } check_variable = { current_energy_consumption_policy < 2 } OR = { check_variable = { max_stored_energy < 0.01 } check_variable = { var = stored_energy value = automation_energy_storage_threshold compare = greater_than_or_equals } } } add_to_temp_variable = { desired_energy_consumption_policy = 1 } } if = { limit = { NOT = { check_variable = { desired_energy_consumption_policy = current_energy_consumption_policy } } } if = { limit = { check_variable = { desired_energy_consumption_policy = -2 } } swap_ideas = { add_idea = heavy_power_restrictions_spirit remove_idea = some_power_restrictions_spirit } } else_if = { limit = { check_variable = { desired_energy_consumption_policy = -1 } } if = { limit = { check_variable = { current_energy_consumption_policy = -2 } } swap_ideas = { add_idea = some_power_restrictions_spirit remove_idea = heavy_power_restrictions_spirit } } else = { add_ideas = some_power_restrictions_spirit } } else_if = { limit = { check_variable = { desired_energy_consumption_policy = 0 } check_variable = { current_energy_consumption_policy = -1 } } remove_ideas = some_power_restrictions_spirit } else_if = { limit = { check_variable = { desired_energy_consumption_policy = 0 } check_variable = { current_energy_consumption_policy = 1 } } remove_ideas = some_additional_consumption_spirit } else_if = { limit = { check_variable = { desired_energy_consumption_policy = 1 } } if = { limit = { check_variable = { current_energy_consumption_policy = 2 } } swap_ideas = { add_idea = some_additional_consumption_spirit remove_idea = heavy_additional_consumption_spirit } } else = { add_ideas = some_additional_consumption_spirit } } else_if = { limit = { check_variable = { desired_energy_consumption_policy = 2 } } swap_ideas = { add_idea = heavy_additional_consumption_spirit remove_idea = some_additional_consumption_spirit } } update_energy_policy_change = yes } } # Effect: energy_calc_consumption # Purpose: Population, building, and static energy consumption, computed straight into the per-type display vars # Produces (temp): temp_total_energy_use (consumed by energy_calc_balance) energy_calc_consumption = { # Set temp vars for each multiplier and add 1 to the multipliers (which are percentages). # IE: if energy_use_multiplier is modified to 40% (.4) it will be treated as a 140% (1.4) multiplication on its correlating modifier set_temp_variable = { temp_pop_use_m = { value = 1 add = modifier@pop_energy_use_multiplier } } set_temp_variable = { temp_energy_use_m = { value = 1 add = modifier@energy_use_multiplier } } # Display multiplier folded into every consumption source: temp_energy_use_m * @energy_use_balance_multiplier # The balance multiplier scales overall consumption without touching the ratio of its sources set_temp_variable = { display_multiplier = { value = temp_energy_use_m multiply = @energy_use_balance_multiplier } } # GDP/c scaling factor (40k GDP/c is considered the middle ground) set_temp_variable = { temp_gdp_per_capita = { value = gdp_per_capita clamp = { min = 1 max = 999999999 } multiply = 0.025 } } # Population Energy Use, computed straight into its display var with the display multiplier folded in # Base formula: population_total * 0.001 * temp_pop_use_m * max(gdp_per_capita, 1) * 0.025 * @population_energy_use_balance_value * display_multiplier set_variable = { population_energy_use_display_var = { value = population_total multiply = 0.001 multiply = temp_pop_use_m multiply = temp_gdp_per_capita multiply = @population_energy_use_balance_value multiply = display_multiplier multiply = { value = 1 add = energy_seasonal_population_demand_factor } } } # Static use from special decisions/events, scaled into its display var set_variable = { other_energy_use_display_var = { value = modifier@energy_use multiply = display_multiplier } } # Energy Use from Buildings, computed straight into the persistent per-type display vars with the display multiplier folded in # Base energy use per building: count * (1 + modifier) * base_energy_use * display_multiplier # Base constants: Civs 0.5, Offices 0.25, Agriculture 0.10, Mils 0.5, Dockyards 0.5 # Microchip 0.75, Composite 0.8, Synthetic Refinery 0.2 set_variable = { energy_use_synthetic_refinery_total_display_var = { value = synthetic_refinery_total multiply = { value = 1 add = modifier@energy_use_modifier_synthetic_refinery } multiply = 0.2 multiply = display_multiplier } } set_variable = { energy_use_composite_plant_total_display_var = { value = composite_plant_total multiply = { value = 1 add = modifier@energy_use_modifier_composite_plant } multiply = 0.8 multiply = display_multiplier } } set_variable = { energy_use_microchip_plant_total_display_var = { value = microchip_plant_total multiply = { value = 1 add = modifier@energy_use_modifier_microchip_plant } multiply = 0.75 multiply = display_multiplier } } set_variable = { energy_use_civs_total_display_var = { value = industrial_complex_total multiply = { value = 1 add = modifier@energy_use_modifier_civs } multiply = 0.5 multiply = display_multiplier } } set_variable = { energy_use_offices_total_display_var = { value = office_park_total multiply = { value = 1 add = modifier@energy_use_modifier_offices } multiply = 0.25 multiply = display_multiplier } } set_variable = { energy_use_agriculture_district_total_display_var = { value = agriculture_district_total multiply = { value = 1 add = modifier@energy_use_modifier_agriculture_district } multiply = 0.10 multiply = display_multiplier } } set_variable = { energy_use_mils_total_display_var = { value = military_factory_total multiply = { value = 1 add = modifier@energy_use_modifier_mils } multiply = 0.5 multiply = display_multiplier } } set_variable = { energy_use_dockyards_total_display_var = { value = num_of_naval_factories multiply = { value = 1 add = modifier@energy_use_modifier_dockyards } multiply = 0.5 multiply = display_multiplier } } set_variable = { energy_use_buildings_total_display_var = { value = energy_use_civs_total_display_var add = energy_use_offices_total_display_var add = energy_use_agriculture_district_total_display_var add = energy_use_mils_total_display_var add = energy_use_dockyards_total_display_var add = energy_use_microchip_plant_total_display_var add = energy_use_composite_plant_total_display_var add = energy_use_synthetic_refinery_total_display_var } } # Total internal energy consumption: sum of every scaled source, clamped set_temp_variable = { temp_total_energy_use = { value = population_energy_use_display_var add = energy_use_buildings_total_display_var add = other_energy_use_display_var clamp = { min = 0.001 max = 999999999 } } } } # Effect: energy_calc_generation # Purpose: Renewable, battery, hydro/geothermal, fossil, nuclear, and misc generation accumulated into energy_sum # Produces (temp): no_fuel_killswitch_var (consumed by energy_calc_fuel) energy_calc_generation = { # Energy Gain Multiplier set_temp_variable = { temp_energy_gain_m = { value = 1 add = modifier@energy_gain_multiplier } } # Net Energy Balance Calculations # Add energy gain to sum, then factor it by corresponding multiplier to get final energy gain (through modifiers) set_temp_variable = { temp_renewable_energy_gain_m = { value = 1 add = modifier@renewable_energy_gain_multiplier multiply = temp_energy_gain_m } } set_variable = { energy_sum = { value = state_renewable_energy_var multiply = temp_renewable_energy_gain_m } } set_variable = { minimum_renewable_energy_var = { value = minimum_renewable_energy_var_base multiply = temp_renewable_energy_gain_m } } set_variable = { maximum_renewable_energy_var = { value = maximum_renewable_energy_var_base multiply = temp_renewable_energy_gain_m } } set_variable = { renewable_energy_display_var = energy_sum } # Base amount of GW/h one battery park can store, scaled by storage size modifier set_variable = { max_stored_energy = { value = max_stored_energy_base add = { value = number_of_battery_parks multiply = 100 multiply = { value = 1 add = modifier@battery_park_storage_size_modifier } } } } set_variable = { hydroelectric_energy_generation = { value = hydroelectric_energy_generation_base multiply = temp_energy_gain_m multiply = { value = 1 add = modifier@hydroelectric_power_generation_modifier } } } set_variable = { geothermal_energy_generation = { value = geothermal_energy_generation_base multiply = temp_energy_gain_m multiply = { value = 1 add = modifier@geothermal_power_generation_modifier } } } add_to_variable = { energy_sum = hydroelectric_energy_generation } add_to_variable = { energy_sum = geothermal_energy_generation } # Calculate fuel consumption and energy generation of fossil power plants if = { limit = { has_country_flag = disable_fossil_fuel_power_plant_flag } set_variable = { fossil_pp_energy_generation = 0 } set_variable = { fossil_pp_fuel_consumption = 0 } } else = { set_temp_variable = { fossil_pp_energy_generation_multiplier = { value = 1 add = modifier@fossil_pp_energy_generation_modifier } } # Strip out raw building output from the country modifier (will be re-added with per-state modifiers applied) and keep flat idea bonuses set_variable = { fossil_pp_energy_generation = { value = modifier@fossil_energy_gain subtract = { value = number_of_fossil_pps multiply = 2 } add = state_fossil_energy_var multiply = fossil_pp_energy_generation_multiplier multiply = temp_energy_gain_m } } set_variable = { fossil_pp_fuel_consumption = { value = modifier@fossil_fuel_consumption multiply = { value = 1 add = modifier@fossil_pp_fuel_consumption_modifier } multiply = -1 } } # Generation of Power per Fossil Power Plant set_variable = { fossil_pp_energy_per_plant_display = { value = 2 multiply = fossil_pp_energy_generation_multiplier multiply = temp_energy_gain_m } } } multiply_variable = { fossil_pp_energy_generation = fossil_powerplants_manpower_fulfillment } # Implements the No Fuel Killswitch set_temp_variable = { no_fuel_killswitch_var = 1 } if = { limit = { check_variable = { fuel_k = 0 } } set_variable = { fossil_pp_energy_generation = 0 } set_variable = { fossil_pp_fuel_consumption = 0 } set_temp_variable = { no_fuel_killswitch_var = 0 } } add_to_variable = { energy_sum = fossil_pp_energy_generation } # Nuclear Energy Section # weekly_production = (sum of nuclear_reactor_fuel_production) * (undamaged facilities / total facilities) * (1 + sum of nuclear_reactor_fuel_production_factor) # The building modifier counts every built facility regardless of damage, so scale by the undamaged fraction to make raids cut production if = { limit = { has_country_flag = enabled_nuclear_reactor_fuel_production check_variable = { total_enrichment_facilities > 0 } } set_variable = { total_nuclear_reactor_fuel_production = { value = modifier@nuclear_reactor_fuel_production multiply = undamaged_enrichment_facilities divide = total_enrichment_facilities multiply = { value = 1 add = modifier@nuclear_reactor_fuel_production_factor } round = yes } } } else = { set_variable = { total_nuclear_reactor_fuel_production = 0 } } if = { limit = { NOT = { has_country_flag = disable_nuclear_power_plant_flag } NOT = { has_idea = non_nuclear_power } } # Weekly fuel consumption = base * (1 + consumption modifier), clamped to 0.0001 to avoid div-by-zero set_variable = { nuclear_fuel_consumption = { value = modifier@nuclear_fuel_consumption multiply = { value = 1 add = modifier@nuclear_fuel_consumption_modifier } clamp = { min = 0.0001 max = 999999999 } } } # Net nuclear fuel = weekly production - weekly consumption set_variable = { net_nuclear_fuel_display = { value = total_nuclear_reactor_fuel_production subtract = nuclear_fuel_consumption } } # Strip out raw reactor output from the country modifier (will be re-added with per-state modifiers applied) and keep flat idea bonuses # nuclear_energy_generation = (modifier@nuclear_energy_gain - nuclear_reactors*4 + state_nuclear_energy_var) * (1 + generation_modifier) * gain_m * manpower_fulfillment set_variable = { nuclear_energy_generation = { value = modifier@nuclear_energy_gain subtract = { value = nuclear_reactors multiply = 4 } add = state_nuclear_energy_var multiply = { value = 1 add = modifier@nuclear_energy_generation_modifier } multiply = temp_energy_gain_m multiply = nuclear_reactors_manpower_fulfillment } } # If the reactor-grade stockpile is empty, scale output by the production/consumption fulfillment ratio if = { limit = { check_variable = { var_reactor_material_stockpile = 0 } } multiply_variable = { var = nuclear_energy_generation value = { value = total_nuclear_reactor_fuel_production divide = nuclear_fuel_consumption clamp = { min = 0 max = 1 } } } } add_to_variable = { energy_sum = nuclear_energy_generation } # Generation of Power per Nuclear Reactor set_variable = { nuclear_energy_per_reactor_display = { value = 4 multiply = { value = 1 add = modifier@nuclear_energy_generation_modifier } multiply = temp_energy_gain_m } } } else = { # Set only to production when nuclear power is disabled set_variable = { nuclear_fuel_consumption = 0 } set_variable = { nuclear_energy_generation = 0 } set_variable = { net_nuclear_fuel_display = total_nuclear_reactor_fuel_production } } # Flat Miscellaneous Gain from Content set_variable = { other_energy_generation = { value = modifier@energy_gain multiply = temp_energy_gain_m } } add_to_variable = { energy_sum = other_energy_generation } } # Effect: energy_calc_balance # Purpose: Energy balance, storage withdrawal, fossil fuel-saving, fulfillment ratio, and unfulfilled-demand penalties # Requires (temp): temp_total_energy_use (from energy_calc_consumption) energy_calc_balance = { set_variable = { energy_consumption = temp_total_energy_use } set_variable = { energy_balance = { value = energy_sum subtract = energy_consumption } } set_temp_variable = { energy_fulfillment = energy_sum } set_variable = { energy_withdrawal_from_storage = 0 } set_variable = { free_fossil_powerplants_power = 0 } if = { limit = { check_variable = { stored_energy > 0 } check_variable = { energy_balance < 0 } } set_variable = { energy_withdrawal_from_storage = { value = energy_balance multiply = -1 } } add_to_temp_variable = { energy_fulfillment = energy_withdrawal_from_storage } } if = { limit = { check_variable = { stored_energy = max_stored_energy } check_variable = { energy_balance > 0 } check_variable = { fossil_pp_fuel_consumption < 0 } check_variable = { fossil_pp_energy_generation > 0 } } # saved_fuel is bounded to the surplus energy and current fossil generation set_temp_variable = { saved_fuel = { value = energy_balance max = 0 min = fossil_pp_energy_generation } } set_variable = { free_fossil_powerplants_power = saved_fuel } # Calculate fuel savings proportionally: fraction of generation shut down = fraction of fuel saved # This is always correct regardless of energy_gain_m, manpower, or other multiplier combinations set_temp_variable = { fuel_saved = { value = saved_fuel divide = fossil_pp_energy_generation multiply = fossil_pp_fuel_consumption multiply = -1 } } subtract_from_variable = { fossil_pp_energy_generation = saved_fuel } subtract_from_variable = { energy_sum = saved_fuel } add_to_variable = { fossil_pp_fuel_consumption = fuel_saved } } divide_temp_variable = { energy_fulfillment = energy_consumption } set_variable = { energy_balance_value_display = energy_fulfillment } clamp_variable = { var = energy_balance_value_display min = 0 } clamp_temp_variable = { var = energy_fulfillment min = 0 max = 1 } set_variable = { unfulfilled_energy_demand_var = { value = -1 add = energy_fulfillment } } add_to_variable = { energy_sum = energy_withdrawal_from_storage } #for display purposes set_variable = { energy_difference_variable = { value = energy_sum subtract = energy_consumption } } if = { limit = { has_variable = energy_load_sharing_gain_var } subtract_from_variable = { energy_difference_variable = energy_load_sharing_gain_var } } # Caps penalty for unfulfilled at 50%, then derives scaled variants by GDP/c and a flat -30% variant set_variable = { unfulfilled_energy_demand_dynmod_var = { value = unfulfilled_energy_demand_var multiply = 0.5 clamp = { min = -0.50 max = 0 } } } set_variable = { unfulfilled_energy_demand_dynmod_var_2 = { value = unfulfilled_energy_demand_dynmod_var multiply = gdp_per_capita multiply = 0.025 #penalties decrease below 40k gdp/c, increase above it clamp = { min = -0.50 max = 0 } } } set_variable = { unfulfilled_energy_demand_dynmod_var_3 = { value = unfulfilled_energy_demand_var multiply = 0.3 clamp = { min = -0.30 max = 0 } } } } # Effect: energy_calc_fuel # Purpose: Non-electric fuel consumption and fuel displays, then fires the energy alerts and UI refresh # Requires (temp): no_fuel_killswitch_var (from energy_calc_generation) energy_calc_fuel = { # Calculate the Non-Electric Fuel Consumption set_variable = { non_electric_fuel_consumption = { value = population_total_m multiply = -19 # gdpc_scaling_multiplier = gdp_per_capita * 0.02 + 0.1 (division by 50, plus a floor for super low GDP/c countries) multiply = { value = gdp_per_capita multiply = 0.02 add = 0.1 } # Clamp the modifier floor to 0 so a strongly negative modifier cannot reduce fuel below zero multiply = { value = 1 add = modifier@non_electric_fuel_consumption_modifier clamp = { min = 0 max = 999999999 } } multiply = no_fuel_killswitch_var multiply = { value = 1 add = energy_seasonal_population_demand_factor } } } set_variable = { powerplants_and_pop_fuel_consumption = { value = non_electric_fuel_consumption add = fossil_pp_fuel_consumption } } # Calculate the Display Variables set_variable = { fossil_pp_fuel_display = { value = fossil_pp_fuel_consumption multiply = 24 } } set_variable = { non_electric_fuel_display = { value = non_electric_fuel_consumption multiply = 24 } } md_check_nuclear_fuel_alert = yes md_check_energy_balance_alert = yes md_check_idle_nuclear_reactors_alert = yes update_global_energy_ui = yes } # Effect: update_global_energy_ui # Purpose: Bumps the global UI dirty counter so the energy screen re-reads its variables update_global_energy_ui = { if = { limit = { check_variable = { global.energy_ui > 1000000 } } set_variable = { global.energy_ui = 1 } } else = { add_to_variable = { global.energy_ui = 1 } } } # Effect: calculate_energy_load_sharing # Purpose: Calculates the Energy Load Sharing # TODO: This right now is limited to one way agreements for now. We can expand this to more bilateral agreements later on when we have more details on it. calculate_energy_load_sharing = { if = { limit = { NOT = { check_variable = { energy_load_sharing_nations^0 = 0 } } } set_temp_variable = { available_energy_to_share = { value = energy_difference_variable add = energy_load_sharing_use_var max = 0 } } # Reset the amount of energy load shared to 0 set_variable = { energy_load_sharing_use_var = 0 } set_variable = { energy_load_sharing_gain_var = 0 } set_temp_variable = { needed_energy_for_nations = 0 } for_each_scope_loop = { array = energy_load_sharing_nations if = { limit = { check_variable = { energy_difference_variable < 0 } } set_temp_variable = { energy_required = { value = energy_difference_variable multiply = -1 } } add_to_temp_variable = { PREV.needed_energy_for_nations = energy_required } } } # Calculate the Energy Shared # Assume that if you are sharing energy that you have to maintain more energy otherwise the loading sharing has gotta stop if = { limit = { NOT = { check_variable = { available_energy_to_share < needed_energy_for_nations } } } resize_array = { array = energy_load_sharing_nations_value size = energy_load_sharing_nations^num } for_each_loop = { array = energy_load_sharing_nations var:v = { # Only share if recipient has a deficit; ignore surplus set_temp_variable = { energy_lack = { value = energy_difference_variable min = 0 } } set_variable = { PREV.energy_load_sharing_nations_value^i = energy_lack } set_variable = { energy_load_sharing_gain_var = { value = energy_lack multiply = -1 } } } } set_temp_variable = { total_energy_required_to_share = 0 } for_each_loop = { array = energy_load_sharing_nations_value add_to_temp_variable = { PREV.total_energy_required_to_share = v } } set_variable = { energy_load_sharing_use_var = { value = total_energy_required_to_share multiply = -1 } } } else = { # Provider doesn't have enough energy to share set_variable = { energy_load_sharing_use_var = 0 } for_each_loop = { array = energy_load_sharing_nations var:v = { set_variable = { energy_load_sharing_gain_var = 0 } } } } } # Clear variables if you're neither a provider nor a recipient if = { limit = { check_variable = { energy_load_sharing_nations^0 = 0 } NOT = { has_country_flag = energy_load_sharing_recipient } } clear_variable = energy_load_sharing_use_var clear_variable = energy_load_sharing_gain_var clear_variable = energy_load_sharing_income_var } } # Effect: energy_on_daily # Purpose: applies the energy balance penalties energy_on_daily = { if = { limit = { check_variable = { fuel_k = 0 } NOT = { has_idea = no_fuel_penalties_modifier } } add_ideas = no_fuel_penalties_modifier } else_if = { limit = { check_variable = { fuel_k > 10 } has_idea = no_fuel_penalties_modifier } remove_ideas = no_fuel_penalties_modifier } # Update stored energy based on daily balance and storage capacity if = { limit = { check_variable = { ROOT.max_stored_energy > 0 } } set_variable = { stored_energy = { value = stored_energy add = { value = energy_balance multiply = 24 } clamp = { min = 0 max = ROOT.max_stored_energy } } } } else = { set_variable = { ROOT.stored_energy = 0 } } } # Effect: random_renewable_variable_calculation # Purpose: Calculates the randomized variable for the amount of energy gained from Renewable Energy from a specific state random_renewable_variable_calculation = { for_each_scope_loop = { array = global.states # Monthly output: a random 0..1 fraction of the state's renewable factor (a multiplier averaging 1.0) set_variable_to_random = { var = renewable_energy_random_var min = 0 max = 1 } multiply_variable = { var = renewable_energy_random_var value = modifier@state_renewable_capacity_factor_modifier } # Min / Max for UI info: lowest possible is 0, highest is the full factor set_variable = { min_renewable_energy_var = 0 } set_variable = { max_renewable_energy_var = modifier@state_renewable_capacity_factor_modifier } } } # Effect: build_battery_park_effect # Purpose: Builds battery parks and charges treasury unless payment is skipped # Parameters: # - temp_change - number of battery parks to add # - skip_payment - (optional) set to 1 to skip treasury charge build_battery_park_effect = { custom_effect_tooltip = build_battery_park_effect_TT if = { limit = { NOT = { check_variable = { skip_payment = 1 } } } set_temp_variable = { treasury_change = { value = temp_change multiply = -100 multiply = { value = 1 add = modifier@battery_park_construction_cost } } } modify_treasury_effect = yes } hidden_effect = { random_owned_controlled_state = { add_to_variable = { number_of_battery_parks_state_var = temp_change } } } ingame_update_setup = yes } # Effect: add_hydroelectric_energy_production_effect # Purpose: Adds hydroelectric energy production to a particular state # Parameters: # - electric_addition - Power generation of the plants # - storage_addition - Storage addition for the plants add_hydroelectric_energy_production_effect = { custom_effect_tooltip = add_hydroelectric_energy_production_effect_tt add_to_variable = { hydroelectric_energy_production_var = electric_addition } add_to_variable = { hydroelectric_energy_storage_var = storage_addition } hidden_effect = { if = { limit = { NOT = { has_dynamic_modifier = { modifier = hydroelectric_infrastructure_in_state } } } add_dynamic_modifier = { modifier = hydroelectric_infrastructure_in_state } } } } # Effect: change_reactor_grade_material_effect # Purpose: Changes the amount of reactor grade nuclear material that a nation possesses change_reactor_grade_material_effect = { custom_effect_tooltip = change_reactor_grade_material_effect_tt add_to_variable = { var_reactor_material_stockpile = change_resource } } # Effect: buy_fuel_from_the_market_effect # Purpose: Adds 50k units of fuel when buying it from the energy screen buy_fuel_from_the_market_effect = { add_fuel = 100000 set_temp_variable = { treasury_change = -0.1 } modify_treasury_effect = yes }