mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Movement: implement MotionMasterDelayedAction validator
This commit is contained in:
@@ -82,14 +82,21 @@ struct MovementGeneratorInformation
|
||||
std::string TargetName;
|
||||
};
|
||||
|
||||
static bool EmptyValidator()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
class MotionMasterDelayedAction
|
||||
{
|
||||
public:
|
||||
explicit MotionMasterDelayedAction(std::function<void()>&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Type(type) { }
|
||||
explicit MotionMasterDelayedAction(std::function<void()>&& action, std::function<bool()>&& validator, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(std::move(validator)), Type(type) { }
|
||||
explicit MotionMasterDelayedAction(std::function<void()>&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(EmptyValidator), Type(type) { }
|
||||
~MotionMasterDelayedAction() { }
|
||||
|
||||
void Resolve() { Action(); }
|
||||
void Resolve() { if (Validator()) Action(); }
|
||||
|
||||
std::function<bool()> Validator;
|
||||
std::function<void()> Action;
|
||||
uint8 Type;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user