jpw1991 / chebs-necromancy

Cheb's Necromancy adds Necromancy to Valheim via craftable wands and structures. Minions will follow you, guard your base, and perform menial tasks.
The Unlicense
10 stars 4 forks source link

Reduce asset maintenance via prerequisite assets mod shared by Necromancy and Mercenaries #272

Closed jpw1991 closed 1 month ago

jpw1991 commented 3 months ago

Right now, a bunch of items (eg. ChebGonaz_SkeletonBow) are shared and used by both Cheb's Mercenaries and Cheb's Necromancy and these are stored inside the chebgonaz asset bundle.

In the process of cleaning this bundle out and implementing a lot of mock objects, it's become apparent to me that many of these items needn't be created and maintained in Unity, rather they can be created using pure code. This will reduce the maintenance on the Unity side.

But for this to work, a new mod needs to be created and loaded first as a requirement so that the items are ready to go to be assigned to the minions as the mod is loading in.

Example creation of green skeleton starter bow:

            PrefabManager.OnVanillaPrefabsAvailable += () =>
            {
                var testBow = new CustomItem("ChebGonaz_TestBow", "skeleton_bow");
                testBow.ItemPrefab.GetComponentInChildren<MeshRenderer>().sharedMaterial = _testBowMaterial;
                ItemManager.Instance.AddItem(testBow);
            };