Advertisement
Chronos_Ouroboros

JGP thing

Jan 25th, 2020
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1.     override void WorldTick() {
  2.         for (int pn = 0; pn < MAXPLAYERS; pn++) {
  3.             if (!playerInGame [pn])
  4.                 continue;
  5.  
  6.             PlayerInfo player = players [pn];
  7.             PlayerPawn mo = player.mo;
  8.  
  9.             if (!player || !mo)
  10.                 continue;
  11.             if (!player.ReadyWeapon)
  12.                 continue;
  13.             if (!bdoom_replaceweapons) // Check if the replace weapons CVAR is true.
  14.                 continue;
  15.  
  16.             let oldweapr = player.readyweapon.GetClassName (); // Get the currently selected weapons
  17.             // If (a vanilla weapon is READY (such as Pistol at vanilla map start), we also take it away and select the modded counterpart.
  18.             switch (oldweapr) {
  19.                 case 'Fist'          : GetWeapon (mo, "BD_Fist"          ).Use (false); break;
  20.                 case 'Chainsaw'      : GetWeapon (mo, "BD_Chainsaw"      ).Use (false); break;
  21.                 case 'Pistol'        : GetWeapon (mo, "BD_Pistol"        ).Use (false); break;
  22.                 case 'Shotgun'       : GetWeapon (mo, "BD_Shotgun"       ).Use (false); break;
  23.                 case 'SuperShotgun'  : GetWeapon (mo, "BD_SuperShotgun"  ).Use (false); break;
  24.                 case 'Chaingun'      : GetWeapon (mo, "BD_Chaingun"      ).Use (false); break;
  25.                 case 'RocketLauncher': GetWeapon (mo, "BD_RocketLauncher").Use (false); break;
  26.                 case 'PlasmaRifle'   : GetWeapon (mo, "BD_PlasmaRifle"   ).Use (false); break;
  27.                 case 'BFG9000'       : GetWeapon (mo, "BD_BFG9000"       ).Use (false); break;
  28.                 default: continue;
  29.             }
  30.  
  31.             mo.TakeInventory (oldweapr,1);
  32.             player.ReadyWeapon = null;
  33.         }
  34.     }
  35.  
  36.     private Weapon GetWeapon (PlayerPawn mo, Class<Weapon> type) {
  37.         let weap = Weapon (mo.FindInventory (type));
  38.         return weap ? weap : Weapon (mo.GiveInventoryType (type));
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement