Recently I came across a full skin mod for Don't Starve Together that has been discontinued and its source code made public. Initially, I thought all projects like this worked the same way: pack the official skin resources into the mod directory, modify a few tables, and finally "display them" in the game—done.
But in reality, it's not an ordinary resource pack at all. More accurately, it's a runtime skin injection system. It doesn't just copy official skins over; instead, it tries to replicate the original skin workflow of Don't Starve Together as closely as possible, then adds an extra custom_ namespace and a set of runtime Hooks on top of that system. This makes local skins participate in name lookups, icon lookups, ownership checks, entity spawning, and skin-changing processes just like official skins.
Taking Over the Skin System
This project doesn't bypass the official skin system. It sticks as closely as possible to the official structure, only inserting its own runtime modifications where necessary.
For example, in modmain.lua, the mod first defines the logic to detect and strip the custom_ prefix, establishing a stable mapping relationship:
- Official skin:
wilson_formal - Mod skin:
custom_wilson_formal
The mod can recognize custom_wilson_formal as its own skin at runtime, and when it needs to call official data, it can revert it back to wilson_formal to look up names, descriptions, icons, and rarities.
Reusing Official Query Capabilities
In skinloader/skinloader.lua, instead of maintaining a huge localization text table or copying the entire set of official icon names and rarity strings, it directly intercepts the query functions.
It wraps a layer of proxy around global functions like:
GetSkinDescriptionGetSkinNameGetSkinInvIconNameGetModifiedRarityStringForItemGetColorForItem
If the incoming item has a custom_ prefix, it strips the prefix first and then passes the request back to the official function.
The mod doesn't need to maintain a large set of display data on its own. When the game queries custom_wilson_formal, it still gets the name, description, icon, and rarity logic from the official wilson_formal.
Ownership Forgery
In skinloader/skinloader.lua, the mod rewrites several interfaces related to inventory ownership, such as:
InventoryProxy.CheckOwnershipInventoryProxy.CheckOwnershipGetLatestInventoryProxy.GetOwnedItemCountInventoryProxy.GetFullInventory
The core idea is simple: as long as a skin is registered in the mod's own SKINS table, the official logic treats it as "owned."
This step is crucial because DST's skin system doesn't just let you equip a skin just because the resources are local; there's an ownership check in between.
Taking Over the Spawning and Skin-Changing Process
This project intercepts several skin-related processes at runtime:
CreatePrefabSkin(...)SpawnPrefab(...)Sim:ReskinEntity(...)AnimState:GetSkinBuild(...)
The mod doesn't just drop resources into the directory and hope the engine discovers them by chance. Instead, at key points like entity spawning, skin changing, and animation build name resolution, it explicitly tells the game, "Now use this custom_ skin."