Multiplying units by an integer
Posted: Sat Feb 26, 2022 7:07 am
Hello,
As the title says, I'd like to multiply a unit by an integer.
Specifically, I'd like to multiply "300kW" by 4, and get either "1200kW", "1.2MW", or (for all I care) "1200000W"
However, units (such as energy units) are strings: https://wiki.factorio.com/Types/Energy
I feel like there's gotta be a builtin for this, or at least a built-in to turn a unit into an integer. Like GetValsFromUnit(unit) and GetValsFromUnit("1200kW") would return 1200000 and "W".
If there isn't, then... damn. Rip.
I'm fully aware that XKCDs 1205, 974, and (in a less extreme sense) 1319 can ALL be invoked, given that I can just put "3MW" in the field that I want filled.
On the other hand, I don't care.
Thanks,
Tsumiki Miniwa
As the title says, I'd like to multiply a unit by an integer.
Specifically, I'd like to multiply "300kW" by 4, and get either "1200kW", "1.2MW", or (for all I care) "1200000W"
However, units (such as energy units) are strings: https://wiki.factorio.com/Types/Energy
I feel like there's gotta be a builtin for this, or at least a built-in to turn a unit into an integer. Like GetValsFromUnit(unit) and GetValsFromUnit("1200kW") would return 1200000 and "W".
If there isn't, then... damn. Rip.
I'm fully aware that XKCDs 1205, 974, and (in a less extreme sense) 1319 can ALL be invoked, given that I can just put "3MW" in the field that I want filled.
On the other hand, I don't care.
Thanks,
Tsumiki Miniwa