Aluminum

by brevven

Adds aluminum, alumina, cables, alloys and more to the game. Compatible with RSO, Krastorio 2 and Space Exploration. A standalone piece of BZ Mods.

Content
8 months ago
1.1
28.9K
Mining Manufacturing

i Aluminium/Aluminum Toggle

2 years ago
(updated 2 years ago)

Heya, not sure if this is a duplicate of the earlier .cfg post or not (different locales, spellings), so here goes ...

I'd like a startup-option to allow the string to be toggled between "Aluminum" (North American) and "Aluminium" (Everyone else?) strings.

Utility function in a .lua script to perform a ternary operation:

local function ternary_op( cond, true_case, false_case )
    if cond then return true_case else return false_case end
end

A line in your settings.lua:

data:extend({{ type = 'bool-setting', name = "bz_aluminum-modus", setting_type = 'startup',
               localised_name={"bz_aluminum-modus.name"},
               localised_description={"bz_aluminum-modus.desc"}, default_value = false }});

When referencing "Aluminum"/"aluminum" (in a data.lua), perform a locale query, much like so:

local capitalized = {
    "bz_aluminum-modus" .. ternary_op( settings.startup["bz_aluminum-modus"], ".gn_cap", ".na_cap" ) }

local lowercase = {
    "bz_aluminum-modus" .. ternary_op( settings.startup["bz_aluminum-modus"], ".gn_low", ".na_low" ) }

The above keys can then be used as parameters to parametric locale queries, or stand-alone.

With a locale file containing the following content:

[bz_aluminum-modus]
gn_cap=Aluminium
gn_low=aluminium
na_cap=Aluminum
na_low=aluminum
name=Use global naming ("Aluminium") or North American ("Aluminum")
desc=Toggle ON to use global naming, OFF (Default) to use North American naming.

Now, although the above code works, in my mind... heh...
The above code is untested, but that should more-or-less allow alternating between the two accepted names for Aluminium/Aluminum.
Now you've got keys for both the capitalized and the lowercase versions.

(Any questions?)

Best Regards,

2 years ago

Hi! Thanks for the suggestion. I will try to add this into the mod soon. I've been quite busy recently, so I hope to be able to do so in the next few weeks.

2 years ago

Hi, for the moment I've decided to keep things very simple and I added two items "aluminum_upper" and "aluminum_lower" that can be used in locales. Here's an example mod that takes advantage, and might be all that you need right now: https://mods.factorio.com/mod/bzall10n

2 years ago

Thanks. That sounds like it should do it then. Definitely a simpler solution to the locale-quirk then :)

The problem for me was the North American English whilst I normally interact with the standard American English.
I also find it easier to say "Aluminium" instead of "Aluminum" ... to me it sounds like the less "distraught" version, heh.

New response