Compare commits

..

No commits in common. "17f55129c2e0c135e70461b0d892de875ace6947" and "c8c7d3c528de0f9a3abe6418304bd0cb3bc077ea" have entirely different histories.

3 changed files with 20 additions and 20 deletions

View file

@ -27,12 +27,12 @@ public class ExampleMod : Mod {
// visual data about this mod // visual data about this mod
public override string Name => "Example Mod"; public override string Name => "Example 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[0, 0];
private Dictionary<Point, TextureRegion> customTops; private UniformTextureAtlas customTops;
private Dictionary<Point, TextureRegion> customHairs; private UniformTextureAtlas customHairs;
private Dictionary<Point, TextureRegion> customBottoms; private UniformTextureAtlas customBottoms;
private Dictionary<Point, TextureRegion> uiTextures; private UniformTextureAtlas uiTextures;
private Dictionary<Point, TextureRegion> wallpaperTextures; private Dictionary<Point, TextureRegion> wallpaperTextures;
public override void AddGameContent(GameImpl game, ModInfo info) { public override void AddGameContent(GameImpl game, ModInfo info) {
@ -49,15 +49,15 @@ public class ExampleMod : Mod {
// adding custom clothing // adding custom clothing
var darkShirt = new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt, var darkShirt = new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt,
this.customTops, new Point(0, 0), // the top left in-world region (the rest will be auto-gathered from the atlas) this.customTops[0, 0], // the top left in-world region (the rest will be auto-gathered from the atlas)
100, // the price 100, // the price
ClothesIntention.Everyday | ClothesIntention.Workout, // the clothes item's use cases ClothesIntention.Everyday | ClothesIntention.Workout, // the clothes item's use cases
ColorScheme.WarmDark) {Icon = this.Icon}; ColorScheme.WarmDark) {Icon = this.Icon};
Clothes.Register(darkShirt); Clothes.Register(darkShirt);
// adding some more custom clothing // adding some more custom clothing
Clothes.Register(new Clothes("ExampleMod.PastelPants", ClothesLayer.Pants, this.customBottoms, new Point(4, 0), 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon}); Clothes.Register(new Clothes("ExampleMod.PastelPants", ClothesLayer.Pants, this.customBottoms[4, 0], 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon});
Clothes.Register(new Clothes("ExampleMod.PastelShoes", ClothesLayer.Shoes, this.customBottoms, new Point(0, 0), 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon}); Clothes.Register(new Clothes("ExampleMod.PastelShoes", ClothesLayer.Shoes, this.customBottoms[0, 0], 100, ClothesIntention.Everyday, ColorScheme.Pastel) {Icon = this.Icon});
Clothes.Register(new Clothes("ExampleMod.WeirdHair", ClothesLayer.Hair, this.customHairs, new Point(0, 0), 0, ClothesIntention.None, ColorScheme.Modern) {Icon = this.Icon}); Clothes.Register(new Clothes("ExampleMod.WeirdHair", ClothesLayer.Hair, this.customHairs[0, 0], 0, ClothesIntention.None, ColorScheme.Modern) {Icon = this.Icon});
// adding an event subscription to people // adding an event subscription to people
MapObject.OnEventsAttachable += o => { MapObject.OnEventsAttachable += o => {
@ -89,12 +89,12 @@ public class ExampleMod : Mod {
PassivePriority = p => p.Emotion == EmotionType.Uncomfortable ? 150 : 25 PassivePriority = p => p.Emotion == EmotionType.Uncomfortable ? 150 : 25
}, },
// since this action doesn't use objects (like chairs etc.), we set a texture to display instead // since this action doesn't use objects (like chairs etc.), we set a texture to display instead
Texture = this.uiTextures[new Point(1, 0)] Texture = this.uiTextures[1, 0]
}); });
// we use this emotion modifier in SitDownOnGrassAction // we use this emotion modifier in SitDownOnGrassAction
ExampleMod.GrassSittingModifier = EmotionModifier.Register( ExampleMod.GrassSittingModifier = EmotionModifier.Register(
new EmotionModifier("ExampleMod.GrassSitting", this.uiTextures[new Point(1, 0)], EmotionType.Happy)); new EmotionModifier("ExampleMod.GrassSitting", this.uiTextures[1, 0], EmotionType.Happy));
// 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);
@ -106,10 +106,10 @@ public class ExampleMod : Mod {
// loads a texture atlas with the given amount of separate texture regions in the x and y axes // 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 // we submit it to the texture packer to increase rendering performance. The callback is invoked once packing is completed
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomTops"), 4, 8), r => this.customTops = r); texturePacker.Add(content.Load<Texture2D>("CustomTops"), r => this.customTops = new UniformTextureAtlas(r, 4, 8));
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomHairs"), 4, 6), r => this.customHairs = r); texturePacker.Add(content.Load<Texture2D>("CustomHairs"), r => this.customHairs = new UniformTextureAtlas(r, 4, 6));
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r); texturePacker.Add(content.Load<Texture2D>("CustomBottomsShoes"), r => this.customBottoms = new UniformTextureAtlas(r, 8, 6));
texturePacker.Add(new UniformTextureAtlas(content.Load<Texture2D>("UiTextures"), 8, 8), r => this.uiTextures = r); texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
// 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);
} }

View file

@ -5,13 +5,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TinyLifeApi" Version="0.28.1" /> <PackageReference Include="TinyLifeApi" Version="0.27.0" />
<PackageReference Include="ExtremelySimpleLogger" Version="1.2.5" /> <PackageReference Include="ExtremelySimpleLogger" Version="1.2.5" />
<PackageReference Include="Lib.Harmony" Version="2.2.1" /> <PackageReference Include="Lib.Harmony" Version="2.2.1" />
<PackageReference Include="MLEM.Data" Version="6.1.0-629" /> <PackageReference Include="MLEM.Data" Version="6.0.0" />
<PackageReference Include="MLEM.Extended" Version="6.1.0-629" /> <PackageReference Include="MLEM.Extended" Version="6.0.0" />
<PackageReference Include="MLEM.Startup" Version="6.1.0-629" /> <PackageReference Include="MLEM.Startup" Version="6.0.0" />
<PackageReference Include="MonoGame.Extended" Version="3.8.0" /> <PackageReference Include="MonoGame.Extended" Version="3.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.263" /> <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.263" />

View file

@ -40,7 +40,7 @@ public class ExampleModGrassSitAction : MultiAction {
protected override CompletionType AndThenIsCompleted() { protected override CompletionType AndThenIsCompleted() {
// we want to complete our action once 10 minutes of sitting time have passed // we want to complete our action once 10 minutes of sitting time have passed
return this.CompleteIfTimeUp(TimeSpan.FromMinutes(10)); return this.CompleteInTime(TimeSpan.FromMinutes(10));
} }
protected override void AndThenOnCompleted(CompletionType type) { protected override void AndThenOnCompleted(CompletionType type) {