- swapped order of checks for picking up an item.

Failure must take precedence over the morph check because this does not return a proper toucher.
This commit is contained in:
Christoph Oelckers 2019-01-23 00:14:27 +01:00
parent 12c10b5156
commit 477560e1ef

View file

@ -1887,17 +1887,17 @@ class PlayerPawn : Actor
bool res; bool res;
Actor check; Actor check;
[res, check] = item.CallTryPickup(self); [res, check] = item.CallTryPickup(self);
if (check != self) if (!res)
{
item.Destroy();
item = NULL;
}
else if (check != self)
{ {
// Player was morphed. This is illegal at game start. // Player was morphed. This is illegal at game start.
// This problem is only detectable when it's too late to do something about it... // This problem is only detectable when it's too late to do something about it...
ThrowAbortException("Cannot give morph item '%s' when starting a game!", di.Name); ThrowAbortException("Cannot give morph item '%s' when starting a game!", di.Name);
} }
else if (!res)
{
item.Destroy();
item = NULL;
}
} }
let weap = Weapon(item); let weap = Weapon(item);
if (weap != NULL && weap.CheckAmmo(Weapon.EitherFire, false)) if (weap != NULL && weap.CheckAmmo(Weapon.EitherFire, false))