Skip to content

Mod Structure

bdlm-dev edited this page May 13, 2023 · 7 revisions

Overview

With Winch, each mod has it's own folder within the Mods folder in the root directory of the game. This folder is where you can put all the content of your mod and have Winch load it into the game automatically when it starts.

mod_meta.json

Each mod requires a file named mod_meta.json which defines some metadata for the mod and allows Winch to know what exactly it has to load and do on startup. It's a basic JSON file which can/must have the following attributes:

Key Value Required?
ModAssembly The name of the .dll file in your mod's folder which should be loaded. ✔️
Entrypoint The name of the method in your Mod Assembly which should be called when the game starts. Format: <Namespace>.<Class>/<Method> (Must be a public static void)
Version A version number for your mod in the format [(alpha | beta)-](Major).(Minor). Recommended.
MinWinchVersion A version number defining the minimum required version of Winch for the mod to load. Same format as Version field. ✔️
Dependencies A string array of mod names which your mod depends on. Minimum versions can be defined using <ModName>@<MinimumVersion>.
DefaultConfig A JSON object representing the default contents of your mod's config file. If undefined, no config file will be generated.

Assets

Winch features a multitude of automated asset loading mechanisms. All assets which should be loaded by Winch must be placed in a subfolder of an Assets folder within the mod's folder depending on the type of asset.

Example:

DREDGE/
└── Mods/
    └── ExampleMod/
        ├── mod_meta.json
        ├── ExampleMod.dll
        └── Assets/
            ├── Items/
            │   ├── General/
            │   │   └── examplemod.item1.json
            │   └── Fish/
            │   │   └── examplemod.fish1.json
            ├── Localization/
            │   └── en.json
            └── Textures/
                └── examplemod.item1.png

Localized Strings

DREDGE uses Unity Localization in order to display text in various languages. Winch supports loading custom localized strings using a Localization Asset subfolder. You can put JSON files with the name format <LocaleCode>.json in this folder and they will be loaded and assigned to the corresponding Locale automatically. The following locales are available (as of DREDGE v1.0.4):

Locale Code Language
en English
fr French
it Italian
de German
es Spanish
ru Russian
zh-Hans Chinese (Simplified)
zh-Hant Chinese (Traditional)
ja-JP Japanese
ko-KR Korean
pt-BR Portuguese (Brazil)

The content of the localization JSON file is simply a mapping of string identifiers to their corresponding content. Take the following example from the DisasterButton Example Mod:

/** en.json **/
{
  "notification.disaster-button": "A sudden chill runs down your spine."
}

This registers the string identifier notification.disaster-button and it's corresponding English translation.

Note: Localized String Identifiers have to be globally unique. It's a good idea to have your mod's name be part of it to avoid conflicts with other mods.


Textures

Image files can be put in a Textures Asset subfolder to be loaded automatically by Winch and made available as Texture2D or Sprite objects. Conversion of images to textures is done by the ImageConversion.LoadImage() method available in Unity. For compatibility with file formats, refer to the original Unity documentation.

In code, the converted Texture2D or Sprite objects can be accessed using TextureUtil.GetTexture() and TextureUtil.GetSprite() respectively. The key parameter must be equal to the texture filename without the file extension. For example, an image file named examplemod.exampletexture.png would be accessible via the key "examplemod.exampletexture".

Note: Texture keys must be globally unique. It's a good idea to have your mod's name be part of it to avoid conflicts with other mods.


Items

Winch can load custom items from an Items Asset subfolder automatically when the game starts. The items defined here will be loaded into the ItemManager game class. Each different type of item must be placed in a different subfolder of the Items folder. The following types are supported:

Subfolder Name Item Type
General General Items such as Trinkets and Quest Items
Fish Items representing catchable fish
Will add all other item types to this list once fully tested.

Depending on the type of item, various attributes can be set. Refer to the following lists for more information.

All Item Attributes

All items have these attributes available.

Attribute Description Default Value
itemNameKey ID of the Localized String containing the name of the item. None
itemDescriptionKey ID of the Localized String containing the description of the item. None
itemInsaneTitleKey ID of the Localized String containing the name of the item when sanity is low. None
itemInsaneDescriptionKey ID of the Localized String containing the description of the item when sanity is low. None
itemType Defines the type of item. Refer to below for a list of accepted values. GENERAL
itemSubtype Defines the type of item more specifically. Refer to below for a list of accepted values. GENERAL
tooltipTextColor Color of the font showing the name of the item when hovering over it. White
tooltipNotesColor Color of the font showing the description of the item when hovering over it. White
itemTypeIcon Name of the Sprite shown as the little icon next to the item name when hovering over it. None
harvestParticlePrefab ??? None
overrideHarvestParticleDepth ??? false
harvestParticleDepthOffset ??? -3
flattenParticleShape ??? false
availableInDemo ??? false

itemType Values

Valid values for the itemType field are:

  • NONE
  • GENERAL
  • EQUIPMENT
  • DAMAGE
  • ALL

