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:

{
  "Format": "1.26.0",
  "Changes": [
    {
      "Action": "EditData",
      "Target": "Data/PeacefulEnd/FashionSense/AppearanceData",
      "Fields": {
        "ExampleAuthor.ExampleFashionSensePack/Hat/Animated Pumpkin Head": {
          "IsLocked": true
        }
      },
      "When": {
        "Time": "{{Range: 0600, 1800}}"
      },
      "Update": "OnTimeChange"
    },
    {
      "Action": "EditData",
      "Target": "Data/PeacefulEnd/FashionSense/AppearanceData",
      "Fields": {
        "ExampleAuthor.ExampleFashionSensePack/Hat/Animated Pumpkin Head": {
          "IsLocked": false
        }
      },
      "When": {
        "Time": "{{Range: 1900, 2600}}"
      },
      "Update": "OnTimeChange"
    }
  ]
}

The Fashion Sense Data Path

Notice the "Target" property is set to: Data/PeacefulEnd/FashionSense/AppearanceData

This is the path in which Fashion Sense stores all relevant appearance data and enables for external, dynamic changes.

Update rates

The framework will sync changes immediately with Content Patcher when using OnDayStart, OnLocationChange or OnTimeChange for the Update field.