"Extended Virtual Hitbox" for items.

This commit is contained in:
Mari the Deer 2022-03-27 15:27:03 +02:00
commit 0aee4035ed
8 changed files with 53 additions and 4 deletions

View file

@ -111,7 +111,9 @@ extend Class SWWMHandler
if ( a == players[consoleplayer].Camera ) continue;
if ( a.bINVISIBLE && !(a is 'DynamicLight') ) continue;
if ( (a is 'Inventory') && Inventory(a).Owner ) continue;
if ( (a is 'SWWMShadow') || (a is 'GhostArtifactX') || (a is 'DemolitionistSelfLight') || (a is 'HeadpatTracker') ) continue;
if ( (a is 'SWWMPickupFlash') && (a.CurState == a.FindState('Pickup')) ) continue;
if ( (a is 'SWWMShadow') || (a is 'GhostArtifactX') || (a is 'DemolitionistSelfLight') || (a is 'HeadpatTracker') || (a is 'SWWMExtendedItemHitbox')
|| (a is 'SWWMTeleportLine') || (a is 'SWWMTeleportDest') ) continue;
if ( a.Distance3DSquared(e.Camera) > 1000000 ) continue;
DrawActor(e,a);
}

View file

@ -52,10 +52,43 @@ Class CrossLineFinder : LineTracer
}
}
// hitbox with default collision size for items
Class SWWMExtendedItemHitbox : Actor
{
override void Tick()
{
if ( !master )
{
Destroy();
return;
}
if ( pos != master.pos ) SetOrigin(master.pos,false);
}
override void Touch( Actor toucher )
{
if ( !master || !master.bSPECIAL || !swwm_extendedpickup )
return;
master.Touch(toucher);
}
default
{
+NOGRAVITY;
+SPECIAL;
}
}
Mixin Class SWWMUseToPickup
{
bool bUsePickup;
override void BeginPlay()
{
Super.BeginPlay();
if ( !swwm_extendedpickup ) return;
let box = Spawn("SWWMExtendedItemHitbox",pos);
box.master = self;
}
// allow pickup by use
override bool Used( Actor user )
{

View file

@ -47,6 +47,14 @@ Class SWWMWeapon : Weapon abstract
return null;
}
override void BeginPlay()
{
Super.BeginPlay();
if ( !swwm_extendedpickup ) return;
let box = Spawn("SWWMExtendedItemHitbox",pos);
box.master = self;
}
override void Touch( Actor toucher )
{
// show prompt to swap weapon, and prevent normal pickup