Rewrite entire PickWeapon function to fix a bug.
This commit is contained in:
parent
bba1cf9a17
commit
9c8b4421a1
3 changed files with 25 additions and 3 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.24 \cu(Sun 12 Jun 15:24:58 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.2.24 \cu(2022-06-12 15:24:58)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.25 \cu(Mon 13 Jun 09:40:34 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.2.25 \cu(2022-06-13 09:40:34)\c-";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
pk7
|
||||
.git
|
||||
*.md
|
||||
docimg
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,29 @@ Class Demolitionist : PlayerPawn
|
|||
grav *= .25;
|
||||
vel.z -= grav;
|
||||
}
|
||||
// the default PickWeapon code breaks when dual weapons are involved
|
||||
// so we gotta roll out our own here
|
||||
//
|
||||
// I could rewrite PickNextWeapon and PickPrevWeapon as well, but nah
|
||||
// those always call CheckAmmo so it's fine
|
||||
override Weapon PickWeapon( int slot, bool checkammo )
|
||||
{
|
||||
int slotsize = player.weapons.SlotSize(slot);
|
||||
let cur = player.ReadyWeapon;
|
||||
for ( int i=slotsize-1; i>=0; i-- )
|
||||
{
|
||||
let type = player.weapons.GetWeapon(slot,i);
|
||||
let w = Weapon(player.mo.FindInventory(type));
|
||||
if ( !w || (w == cur) || (cur && cur.bPOWERED_UP && (w == cur.SisterWeapon)) )
|
||||
continue;
|
||||
String sn = w.GetClassName();
|
||||
bool dual = ((type is 'SWWMWeapon') && (sn.Left(4) ~== "Dual"));
|
||||
if ( (!checkammo && (!dual || (w.SisterWeapon && (w.SisterWeapon.Amount > 1))))
|
||||
|| w.CheckAmmo(Weapon.EitherFire,false) )
|
||||
return w;
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
override void MarkPrecacheSounds()
|
||||
{
|
||||
Super.MarkPrecacheSounds();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue