Details

Last Updated
2 months ago
First Uploaded
2 months ago
Downloads
67
Likes
1
Size
67KB
Dependency string
Wormswept-WormAPI-1.0.0
Dependants

Categories

WormAPI

A utilities library to make modding wormtown easier!

AssetHelper

  • Provides DirectLazyAsset<T> and LazyAsset<T> for getting game assets once they become available.
  • LazyAsset<T> 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<T> 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<Shader> clayDissolve = new LazyAsset<Shader>("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<GameObject> someObject = new DirectLazyAsset<GameObject>(
    (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<NetworkObject>();
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<GameObject>("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<GameObject>("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.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.