Content Patcher Integration - Floogen/FashionSense GitHub Wiki
Content Patcher is a powerful tool which allows you to edit game / custom assets based on various conditions.
Fashion Sense integrates with Content Patcher by loading all appearance data into a dedicated path. By targeting this path, you can modify any arbitrary Fashion Sense appearance property and the changes will be applied while the game is running (according the content pack's Update field. This enables mod authors to do things such as hiding an accessory until an achievement is met (via the IsLocked property).
Note: Using Content Patcher along with Fashion Sense requires a fair bit of understanding of both mods and this part of the Wiki assumes you are familiar with them. If you are not, please read over the Creating a Content Pack and Content Patcher's Author Guide before proceeding.
Using Content Patcher
To utilize Content Patcher, you'll need to first make a content pack for Content Patcher with a required dependency on Fashion Sense.
An example manifest.json
for a Content Patcher content pack:
{
"Name": "Content Patcher Examples For Fashion Sense",
"Author": "PeacefulEnd",
"Version": "1.0.0",
"Description": "Tests for using Content Patcher to modify Fashion Sense packs.",
"UniqueID": "PeacefulEnd.ContentPatcherForFashionSense",
"UpdateKeys": [ "Nexus:???" ],
"ContentPackFor": {
"UniqueID": "Pathoschild.ContentPatcher"
},
"Dependencies": [
{
"UniqueID": "PeacefulEnd.FashionSense",
"IsRequired": true
}
]
}
Making Property Changes
To start making changes to the relevant Fashion Sense appearance properties, you'll need to create a content.json
file. This file is utilized by Content Patcher to detect which changes the content pack wants to make.
Example of a content.json
which sets IsLocked
for the hat Animated Pumpkin Head until 9PM in the game:
{
"Changes": [
{
"Action": "EditData",
"Target": "Data/PeacefulEnd/FashionSense/HatData",
"Fields": {
"ExampleAuthor.ExampleFashionSensePack/Hat/Animated Pumpkin Head": {
"IsLocked": true
}
},
"When": {
"Time": "{{Range: 0600, 1800}}"
},
"Update": "OnTimeChange"
},
{
"Action": "EditData",
"Target": "Data/PeacefulEnd/FashionSense/HatData",
"Fields": {
"ExampleAuthor.ExampleFashionSensePack/Hat/Animated Pumpkin Head": {
"IsLocked": false
}
},
"When": {
"Time": "{{Range: 1900, 2600}}"
},
"Update": "OnTimeChange"
}
]
}
The Fashion Sense Data Paths
Notice the "Target"
property is set to: Data/PeacefulEnd/FashionSense/HatData
This is the path in which Fashion Sense stores all Hat data and enables for external, dynamic changes.
The full list of data paths are as follows
Appearance Type | Data Path |
---|---|
Accessory | Data/PeacefulEnd/FashionSense/AccessoryData |
Hat | Data/PeacefulEnd/FashionSense/HatData |
Hair | Data/PeacefulEnd/FashionSense/HairData |
Shirt | Data/PeacefulEnd/FashionSense/ShirtData |
Sleeves | Data/PeacefulEnd/FashionSense/SleevesData |
Pants | Data/PeacefulEnd/FashionSense/PantsData |
Shoes | Data/PeacefulEnd/FashionSense/ShoesData |
Body | Data/PeacefulEnd/FashionSense/BodyData |
Using an in-game Hat or Shirt
Fashion Sense supports creating a Hat or Shirt appearance via an existing in-game item that has been added via Content Patcher.
Example of a content.json
which creates an in-game Hat via Content Patcher before using it to create a Fashion Sense appearance (adding it to the Hand Mirror) via the FromItemId
property:
{
"Changes": [
// Load in the Hat textures
{
"Action": "Load",
"Target": "Mods.PeacefulEnd.ContentPatcherForFashionSense.TestHat",
"FromFile": "assets/test_hat.png"
},
{
"Action": "Load",
"Target": "Mods.PeacefulEnd.ContentPatcherForFashionSense.ActualHat",
"FromFile": "assets/actual_hat.png"
},
// Load in the Fashion Sense Hat
{
"Action": "EditData",
"Target": "Data/PeacefulEnd/FashionSense/HatData",
"Entries": {
// The key should follow the format: PackId/PackType/Name
"ExampleAuthor.ContentPatcherForFashionSense/Hat/Test Hat": {
"Author": "ExampleAuthor", // The author name to display in the Hand Mirror when using the given Fashion Sense pack
"PackName": "FS Appearances via Content Patcher", // Name of the Fashion Sense pack (multiple appearances may be part of a pack)
"PackId": "ExampleAuthor.ContentPatcherForFashionSense", // ID of the Fashion Sense pack, usually the manifest ID of the manifest.json
"Name": "Test Hat", // Name of the Fashion Sense item
"TexturePath": "Mods.PeacefulEnd.ContentPatcherForFashionSense.TestHat",
"FrontHat": {
"DisableGrayscale": true,
"StartingPosition": {
"X": 0,
"Y": 0
},
"HeadPosition": {
"X": -2,
"Y": 0
},
"HatSize": {
"Width": 16,
"Length": 16
}
}
}
}
},
// Load in an in-game hat, to use as a Fashion Sense Hat
// add hat data
{
"Action": "EditData",
"Target": "Data/Hats",
"Entries": {
"ExampleAuthor.ContentPatcherForFashionSense/Hat/Actual Hat": "ExampleAuthor.ContentPatcherForFashionSense.Hat.Actual Hat/An actual hat./true/true//Actual Hat/0/Mods.PeacefulEnd.ContentPatcherForFashionSense.ActualHat"
}
},
// Load in the Fashion Sense Hat (by using an existing in-game hat)
{
"Action": "EditData",
"Target": "Data/PeacefulEnd/FashionSense/HatData",
"Entries": {
// The key should follow the format: PackId/PackType/Name
"ExampleAuthor.ContentPatcherForFashionSense/Hat/Test Hat": {
"Author": "ExampleAuthor", // The author name to display in the Hand Mirror when using the given Fashion Sense pack
"PackName": "FS Appearances via Content Patcher", // Name of the Fashion Sense pack (multiple appearances may be part of a pack)
"PackId": "ExampleAuthor.ContentPatcherForFashionSense", // ID of the Fashion Sense pack, usually the manifest ID of the manifest.json
"FromItemId": "(H)ExampleAuthor.ContentPatcherForFashionSense/Hat/Actual Hat"
}
}
}
]
}
FromItemId
FromItemId
allows users to automatically populate required Fashion Sense appearance properties (such as Name
, StartingPosition
and Size
). These values are populated based on the vanilla dimensions, so the property can only be used if the appearance follows the game's format / sizing.
Update rates
The framework will sync changes immediately with Content Patcher when using OnDayStart
, OnLocationChange
or OnTimeChange
for the Update
field.