diff --git a/src/d_net.cpp b/src/d_net.cpp index 583b99ebf..ac4f512f5 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -63,6 +63,7 @@ #include "g_levellocals.h" #include "events.h" #include "i_time.h" +#include "vm.h" EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, autosavecount) @@ -2253,9 +2254,10 @@ void Net_DoCommand (int type, uint8_t **stream, int player) while (item != NULL) { AInventory *next = item->Inventory; - if (item->ItemFlags & IF_INVBAR && !(item->IsKindOf(pitype))) + IFVIRTUALPTR(item, AInventory, UseAll) { - players[player].mo->UseInventory (item); + VMValue param[] = { item, players[player].mo }; + VMCall(func, param, 2, nullptr, 0); } item = next; } diff --git a/wadsrc/static/zscript/inventory/inv_misc.txt b/wadsrc/static/zscript/inventory/inv_misc.txt index 4761408b3..7aa60227d 100644 --- a/wadsrc/static/zscript/inventory/inv_misc.txt +++ b/wadsrc/static/zscript/inventory/inv_misc.txt @@ -132,6 +132,9 @@ class PuzzleItem : Inventory return false; } + override void UseAll(Actor user) + { + } override bool ShouldStay () { diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index 2166c8630..86c5527f6 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -934,6 +934,11 @@ class Inventory : Actor native virtual version("2.4") ui void AlterWeaponSprite(VisStyle vis, in out int changed) {} virtual void OwnerDied() {} virtual Color GetBlend () { return 0; } + + virtual void UseAll(Actor user) + { + if (bInvBar) user.UseInventory(self); + } //=========================================================================== //