Fix swap weapons + item respawn glitch.
This commit is contained in:
parent
95d59ba72a
commit
bba6a6d0d7
2 changed files with 40 additions and 3 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r388 \cu(Tue 30 Aug 18:29:25 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r388 \cu(2022-08-30 18:29:25)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r389 \cu(Tue 30 Aug 20:43:12 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r389 \cu(2022-08-30 20:43:12)\c-";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
Class SWWMWeapon : Weapon abstract
|
||||
{
|
||||
Mixin SWWMOverlapPickupSound;
|
||||
Mixin SWWMRespawn;
|
||||
|
||||
bool wasused;
|
||||
bool bUsePickup;
|
||||
|
|
@ -20,6 +19,7 @@ Class SWWMWeapon : Weapon abstract
|
|||
FlagDef HideInMenu : SWeaponFlags, 1; // don't show in inventory menu (usually for sister weapons)
|
||||
FlagDef NoSwapWeapon : SWeaponFlags, 2; // weapon is not affected by slot swapping
|
||||
FlagDef HasScrTex : SWeaponFlags, 3; // weapon model has a scripted texture (calls RenderTexture() from Event Handler)
|
||||
FlagDef SwappedTo : SWeaponFlags, 4; // this weapon was swapped to on pickup (so it won't respawn)
|
||||
|
||||
int oldtagcolor;
|
||||
|
||||
|
|
@ -143,11 +143,13 @@ Class SWWMWeapon : Weapon abstract
|
|||
}
|
||||
}
|
||||
bUsePickup = true;
|
||||
bSWAPPEDTO = true;
|
||||
Touch(user);
|
||||
bUsePickup = false;
|
||||
// we got picked up
|
||||
if ( bDestroyed || Owner || !bSPECIAL )
|
||||
{
|
||||
bSWAPPEDTO = false; // clear this flag
|
||||
// autoswitch to us if we got swapped
|
||||
if ( swapto ) user.A_SelectWeapon(GetClass());
|
||||
Vector3 tracedir = level.Vec3Diff(userpos,itempos);
|
||||
|
|
@ -317,6 +319,40 @@ Class SWWMWeapon : Weapon abstract
|
|||
if ( !bDROPPED && (deathmatch || alwaysapplydmflags) && sv_weaponstay ) return true;
|
||||
return false;
|
||||
}
|
||||
// we need to copy this since we can't re-use the mixin
|
||||
override void Hide()
|
||||
{
|
||||
bSPECIAL = false;
|
||||
bNOGRAVITY = true;
|
||||
bINVISIBLE = true;
|
||||
SetState(FindState("HideDoomish"));
|
||||
tics = 1050;
|
||||
if ( (self is 'Ammo') || (self is 'MagAmmo') )
|
||||
tics -= 350;
|
||||
if ( self.bBIGPOWERUP || SWWMUtility.IsVIPItem(self) )
|
||||
tics += 1050;
|
||||
if ( RespawnTics != 0 ) tics = RespawnTics;
|
||||
if ( ShouldRespawn() )
|
||||
{
|
||||
Vector3 oldpos = pos;
|
||||
A_RestoreSpecialPosition();
|
||||
let t = Spawn("SWWMRespawnTimer",pos);
|
||||
t.tracer = self;
|
||||
t.special1 = tics;
|
||||
t.A_SetSize(radius,height);
|
||||
SetOrigin(oldpos,false);
|
||||
}
|
||||
}
|
||||
override bool ShouldRespawn()
|
||||
{
|
||||
// swapped-to weapons do not respawn
|
||||
if ( bSWAPPEDTO ) return false;
|
||||
// always respawn in DM
|
||||
if ( deathmatch && !bNEVERRESPAWN ) return true;
|
||||
if ( (bBigPowerup || SWWMUtility.IsVIPItem(self)) && !sv_respawnsuper ) return false;
|
||||
if ( bNEVERRESPAWN ) return false;
|
||||
return (sv_itemrespawn||bALWAYSRESPAWN);
|
||||
}
|
||||
override void AttachToOwner( Actor other )
|
||||
{
|
||||
Inventory.AttachToOwner(other);
|
||||
|
|
@ -331,6 +367,7 @@ Class SWWMWeapon : Weapon abstract
|
|||
StatusBar.ReceivedWeapon(self);
|
||||
}
|
||||
GivenAsMorphWeapon = false;
|
||||
bSwappedTo = false;
|
||||
}
|
||||
override void OwnerDied()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue