Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

ichortower

Uploaded by

ichortower

Virus scan

Safe to use

Tags for this mod

About this mod

(No longer useful)

Requirements
Permissions and credits
Mirrors
Changelogs
I am pleased to report that this mod no longer serves a purpose, since its features have been implemented in the base game.

I may one day update this or make a replacement with new NPC-sizing features, but for now you should not download this.


For posterity, the previous mod description is preserved below.



NPC Geometry

A small toolkit mod for Stardew Valley 1.6+. (will not work in any earlier version of the game)

Allows several hardcoded NPC metrics to be overridden by setting custom data fields for characters in the "Data/Characters" asset.

This is useful if you're like me and you made a custom NPC who is an adult but is very short; the base game uses heuristics based on age and gender to calculate positions, and they don't work out.

Also released on GitHub.

Important Considerations

The 1.0.1-alpha release is compatible with alpha build 23334 (2023-11-29 nightly) or newer, as that build introduced this change:
    - Split `NPC.draw` into smaller methods.
If you are using an older alpha build for some reason, use the 1.0.0-alpha release.

Earlier on, this mod was incompatible with SpaceCore and would not work correctly when both were installed, due to a conflict in Harmony patches. That issue was addressed, so there are no remaining known incompatibilities.

How To Use

This mod doesn't have any visible effect on its own: it injects code into a few existing game methods to replace position-calculating logic with custom values, if found. Currently, this allows other mods to specify the following:

  • "BreatheRect": The position and size of the rectangle that animates to show the NPC breathing.
  • "EmoteHeight": The height offset to use when rendering emote bubbles.
  • "ShadowScale": The scaling factor to apply to the NPC's shadow.

By default, these things are hardcoded or use heuristic calculations based on the NPC's age and gender. With this mod installed, these routines will try to read from the character's "CustomFields" dictionary, and use values there if they are found.

BreatheRect

To set a custom breathing rectangle, set the custom field "ichortower.NPCGeometry/BreatheRect" to a slash-delimited string containing four integer fields: X, Y, Width, and Height, in that order. For example:

"CustomFields": {
  "ichortower.NPCGeometry/BreatheRect": "5/25/6/3"
}

These values are pixels in the spritesheet frame (big 4x pixels, not screen pixels) and are relative to the top-left corner of the frame, which is usually 16x32. The X and Y values are indexes, so "0/0" is the top-left-most pixel.

EmoteHeight

To change the rendering position of emote bubbles (both in events and in normal gameplay), set the custom field "ichortower.NPCGeometry/EmoteHeight" to an integer. This value will be used to position the emote bubbles vertically, and will not use any of the age or gender heuristics.

"CustomFields": {
  "ichortower.NPCGeometry/EmoteHeight": "23"
}

Event and non-event emote rendering are handled separately by the game. By default, they don't yield the same results (events use age and gender and also a slightly different base offset). If you set this field, the emotes should appear at the same height in both situations: it is intended to look like the bottom pixel of the emote starts at the offset in the field (when counting from the bottom of the NPC's sprite frame).

ShadowScale

To change the scale of the shadow the NPC casts, set the custom field "ichortower.NPCGeometry/ShadowScale" to a floating-point value.

"CustomFields": {
  "ichortower.NPCGeometry/ShadowScale": "0.85"
}

This is used as an additional scale multiplier when drawing the NPC's shadow, so 1.0 is normal size, 0.5 is half, 2.0 is double, etc.

Scale (future? not implemented)

In the future, it may be possible to change the scale at which an NPC is rendered. I have left it out of this mod so far because simply setting the Scale property on an NPC doesn't seem fully-baked (it often causes strange rendering errors).

I may be able to provide a field for this later, but it will require more patches to support.