Skip to content

Commit

Permalink
move RemoveRandomWeapon into DXRFlagsNGPMaxRando
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Sep 10, 2023
1 parent 48cd02f commit 9e6c428
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
28 changes: 24 additions & 4 deletions DXRModules/DeusEx/Classes/DXRFlagsNGPMaxRando.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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?
Expand All @@ -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();
}
22 changes: 0 additions & 22 deletions DXRModules/DeusEx/Classes/DXRWeapons.uc
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,3 @@ simulated function bool RandoProjectile(DeusExWeapon w, out class<Projectile> 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();
}

0 comments on commit 9e6c428

Please sign in to comment.