WormAPI

v1.0.0·Updated 2025-05-27

A general-purpose API for making Wormtown mods.

About this mod Author’s original text

WormAPI

A utilities library to make modding wormtown easier!

AssetHelper

  • Provides DirectLazyAsset and LazyAsset for getting game assets once they become available.
  • LazyAsset allows for automatically finding an asset by name and retrieving it once it becomes available. Casts to the asset once found, and null otherwise.
  • DirectLazyAsset takes a scene-load delegate to try and find the asset once a scene has been loaded. Casts to the asset once found, and null otherwise.

LazyAsset clayDissolve = new LazyAsset("Clay_WithDissolve");

clayDissolve.onAssetLoad += () => { // this will run on the first scene where the specified asset was found

Shader shader = clayDissolve; // implicitly casts back to the asset type

};

DirectLazyAsset someObject = new DirectLazyAsset(

(root) => { // this will be called on scene load until we find our object

return GameObject.Find("some object chain");

}

);

someObject.onAssetLoad += () => { // this will be called once we have our objects

GameObject obj = someObject;

Debug.Log(obj);

};

PrefabAPI

  • Utility for creating mock "prefabs" at runtime.
  • Has a method to automatically register a NetworkObject once the NetworkManager has loaded.

GameObject testObject = new("A Test Object");

testObject.MakePrefab(); // this object becomes a mock prefab. it will no longer be destroyed on spawn and is parented to an inactive root object, making it become active once cloned.

testObject.AddComponent();

testObject.MarkNetworkPrefab(); // this object becomes registered to the networked prefabs list once available

WormAbilityAPI

  • Greatly simplifies creating worm abilities, via the AddWormAbility() method
  • Automatically handles adjusting the UI to accomodate for them.

GameObject prefab = testbundle.LoadAsset("TestAbility.prefab");

WormAbilityAPI.AddWormAbility(new WormAbilityInfo() {

WormAbilityObject = prefab,

AbilityNotes = new() {

"A Note About Our Ability"

}

});

EquipmentAPI

  • The same as WormAbilityAPI, but for pardner equipments.
  • Automatically handles adding equipments to the spawnable pool for the cheat menu.

GameObject prefab = testbundle.LoadAsset("TestEquipment.prefab");

EquipmentAPI.AddEquipment(new EquipmentInfo() {

Name = "Test Pardner Equipment",

Prefab = prefab

});

LanguageAPI

  • A utility for adding localization pairs for languages.

LanguageAPI.AddString("ABILITY_TESTWORM_NAME", "Worm Test Ability");

LanguageAPI.AddString("ABILITY_TESTWORM_DESC", "Head to Worm City."); // defaults to english

LanguageAPI.AddString("ABILITY_TESTWORM_DESC", "Fahren Sie nach Wurmstadt", LanguageAPI.Language.German); // can specify which language

CommonAssets

  • A list of named LazyAssets for common game assets. Currently just the main shaders.

LayerIndex

  • A named list of the numerical IDs for every collision layer in the game.

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide.

Dependencies

Install these first, or the mod will not work:

HookGenPatcher_Wormtown-HookGenPatcherBepInEx_Wormtown-BepInExPack

File & checksum

Filename
WormAPI-1.0.0.zip
File size
65.0 KiB