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

unable to set custom container/container inventory sizes on pylons #214

Open jpw1991 opened 1 year ago

jpw1991 commented 1 year ago

Describe the bug

Bug: Unable to set custom inventory sizes without causing error. Help welcomed to fix this (I have no idea right now).


Long-standing issue #100 was the result of trying to set custom inventory sizes for pylons. I was able to fix that issue with:

  1. Delete the Container script from the prefab
  2. Add it via code instead & set the name
  3. Do not attempt to resize the container/inventory -> instantly results in this error
            // originally the Container was set on the prefab in unity and set up properly, but it will cause the
            // problem here:  https://github.com/jpw1991/chebs-necromancy/issues/100
            // So we add it here like this instead.
            // Pros: No bug
            // Cons: Cannot set custom width/height
            _container = gameObject.AddComponent<Container>();
            _container.m_name = "$chebgonaz_neckrogathererpylon_name";
            // _container.m_width = ContainerWidth.Value;
            // _container.m_height = ContainerHeight.Value;

            var inv = _container.GetInventory();
            inv.m_name = Localization.instance.Localize(_container.m_name);
            // trying to set width causes error here: https://github.com/jpw1991/chebs-necromancy/issues/100
            // inv.m_width = ContainerWidth.Value;
            // inv.m_height = ContainerHeight.Value;