1
0
KF2-Dev-Scripts/KFGame/Classes/Path_PreferWalls.uc

50 lines
1.3 KiB
Ucode
Raw Permalink Normal View History

2020-12-13 15:01:13 +00:00
//=============================================================================
// Path_AvoidChokePoints.uc
//=============================================================================
// Path constraint for NPCs who prefer navigation points in darker areas
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
//=============================================================================
class Path_PreferWalls extends PathConstraint
native(Waypoint);
var bool bOnlyAcceptWallNodes;
var int FloorNodeCost;
var bool bAvoidEnemy;
cpptext
{
virtual UBOOL EvaluatePath( UReachSpec* Spec, APawn* Pawn, INT& out_PathCost, INT& out_HeuristicCost );
}
static function bool PreferWalls( Pawn P, optional bool InOnlyAcceptWallNodes=false, optional int InFloorNodeCost=10000, optional bool InAvoidEnemy=false )
{
local Path_PreferWalls Con;
if( P != None )
{
Con = Path_PreferWalls( P.CreatePathConstraint(default.class) );
if( Con != None )
{
Con.FloorNodeCost = InFloorNodeCost;
Con.bOnlyAcceptWallNodes = InOnlyAcceptWallNodes;
Con.bAvoidEnemy = InAvoidEnemy;
P.AddPathConstraint( Con );
return true;
}
}
return false;
}
function Recycle()
{
Super.Recycle();
}
defaultproperties
{
CacheIdx=16
}