Add localized message support to warheads.
This commit is contained in:
committed by
Gustas
parent
50d4936e51
commit
bc3c97398b
@@ -20,6 +20,7 @@ using Linguini.Syntax.Parser;
|
|||||||
using OpenRA.Mods.Common.Scripting;
|
using OpenRA.Mods.Common.Scripting;
|
||||||
using OpenRA.Mods.Common.Scripting.Global;
|
using OpenRA.Mods.Common.Scripting.Global;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Mods.Common.Warheads;
|
||||||
using OpenRA.Scripting;
|
using OpenRA.Scripting;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
@@ -141,6 +142,23 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var weapon in rules.Weapons)
|
||||||
|
{
|
||||||
|
foreach (var warhead in weapon.Value.Warheads)
|
||||||
|
{
|
||||||
|
var warheadType = warhead.GetType();
|
||||||
|
foreach (var field in Utility.GetFields(warheadType))
|
||||||
|
{
|
||||||
|
var translationReference = Utility.GetCustomAttributes<TranslationReferenceAttribute>(field, true).SingleOrDefault();
|
||||||
|
if (translationReference == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (var key in LintExts.GetFieldValues(warhead, field, translationReference.DictionaryReference))
|
||||||
|
usedKeys.Add(key, translationReference, $"Weapon `{weapon.Key}` warhead `{warheadType.Name[..^7]}.{field.Name}`");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return usedKeys;
|
return usedKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +245,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
var testedFields = new List<FieldInfo>();
|
var testedFields = new List<FieldInfo>();
|
||||||
testedFields.AddRange(
|
testedFields.AddRange(
|
||||||
modData.ObjectCreator.GetTypes()
|
modData.ObjectCreator.GetTypes()
|
||||||
.Where(t => t.IsSubclassOf(typeof(TraitInfo)))
|
.Where(t => t.IsSubclassOf(typeof(TraitInfo)) || t.IsSubclassOf(typeof(Warhead)))
|
||||||
.SelectMany(t => t.GetFields().Where(f => f.HasAttribute<TranslationReferenceAttribute>())));
|
.SelectMany(t => t.GetFields().Where(f => f.HasAttribute<TranslationReferenceAttribute>())));
|
||||||
|
|
||||||
// HACK: Need to hardcode the custom loader for GameSpeeds.
|
// HACK: Need to hardcode the custom loader for GameSpeeds.
|
||||||
|
|||||||
Reference in New Issue
Block a user