Skip to content

Commit

Permalink
feat: hide ramping speed when too fast
Browse files Browse the repository at this point in the history
  • Loading branch information
mglst committed Nov 25, 2024
1 parent 3e5ecf5 commit 81ee89a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
32 changes: 19 additions & 13 deletions website/technology_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,19 +551,25 @@ def _package_power_generating_facility_base(player: Player, facility):
"""Gets all data shared by power and storage facilities"""
engine: GameEngine = current_app.config["engine"]
const_config_assets = engine.const_config["assets"]
return {
"power_generation": const_config_assets[facility]["base_power_generation"]
* power_production_multiplier(player, facility),
"ramping_time": const_config_assets[facility]["ramping_time"]
if const_config_assets[facility]["ramping_time"] != 0
else None,
"ramping_speed": const_config_assets[facility]["base_power_generation"]
* power_production_multiplier(player, facility)
/ const_config_assets[facility]["ramping_time"]
* 60
if const_config_assets[facility]["ramping_time"] != 0
else None,
} | _capacity_factors(player, facility)
return (
{
"power_generation": const_config_assets[facility]["base_power_generation"]
* power_production_multiplier(player, facility)
}
| (
{
"ramping_time": const_config_assets[facility]["ramping_time"],
"ramping_speed": const_config_assets[facility]["base_power_generation"]
* power_production_multiplier(player, facility)
/ const_config_assets[facility]["ramping_time"]
* 60,
}
if const_config_assets[facility]["ramping_time"] != 0
and const_config_assets[facility]["ramping_time"] > engine.in_game_seconds_per_tick
else {}
)
| _capacity_factors(player, facility)
)


def _capacity_factors(player: Player, facility: str):
Expand Down
2 changes: 1 addition & 1 deletion website/templates/assets/power_facilities.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
</td>
</tr>
{# Ramping Speed #}
{% if facility_data.ramping_speed is not none %}
{% if "ramping_speed" in facility_data %}
<tr>
<td>Ramping speed</td>
<td class="txt_center">
Expand Down
16 changes: 9 additions & 7 deletions website/templates/assets/storage_facilities.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@
</td>
</tr>
{# Ramping Speed #}
<tr>
<td>Ramping speed</td>
<td class="txt_center">
<strong id="ramping_speed"></strong>
<script>document.currentScript.previousElementSibling.innerHTML = format_power({{ facility_data.ramping_speed }}) + "/min";</script>
</td>
</tr>
{% if "ramping_speed" in facility_data %}
<tr>
<td>Ramping speed</td>
<td class="txt_center">
<strong id="ramping_speed"></strong>
<script>document.currentScript.previousElementSibling.innerHTML = format_power({{ facility_data.ramping_speed }}) + "/min";</script>
</td>
</tr>
{% endif %}
{# Efficiency #}
<tr>
<td>Efficiency</td>
Expand Down

0 comments on commit 81ee89a

Please sign in to comment.