- fixed and consolidated artifact check in cheat code.

This commit is contained in:
Christoph Oelckers 2022-07-15 07:56:22 +02:00
parent ffd8b5ed5a
commit ef8dd4d01e

View file

@ -42,6 +42,11 @@ extend class PlayerPawn
} }
native void CheatSuicide(); native void CheatSuicide();
private bool CheckArtifact(class<Actor> type)
{
return !(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor") && !(type is "Key") && !(type is "Weapon");
}
virtual void CheatGive (String name, int amount) virtual void CheatGive (String name, int amount)
{ {
@ -207,8 +212,7 @@ extend class PlayerPawn
if (type!= null) if (type!= null)
{ {
let def = GetDefaultByType (type); let def = GetDefaultByType (type);
if (def.Icon.isValid() && (def.MaxAmount > 1 || def.bAutoActivate == false) && if (def.Icon.isValid() && (def.MaxAmount > 1 || def.bAutoActivate == false) && CheckArtifact(type))
!(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor") && !(type is "Key"))
{ {
// Do not give replaced items unless using "give everything" // Do not give replaced items unless using "give everything"
if (giveall == ALL_YESYES || GetReplacement(type) == type) if (giveall == ALL_YESYES || GetReplacement(type) == type)
@ -364,7 +368,7 @@ extend class PlayerPawn
for (int i = 0; i < AllActorClasses.Size(); ++i) for (int i = 0; i < AllActorClasses.Size(); ++i)
{ {
type = (class<Inventory>)(AllActorClasses[i]); type = (class<Inventory>)(AllActorClasses[i]);
if (type!= null && !(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor") && !(type is "Key") && !(type is "Weapon")) if (type!= null && CheckArtifact(type))
{ {
let pack = FindInventory(type); let pack = FindInventory(type);
if (pack) pack.Destroy(); if (pack) pack.Destroy();