From ef8dd4d01ea9b85303ca510251afe1b99c664bcc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Jul 2022 07:56:22 +0200 Subject: [PATCH] - fixed and consolidated artifact check in cheat code. --- wadsrc/static/zscript/actors/player/player_cheat.zs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wadsrc/static/zscript/actors/player/player_cheat.zs b/wadsrc/static/zscript/actors/player/player_cheat.zs index fb471e19d..adacdfb52 100644 --- a/wadsrc/static/zscript/actors/player/player_cheat.zs +++ b/wadsrc/static/zscript/actors/player/player_cheat.zs @@ -42,6 +42,11 @@ extend class PlayerPawn } native void CheatSuicide(); + + private bool CheckArtifact(class 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) { @@ -207,8 +212,7 @@ extend class PlayerPawn if (type!= null) { let def = GetDefaultByType (type); - if (def.Icon.isValid() && (def.MaxAmount > 1 || def.bAutoActivate == false) && - !(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor") && !(type is "Key")) + if (def.Icon.isValid() && (def.MaxAmount > 1 || def.bAutoActivate == false) && CheckArtifact(type)) { // Do not give replaced items unless using "give everything" if (giveall == ALL_YESYES || GetReplacement(type) == type) @@ -364,7 +368,7 @@ extend class PlayerPawn for (int i = 0; i < AllActorClasses.Size(); ++i) { type = (class)(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); if (pack) pack.Destroy();