A utilities library to make modding wormtown easier!
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);
};
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
GameObject prefab = testbundle.LoadAsset<GameObject>("TestAbility.prefab");
WormAbilityAPI.AddWormAbility(new WormAbilityInfo() {
WormAbilityObject = prefab,
AbilityNotes = new() {
"A Note About Our Ability"
}
});
GameObject prefab = testbundle.LoadAsset<GameObject>("TestEquipment.prefab");
EquipmentAPI.AddEquipment(new EquipmentInfo() {
Name = "Test Pardner Equipment",
Prefab = prefab
});
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