Fix Bone Servant crash when dropping a payload it can't place
DropPayload() cloned template.m_itemData straight off the ObjectDB prefab and handed the clone to ItemDrop.DropItem, which instantiates item.m_dropPrefab - a field a clone off a raw prefab never carries (same pitfall already fixed in AswidBloodPotions.MakeFood). The result was an unhandled ArgumentException instantiating null. This fires whenever a servant is holding something with nowhere sealed to put it - e.g. chests without the sigil item yet, as in the bug report - and since the exception aborts before m_payload.Clear() runs, the same broken load is retried, and crashes, on every AI tick after: relogging or killing the servant doesn't clear it, because the payload lives in the ZDO, not the character. Fix: set clone.m_dropPrefab = prefab before dropping, same as the existing fix.
This commit is contained in:
parent
c99a386e4f
commit
e042579e17
1 changed files with 9 additions and 1 deletions
|
|
@ -921,7 +921,15 @@ namespace RacesOfValheim
|
||||||
while (left > 0)
|
while (left > 0)
|
||||||
{
|
{
|
||||||
int stack = Mathf.Min(left, max);
|
int stack = Mathf.Min(left, max);
|
||||||
ItemDrop.DropItem(template.m_itemData.Clone(), stack,
|
|
||||||
|
// ItemDrop.DropItem instantiates item.m_dropPrefab - a clone off a raw ObjectDB
|
||||||
|
// prefab does not carry that (see AswidBloodPotions.MakeFood for the same fix).
|
||||||
|
// Without this, dropping a payload throws instantiating null and never clears
|
||||||
|
// it, so the same broken load is retried - and crashes - on every AI tick after.
|
||||||
|
ItemDrop.ItemData clone = template.m_itemData.Clone();
|
||||||
|
clone.m_dropPrefab = prefab;
|
||||||
|
|
||||||
|
ItemDrop.DropItem(clone, stack,
|
||||||
at + Random.insideUnitSphere * 0.3f, Quaternion.identity);
|
at + Random.insideUnitSphere * 0.3f, Quaternion.identity);
|
||||||
left -= stack;
|
left -= stack;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue