|
|
|
|
|
|
|
class BotGuardBase |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
bool GuardCondition (BotEventBase e) { return true; } |
|
}; |
|
|
|
class BotGuardAnd extends BotGuardBase |
|
{ |
|
ref BotGuardBase m_arg0; |
|
ref BotGuardBase m_arg1; |
|
|
|
void BotGuardAnd (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; } |
|
|
|
override bool GuardCondition (BotEventBase e) |
|
{ |
|
bool result = m_arg0.GuardCondition(e) && m_arg1.GuardCondition(e); |
|
botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " && " + m_arg1.Type() + " = " + result); |
|
return result; |
|
} |
|
}; |
|
|
|
class BotGuardNot extends BotGuardBase |
|
{ |
|
ref BotGuardBase m_arg0; |
|
|
|
void BotGuardNot (BotGuardBase arg0 = NULL) { m_arg0 = arg0; } |
|
|
|
override bool GuardCondition (BotEventBase e) |
|
{ |
|
bool result = !m_arg0.GuardCondition(e); |
|
botDebugPrint("[botfsm] guard - ! " + m_arg0.Type() + " = " + result); |
|
return result; |
|
} |
|
}; |
|
|
|
class BotGuardOr extends BotGuardBase |
|
{ |
|
ref BotGuardBase m_arg0; |
|
ref BotGuardBase m_arg1; |
|
|
|
void BotGuardOr (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; } |
|
|
|
override bool GuardCondition (BotEventBase e) |
|
{ |
|
bool result = m_arg0.GuardCondition(e) || m_arg1.GuardCondition(e); |
|
botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " || " + m_arg1.Type() + " = " + result); |
|
return result; |
|
} |
|
}; |
|
|
|
class BotGuardHasItemInHands extends HandGuardBase |
|
{ |
|
protected Man m_Player; |
|
void BotGuardHasItemInHands (Man p = NULL) { m_Player = p; } |
|
|
|
override bool GuardCondition (HandEventBase e) |
|
{ |
|
if (m_Player.GetHumanInventory().GetEntityInHands()) |
|
{ |
|
if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - has valid entity in hands"); |
|
return true; |
|
} |
|
|
|
if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - no entity in hands"); |
|
return false; |
|
} |
|
}; |
|
|
|
|