2020-12-13 15:01:13 +00:00
//=============================================================================
// KFProjectileStickHelper_HRGScorcher
//=============================================================================
// Manages projectile sticking and pinning functionality for HRG Scorcher primary fire.
// Overriding stick functionality to not do any damage
//=============================================================================
// Killing Floor 2
// Copyright (C) 2020 Tripwire Interactive LLC
//=============================================================================
class KFProjectileStickHelper _HRGScorcher extends KFProjectileStickHelper ;
/** Stops movement of projectile and calculates orientation to surface */
simulated function Stick ( Actor HitActor , vector HitLocation , vector HitNormal , const out TraceHitInfo HitInfo )
{
local int BoneIdx ;
local KFPawn _Monster HitMonster ;
local array < ImpactInfo > HitZoneImpactList ;
local vector StartTrace , EndTrace , Direction , ClosestBoneLocation ;
local name BoneName ;
BoneName = HitInfo . BoneName ;
HitMonster = KFPawn _Monster ( HitActor ) ;
if ( HitMonster != none )
{
// get injury hit zone
StartTrace = HitLocation ;
Direction = Normal ( Velocity ) ;
EndTrace = StartTrace + Direction * ( HitMonster . CylinderComponent . CollisionRadius * 6.0 ) ;
TraceProjHitZones ( HitMonster , EndTrace , StartTrace , HitZoneImpactList ) ;
if ( BoneName == '' )
{
// get the best bone to attach to
ClosestBoneLocation = HitMonster . Mesh . GetClosestCollidingBoneLocation ( HitLocation , true , false ) ;
BoneName = HitMonster . Mesh . FindClosestBone ( ClosestBoneLocation , ClosestBoneLocation ) ;
}
//Deleted damage to monster code, we don't want to do damage on sticking
}
if ( ! IsZero ( HitLocation ) )
{
SetLocation ( HitLocation ) ;
}
SetStickOrientation ( HitNormal ) ;
BoneIdx = INDEX _NONE ;
if ( BoneName != '' )
{
BoneIdx = GetBoneIndexFromActor ( HitActor , BoneName ) ;
}
StickToActor ( HitActor , HitInfo . HitComponent , BoneIdx , true ) ;
if ( Role < ROLE _Authority )
{
Outer . ServerStick ( HitActor , BoneIdx , StuckToLocation , StuckToRotation ) ;
}
if ( WorldInfo . NetMode != NM _DedicatedServer && StickAkEvent != none )
{
PlaySoundBase ( StickAkEvent ) ;
}
}
simulated function bool GetImpactResult ( Actor HitActor , PrimitiveComponent HitComp )
{
local KFPawn _Human KFP ;
local KFDestructibleActor D ;
local StaticMeshComponent StaticMeshComp ;
if ( HitActor == none )
{
return true ;
}
if ( HitActor . RemoteRole == ROLE _None && ! HitActor . bWorldGeometry && InterpActor ( HitActor ) == None ) //Added InterpActor to be able to stick to those actors (KII-51625)
{
return false ;
}
// if we've already been dislodged from an actor, don't keep trying to stick to it while falling
if ( HitActor . bTearOff || HitActor . bDeleteMe || HitActor . bPendingDelete || HitActor == PrevStuckToActor )
{
return false ;
}
StaticMeshComp = StaticMeshComponent ( HitComp ) ;
if ( StaticMeshComp != none )
{
// NOTE: Door actors fall into this category!
// pass through meshes that can move
2021-03-02 11:56:51 +00:00
return true ;
2020-12-13 15:01:13 +00:00
}
KFP = KFPawn _Human ( HitActor ) ;
if ( KFP != none )
{
// bounce off of player pawns, stick to other pawns
return false ;
2021-03-02 11:56:51 +00:00
}
2020-12-13 15:01:13 +00:00
D = KFDestructibleActor ( HitActor ) ;
if ( D != none )
{
2021-03-02 11:56:51 +00:00
2020-12-13 15:01:13 +00:00
// don't react to client-side-only destructibles, stick to others
return D . ReplicationMode != RT _ClientSide ;
2021-03-02 11:56:51 +00:00
}
2020-12-13 15:01:13 +00:00
return true ;
}