Skip to content

BT auditor: parse decorator logic operators (AND/OR/NOT) correctly #32

@kvirani

Description

@kvirani

Problem

The BT auditor's BuildDecoratorLogicString ignores the Number field in FBTDecoratorLogic, which defines how many operands each operator consumes (prefix notation). The current code just appends the operator keyword, producing garbled expressions for branches with 3+ decorators combined with AND/OR/NOT logic.

Simple cases (1-2 decorators) work fine since there's no logic ops array.

Related

The DecoratorLogic field is gathered (populated on each child node) but never serialized in the markdown output (#7 from code review). Both should be fixed together.

Current behavior

For And(3), Test, Test, Test (meaning A AND B AND C), the output is a flat meaningless string.

Expected behavior

Proper expression like (Blackboard: IsSet) AND (Cooldown: 5s) AND (TimeLimit: 10s).

Implementation notes

FBTDecoratorLogic uses prefix notation where Number is the operand count:

  • And(2), Test(0), Test(1) means decorator[0] AND decorator[1]
  • Or(2), And(2), Test(0), Test(1), Test(2) means (decorator[0] AND decorator[1]) OR decorator[2]

Needs a small recursive descent parser walking the ops array with a stack. Then serialize the resulting expression string in SerializeNodeToMarkdown.

Priority

Low. Individual decorator properties are already output correctly, so LLMs can understand what each decorator does. The logic expression is a readability improvement for understanding how they combine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions