- scriptified the decision making of the invuseall CCMD.

Custom items had no way to adjust to this - and it also was the last native access to ItemFlags.
This commit is contained in:
Christoph Oelckers 2018-12-02 18:43:38 +01:00
parent 93f91d1039
commit 3182569fb8
3 changed files with 12 additions and 2 deletions

View File

@ -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;
}

View File

@ -132,6 +132,9 @@ class PuzzleItem : Inventory
return false;
}
override void UseAll(Actor user)
{
}
override bool ShouldStay ()
{

View File

@ -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);
}
//===========================================================================
//