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

Neckro Null Object #126

Closed jpw1991 closed 1 year ago

jpw1991 commented 1 year ago

image

CW-Jesse commented 1 year ago

What commit is this?

jpw1991 commented 1 year ago

Newest master

jpw1991 commented 1 year ago

I'm thinking it can only be _monsterAI:

        private Container GetNearestDropOffPoint() {
            // Container closestContainer;
            Container closestContainer = FindClosest<Container>(DropoffPointRadius.Value, pieceMask,
                c => c.GetInventory().GetEmptySlots() > 0);
            if (closestContainer == null) return null;

            // move toward that piece
            _monsterAI.SetFollowTarget(closestContainer.gameObject);
            return closestContainer;
        }
CW-Jesse commented 1 year ago

It's a problem with the FindClosest method. Probably happens when no Containers or something. Thanks for finding this!

CW-Jesse commented 1 year ago

What's the NeckroStatus when this error occurs? Can't recreate the error by removing nearby containers.

jpw1991 commented 1 year ago

It's a problem with the FindClosest method. Probably happens when no Containers or something. Thanks for finding this!

Maybe this line? .Where(t => t.GetComponent<ZNetView>().IsValid()) // TODO: explain

Perhaps no ZNetView is there

jpw1991 commented 1 year ago

That seems to fix it for now, so I am going to release that as a hotfix and we can investigate better solutions later. Just gotta stop ppls games crashing etc.