1
0
KF2-Dev-Scripts/KFGame/Classes/Path_PreferDarkness.uc
2020-12-13 18:01:13 +03:00

49 lines
1.3 KiB
Ucode

//=============================================================================
// Path_PreferDarkness.uc
//=============================================================================
// Path constraint for NPCs who prefer navigation points in darker areas
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
//=============================================================================
class Path_PreferDarkness extends PathConstraint
native(Waypoint);
cpptext
{
virtual UBOOL EvaluatePath( UReachSpec* Spec, APawn* Pawn, INT& out_PathCost, INT& out_HeuristicCost );
}
/** Maximum luminance (per navigation point) before adding extra costs */
var() float MaxLuminance;
static function bool DontGoIntoTheLight( Pawn P, float InMaxLuminance )
{
local Path_PreferDarkness Con;
if( P != None && InMaxLuminance > 0.f )
{
Con = Path_PreferDarkness(P.CreatePathConstraint(default.class));
if( Con != None )
{
Con.MaxLuminance = InMaxLuminance;
P.AddPathConstraint( Con );
return true;
}
}
return false;
}
function Recycle()
{
Super.Recycle();
MaxLuminance=default.MaxLuminance;
}
defaultproperties
{
CacheIdx=12
MaxLuminance=0.5f
}