Closed RamuneNeptune closed 9 months ago
Currently I gotta add an extra parameter to my extension methods for the ID & name
You can use the following code to achieve this
public static class TechTypeExtensions
{
public static string DisplayName(this TechType techType) => Language.main.Get(techType);
public static string Tooltip(this TechType techType) => Language.main.Get("Tooltip_" + techType);
public static Atlas.Sprite Sprite(this TechType techType) => SpriteManager.Get(techType);
}
public static class CustomPrefabExtensions
{
public static string Id(this CustomPrefab customPrefab) => customPrefab.Info.ClassID;
public static string DisplayName(this CustomPrefab customPrefab) => Language.main.Get(customPrefab.Info.TechType);
public static string Tooltip(this CustomPrefab customPrefab) => Language.main.Get("Tooltip_" + customPrefab.Info.TechType);
public static Atlas.Sprite Sprite(this CustomPrefab customPrefab) => SpriteManager.Get(customPrefab.Info.TechType);
}
Describe the feature A way to fetch your CustomPrefab's ID, name, description, and sprite. Like
PrefabInfo.ID
PrefabInfo.DisplayName
etc or somethingUsage How would modders use this feature?