This commit is contained in:
Ell 2021-02-18 19:12:01 +01:00
parent 01a02b6df7
commit 468e72a071
5 changed files with 10 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

View file

@ -19,27 +19,31 @@ namespace ExampleMod {
// visual data about this mod
public override string Name => "Example Mod";
public override string Description => "This is the example mod for Tiny Life!";
public override TextureRegion Icon => this.uiTextures[0, 0];
private UniformTextureAtlas customClothes;
private UniformTextureAtlas uiTextures;
public override void AddGameContent(GameImpl game) {
// adding a custom furniture item
FurnitureType.Register(new FurnitureType.TypeSettings("ExampleMod.CustomTable", new Point(1, 1), ObjectCategory.Table, 150, ColorScheme.SimpleWood) {
Construct = (i, t, c, m, p) => new CustomTable(i, t, c, m, p)
ConstructedType = typeof(CustomTable),
Icon = this.Icon
});
// adding custom clothing
Clothes.Register(new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt,
this.customClothes[0, 0], // the top left in-world region (the rest will be auto-gathered from the atlas)
ColorScheme.WarmDark));
100, this.Icon, false, ColorScheme.WarmDark));
}
public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker) {
Logger = logger;
// 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
texturePacker.Add(content.Load<Texture2D>("CustomClothes"), r => this.customClothes = new UniformTextureAtlas(r, 4, 6));
texturePacker.Add(content.Load<Texture2D>("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8));
}
public override IEnumerable<string> GetCustomFurnitureTextures() {

View file

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TinyLifeApi" Version="0.6.0" />
<PackageReference Include="TinyLifeApi" Version="0.7.0" />
<PackageReference Include="ExtremelySimpleLogger" Version="1.2.1" />
<PackageReference Include="MLEM.Data" Version="4.3.0" />

View file

@ -4,7 +4,7 @@ cd /d "%~dp0"
rem build the mod
dotnet build
rem copy the mod to the mods folder
robocopy ./bin/Debug/netcoreapp3.0/ "%LOCALAPPDATA%/Tiny Life/Mods" /e
robocopy ./bin/Debug/net5.0/ "%LOCALAPPDATA%/Tiny Life/Mods" /e /is
rem run the game
set /p dir=<"%LOCALAPPDATA%/Tiny Life/GameDir"
cd /d %dir%

2
Run.sh
View file

@ -4,7 +4,7 @@ cd "$(dirname "$0")"
# build the mod
dotnet build
# copy the mod to the mods folder
cp ./bin/Debug/netcoreapp3.0/* "$LOCALAPPDATA/Tiny Life/Mods" -r
cp ./bin/Debug/net5.0/* "$LOCALAPPDATA/Tiny Life/Mods" -r
# run the game
dir=$(<"$LOCALAPPDATA/Tiny Life/GameDir")
cd $dir