Compare commits

...

27 commits
0.37.4 ... main

Author SHA1 Message Date
Ell
3da4807b57 0.42.4 2024-06-19 12:57:19 +02:00
Ell
eb19f848e0 0.42.3 2024-06-17 22:36:54 +02:00
Ell
0922ecefc5 0.42.2 2024-06-15 12:48:45 +02:00
Ell
977ad2d401 0.42.1 2024-06-09 20:51:37 +02:00
Ell
c963a9781c 0.42.0 2024-06-09 17:07:26 +02:00
Ell
339411aed6 0.41.2 2024-05-01 17:59:47 +02:00
Ell
ef04313a7a 0.41.1 2024-04-21 10:33:56 +02:00
Ell
17e0f6dbfb 0.41.0 2024-04-14 17:59:01 +02:00
Ell
728553e329 0.40.1 2024-03-10 16:38:23 +01:00
Ell
6d6e95727b 0.40.0 2024-03-09 19:54:31 +01:00
Ell
0c2057801e 0.39.1 2024-02-04 12:36:01 +01:00
Ell
7676e8e294 0.39.0 2024-02-02 18:15:15 +01:00
jpiolho
a07d8ba5c7
Custom tile example (#2)
* Added custom tile example

* Fixed whitespace
2024-01-27 13:50:18 +01:00
Ell
f20a1dc1ae 0.38.4 2024-01-07 16:53:45 +01:00
Ell
9f2694178d use collection expressions in whole project 2023-12-21 17:34:40 +01:00
Ell
25d51baafb 0.38.3 2023-12-19 16:55:34 +01:00
Ell
855feece79 don't include various ide settings by default 2023-12-16 20:22:50 +01:00
Ell
3a4f8d5413 added some more base game dependencies to example mod for ease of use 2023-12-16 17:15:12 +01:00
Ell
cefa4b4f13 0.38.2 2023-12-14 11:04:47 +01:00
Ell
f911f01ce9 0.38.1 2023-12-13 14:46:38 +01:00
Ell
80309a73a5 small cake cleanup 2023-12-10 17:25:20 +01:00
Ell
4a7a3e8e44 fixed running on *nix causing log output to appear twice 2023-12-10 15:46:33 +01:00
Ell
eb4bebe12a added the ability to pass arguments to the cake script 2023-12-08 13:37:12 +01:00
Ell
4a1a06ac94 0.38.0 2023-12-06 13:30:16 +01:00
Ell
89b120e61c rider what 2023-12-01 13:45:52 +01:00
Ell
cd1445af8a allow including ansi code in logs for modders 2023-12-01 13:44:56 +01:00
Ell
1620b0f462 0.37.5 2023-11-18 12:57:03 +01:00
6 changed files with 34 additions and 18 deletions

4
.gitignore vendored
View file

@ -1,4 +1,6 @@
bin/ bin/
obj/ obj/
/packages/ /packages/
.idea .idea/
.vs/
.vscode/

View file

@ -1,7 +1,8 @@
{ {
"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.

After

Width:  |  Height:  |  Size: 535 B

View file

@ -34,12 +34,14 @@ 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]";
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;
@ -52,6 +54,7 @@ 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);
} }
@ -115,7 +118,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 = new[] {NeedType.Energy}, SolvedNeeds = [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
}, },
@ -129,6 +132,9 @@ 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) {

View file

@ -1,19 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="TinyLifeApi" Version="0.37.4" /> <PackageReference Include="TinyLifeApi" Version="0.42.4" />
<PackageReference Include="ExtremelySimpleLogger" Version="1.3.1" />
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="MLEM.Data" Version="6.1.0" />
<PackageReference Include="MLEM.Extended" Version="6.1.0" />
<PackageReference Include="MLEM.Startup" Version="6.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.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="ExtremelySimpleLogger" Version="1.4.1" />
<PackageReference Include="MLEM.Data" Version="6.3.0" />
<PackageReference Include="MLEM.Extended" Version="6.3.0" />
<PackageReference Include="MLEM.Startup" Version="6.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="DynamicEnums" Version="1.2.0" />
<PackageReference Include="Coroutine" Version="2.1.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -4,6 +4,7 @@ using System.Threading;
var target = Argument("target", "Run"); var target = Argument("target", "Run");
var config = Argument("configuration", "Release"); var config = Argument("configuration", "Release");
var args = Argument("args", "");
var tinyLifeDir = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/Tiny Life"; var tinyLifeDir = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/Tiny Life";
@ -29,12 +30,16 @@ Task("Run").IsDependentOn("CopyToMods").Does(() => {
// start the tiny life process // start the tiny life process
var exeDir = System.IO.File.ReadAllText($"{tinyLifeDir}/GameDir"); var exeDir = System.IO.File.ReadAllText($"{tinyLifeDir}/GameDir");
var process = Process.Start(new ProcessStartInfo($"{exeDir}/Tiny Life") { var process = Process.Start(new ProcessStartInfo($"{exeDir}/Tiny Life") {
Arguments = "-v --skip-splash --skip-preloads --debug-saves", Arguments = $"-v --skip-splash --skip-preloads --debug-saves --ansi {args}",
CreateNoWindow = true RedirectStandardOutput = true,
RedirectStandardError = true
}); });
// make sure the output buffers (which we ignore) don't fill up
process.BeginOutputReadLine();
process.BeginErrorReadLine();
// we wait a bit to make sure the process has generated a new log file, bleh // we wait a bit to make sure the process has generated a new log file
Thread.Sleep(3000); Thread.Sleep(1000);
// attach to the newest log file // attach to the newest log file
var logsDir = $"{tinyLifeDir}/Logs"; var logsDir = $"{tinyLifeDir}/Logs";
@ -44,12 +49,12 @@ Task("Run").IsDependentOn("CopyToMods").Does(() => {
using (var reader = new StreamReader(stream)) { using (var reader = new StreamReader(stream)) {
var lastPos = 0L; var lastPos = 0L;
do { do {
if (reader.BaseStream.Length > lastPos) { if (stream.Length > lastPos) {
reader.BaseStream.Seek(lastPos, SeekOrigin.Begin); stream.Seek(lastPos, SeekOrigin.Begin);
string line; string line;
while ((line = reader.ReadLine()) != null) while ((line = reader.ReadLine()) != null)
Information(line); Information(line);
lastPos = reader.BaseStream.Position; lastPos = stream.Position;
} }
Thread.Sleep(10); Thread.Sleep(10);
} while (!process.HasExited); } while (!process.HasExited);