UTWeap_LinkGun.uc: line 566 (at least in the UT3 source code)
Code:
/**
* This function looks at how the beam is hitting and determines if this person is linkable
*/
function AttemptLinkTo(Actor Who, PrimitiveComponent HitComponent)
{
local UTVehicle UTV;
local UTOnslaughtObjective UTO;
local Vector StartTrace, EndTrace, V, HitLocation, HitNormal;
local Actor HitActor;
// redirect to vehicle if owned by a vehicle and the vehicle allows it
if( Who != none )
{
UTV = UTVehicle(Who.Owner);
if (UTV != None && UTV.AllowLinkThroughOwnedActor(Who))
{
Who = UTV;
}
}
// Check for linking to pawns
UTV = UTVehicle(Who);
if (UTV != None && UTV.bValidLinkTarget)
{
// Check teams to make sure they are on the same side or empty
if ( WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTV,Instigator) || (!UTV.bTeamLocked && UTV.CanEnterVehicle(Instigator)) )
{
if ( !WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTV,Instigator)
&& (Instigator.GetTeamNum() != 255) )
{
UTV.SetTeamNum( Instigator.GetTeamNum() );
}
LinkedComponent = HitComponent;
if ( LinkedTo != UTV )
{
UnLink();
LinkedTo = UTV;
UTV.IncrementLinkedToCount();
}
}
else
{
// Enemy got in the way, break any links
UnLink();
}
}
else
{
UTO = UTOnslaughtObjective(Who);
if ( (UTO != none) && WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTO,Instigator) )
{
if ( UTO.LinkHealMult > 0 )
{
if(LinkedTo != Who)
{
Unlink();
}
LinkedTo = UTO;
LinkedComponent = HitComponent;
}
else
{
UTO.FailedLinkHeal(Instigator.Controller);
UnLink();
}
}
else if (Who != None && !Who.bStatic)
{
UnLink();
}
}
if (LinkedTo != None)
{
// Determine if the link has been broken for another reason
if (LinkedTo.bDeleteMe || (Pawn(LinkedTo) != None && Pawn(LinkedTo).Health <= 0))
{
UnLink();
return;
}
// if we were passed in LinkedTo, we know we hit it straight on already, so skip the rest
if (LinkedTo != Who)
{
StartTrace = Instigator.GetWeaponStartTraceLocation();
EndTrace = GetLinkedtoLocation();
// First, check to see if we have skewed too much, or if the LinkedTo pawn has died and
// we didn't get cleaned up.
V = Normal(EndTrace - StartTrace);
if ( V dot vector(Instigator.GetViewRotation()) < LinkFlexibility || VSize(EndTrace - StartTrace) > 1.5 * WeaponRange )
{
UnLink();
return;
}
// If something is blocking us and the actor, drop the link
HitActor = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);
if (HitActor != none && HitActor != LinkedTo)
{
UnLink(true); // In this case, use a delayed UnLink
}
}
}
// if we are linked, make sure the proper flash location is set
if (LinkedTo != None)
{
SetFlashLocation(GetLinkedtoLocation());
}
}
Bookmarks