Skip to content

Commit

Permalink
Merge pull request #14 from mills88812/altoids-whiskers
Browse files Browse the repository at this point in the history
Gives Nomad their face back, plus a buncha whiskers
  • Loading branch information
BensoneWhite authored May 10, 2024
2 parents 24ad3bb + 3fffc51 commit f4cb344
Show file tree
Hide file tree
Showing 24 changed files with 194 additions and 88 deletions.
Binary file removed mod/dressmyslugcat/Nomad/head.png
Binary file not shown.
5 changes: 0 additions & 5 deletions mod/dressmyslugcat/Nomad/metadata.json

This file was deleted.

File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
Binary file added mod/nomad/head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 19 additions & 19 deletions mod/dressmyslugcat/Nomad/head.txt → mod/nomad/head.txt
Original file line number Diff line number Diff line change
@@ -1,142 +1,142 @@
{"frames": {

"HeadA0.png":
"nomad_HeadA0":
{
"frame": {"x":2,"y":2,"w":96,"h":120},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":120},
"sourceSize": {"w":96,"h":120}
},
"HeadA1.png":
"nomad_HeadA1":
{
"frame": {"x":100,"y":2,"w":96,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":102},
"sourceSize": {"w":96,"h":102}
},
"HeadA2.png":
"nomad_HeadA2":
{
"frame": {"x":198,"y":2,"w":96,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":102},
"sourceSize": {"w":96,"h":102}
},
"HeadA3.png":
"nomad_HeadA3":
{
"frame": {"x":296,"y":2,"w":96,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":102},
"sourceSize": {"w":96,"h":102}
},
"HeadA4.png":
"nomad_HeadA4":
{
"frame": {"x":394,"y":2,"w":90,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":90,"h":102},
"sourceSize": {"w":90,"h":102}
},
"HeadA5.png":
"nomad_HeadA5":
{
"frame": {"x":486,"y":2,"w":96,"h":114},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":114},
"sourceSize": {"w":96,"h":114}
},
"HeadA6.png":
"nomad_HeadA6":
{
"frame": {"x":584,"y":2,"w":96,"h":120},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":96,"h":120},
"sourceSize": {"w":96,"h":120}
},
"HeadA7.png":
"nomad_HeadA7":
{
"frame": {"x":682,"y":2,"w":102,"h":108},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":108},
"sourceSize": {"w":102,"h":108}
},
"HeadA8.png":
"nomad_HeadA8":
{
"frame": {"x":786,"y":2,"w":102,"h":90},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":90},
"sourceSize": {"w":102,"h":90}
},
"HeadA9.png":
"nomad_HeadA9":
{
"frame": {"x":890,"y":2,"w":108,"h":96},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":108,"h":96},
"sourceSize": {"w":108,"h":96}
},
"HeadA10.png":
"nomad_HeadA10":
{
"frame": {"x":2,"y":124,"w":108,"h":96},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":108,"h":96},
"sourceSize": {"w":108,"h":96}
},
"HeadA11.png":
"nomad_HeadA11":
{
"frame": {"x":112,"y":124,"w":108,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":108,"h":102},
"sourceSize": {"w":108,"h":102}
},
"HeadA12.png":
"nomad_HeadA12":
{
"frame": {"x":222,"y":124,"w":108,"h":108},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":108,"h":108},
"sourceSize": {"w":108,"h":108}
},
"HeadA13.png":
"nomad_HeadA13":
{
"frame": {"x":332,"y":124,"w":114,"h":114},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":114,"h":114},
"sourceSize": {"w":114,"h":114}
},
"HeadA14.png":
"nomad_HeadA14":
{
"frame": {"x":448,"y":124,"w":120,"h":102},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":120,"h":102},
"sourceSize": {"w":120,"h":102}
},
"HeadA15.png":
"nomad_HeadA15":
{
"frame": {"x":570,"y":124,"w":144,"h":90},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":144,"h":90},
"sourceSize": {"w":144,"h":90}
},
"HeadA16.png":
"nomad_HeadA16":
{
"frame": {"x":716,"y":124,"w":144,"h":90},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":144,"h":90},
"sourceSize": {"w":144,"h":90}
},
"HeadA17.png":
"nomad_HeadA17":
{
"frame": {"x":862,"y":124,"w":144,"h":96},
"rotated": false,
Expand All @@ -147,7 +147,7 @@
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.0",
"image": "EXtemplateHead.png",
"nomad_image": "EXtemplateHead",
"format": "RGBA8888",
"size": {"w":1008,"h":240},
"scale": "1",
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
5 changes: 2 additions & 3 deletions src/Features/SunShade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ public SunShade(Room room)
public override void Update(bool eu)
{
base.Update(eu);
if (room == null)
{
if (room is null)
return;
}

foreach (var effect in room.roomSettings.effects)
{
if (effect.type == DeadlandsEnums.RoomEffect.SunShade)
Expand Down
30 changes: 30 additions & 0 deletions src/Nomad/FSpriteNomad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Deadlands;

/// <summary>
/// Overrides any element modification to use the Nomad sprites instead of the normal ones. <br/>
/// This is used to (for example) replace the normal slugcat head with Nomad's head, etc etc
/// </summary>
public class FSpriteNomad : FSprite
{
public FSpriteNomad(string elementName)
: base(elementName)
{
}

public override void HandleElementChanged()
{
if (!_element.name.StartsWith("nomad_"))
{
Debug.Log("Element name was altered to be '" + element.name + "'!");
_element = Futile.atlasManager.GetElementWithName("nomad_" + _element.name);
_atlas = _element.atlas;
}
base.HandleElementChanged();
}
}
11 changes: 5 additions & 6 deletions src/Nomad/NomadData/NomadData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@ public class NomadData
public DynamicSoundLoop windSound;

public readonly bool IsNomad;
public readonly Player player;

public WeakReference<Player> PlayerRef;

/// <summary>
/// Represents the current speed nomad is gliding, ranges from 0 to 1
/// Represents the current speed nomad is gliding, ranges from 0 to 1 <br/>
/// Will be 0.01 if the player is doing wing splay
/// </summary>
public float GlideSpeed = 0;

/// <summary>
/// The nomad's y coordinate from the start of their glide
/// The nomad's <b>y</b> coordinate from the start of their glide. </summary>
/// <remarks>
/// Used to calculate how far the player has fallen since the start of the glide
/// </summary>
/// </remarks>
public float StartHeight = 0;

/// <summary>
/// Adds a decay effect to the Player.superLaunchJump variable (to detect if the player recently super jumped)
/// Adds a decay effect to the <see cref="Player.superLaunchJump"/> variable (to detect if the player recently super jumped)
/// </summary>
public int SuperJumpDecay = 0;

public NomadData(Player player)
{
IsNomad = player.slugcatStats.name == DeadlandsEnums.Nomad;
PlayerRef = new WeakReference<Player>(player);
this.player = player;

if (!IsNomad) return;

Expand Down
9 changes: 4 additions & 5 deletions src/Nomad/NomadGliding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ private static void Player_UpdateMSC(On.Player.orig_UpdateMSC orig, Player self)

float vol = nomadData.windSound.Volume;

nomadData.windSound.Volume = nomadData.GlideSpeed > 0 &&
self.bodyMode == Player.BodyModeIndex.Default &&
rootChunk.lastPos.y - rootChunk.pos.y > -1 ?
Mathf.Min(vol + 0.3f, 1f * nomadData.GlideSpeed) :
Mathf.Max(vol - 0.5f, 0f);
if (nomadData.GlideSpeed > 0 && self.bodyMode == Player.BodyModeIndex.Default && rootChunk.lastPos.y - rootChunk.pos.y > -1)
nomadData.windSound.Volume = Mathf.Min(vol + 0.3f, 1f * nomadData.GlideSpeed);
else
nomadData.windSound.Volume = Mathf.Max(vol - 0.5f, 0f);

//Deprecated, used to update the sound but actually the sound is updated with the Mathf Min and Max, maybe should be changed to a lerp instead
//nomadData.windSound.Update();
Expand Down
Loading

0 comments on commit f4cb344

Please sign in to comment.