From 41c69736b1544158816c9254a5837afd79b06209 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Mon, 30 Sep 2024 01:51:55 -0400 Subject: [PATCH] - fix some issues with ClearInventory() that sometimes caused script errors --- wadsrc/static/zscript/actors/inventory/inventory.zs | 1 + wadsrc/static/zscript/actors/inventory_util.zs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/zscript/actors/inventory/inventory.zs b/wadsrc/static/zscript/actors/inventory/inventory.zs index 52009f2e11..f41880a3c0 100644 --- a/wadsrc/static/zscript/actors/inventory/inventory.zs +++ b/wadsrc/static/zscript/actors/inventory/inventory.zs @@ -940,6 +940,7 @@ class Inventory : Actor } else { + Owner = null; Destroy(); } } diff --git a/wadsrc/static/zscript/actors/inventory_util.zs b/wadsrc/static/zscript/actors/inventory_util.zs index 011ca134f4..e47172a495 100644 --- a/wadsrc/static/zscript/actors/inventory_util.zs +++ b/wadsrc/static/zscript/actors/inventory_util.zs @@ -333,8 +333,13 @@ extend class Actor // destroy something we already processed, we've already destroyed it, // 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) { let inv = last.inv; @@ -348,11 +353,6 @@ extend class Actor last = inv; } } - if (player != null) - { - player.ReadyWeapon = null; - player.PendingWeapon = WP_NOCHANGE; - } }