Debian Codegraph @

default/scripting/techs/ship_parts/fuel/fuel.py

raw
1 # Increase the fuel capacity of ships with FU_BASIC_TANK parts.
2 # Adds the given increase amount times the number of FU_BASIC_TANK parts in the design to the max fuel meter.
3 # @1@ Accounting label to present this effect with
4 # @2@ Fuel capacity increase per fuel part
5 from focs._effects import (
6 DesignHasPart,
7 EffectsGroup,
8 NamedReal,
9 OwnedBy,
10 PartsInShipDesign,
11 SetMaxFuel,
12 Ship,
13 Source,
14 Target,
15 Value,
16 )
17
18
19 def PART_UPGRADE_MAXFUEL_EFFECTS(effect_name: str, value: float):
20 return EffectsGroup(
21 scope=Ship & OwnedBy(empire=Source.Owner) & DesignHasPart(name="FU_BASIC_TANK"),
22 accountinglabel=effect_name,
23 effects=[
24 SetMaxFuel(
25 value=Value
26 + NamedReal(name=effect_name + "_MULT", value=value)
27 * PartsInShipDesign(name="FU_BASIC_TANK", design=Target.DesignID)
28 )
29 ],
30 )