Do not magnetize swapweapons.

This commit is contained in:
Mari the Deer 2022-08-17 13:56:36 +02:00
commit c90671fe29
4 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r333 \cu(Wed 17 Aug 01:21:38 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r333 \cu(2022-08-17 01:21:38)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r334 \cu(Wed 17 Aug 13:56:36 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r334 \cu(2022-08-17 13:56:36)\c-";

View file

@ -892,6 +892,8 @@ Class Demolitionist : PlayerPawn
else if ( i is 'MaGammo' ) cls = MagAmmo(i).GetParentMagAmmo();
let oi = FindInventory(cls);
if ( !i.bALWAYSPICKUP && oi && (oi.Amount >= oi.MaxAmount) ) continue;
if ( (i is 'SWWMWeapon') && SWWMWeapon(i).HasSwapWeapon(self) && swwm_swapweapons ) continue;
if ( (i is 'SWWMDualWeaponGiver') && SWWMDualWeaponGiver(i).HasSwapWeapon(self) && swwm_swapweapons ) continue;
bool addme = true;
for ( SWWMMagItem mi=magitem; mi; mi=mi.next )
{

View file

@ -239,6 +239,8 @@ Class SWWMMagItem play
else if ( item is 'MaGammo' ) cls = MagAmmo(item).GetParentMagAmmo();
let oi = target.FindInventory(cls);
if ( !item.bALWAYSPICKUP && oi && (oi.Amount >= oi.MaxAmount) ) return true;
if ( (item is 'SWWMWeapon') && SWWMWeapon(item).HasSwapWeapon(target) && swwm_swapweapons ) return true;
if ( (item is 'SWWMDualWeaponGiver') && SWWMDualWeaponGiver(item).HasSwapWeapon(target) && swwm_swapweapons ) return true;
Vector3 dirto = level.Vec3Diff(item.pos,target.Vec3Offset(0,0,target.height/2));
double dist = dirto.length();
if ( SWWMUtility.BoxIntersect(item,target) )

View file

@ -603,6 +603,17 @@ Class SWWMDualWeaponGiver : Inventory
box.master = self;
}
SWWMWeapon HasSwapWeapon( Actor other ) const
{
if ( giveme[0].bNoSwapWeapon ) return null;
for ( Inventory i=other.inv; i; i=i.inv )
{
if ( giveme[0].IsSwapWeapon(i) )
return SWWMWeapon(i);
}
return null;
}
override void Touch( Actor toucher )
{
// show prompt to swap weapon, and prevent normal pickup