- scriptified the remains of AAmmo.

This commit is contained in:
Christoph Oelckers 2017-01-18 14:18:17 +01:00
commit d9fd2d509f
22 changed files with 122 additions and 245 deletions

View file

@ -20,7 +20,6 @@
#include "p_spec.h"
#include "serializer.h"
#include "virtual.h"
#include "a_ammo.h"
#include "c_functions.h"
#include "g_levellocals.h"
@ -1314,29 +1313,7 @@ bool AInventory::TryPickup (AActor *&toucher)
ItemFlags &= ~IF_PICKUPGOOD;
GoAwayAndDie ();
}
else if (MaxAmount == 0 && !IsKindOf(RUNTIME_CLASS(AAmmo)))
{
// Special case: If an item's MaxAmount is 0, you can still pick it
// up if it is autoactivate-able.
if (!(ItemFlags & IF_AUTOACTIVATE))
{
return false;
}
// The item is placed in the inventory just long enough to be used.
toucher->AddInventory (this);
bool usegood = CallUse (true);
toucher->RemoveInventory (this);
if (usegood)
{
GoAwayAndDie ();
}
else
{
return false;
}
}
else
else if (MaxAmount > 0)
{
// Add the item to the inventory. It is not already there, or HandlePickup
// would have already taken care of it.
@ -1374,6 +1351,25 @@ bool AInventory::TryPickup (AActor *&toucher)
}
}
}
else if (ItemFlags & IF_AUTOACTIVATE)
{
// Special case: If an item's MaxAmount is 0, you can still pick it
// up if it is autoactivate-able.
// The item is placed in the inventory just long enough to be used.
toucher->AddInventory(this);
bool usegood = CallUse(true);
toucher->RemoveInventory(this);
if (usegood)
{
GoAwayAndDie();
}
else
{
return false;
}
}
return true;
}