From 9e6c428f9ff06b145df3f45374e22a2364e67467 Mon Sep 17 00:00:00 2001 From: Die4Ever Date: Sun, 10 Sep 2023 11:00:19 -0500 Subject: [PATCH] move RemoveRandomWeapon into DXRFlagsNGPMaxRando --- .../DeusEx/Classes/DXRFlagsNGPMaxRando.uc | 28 ++++++++++++++++--- DXRModules/DeusEx/Classes/DXRWeapons.uc | 22 --------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/DXRModules/DeusEx/Classes/DXRFlagsNGPMaxRando.uc b/DXRModules/DeusEx/Classes/DXRFlagsNGPMaxRando.uc index 600e330fc..531c50bdb 100644 --- a/DXRModules/DeusEx/Classes/DXRFlagsNGPMaxRando.uc +++ b/DXRModules/DeusEx/Classes/DXRFlagsNGPMaxRando.uc @@ -154,7 +154,6 @@ function NewGamePlus() local #var(PlayerPawn) p; local DataStorage ds; local DXRSkills skills; - local DXRWeapons weapons; local DXRAugmentations augs; local int i, bingo_win,bingo_freespaces; local float exp; @@ -244,9 +243,7 @@ function NewGamePlus() augs.RemoveRandomAug(p); // TODO: do this in the intro instead of in the credits? - weapons = DXRWeapons(dxr.FindModule(class'DXRWeapons')); - if( weapons != None ) - weapons.RemoveRandomWeapon(p); + RemoveRandomWeapon(p); //Should you actually get fresh augs and credits on a NG+ non-vanilla start map? //Technically it should make up for levels you skipped past, so maybe? @@ -263,3 +260,26 @@ function NewGamePlus() class'PlayerDataItem'.static.ResetData(p); Level.Game.SendPlayer(p, "00_intro"); } + +simulated function RemoveRandomWeapon(#var(PlayerPawn) p) +{ + local Inventory i, next; + local Weapon weaps[64]; + local int numWeaps, slot; + + for( i = p.Inventory; i != None; i = next ) { + next = i.Inventory; + if( Weapon(i) == None ) continue; + weaps[numWeaps++] = Weapon(i); + } + + // don't take the player's only weapon + if( numWeaps <= 1 ) return; + + SetSeed( "RemoveRandomWeapon " $ numWeaps ); + + slot = rng(numWeaps); + info("RemoveRandomWeapon("$p$") Removing weapon "$weaps[slot]$", numWeaps was "$numWeaps); + p.DeleteInventory(weaps[slot]); + weaps[slot].Destroy(); +} diff --git a/DXRModules/DeusEx/Classes/DXRWeapons.uc b/DXRModules/DeusEx/Classes/DXRWeapons.uc index cc355c679..2a90f9145 100644 --- a/DXRModules/DeusEx/Classes/DXRWeapons.uc +++ b/DXRModules/DeusEx/Classes/DXRWeapons.uc @@ -159,25 +159,3 @@ simulated function bool RandoProjectile(DeusExWeapon w, out class p, return true; } - -simulated function RemoveRandomWeapon(#var(PlayerPawn) p) -{ - local Inventory i; - local Weapon weaps[64]; - local int numWeaps, slot; - - for( i = p.Inventory; i != None; i = i.Inventory ) { - if( Weapon(i) == None ) continue; - weaps[numWeaps++] = Weapon(i); - } - - // don't take the player's only weapon - if( numWeaps <= 1 ) return; - - SetSeed( "RemoveRandomWeapon " $ numWeaps ); - - slot = rng(numWeaps); - info("RemoveRandomWeapon("$p$") Removing weapon "$weaps[slot]$", numWeaps was "$numWeaps); - p.DeleteInventory(weaps[slot]); - weaps[slot].Destroy(); -}