Compare commits

..

No commits in common. "main" and "0.38.3" have entirely different histories.
main ... 0.38.3

4 changed files with 12 additions and 16 deletions

View file

@ -1,8 +1,7 @@
{ {
"BuildMode": { "BuildMode": {
"ExampleMod.CustomTable": "Custom Table", "ExampleMod.CustomTable": "Custom Table",
"ExampleMod.CrossedWallpaper": "Crossed Wallpaper", "ExampleMod.CrossedWallpaper": "Crossed Wallpaper"
"ExampleMod.CustomTile": "Custom Tile"
}, },
"Clothes": { "Clothes": {
"ExampleMod.DarkShirt": "Dark Shirt", "ExampleMod.DarkShirt": "Dark Shirt",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 B

View file

@ -34,14 +34,13 @@ public class ExampleMod : Mod {
public override string Description => "This is the example mod for Tiny Life!"; public override string Description => "This is the example mod for Tiny Life!";
public override TextureRegion Icon => this.uiTextures[new Point(0, 0)]; public override TextureRegion Icon => this.uiTextures[new Point(0, 0)];
public override string IssueTrackerUrl => "https://github.com/Ellpeck/TinyLifeExampleMod/issues"; public override string IssueTrackerUrl => "https://github.com/Ellpeck/TinyLifeExampleMod/issues";
public override string TestedVersionRange => "[0.42.0,0.42.4]"; public override string TestedVersionRange => "[0.38.0, 0.38.3]";
private Dictionary<Point, TextureRegion> customTops; private Dictionary<Point, TextureRegion> customTops;
private Dictionary<Point, TextureRegion> customHairs; private Dictionary<Point, TextureRegion> customHairs;
private Dictionary<Point, TextureRegion> customBottoms; private Dictionary<Point, TextureRegion> customBottoms;
private Dictionary<Point, TextureRegion> uiTextures; private Dictionary<Point, TextureRegion> uiTextures;
private Dictionary<Point, TextureRegion> wallpaperTextures; private Dictionary<Point, TextureRegion> wallpaperTextures;
private Dictionary<Point, TextureRegion> tileTextures;
public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) { public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) {
ExampleMod.Logger = logger; ExampleMod.Logger = logger;
@ -54,7 +53,6 @@ public class ExampleMod : Mod {
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomHairs"), 4, 5), r => this.customHairs = r, 1, true); texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomHairs"), 4, 5), r => this.customHairs = r, 1, true);
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r, 1, true); texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r, 1, true);
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("UiTextures"), 8, 8), r => this.uiTextures = r, 1, true); texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("UiTextures"), 8, 8), r => this.uiTextures = r, 1, true);
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("Tiles"), 4, 2), r => this.tileTextures = r, 1, true);
// wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor // wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor
WallMode.ApplyMasks(content.Load<Texture2D>("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r); WallMode.ApplyMasks(content.Load<Texture2D>("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r);
} }
@ -118,7 +116,7 @@ public class ExampleMod : Mod {
// we allow the action to be done even if the solved needs aren't low enough on a person // we allow the action to be done even if the solved needs aren't low enough on a person
CanDoRandomly = true, CanDoRandomly = true,
// the solved needs indicate when the AI should mark this action as important, they don't actually have to match the action's behavior // the solved needs indicate when the AI should mark this action as important, they don't actually have to match the action's behavior
SolvedNeeds = [NeedType.Energy], SolvedNeeds = new[] {NeedType.Energy},
// make people more likely to sit down in the grass if they're uncomfortable // make people more likely to sit down in the grass if they're uncomfortable
PassivePriority = p => p.Emotion == EmotionType.Uncomfortable ? 150 : 25 PassivePriority = p => p.Emotion == EmotionType.Uncomfortable ? 150 : 25
}, },
@ -132,9 +130,6 @@ public class ExampleMod : Mod {
// adding a custom wallpaper (we're using the top left texture region, which is why we pass 0, 0 as the texture coordinate) // adding a custom wallpaper (we're using the top left texture region, which is why we pass 0, 0 as the texture coordinate)
Wallpaper.Register("ExampleMod.CrossedWallpaper", 15, this.wallpaperTextures, new Point(0, 0), ColorScheme.Modern, this.Icon); Wallpaper.Register("ExampleMod.CrossedWallpaper", 15, this.wallpaperTextures, new Point(0, 0), ColorScheme.Modern, this.Icon);
// adding a custom tile
Tile.Register("ExampleMod.CustomTile", 8, this.tileTextures, new Point(0, 0), ColorScheme.Bricks, icon: this.Icon);
} }
public override IEnumerable<string> GetCustomFurnitureTextures(ModInfo info) { public override IEnumerable<string> GetCustomFurnitureTextures(ModInfo info) {
@ -152,9 +147,11 @@ public class ExampleMod : Mod {
group.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => $"{Localization.Get(LnCategory.Ui, "ExampleMod.DarkShirtSpeedOption")}: {ExampleMod.Options.DarkShirtSpeedIncrease}")); group.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => $"{Localization.Get(LnCategory.Ui, "ExampleMod.DarkShirtSpeedOption")}: {ExampleMod.Options.DarkShirtSpeedIncrease}"));
group.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 10), 5, 5) { group.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 10), 5, 5) {
CurrentValue = ExampleMod.Options.DarkShirtSpeedIncrease, CurrentValue = ExampleMod.Options.DarkShirtSpeedIncrease,
OnValueChanged = (_, v) => ExampleMod.Options.DarkShirtSpeedIncrease = v OnValueChanged = (_, v) => {
ExampleMod.Options.DarkShirtSpeedIncrease = v;
info.SaveOptions(ExampleMod.Options);
}
}); });
group.OnRemovedFromUi += _ => info.SaveOptions(ExampleMod.Options);
} }
} }

View file

@ -5,16 +5,16 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TinyLifeApi" Version="0.42.4" /> <PackageReference Include="TinyLifeApi" Version="0.38.3" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" /> <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
<PackageReference Include="Lib.Harmony" Version="2.2.2" /> <PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="ExtremelySimpleLogger" Version="1.4.1" /> <PackageReference Include="ExtremelySimpleLogger" Version="1.4.1" />
<PackageReference Include="MLEM.Data" Version="6.3.0" /> <PackageReference Include="MLEM.Data" Version="6.1.0" />
<PackageReference Include="MLEM.Extended" Version="6.3.0" /> <PackageReference Include="MLEM.Extended" Version="6.1.0" />
<PackageReference Include="MLEM.Startup" Version="6.3.0" /> <PackageReference Include="MLEM.Startup" Version="6.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="DynamicEnums" Version="1.2.0" /> <PackageReference Include="DynamicEnums" Version="1.0.1" />
<PackageReference Include="Coroutine" Version="2.1.5" /> <PackageReference Include="Coroutine" Version="2.1.5" />
</ItemGroup> </ItemGroup>