Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override void WorldTick() {
- for (int pn = 0; pn < MAXPLAYERS; pn++) {
- if (!playerInGame [pn])
- continue;
- PlayerInfo player = players [pn];
- PlayerPawn mo = player.mo;
- if (!player || !mo)
- continue;
- if (!player.ReadyWeapon)
- continue;
- if (!bdoom_replaceweapons) // Check if the replace weapons CVAR is true.
- continue;
- let oldweapr = player.readyweapon.GetClassName (); // Get the currently selected weapons
- // If (a vanilla weapon is READY (such as Pistol at vanilla map start), we also take it away and select the modded counterpart.
- switch (oldweapr) {
- case 'Fist' : GetWeapon (mo, "BD_Fist" ).Use (false); break;
- case 'Chainsaw' : GetWeapon (mo, "BD_Chainsaw" ).Use (false); break;
- case 'Pistol' : GetWeapon (mo, "BD_Pistol" ).Use (false); break;
- case 'Shotgun' : GetWeapon (mo, "BD_Shotgun" ).Use (false); break;
- case 'SuperShotgun' : GetWeapon (mo, "BD_SuperShotgun" ).Use (false); break;
- case 'Chaingun' : GetWeapon (mo, "BD_Chaingun" ).Use (false); break;
- case 'RocketLauncher': GetWeapon (mo, "BD_RocketLauncher").Use (false); break;
- case 'PlasmaRifle' : GetWeapon (mo, "BD_PlasmaRifle" ).Use (false); break;
- case 'BFG9000' : GetWeapon (mo, "BD_BFG9000" ).Use (false); break;
- default: continue;
- }
- mo.TakeInventory (oldweapr,1);
- player.ReadyWeapon = null;
- }
- }
- private Weapon GetWeapon (PlayerPawn mo, Class<Weapon> type) {
- let weap = Weapon (mo.FindInventory (type));
- return weap ? weap : Weapon (mo.GiveInventoryType (type));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement