From 0ba898838a306860580f0d24032986791905e8c4 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 22 Nov 2022 19:25:15 +0100 Subject: [PATCH] use simpler file and class naming for the example mod --- ExampleMod.cs | 8 ++++---- SitDownOnGrassAction.cs => ExampleModGrassSitAction.cs | 4 ++-- ModOptions.cs => ExampleModOptions.cs | 2 +- CustomTable.cs => ExampleModTable.cs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename SitDownOnGrassAction.cs => ExampleModGrassSitAction.cs (93%) rename ModOptions.cs => ExampleModOptions.cs (78%) rename CustomTable.cs => ExampleModTable.cs (86%) diff --git a/ExampleMod.cs b/ExampleMod.cs index ac49161..57f2683 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -20,7 +20,7 @@ public class ExampleMod : Mod { // the logger that we can use to log info about this mod public static Logger Logger { get; private set; } - public static ModOptions Options { get; private set; } + public static ExampleModOptions Options { get; private set; } public static EmotionModifier GrassSittingModifier { get; private set; } @@ -40,7 +40,7 @@ public class ExampleMod : Mod { FurnitureType.Register(new FurnitureType.TypeSettings("ExampleMod.CustomTable", new Point(1, 1), ObjectCategory.Table, 150, ColorScheme.SimpleWood) { // specify the type that should be constructed when this furniture type is placed // if this is not specified, the Furniture class is used, which is used for furniture without special animations or data - ConstructedType = typeof(CustomTable), + ConstructedType = typeof(ExampleModTable), // specifying icons for custom clothes and furniture is optional, but using the mod's icon helps users recognize a mod's features Icon = this.Icon, // allow chairs and plates to be slotted into and onto the table @@ -71,7 +71,7 @@ public class ExampleMod : Mod { }; // adding a simple action: sitting down in the grass, which also gives us a nice emotion modifier - ActionType.Register(new ActionType.TypeSettings("ExampleMod.SitOnGrass", ObjectCategory.Ground, typeof(SitDownOnGrassAction)) { + ActionType.Register(new ActionType.TypeSettings("ExampleMod.SitOnGrass", ObjectCategory.Ground, typeof(ExampleModGrassSitAction)) { // we set this action to be executable only on grass tiles, not on other ground CanExecute = (actionInfo, _) => { if (!actionInfo.Map.IsInBounds(actionInfo.ActionLocation.ToPoint())) @@ -102,7 +102,7 @@ public class ExampleMod : Mod { public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) { ExampleMod.Logger = logger; - ExampleMod.Options = info.LoadOptions(() => new ModOptions()); + ExampleMod.Options = info.LoadOptions(() => new ExampleModOptions()); // loads a texture atlas with the given amount of separate texture regions in the x and y axes // we submit it to the texture packer to increase rendering performance. The callback is invoked once packing is completed diff --git a/SitDownOnGrassAction.cs b/ExampleModGrassSitAction.cs similarity index 93% rename from SitDownOnGrassAction.cs rename to ExampleModGrassSitAction.cs index d31ffd7..35f688a 100644 --- a/SitDownOnGrassAction.cs +++ b/ExampleModGrassSitAction.cs @@ -10,9 +10,9 @@ namespace ExampleMod; // we use a multi action because we want to walk to the location, and then execute the main sitting part // see CustomTable for information on how to store custom action-specific information to disk as well -public class SitDownOnGrassAction : MultiAction { +public class ExampleModGrassSitAction : MultiAction { - public SitDownOnGrassAction(ActionType type, ActionInfo info) : base(type, info) {} + public ExampleModGrassSitAction(ActionType type, ActionInfo info) : base(type, info) {} protected override IEnumerable CreateFirstActions() { // we want to walk to the location clicked, so we use the current action info diff --git a/ModOptions.cs b/ExampleModOptions.cs similarity index 78% rename from ModOptions.cs rename to ExampleModOptions.cs index 54b075e..cb2403e 100644 --- a/ModOptions.cs +++ b/ExampleModOptions.cs @@ -1,7 +1,7 @@ namespace ExampleMod; // these options are saved and loaded in ExampleMod -public class ModOptions { +public class ExampleModOptions { public float DarkShirtSpeedIncrease = 2; diff --git a/CustomTable.cs b/ExampleModTable.cs similarity index 86% rename from CustomTable.cs rename to ExampleModTable.cs index 1be2c03..2f9aebf 100644 --- a/CustomTable.cs +++ b/ExampleModTable.cs @@ -6,15 +6,15 @@ using TinyLife.World; namespace ExampleMod; // note that having a custom class for a furniture item like this is entirely optional -// but it allows for additional functionalities as displayed in this example -public class CustomTable : Furniture { +// but it allows for additional functionalities as displayed in this example +public class ExampleModTable : Furniture { // anything whose base classes have the DataContract attribute automatically gets saved and loaded to and from disk // this means that you can add custom DataMember members to have them saved and loaded [DataMember] public float TestValue; - public CustomTable(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos) : base(id, type, colors, map, pos) { + public ExampleModTable(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos) : base(id, type, colors, map, pos) { this.TestValue = Furniture.Random.NextSingle(); }