Add option to make single weapons have higher slot priority.

This commit is contained in:
Mari the Deer 2021-03-09 00:37:15 +01:00
commit 1da4bd6126
7 changed files with 28 additions and 2 deletions

View file

@ -8,6 +8,7 @@ Class Demolitionist : PlayerPawn
bool sendtoground;
bool key_reentrant;
bool bInDefaultInventory;
bool oldsinglefirst;
int lastdamage;
transient int lastdamagetic;
@ -414,6 +415,7 @@ Class Demolitionist : PlayerPawn
override void PostBeginPlay()
{
Super.PostBeginPlay();
oldsinglefirst = swwm_singlefirst; // super already sets up the slots, so save the cvar value now
mystats = SWWMStats.Find(player);
lastground = true;
}
@ -742,6 +744,10 @@ Class Demolitionist : PlayerPawn
let sc = Inventory(Spawn("SayaCollar"));
sc.AttachToOwner(self);
}
// this is why we need mod cvar callbacks
if ( swwm_singlefirst != oldsinglefirst )
WeaponSlots.SetupWeaponSlots(self);
oldsinglefirst = swwm_singlefirst;
// strife thing
if ( mystats.oldlogtext == "" )
mystats.oldlogtext = player.logtext;

View file

@ -106,6 +106,20 @@ Class SWWMWeapon : Weapon abstract
return false;
}
override int, int CheckAddToSlots()
{
if ( (GetReplacement(GetClass()) == GetClass()) && !bPowered_Up )
{
if ( swwm_singlefirst && SisterWeaponType )
{
let sw = GetDefaultByType(SisterWeaponType);
return sw.SlotNumber, int(sw.SlotPriority*65536);
}
return SlotNumber, int(SlotPriority*65536);
}
return -1, 0;
}
// subtracts given ammo from price, drops excess
virtual bool PickupForAmmoSWWM( SWWMWeapon ownedWeapon )
{