BodyPartTemplateNames
Tracking Issue: #328
Tags: customization
Allows Torso, Arms and Legs customization pieces to be uniquely localized.
For templates, localization (i.e. providing strings for in-game display like names
or descriptions) is handled using the object name that is the same as the template name.
For example, given a template name of 'Female_LongStraight'
, the template is created
by giving the X2BodyPartTemplate
that name:
// Object name -------vvvvvvvvvvvvvvvvvvv
Template = new(None, "Female_LongStraight") class'X2BodyPartTemplate';
Template.SetTemplateName('Female_LongStraight');
// Template name ---------^^^^^^^^^^^^^^^^^^^
On the localization side, the object name is used to localize the DisplayName
:
;vvvvvvvvvvvvvvvvvvv--- Object name
[Female_LongStraight X2BodyPartTemplate]
DisplayName="Long Straight"
Body part templates are different from normal templates in that templates for different
customization categories are allowed to have the same name. In vanilla, there are collisions
for Torso
, Arms
and Legs
so there is a Conventional Medium Male Torso, an Arms piece,
and a Legs piece with the name CnvMed_Std_A_M
.
However, in order for localization to work, there must be no object name collisions.
As a result, the game opts to not assign any object name to Torsos, Arms, and Legs, and instead
simply shows them as "Torso 1", "Torso 2" and so on.
Because mods may want to localize their pieces, this Highlander change gives all armor pieces a unique object name.
This happens using the following algorithm for every BodyPartTemplateConfig
entry:
- If the
PartType
is not"Torso"
,"Arms"
,"Legs"
, the object name and the template name are taken fromTemplateName
in the config entry (vanilla behavior). - If the
PartType
is"Torso"
,"Arms"
, or"Legs"
:- If
TemplateName
contains that part type, then the object name and the template name are taken fromTemplateName
in the config entry. - If
TemplateName
does not contain that part type, then the template name is taken fromTemplateName
, and the object name is created by appending an underscore and the part type to the template name.
- If
Additionally, the UI is changed to use the DisplayName
for Torso/Arms/Legs, and fall back to numbered vanilla display
if no DisplayName
is provided.
A table with some examples:
Config PartType |
Config TemplateName |
Resulting Template Name | Resulting Object Name |
---|---|---|---|
"Torso" |
"CnvMed_Std_A_M" |
'CnvMed_Std_A_M' |
"CnvMed_Std_A_M_Torso" |
"Helmets" |
"Reaper_Hood_A_M" |
'Reaper_Hood_A_M' |
"Reaper_Hood_A_M" |
"Torso" |
"DLC_30_Torso_M" |
'DLC_30_Torso_M' |
"DLC_30_Torso_M" |