Core/Movement: implement MotionMasterDelayedAction validator
Port From (https://github.com/TrinityCore/TrinityCore/commit/36a1d00444b35d6f8fbfaabebf835f4ad9c01108)
This commit is contained in:
@@ -59,16 +59,29 @@ namespace Game.Movement
|
||||
|
||||
class MotionMasterDelayedAction
|
||||
{
|
||||
Func<bool> Validator;
|
||||
public Action Action;
|
||||
public MotionMasterDelayedActionType Type;
|
||||
|
||||
public MotionMasterDelayedAction(Action action, Func<bool> validator, MotionMasterDelayedActionType type)
|
||||
{
|
||||
Action = action;
|
||||
Validator = validator;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public MotionMasterDelayedAction(Action action, MotionMasterDelayedActionType type)
|
||||
{
|
||||
Action = action;
|
||||
Validator = () => true;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public void Resolve() { Action(); }
|
||||
public void Resolve()
|
||||
{
|
||||
if (Validator())
|
||||
Action();
|
||||
}
|
||||
}
|
||||
|
||||
public class MotionMaster
|
||||
@@ -112,7 +125,7 @@ namespace Game.Movement
|
||||
return _defaultGenerator == null && _generators.Empty();
|
||||
}
|
||||
|
||||
int Size()
|
||||
public int Size()
|
||||
{
|
||||
return _defaultGenerator != null ? 1 : 0 + _generators.Count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user