From 1c3a1918115e5b57c5965dfe6835a73365f1fe35 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 17 May 2021 23:35:34 +0200 Subject: [PATCH] update to 0.10.0 --- Content/ExampleMod/CustomClothes.png | Bin 876 -> 1127 bytes ExampleMod.cs | 19 ++++++++++++++++--- ExampleMod.csproj | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Content/ExampleMod/CustomClothes.png b/Content/ExampleMod/CustomClothes.png index fb2524343423dbc8f7f4e13702e7e470a0873c76..582fe5c6411ad456f3a97f2dc111b269e652a4b7 100644 GIT binary patch delta 1120 zcmV-m1fTot2ImNn7JmT%2nGNE00TyF1^@s60drDELIAGL9O(c61R+U8K~#90?cKqO zt2`9I@#AoZVW7+-xS5^!{!b$Ay6GbnK}4wEV#s`{CN{@Jt)2f5?&7wd7}MB+o?{{c z0002|Nty4Bx~>QN|3y)Fk3Dj{^ToQZhtuhF_gd35!JRl#{D0f{g{rD1!6}?hC#kAx zcy!#{F>Az620%pQdc8h6k6KKdec!JZ;~W5=*iYaY&3*~mw?fQ4sEKvO_kAy2*Qw6` z@$n(=@9z)$5HthUoPvAv4nR>9S>N|j7h>YIf5Pn86z897c}(mx!~*~T z000000A7*z_ka3vimNP3)o=T;@w=wStEw8lzP|2WyI!xs7ZDr3YkGV_xIviV1LJI2Xd?QxN`v7w!Qm1-nOm! zxe~Q#p%=!VFrpC5TPwyR{exZN_)~Zi%xf_5j zQrpj#K7aS#QG{c-Id|ou1aVW76}n z9;N4<>G2e)<-OY=Jq`c>000000000S&yt#g(3sh0hxcTPoNl+<;x?+P8qCfXsv;@7 z0TKNUF){Jx!c9p_(=@+>pxNX_N zj=t{~?{RQGp9i}g5t&q)c#EX$ijMJ?IU($r(CUz)C^CB=f|!dJ`PtyXF0yFbc76u9 z_6M?sev)$+95S2C6#o4Dj2ZxupIKlA)pg#<0EoCh@z6pgSAmjYR+3rzow9~WN9@rz zOn&)MUjw3l?i)sEJhnW4$A z!s919?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+++ b/ExampleMod.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using ExtremelySimpleLogger; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,9 +33,21 @@ namespace ExampleMod { }); // adding custom clothing - Clothes.Register(new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt, + var darkShirt = 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) - 100, this.Icon, false, ColorScheme.WarmDark)); + 100, this.Icon, false, ColorScheme.WarmDark); + Clothes.Register(darkShirt); + + // adding an event subscription to people + MapObject.OnEventsAttachable += o => { + if (o is Person person) { + // changing the walk speed to be doubled if a person is wearing our dark shirt + person.OnGetWalkSpeed += (ref float s) => { + if (person.WornClothes.TryGetValue(ClothesLayer.Shirt, out var shirt) && shirt.Type == darkShirt) + s *= 2; + }; + } + }; } public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker) { @@ -42,7 +55,7 @@ namespace ExampleMod { // 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("CustomClothes"), r => this.customClothes = new UniformTextureAtlas(r, 4, 6)); + texturePacker.Add(content.Load("CustomClothes"), r => this.customClothes = new UniformTextureAtlas(r, 4, 8)); texturePacker.Add(content.Load("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8)); } diff --git a/ExampleMod.csproj b/ExampleMod.csproj index 225c201..6ac1ce2 100644 --- a/ExampleMod.csproj +++ b/ExampleMod.csproj @@ -5,7 +5,7 @@ - +