cheats.zsc (2720B)
1 extend class DevilbunnyPlayer 2 { 3 override void CheatGive(String name, int amount) 4 { 5 let player = self.player; 6 if (player.mo == NULL || player.health <= 0) 7 { 8 return; 9 } 10 11 bool giveall = FALSE; 12 if (name ~== "all") 13 { 14 giveall = TRUE; 15 } 16 17 if (name ~== "health") 18 { 19 health = 1; 20 if (amount > 0) 21 { 22 self.GainHealth(amount); 23 } 24 else 25 { 26 self.hitpoints = player.maxhits; 27 } 28 } 29 30 if (giveall || name ~== "spirit" || name ~== "armor" || name ~== "ammo") 31 { 32 if (amount <= 0) 33 amount = 400; 34 35 self.GainSpirit(amount); 36 37 if (!giveall) 38 return; 39 } 40 41 if (giveall || name ~== "sword" || name ~== "grief") 42 { 43 self.hasSword = 1; 44 45 if (!giveall) 46 return; 47 } 48 49 if (giveall || name ~== "brigandine" || name ~== "backpack") 50 { 51 self.hasArmorType = 1; 52 53 if (!giveall) 54 return; 55 } 56 57 if (giveall || name ~== "skullarmor" || name ~== "radsuit") 58 { 59 self.hasArmorType = 2; 60 61 if (!giveall) 62 return; 63 } 64 65 if (giveall || name ~== "stunpunch" || name ~== "chainsaw") 66 { 67 self.stunPunch = TRUE; 68 69 if (!giveall) 70 return; 71 } 72 73 if (giveall || name ~== "keys") 74 { 75 for (int i = 0; i < AllActorClasses.Size(); ++i) 76 { 77 if (AllActorClasses[i] is "Key") 78 { 79 let keyitem = GetDefaultByType (AllActorClasses[i]); 80 if (keyitem.special1 != 0) 81 { 82 let item = Inventory(Spawn(AllActorClasses[i])); 83 if (!item.CallTryPickup (self)) 84 { 85 item.Destroy (); 86 } 87 } 88 } 89 } 90 if (!giveall) 91 return; 92 } 93 94 if (giveall || name ~== "weapons") 95 { 96 let savedpending = player.PendingWeapon; 97 for (i = 0; i < AllActorClasses.Size(); ++i) 98 { 99 let type = (class<Weapon>)(AllActorClasses[i]); 100 if (type != null && type != "Weapon") 101 { 102 // Don't give replaced weapons unless the replacement was done by Dehacked. 103 let rep = GetReplacement(type); 104 if (rep == type || rep is "DehackedPickup") 105 { 106 // Give the weapon only if it is set in a weapon slot. 107 if (player.weapons.LocateWeapon(type)) 108 { 109 readonly<Weapon> def = GetDefaultByType (type); 110 if (giveall == ALL_YESYES || !def.bCheatNotWeapon) 111 { 112 GiveInventory(type, 1, true); 113 } 114 } 115 } 116 } 117 } 118 player.PendingWeapon = savedpending; 119 120 if (!giveall) 121 return; 122 } 123 } 124 125 if (giveall) 126 return; 127 128 type = name; 129 if (type == NULL) 130 { 131 if (PlayerNumber() == consoleplayer) 132 A_Log(String.Format("Unknown item \"%s\"\n", name)); 133 } 134 else 135 { 136 GiveInventory(type, amount, true); 137 } 138 return; 139 140 }