Has Config Value

#Kismet

Check whether or not you have the value desired of a config from any GameMod class. Simply grab the class name and value, and it'll work. Supports either matching the exact value, or equalling at least the desired value.

Ink_SeqCond_HasConfigValue.uc

[RAW] [Download]

/**
 *
 * Copyright 2012-2015 Gears for Breakfast ApS. All Rights Reserved.
 */
 
class Ink_SeqCond_HasConfigValue extends SequenceCondition;
 
var() String GamemodName;
var() Name ConfigName;
var() int RequiredValue;
 
//If checked, the check will pass if the grabbed value is this value or greater.
var() bool UseMinimum;
 
event Activated()
{
    local class<GameMod> GamemodClass;
 
    if (GamemodName != "")
        GamemodClass = class<GameMod>(class'Hat_ClassHelper'.static.ActorClassFromName(GamemodName));
 
    if (GamemodClass != None && ConfigName != '')
    {
        if (UseMinimum)
            OutputLinks[(GamemodClass.static.GetConfigValue(GamemodClass, ConfigName) >= RequiredValue) ? 0 : 1].bHasImpulse = true;
        else
            OutputLinks[(GamemodClass.static.GetConfigValue(GamemodClass, ConfigName) == RequiredValue) ? 0 : 1].bHasImpulse = true;
    }
    else
        OutputLinks[1].bHasImpulse = true;
}
 
defaultproperties
{
    ObjName="Has Config Value"
    ObjCategory="Ink Kismet"
 
    OutputLinks(0)=(LinkDesc="True")
    OutputLinks(1)=(LinkDesc="False")
 
    VariableLinks.Empty
    VariableLinks(0)=(ExpectedType=class'SeqVar_Int',LinkDesc="Required Value",bWriteable=true,PropertyName=DesiredValue)
}