itemSubtype Values

Valid values for the itemSubtype field are:

  • NONE
  • FISH
  • ENGINE
  • ROD
  • GENERAL
  • RELIC
  • TRINKET
  • MATERIAL
  • LIGHT
  • POT
  • NET
  • DREDGE
  • ALL

Type Specific Attributes

General (Spatial)

Attribute Description Default Value
canBeSoldByPlayer Whether or not the player is able to sell this item. true
canBeSoldInBulkAction Whether or not the player is able to sell this item using "Sell all". true
value The value of the item in dollars when sold. 0
hasSellOverride ??? false
sellOverrideValue ??? 0
sprite Name of the sprite which represents the item in the inventory. None
itemColor Background color overlaid onto occupied inventory slots. (65, 65, 65, 255)
canBeDiscardedByPlayer Whether or not the player can discard this item. true
canBeDiscardedDuringQuestPickup Whether or not the item can be discarded during a quest pickup window. true
damageMode Whether or not an item is damaged. NONE
moveMode Determines the type of movement of the item within the inventory more specifically, see list below for more detail. FREE
ignoreDamageWhenPlacing Whether or not placing this item can ignore damage. false
isUnderlayItem ??? false
forbidStorageTray ??? false
dimensions Dimensions of the space that the item takes up in the inventory, represented by an array of coordinates relative to (0, 0) [(0, 0)]
squishFactor Float determining how responsive held items are to movement. 1
itemOwnPrerequisites ??? None
researchPrerequisites ??? None
researchPointsRequired ??? 0
buyableWithoutResearch Whether the item can be bought without having been researched. true
moveMode Values
Value Description
FREE Item can be moved freely
INSTALL Moving item will take in-game time to install.
NONE Item can't be moved around inventories. However, can still be moved between main inventory and storage.
damageMode Values
Value Description
NONE Item isn't influenced by damage
DURABILITY Receiving damage will reduce item durability
OPERATION Receiving damage will disable item operation, e.g., rods, engines, nets, lights
DESTROY Receiving damage will destroy this item.

Engine

Inherits from General (Spatial)

Attribute Description Default Value
speedBonus Float for how many knots the engine adds. 0

Light

Inherits from General (Spatial)

Attribute Description Default Value
lumens Float for how many lumens a light gives. 500
range Float for how many metres a light gives 10

Harvestable

Inherits from General (Spatial)

Attribute Description Default Value
harvestMinigameType Type of harvest minigame for this item, see list below for more detail. FISHING_RADIAL
perSpotMin Minimum number of this item per harvest zone 1
perSpotMax Maximum number of this item per harvest zone 1
harvestItemWeight Weight of this item, used in probabilities where fish caught is RNG-based 1
regenHarvestSpotOnDestroy Whether a harvest zone for this item will respawn true
harvestPOICategory Type of harvestPOI of this item, see list below for more detail. FISH_SMALL
harvestableType Type of harvestable, see list below for more detail. SHALLOW
harvestDifficulty Difficulty of this item's harvest minigame, see list below for more detail. EASY
canBeReplacedWithResearchItem Whether this item can be replaced by a research item when caught in a crab pot. false
canBeCaughtByRod Whether this item can be caught with a rod true
CanBeCaughtByPot Whether this item can be caught with a crab pot false
CanBeCaughtByNet Whether this item can be caught with a net false
affectedByFishingSustain Whether the harvest zone of this item is affected by book Fishing Sustain bonuses true
hasMinDepth Whether this item has a minimum depth for being caught false
minDepth Minimum depth for this item to be caught SHALLOW
hasMaxDepth Whether this item has a maximum depth for being caught. false
maxDepth Maximum depth for this item to be caught VERY_DEEP
zonesFoundIn Zones this item is found in. ALL
harvestMinigameType Values
Value Description
FISHING_RADIAL
FISHING_PENDULUM
FISHING_BALL_CATCHER
FISHING_DIAMOND
DREDGE_RADIAL
harvestPOICategory Values
Value Description
NONE
FISH_SMALL
FISH_MEDIUM
FISH_LARGE
TRINKET
MATERIAL
RELIC
harvestableType Values
Value Description
NONE
COASTAL
SHALLOW
OCEANIC
ABYSSAL
HADAL
VOLCANIC
MANGROVE
DREDGE
COUNT ??
harvestDifficulty Values
Value Description
VERY_EASY
EASY
MEDIUM
HARD
VERY_HARD
depthEnum Values
Value Description
VERY_SHALLOW
SHALLOW
MEDIUM
DEEP
VERY_DEEP
zoneEnum Values
Value Description
NONE
THE_MARROWS
GALE_CLIFFS
STELLAR_BASIN
TWISTED_STRAND
DEVILS_SPINE
OPEN_OCEAN
ALL

Attribute Description Default Value

TODO: Populate tables for each default item type and specify enumerator values and corresponding purposes- remember to specify inheritance between types.

Clone this wiki locally