//
// Created by bastian on 26.03.22.
//

#include "AmICalled.h"

BT::AmICalled::AmICalled(const std::string &name, const BT::NodeConfiguration &config) :
        ConditionNode(name, config) {}

BT::PortsList BT::AmICalled::providedPorts() {
    return {InputPort<bool>("called")};
}

BT::NodeStatus BT::AmICalled::tick() {
    bool called;
    if (!getInput("called", called)) {
        return NodeStatus::FAILURE;
    }
    if (called) {
        return NodeStatus::SUCCESS;
    }
    return NodeStatus::FAILURE;
}
