@scml/addon-modded-clothes

TypeScript type definitions for Modded clothes addon, for adding and patching modded clothes data.

Installation

npm
yarn
pnpm
bun
deno
npm install -D @scml/addon-modded-clothes

Quick Start

Add type reference

Add triple-slash directive in your project to bring in global types:

/// <reference types="@scml/addon-modded-clothes" />

Use global instance

addonModdedClothesAddon is mounted on window; you can call its methods directly:

window.addonModdedClothesAddon.addClothes(info);

Import types on demand

If you only need to import specific types, use subpaths:

import type { ModdedClothesAddon, ClothesAddInfo } from '@scml/addon-modded-clothes/ModdedClothesAddon';
import type { ModdedClothesAddonParams } from '@scml/addon-modded-clothes/ModdedClothesAddonParams';

Global Types global

Main entry extends Window via /// <reference types="..." />. global The following property is on window:

PropertyTypeDescription
addonModdedClothesAddonModdedClothesAddonAddon instance for clothes add/patch
/// <reference types="@scml/addon-modded-clothes" />

// Usage example
window.addonModdedClothesAddon.addClothes({ modName: 'myMod', clothes: [], patch: [] });
Main entry
Subpath import
/// <reference types="@scml/addon-modded-clothes" />

Subpath Exports

SubpathDescription
.Main entry, augments Window/global
./ModdedClothesAddonMain class, interfaces, utility functions
./ModdedClothesAddonParamsConfig params and type guards

API Reference

./ModdedClothesAddon

ModdedClothesAddon class

Addon plugin class implementing LifeTimeCircleHook and AddonPluginHookPointEx, manages clothesAddInfo.

Constructor

ParameterTypeDescription
gSC2DataManagerSC2DataManagerMod Loader data manager
gModUtilsModUtilsMod utilities

Properties

PropertyTypeDescription
gSC2DataManagerSC2DataManagerData manager reference
gModUtilsModUtilsUtilities reference
loggerLogWrapperLogger
isInitbooleanWhether initialized
changedPathsSet<string>Set of changed paths
clothesAddInfoMap<string, ClothesAddInfo>Clothes info by mod name

Methods

MethodSignatureDescription
registerMod(addonName: string, mod: ModInfo, modZip: ModZipReader) => Promise<void>Register mod, load clothes config
addClothes(info: ClothesAddInfo) => voidAdd clothes data
exportDataZip(zip: JSZip) => Promise<JSZip>Export data to zip
init() => voidInitialize

ClothesAddInfo interface

PropertyTypeDescription
modNamestringMod name
clothesClothesInfo[]Clothes list
patchClothesPatchInfo[]Patch config

ClothesInfo interface

PropertyTypeDescription
keystringClothes key
dataClothesItem[]Clothes item array

searchClothesByName() method

  • Signature: searchClothesByName(name: string): { c: ClothesItem; t: string }[]
  • Parameter: name - Clothes name
  • Returns: Matched clothes items with keys

checkForOutfitWarmth() method

  • Signature: checkForOutfitWarmth(logger: LogWrapper): void
  • Description: Run outfit warmth check for window.getTrueWarmth()

./ModdedClothesAddonParams

ModdedClothesAddonParams interface

Mod config params for mod.json or similar.

PropertyTypeDescription
clothesAddClothesItem[]Clothes to add
patchstring[]Optional patch file paths

AddClothesItem interface

PropertyTypeDescription
keystringClothes key
filePathstringFile path
dataClothesItem[]Optional clothes items

ClothesPatchInfo interface

PropertyTypeDescription
keystringClothes key
dataClothesPatchUpdateType[]Patch update data

ClothesPatchUpdateType type

Partial update type for ClothesItem; keys are ClothesItem properties, values are new value or null.

checkParams() / checkAddClothesItem() / checkClothesPatchInfo() type guard

  • checkParams(a: any): a is ModdedClothesAddonParams
  • checkAddClothesItem(a: any): a is AddClothesItem
  • checkClothesPatchInfo(a: any): a is ClothesPatchInfo

Type Definition Source

INFO