- fix some issues with ClearInventory() that sometimes caused script errors

This commit is contained in:
Rachael Alexanderson 2024-09-30 01:51:55 -04:00
parent 4c27b55eb9
commit 41c69736b1
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
2 changed files with 7 additions and 6 deletions

View file

@ -940,6 +940,7 @@ class Inventory : Actor
} }
else else
{ {
Owner = null;
Destroy(); Destroy();
} }
} }

View file

@ -333,8 +333,13 @@ extend class Actor
// destroy something we already processed, we've already destroyed it, // destroy something we already processed, we've already destroyed it,
// so it won't have anything to destroy. // so it won't have anything to destroy.
let last = self; if (player != null)
{
player.ReadyWeapon = null;
player.PendingWeapon = WP_NOCHANGE;
}
let last = self;
while (last.inv != NULL) while (last.inv != NULL)
{ {
let inv = last.inv; let inv = last.inv;
@ -348,11 +353,6 @@ extend class Actor
last = inv; last = inv;
} }
} }
if (player != null)
{
player.ReadyWeapon = null;
player.PendingWeapon = WP_NOCHANGE;
}
} }