docs\limboai-stable

This commit is contained in:
2026-10-15 16:30:44 +08:00
parent ecebf76f47
commit 18e7b2daa8
149 changed files with 97312 additions and 0 deletions
@@ -0,0 +1,87 @@
<1> LimboAI Documentation
<2> <b>LimboAI</b> is an open-source C++ module for <b>Godot Engine 4</b> providing a combination of <b>Behavior Trees</b> and <b>State Machines</b> for crafting your game’s AI. It comes with a behavior tree editor, built-in documentation, visual debugger, and more! While it is implemented in C++, it fully supports GDScript for <l1>creating your own tasks</l> and states. The full list of features is available on the <l2>LimboAI GitHub</l> page.
<3> <b>Behavior Trees</b> are powerful hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games. To learn more about behavior trees, check out <l1>Introduction to Behavior Trees</l>.
<4> <b>Hierarchical State Machines</b> are finite state machines that allow any state to host their own sub-state machine. This allows you to tackle your AI’s state and transition complexity by breaking down one big state machine into multiple smaller ones.
<5> Getting LimboAI
<6> LimboAI can be used as either a C++ module or as a GDExtension shared library. There are some differences between the two. In short, GDExtension version is more convenient to use but somewhat limited in features. The module version provides better editor experience and is slightly more performant, but it requires using custom engine builds including the export templates. Whichever you choose to use, your project will stay compatible with both and you can switch from one to the other any time.
<7> Choose the version you’d like to use. If you’re unsure, start with the GDExtension version. You can change your decision at any time - both versions are fully compatible.
<8> Get GDExtension version
<9> Precompiled builds are available on the official <l1>LimboAI GitHub</l> page, and in the Asset Library.
<10> GDExtension is the most convenient way of using the LimboAI plugin, but it comes with certain limitations:
<11> Documentation tooltips are not available.
<12> Handy <l1>BBParam</l> property editor is not available in the extension due to dependencies on the engine classes that are not available in the Godot API.
<13> <b>🛈 See also:</b> <l1>What is GDExtension?</l>
<14> Installation instructions:
<15> Make sure you’re using the latest stable version of the Godot editor.
<16> Create a new project for your experiments with LimboAI.
<17> In Godot, click AssetLib tab at the top of the screen and search for LimboAI. Download it. LimboAI plugin will be downloaded with the demo project files. Don’t mind the errors printed at this point, this is due to the extension library not being loaded just yet.
<18> Reload your project with Project -> Reload project. There shouldn’t be any errors printed now.
<19> In the project files, locate a scene file called showcase.tscn and run it. It’s the demo’s entry point.
<20> Get module version
<21> Precompiled builds are available on the official <l1>LimboAI GitHub</l> page.
<22> In <l1>GitHub releases</l>, download the latest pre-compiled release build for your platform.
<23> Download the demo project archive from the same release.
<24> Extract the pre-compiled editor and the demo project files.
<25> Launch the pre-compiled editor binary, import and open the demo project.
<26> Run the project.
<27> <b>Important</b>: To export your game using the module version of LimboAI, make sure to use the pre-compiled export templates included in the same GitHub release build.
<28> Using LimboAI with C#
<29> Here’s how you can use the module version with C# to write your tasks and states.
<30> Locate LimboAI NuGet package files.
<31> Each provided build comes with a GodotSharp folder, which has packages under “GodotSharp/Tools/nupkgs/”. Note down the directory path; you’ll need it in the next step.
<32> Add a local source for NuGet packages using the following command:
<33> Your C# project should be able to see LimboAI classes and compile.
<34> Regarding GDExtension, I can only confirm success with the module version and C#. Unfortunately, I haven’t had any luck with the GDExtension version yet. If you’ve had success with GDExtension, please let me know via Discord or email.
<35> Contributing
<36> We target the latest stable version of the Godot Engine for development until a third beta or a release candidate of an upcoming Godot release becomes available. If you want to contribute to the project, please ensure that you are using the corresponding Godot version.
<37> We follow the <l1>Godot code style guidelines</l>. Please use <2/> to maintain consistent styling. You can install <3/> hooks for Git using <4/> to automate this process.
<38> Please keep the minor versions backward-compatible when submitting pull requests.
<39> We support building LimboAI as a module for the Godot Engine and as a GDExtension library. Make sure your contribution is compatible with both. Our CI workflow will verify that your changes can be compiled in both configurations.
<40> Compiling as module of the Godot Engine
<41> Clone the Godot Engine repository.
<42> Switch to the latest stable tag.
<43> Clone the LimboAI repository into the <1/> directory.
<44> Consult the <l1>Godot Engine documentation</l> for detailed instructions on building the engine.
<45> <b>Unit tests</b> can be compiled using the <1/> build option. To execute them, run the compiled Godot binary with the <2/> command-line options.
<46> Building C# Packages
<47> If you want C# Support for LimboAI when building from source, follow Godot’s instructions for building from source with C# Support: <l1>Compiling with .NET</l>. LimboAI’s classes will be included in the output from that build process.
<48> Compiling as GDExtension library
<49> You’ll need the SCons build tool and a C++ compiler. See also <l1>Compiling</l>. Run <2/> to build the plugin library for your current platform.
<50> SCons will automatically clone the <1/> repository if it doesn’t already exist in the <2/> directory.
<51> By default, built targets are placed in the demo project: <1/>.
<52> Check <1/> for other options and targets.
<53> Contributing to the documentation
<54> Online documentation is created using <l1>Sphinx</l>. Source files are located in the <2/> directory in RST format and can be built locally with <3/>. See the <l4>Sphinx documentation</l> for more details.
<55> Class documentation resides in XML files within the <1/> directory. If you create a new class or modify an existing one, you can run the compiled Godot binary with the <2/> option in the root of the Godot source code to generate the missing XML files or sections within those files in the class documentation. After editing the XML files, please run the compiled editor binary with the <3/> option again to update and tidy up the XML files.
<56> Sphinx RST files for the class documentation are generated from XML files using the Godot script <1/> and stored in the <2/> directory. This process is performed using our own script <3/>. RST files in <4/> should not be edited manually.
<57> Introduction to Behavior Trees
<58> <b>🛈 Note:</b> Demo project includes a tutorial that provides an introduction to behavior trees through illustrative examples.
<59> <b>Behavior Trees (BT)</b> are hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games.
<60> Behavior Trees are composed of tasks that represent specific actions or decision-making rules. Tasks can be broadly categorized into two main types: control tasks and leaf tasks. <b>Control tasks</b> determine the execution flow within the tree. They include <l1>Sequence</l>, <l2>Selector</l>, and <l3>Invert</l>. <b>Leaf tasks</b> represent specific actions to perform, like moving or attacking, or conditions that need to be checked. The <l4>BTTask</l> class provides the foundation for various building blocks of the Behavior Trees. Such tasks can <l5>share data using the Blackboard</l>.
<61> <b>🛈 Note:</b> To <l1>create your own actions</l>, extend the <l2>BTAction</l> class.
<62> A Behavior Tree is usually processed each frame. It is traversed from top to bottom, with the control tasks determining the control flow. Each task has a <l1>_tick</l> method, which performs the task’s work and returns a status indicating its progress: <2/>, <3/>, or <4/>. <5/> and <6/> indicate the outcome of finished work, while <7/> status is returned when a task requires more than one tick to complete its job. These statuses determine how the tree progresses, with the <8/> status usually meaning that the tree will continue execution during the next frame.
<63> There are <i>four types of tasks</i>:
<64> <b>Actions</b> are leaf tasks that perform the actual work.
<65> Examples: <l1>PlayAnimation</l>, <l2>Wait</l>.
<66> <b>Conditions</b> are leaf tasks that conduct various checks.
<67> Examples: <l1>CheckVar</l>, <l2>InRange</l>.
<68> <b>Composites</b> can have one or more child tasks, and dictate the execution flow of their children.
<69> Examples: <l1>Sequence</l>, <l2>Selector</l>, <l3>Parallel</l>.
<70> <b>Decorators</b> can only have a single child and they change how their child task operates.
<71> Examples: <l1>AlwaysSucceed</l>, <l2>Invert</l>, <l3>TimeLimit</l>.
<72> <l1>Sequence</l> is one of the core composite tasks. It executes its child tasks sequentially, from first to last, until one of them returns <2/>, or all of them result in <3/>. In other words, if any child task results in <4/>, the <l5>Sequence</l> execution will be aborted, and the <l6>Sequence</l> itself will return <7/>.
<73> <l1>Selector</l> is another essential composite task. It executes its child tasks sequentially, from first to last, until one of them returns <2/> or all of them result in <3/>. In other words, when a child task results in <4/>, it moves on to the next one until it finds the one that returns <5/>. Once a child task results in <6/>, the <l7>Selector</l> stops and also returns <8/>. The purpose of the <l9>Selector</l> is to find a child that succeeds.
<74> Behavior Trees handle conditional logic using <b>condition tasks</b>. These tasks check for specific conditions and return either <1/> or <2/> based on the state of the agent or its environment (e.g., “IsLowOnHealth”, “IsTargetInSight”). Conditions can be used together with <l3>Sequence</l> and <l4>Selector</l> to craft your decision-making logic.
<75> <b>🛈 Note:</b> To <l1>create your own conditions</l>, extend the <l2>BTCondition</l> class.
<76> Check out the <l1>BTTask</l> class documentation, which provides the foundation for various building blocks of Behavior Trees.
<77> Creating Behavior Trees
<78> This chapter describes how to create and debug behavior trees.
<79> Add a Behavior Tree to an agent
<80> Follow these steps to add a behavior tree to a new or existing agent:
<81> Make a scene file for your agent, or open an existing scene.
<82> Add a <l1>BTPlayer</l> node to your scene.
<83> Select <l1>BTPlayer</l>, and create a new behavior tree in the inspector.
<84> Optionally, you can save the behavior tree to a file using the property’s context menu.
<85> Click the behavior tree property to open it in the LimboAI editor.
<86> Debugging Behavior Trees
<87> In Godot Engine, follow to “Bottom Panel > Debugger > LimboAI” tab. With the LimboAI debugger, you can inspect any currently active behavior tree within the running project. The debugger can be detached from the main editor window, which can be particularly useful if you have a HiDPI or a secondary display.
@@ -0,0 +1,92 @@
<88> Inspecting task properties and blackboard
<89> When you click on a task in the LimboAI debugger, its properties are shown in the remote Inspector panel, including the <l1>Blackboard</l> reference. Click the <l2>Blackboard</l> to open it and view all variables across the full scope chain, grouped by scope. You can also edit variable values live, which can be useful for testing and debugging your game’s AI.
<90> Creating custom tasks
<91> By default, user tasks should be placed in the <1/> directory. You can set an alternative location for user tasks in the <2/> (To see those options, <3/> should be enabled in the Project Settings).
<92> Each subdirectory within the user tasks directory is treated as a category. Therefore, if you create a subdirectory named “motion_and_physics,” your custom tasks in that directory will automatically be categorized under “Motion And Physics.”
<93> When creating custom tasks, <b>extend one of the following</b> base classes: <l1>BTAction</l>, <l2>BTCondition</l>, <l3>BTDecorator</l>, <l4>BTComposite</l>. More on task types you can read in the <l5>Introduction to Behavior Trees</l>.
<94> <b>🛈 Note:</b> To help you write new tasks, you can add a script template to your project using “Misc → Create script template” menu option.
<95> Using the <l1>Blackboard</l> is covered in <l2>Accessing the Blackboard in a Task</l>.
<96> Task anatomy
<97> Example 1: A simple action
<98> Example 2: InRange condition
<99> Creating tasks in C#
<100> You can use the following script template for custom tasks:
<101> Sharing data using Blackboard
<102> To share data between different tasks and states, we employ a feature known as the <l1>Blackboard</l>. The <l2>Blackboard</l> serves as a central repository where tasks and states can store and retrieve named variables, allowing for seamless data interchange. Each instance of a behavior tree or a state machine gets its own dedicated <l3>Blackboard</l>. It has the capability to store various data types, including objects and resources.
<103> Using the <l1>Blackboard</l>, you can easily share data in your behavior trees, making the tasks in the behavior tree more flexible.
<104> Accessing the Blackboard in a Task
<105> Every <l1>BTTask</l> has access to the <l2>Blackboard</l>, providing a straightforward mechanism for data exchange. Here’s an example of how you can interact with the <l3>Blackboard</l> in GDScript:
<106> If you are accessing a variable that holds an object instance, and it is expected that the instance may be null or freed, you can do it like this:
<107> It is recommended to suffix variable name properties with <1/>, like in the example above, which enables the inspector to provide a more convenient property editor for the variable. This editor allows you to select or add the variable to the blackboard plan, and provides a warning icon if the variable does not exist in the blackboard plan.
<108> <b>🛈 Note:</b> The variable doesn’t need to exist when you set it in code.
<109> Editing the Blackboard Plan
<110> The Blackboard Plan, associated with each <l1>BehaviorTree</l> resource, dictates how the <l2>Blackboard</l> initializes for each new instance of the <l3>BehaviorTree</l>. BlackboardPlan resource stores default values, type information, and data bindings necessary for <l4>BehaviorTree</l> initialization.
<111> To add, modify, or remove variables from the Blackboard Plan, follow these steps:
<112> Open the LimboAI editor and load the behavior tree you want to edit.
<113> In the editor, click on the small button located inside the tab. This will open the <l1>BlackboardPlan</l> in the Inspector.
<114> In the Inspector, click the “Manage…” button to show the blackboard plan editor.
<115> In the blackboard plan editor, you can add, remove, or reorder variables, and modify their data type and hint.
<116> The hint provides additional information about the variable to the Inspector, such as minimum and maximum values for an integer variable. Learn more about <l1>property hints in the official Godot documentation</l>.
<117> You can specify the default values of the variables directly in the Inspector.
<118> Overriding variables in BTPlayer
<119> Each <l1>BTPlayer</l> node also has a “Blackboard Plan” property, providing the ability to override values of the BehaviorTree’s blackboard variables. These overrides are specific to the BTPlayer’s scene and do not impact other scenes using the same <l2>BehaviorTree</l>. To modify these values:
<120> Select the BTPlayer node in the scene tree.
<121> In the Inspector, locate the “Blackboard Plan” property.
<122> Override the desired values to tailor the blackboard variables for the specific scene.
<123> Task parameters
<124> In some cases, it can be beneficial to allow behavior tree tasks to export parameters that can either be <b>bound to a blackboard variable or specified directly</b> by the user. For this purpose, LimboAI provides special parameter types that begin with “BB”, such as <l1>BBInt</l>, <l2>BBBool</l>, <l3>BBString</l>, <l4>BBFloat</l>, <l5>BBNode</l>, and more. For a complete list, please refer to the <l6>BBParam</l> class reference.
<125> Usage example:
<126> Connecting variables in BTs to HSMs: Variable mapping
<127> Each <l1>BTState</l> creates a new blackboard scope for its BehaviorTree instance. Because BehaviorTrees are reusable resources that can run in different contexts or on different agents, they do not automatically see variables defined in the HSM. At runtime, HSM variables are usually accessible inside the BT via the parent scope blackboard, but the recommended way to access them is through <b>mapping</b>.
<128> Note
<129> To learn more about scopes, see <l1>Blackboard</l>.
<130> When both the BehaviorTree and the HSM declare variables in their respective <l1>BlackboardPlan</l> resources, the editor provides a <b>Mapping</b> section in the BlackboardPlan inspector. Mapping is the intended and recommended way to connect variables between related plans.
<131> Key points about mapping
<132> Mapping connects two variables so they behave as a single logical variable at runtime.
<133> Linked variables are updated immediately in both scopes — they literally share the same state in memory (no polling or copying).
<134> Mapping is explicit: you decide which variables the BT exposes as inputs and outputs.
<135> Linkage is bidirectional — there is no distinction between input and output.
<136> Mapping does not create new variables automatically — the variables must already exist in both blackboard plans before they can be linked.
<137> Inspector workflow
<138> Define the required variables in each BlackboardPlan (HSM plan and BT plan, for example).
<139> Select the <l1>BTState</l> node in the scene or a <l2>BTSubtree</l> inside a behavior tree.
<140> In the Inspector, select the Blackboard Plan property.
<141> In the BlackboardPlan resource inspector, locate the <b>Mapping</b> section.
<142> Create mappings by pairing variables (<1/>).
<143> On startup the mappings are applied, and the variables are automatically linked for the running instance.
<144> Programmatic alternative: linking variables in code
<145> You can also link variables directly in code using <l1>Blackboard.link_var</l>:
<146> Best practices
<147> Declare all BT dependencies in the BT’s BlackboardPlan instead of relying on parent scopes.
<148> Use <b>Mapping</b> to explicitly declare which variables should be shared with the HSM.
<149> Prefer the inspector-based Mapping workflow for clarity and editor support; use <1/> only when runtime or programmatic setup is required.
<150> Avoid writing to <1/> from inside BT tasks unless you have a very specific reason and accept the coupling it introduces.
<151> Advanced topic: Blackboard scopes
<152> The <l1>Blackboard</l> in LimboAI can act as a parent scope for another <l2>Blackboard</l>. This means that if a specific variable is not found in the active scope, the system will look in the parent <l3>Blackboard</l> to find it. This creates a “blackboard scope chain,” where each <l4>Blackboard</l> can have its own parent scope, and there is no limit to how many blackboards can be in this chain. It’s important to note that the <l5>Blackboard</l> doesn’t modify values in the parent scopes.
<153> Scopes are created automatically to prevent naming collisions between contextually separate environments:
<154> Within <l1>BTNewScope</l>.
<155> Under <l1>BTSubtree</l> decorators.
<156> With <l1>LimboState</l> that have a non-empty blackboard plan defined.
<157> Under <l1>LimboHSM</l> nodes: A new scope is created at the root level, and each <l2>BTState</l> child also receives its own separate scope.
<158> Sharing data between several agents
<159> The blackboard scope mechanism can also be used for sharing data between several agents. In the following example, we have a group of agents, and we want to share a common target between them:
<160> In this example, <l1>blackboard.top()</l> accesses the root scope of the <l2>Blackboard</l> chain. We assign that scope to each agent in a group through code:
<161> In conclusion, the <l1>Blackboard</l> scope chain not only prevents naming conflicts that can occur between state machines, behavior trees, and sub-trees, but it can also be used to share data between several agents.
<162> Debugging blackboard variables
<163> When debugging a running project, you can inspect <l1>Blackboard</l> variables in the remote Inspector. Click on a task in the LimboAI debugger to view its properties, then click the <l2>Blackboard</l> reference to see all variables across the full scope chain, grouped by scope. Variables can be edited live to aid in debugging. For state machines, select a <l3>LimboState</l> node in the Remote Scene Tree to access its <l4>Blackboard</l> in the same way.
<164> Accessing nodes in the scene tree
<165> There are several ways to access nodes in the agent’s scene tree from a <l1>BTTask</l>.
<166> <b>🛈 Note:</b> The root node of the agent’s scene tree can be accessed with the <l1>scene_root</l> property.
<167> With <1/> property
<168> With <1/> property
<169> Using blackboard plan
<170> You can <l1>create a blackboard variable</l> in the editor with the type <2/> and point it to the proper node in the <l3>BTPlayer</l> blackboard plan. By default, any <4/> variable will be replaced with the node instance when the blackboard is instantiated at runtime (see <l5>BlackboardPlan.prefetch_nodepath_vars</l>).
<171> The property BTPlayer.prefetch_nodepath_vars should be set to <1/>.
<172> Create State Machines
<173> This guide will show how to set up and use a state machine using <l1>LimboHSM</l>.
<174> Initialization
<175> To use the <l1>LimboHSM</l> state machine, you first need to initialize it in your code. This is typically done in the <2/> function of your script. Here’s an example of how to do this:
<176> In this example, we first declare the state machine and the states we want to use. Then, in the <1/> function, we add transitions between the states. Finally, we initialize the state machine and set it to active.
<177> State example
<178> You can define the behavior of a state in a script and attach it to the state node. Here’s an example of a state that plays an animation on an <1/> and waits for it to finish:
<179> In this example, the <1/> method is called when the state is entered, and it plays the specified animation. The <2/> method is called every frame, and it checks if the animation is finished. If it is, it dispatches the <3/> event, which can result in a transition to the next state.
@@ -0,0 +1,142 @@
<180> Events and transitions
<181> The <l1>LimboHSM</l> comes with an <b>event system</b> that helps to <b>decouple transitions</b> from the state implementations. A transition is associated with a specific event, a starting state, and a destination state, and it is performed automatically when such an event is dispatched.
<182> To register a transition and associate it with a specific event, you can use the <l1>LimboHSM.add_transition</l> method:
<183> In this example, we’re registering a transition from the <1/> to the <2/> when the <3/> event is dispatched.
<184> A transition can be also associated with no particular starting state:
<185> <b>Events are dispatched</b> with the <l1>LimboState.dispatch</l> method. It’s important to note that this method can be called from anywhere in the state machine hierarchy and outside of it. Events are <b>propagated from the leaf to the root</b> state. This means that if an event is consumed by a state, it won’t be propagated to its parent states.
<186> States can also define <b>event handlers</b>, which are methods that react to specific events. These event handlers typically don’t result in a state transition; they are simply a mechanism for states to react to particular events. You can use the <l1>LimboState.add_event_handler</l> method to register event handlers in your states:
<187> If the event handler returns <1/>, the event will be considered as consumed, and it won’t propagate further or result in a state transition.
<188> State anatomy
<189> Using behavior trees with state machines
<190> The <l1>BTState</l> is a specialized state node in <l2>LimboHSM</l> that can host a behavior tree. When a <l3>BTState</l> is active, it executes the hosted behavior tree each frame, effectively using the behavior tree as its implementation.
<191> This allows you to combine the power of behavior trees with the structure and control of state machines. Behavior trees are excellent for defining complex, hierarchical behaviors, while state machines are great for managing the flow and transitions between different behaviors.
<192> Once the <l1>LimboHSM</l> has been created, a <l2>BTState</l> can be created for a given <l3>LimboHSM</l>:
<193> Single-file state machine setup
<194> In certain scenarios, such as prototyping or during game jams, it’s practical to keep the state machine code in a single file. For such cases, <l1>LimboHSM</l> <b>supports delegation</b> and provides <b>chained methods</b> for easier setup. Let’s illustrate this with a practical code example:
<195> Important classes
<196> There are a lot of classes introduced in LimboAI. Here is a list of the most important ones you should know about:
<197> BTTask
<198> <b>Inherits:</b> <l1>BT</l>
<199> <b>Inherited By:</b> <l1>BTAction</l>, <l2>BTComment</l>, <l3>BTComposite</l>, <l4>BTCondition</l>, <l5>BTDecorator</l>
<200> Base class for all <l1>BehaviorTree</l> tasks.
<201> Description
<202> Base class for all <l1>BehaviorTree</l> tasks. A task is a basic building block in a <l2>BehaviorTree</l> that represents a specific behavior or control flow. Tasks are used to create complex behaviors by combining and nesting them in a hierarchy.
<203> A task can be one of the following types: action, condition, composite, or decorator. Each type of task has its own corresponding subclass: <l1>BTAction</l>, <l2>BTCondition</l>, <l3>BTDecorator</l>, <l4>BTComposite</l>.
<204> Tasks perform their work and return their status using the <l1>_tick</l> method. Status values are defined in <l2>Status</l>. Tasks can be initialized using the <l3>_setup</l> method. See also <l4>_enter</l> & <l5>_exit</l>.
<205> <b>Note:</b> Do not extend <b>BTTask</b> directly for your own tasks. Instead, extend one of the subtypes mentioned above.
<206> Properties
<207> <l1>agent</l>
<208> <l1>Blackboard</l>
<209> <l1>blackboard</l>
<210> <l1>custom_name</l>
<211> <l1>elapsed_time</l>
<212> <l1>scene_root</l>
<213> <l1>Status</l>
<214> <l1>status</l>
<215> Methods
<216> <l1>_enter</l>() <2/>
<217> <l1>_exit</l>() <2/>
<218> <l1>_generate_name</l>() <2/> <3/>
<219> <l1>_get_configuration_warnings</l>() <2/> <3/>
<220> <l1>_setup</l>() <2/>
<221> <l1>_tick</l>(delta: <2/>) <3/>
<222> <l1>abort</l>()
<223> <l1>add_child</l>(task: <l2>BTTask</l>)
<224> <l1>add_child_at_index</l>(task: <l2>BTTask</l>, idx: <3/>)
<225> <l1>BTTask</l>
<226> <l1>clone</l>() <2/>
<227> <l1>BehaviorTree</l>
<228> <l1>editor_get_behavior_tree</l>()
<229> <l1>execute</l>(delta: <2/>)
<230> <l1>get_child</l>(idx: <2/>) <3/>
<231> <l1>get_child_count</l>() <2/>
<232> <l1>get_child_count_excluding_comments</l>() <2/>
<233> <l1>get_index</l>() <2/>
<234> <l1>get_parent</l>() <2/>
<235> <l1>get_root</l>() <2/>
<236> <l1>get_task_name</l>()
<237> <l1>has_child</l>(task: <l2>BTTask</l>) <3/>
<238> <l1>initialize</l>(agent: <2/>, blackboard: <l3>Blackboard</l>, scene_root: <4/>)
<239> <l1>is_descendant_of</l>(task: <l2>BTTask</l>) <3/>
<240> <l1>is_root</l>() <2/>
<241> <l1>next_sibling</l>() <2/>
<242> <l1>print_tree</l>(initial_tabs: <2/> = 0)
<243> <l1>remove_child</l>(task: <l2>BTTask</l>)
<244> <l1>remove_child_at_index</l>(idx: <2/>)
<245> Property Descriptions
<246> <1/> <b>agent</b> <l2>🔗</l>
<247> <1/> <b>set_agent</b>(value: <2/>)
<248> <1/> <b>get_agent</b>()
<249> The agent is the contextual object for the <l1>BehaviorTree</l> instance. This is usually the parent of the <l2>BTPlayer</l> node that utilizes the <l3>BehaviorTree</l> resource.
<250> <l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>
<251> <l1>Blackboard</l> <b>get_blackboard</b>()
<252> Provides access to the <l1>Blackboard</l>. Blackboard is used to share data among tasks of the associated <l2>BehaviorTree</l>.
<253> See <l1>Blackboard</l> for additional info.
<254> <1/> <b>custom_name</b> = <2/> <l3>🔗</l>
<255> <1/> <b>set_custom_name</b>(value: <2/>)
<256> <1/> <b>get_custom_name</b>()
<257> User-provided name for the task. If not empty, it is used by the editor to represent the task. See <l1>get_task_name</l>.
<258> <1/> <b>elapsed_time</b> <l2>🔗</l>
<259> <1/> <b>get_elapsed_time</b>()
<260> Elapsed time since the task was “entered”. See <l1>_enter</l>.
<261> Returns <1/> when task is not <2/>.
<262> <1/> <b>scene_root</b> <l2>🔗</l>
<263> <1/> <b>get_scene_root</b>()
<264> Root node of the scene the behavior tree is used in (e.g., the owner of the <l1>BTPlayer</l> node). Can be uses to retrieve <2/> references.
<265> <b>Example:</b>
<266> <l1>Status</l> <b>status</b> <l2>🔗</l>
<267> <l1>Status</l> <b>get_status</b>()
<268> Last execution <l1>Status</l> returned by <l2>_tick</l>.
<269> Method Descriptions
<270> <1/> <b>_enter</b>() <2/> <l3>🔗</l>
<271> Called when task is “entered”, i.e. when task is executed while not having a <1/> <l2>status</l>.
<272> It is called before <l1>_tick</l> in the execution order. This method is used when preparation is needed before main work begins, usually when it takes more than one tick to finish the task. See also <l2>execute</l>.
<273> <1/> <b>_exit</b>() <2/> <l3>🔗</l>
<274> Called when task is “exited”, i.e. after <l1>_tick</l> returns <2/> or <3/> status. See also <l4>execute</l>.
<275> <1/> <b>_generate_name</b>() <2/> <3/> <l4>🔗</l>
<276> Called to generate a display name for the task unless <l1>custom_name</l> is set. See <l2>get_task_name</l>.
<277> <1/> <b>_get_configuration_warnings</b>() <2/> <3/> <l4>🔗</l>
<278> The string returned by this method is shown as a warning message in the behavior tree editor. Any task script that overrides this method must include <1/> annotation at the top of the file.
<279> <1/> <b>_setup</b>() <2/> <l3>🔗</l>
<280> Called to initialize a task during initialization step. It is called only once before the task’s first execution tick. This method allows you to set up any necessary state or configurations for the task before it begins executing.
<281> <l1>Status</l> <b>_tick</b>(delta: <2/>) <3/> <l4>🔗</l>
<282> Called when task is “ticked”, i.e. executed by <l1>BTPlayer</l> or <l2>BTState</l> during an update.
<283> Returns execution status as defined in <l1>Status</l>.
<284> <b>Note:</b> Tasks perform their main function by implementing this method.
<285> <1/> <b>abort</b>() <l2>🔗</l>
<286> Resets the task and its children recursively. If a task is in the <1/> state, it is exited and its status is reset to <2/>.
<287> <1/> <b>add_child</b>(task: <l2>BTTask</l>) <l3>🔗</l>
<288> Adds a child task. The <1/> is placed at the end of the children list.
<289> <1/> <b>add_child_at_index</b>(task: <l2>BTTask</l>, idx: <3/>) <l4>🔗</l>
<290> Adds a child task. The <1/> is placed at <2/> position in the children list.
<291> <l1>BTTask</l> <b>clone</b>() <2/> <l3>🔗</l>
<292> Duplicates the task and its children, copying the exported members. Sub-resources are shared for efficiency, except for <l1>BBParam</l> subtypes, which are always copied. Used by the editor to instantiate <l2>BehaviorTree</l> and copy-paste tasks.
<293> <l1>BehaviorTree</l> <b>editor_get_behavior_tree</b>() <l2>🔗</l>
<294> Returns the behavior tree that owns this task. This is only available in the editor.
<295> <l1>Status</l> <b>execute</b>(delta: <2/>) <l3>🔗</l>
<296> Performs task’s execution. The execution follows a specific sequence:
<297> If task’s current <l1>status</l> is not <2/>, the <l3>_enter</l> method is called first.
<298> Next, the <l1>_tick</l> method is called next to perform the task’s work.
<299> If the <l1>_tick</l> method returns <2/> or <3/> status, the <l4>_exit</l> method will be called next as part of the execution cleanup.
<300> <l1>BTTask</l> <b>get_child</b>(idx: <2/>) <3/> <l4>🔗</l>
<301> Returns a child task by specifying its index.
<302> <1/> <b>get_child_count</b>() <2/> <l3>🔗</l>
<303> Returns the number of child tasks.
<304> <1/> <b>get_child_count_excluding_comments</b>() <2/> <l3>🔗</l>
<305> Returns the number of child tasks not counting <l1>BTComment</l> tasks.
<306> <1/> <b>get_index</b>() <2/> <l3>🔗</l>
<307> Returns the task’s position in the behavior tree branch. Returns <1/> if the task doesn’t belong to a task tree, i.e. doesn’t have a parent.
<308> <l1>BTTask</l> <b>get_parent</b>() <2/> <l3>🔗</l>
<309> Returns the task’s parent.
<310> <l1>BTTask</l> <b>get_root</b>() <2/> <l3>🔗</l>
<311> Returns the root task of the behavior tree.
<312> <1/> <b>get_task_name</b>() <l2>🔗</l>
<313> The string returned by this method is used to represent the task in the editor.
<314> Method <l1>_generate_name</l> is called to generate a display name for the task unless <l2>custom_name</l> is set.
<315> <1/> <b>has_child</b>(task: <l2>BTTask</l>) <3/> <l4>🔗</l>
<316> Returns <1/> if <2/> is a child of this task.
<317> <1/> <b>initialize</b>(agent: <2/>, blackboard: <l3>Blackboard</l>, scene_root: <4/>) <l5>🔗</l>
<318> Initilizes the task. Assigns <l1>agent</l> and <l2>blackboard</l>, and calls <l3>_setup</l> for the task and its children.
<319> The method is called recursively for each child task. <1/> should be the root node of the scene the behavior tree is used in (e.g., the owner of the node that contains the behavior tree).
<320> <1/> <b>is_descendant_of</b>(task: <l2>BTTask</l>) <3/> <l4>🔗</l>
<321> Returns <1/> if this task is a descendant of <2/>. In other words, this task must be a child of <3/> or one of its children or grandchildren.
@@ -0,0 +1,138 @@
<322> <1/> <b>is_root</b>() <2/> <l3>🔗</l>
<323> Returns <1/> if this task is the root task of its behavior tree. A behavior tree can have only one root task.
<324> <l1>BTTask</l> <b>next_sibling</b>() <2/> <l3>🔗</l>
<325> Returns the next task after this task in the parent’s children list.
<326> Returns <1/> if this task has no parent or it is the last child in the parent’s children list.
<327> <1/> <b>print_tree</b>(initial_tabs: <2/> = 0) <l3>🔗</l>
<328> Prints the subtree that starts with this task to the console.
<329> <1/> <b>remove_child</b>(task: <l2>BTTask</l>) <l3>🔗</l>
<330> Removes <1/> from children.
<331> <1/> <b>remove_child_at_index</b>(idx: <2/>) <l3>🔗</l>
<332> Removes a child task at a specified index from children.
<333> BTPlayer
<334> <b>Inherits:</b>
<335> Player of <l1>BehaviorTree</l> resources.
<336> <b>BTPlayer</b> node is used to instantiate and play <l1>BehaviorTree</l> resources at runtime. During initialization, the behavior tree instance is given references to the agent, the <l2>blackboard</l>, and the current scene root. The agent can be specified by the <l3>agent_node</l> property (defaults to the BTPlayer’s parent node).
<337> For an introduction to behavior trees, see <l1>BehaviorTree</l>.
<338> <l1>active</l>
<339> <l1>agent_node</l>
<340> <l1>behavior_tree</l>
<341> <l1>blackboard</l>
<342> <l1>BlackboardPlan</l>
<343> <l1>blackboard_plan</l>
<344> <l1>monitor_performance</l>
<345> <l1>UpdateMode</l>
<346> <l1>update_mode</l>
<347> <l1>BTInstance</l>
<348> <l1>get_bt_instance</l>()
<349> <l1>restart</l>()
<350> <l1>set_bt_instance</l>(bt_instance: <l2>BTInstance</l>)
<351> <l1>set_scene_root_hint</l>(scene_root: <2/>)
<352> <l1>update</l>(delta: <2/>)
<353> Signals
<354> <b>behavior_tree_finished</b>(status: <1/>) <l2>🔗</l>
<355> <b>Deprecated:</b> Use <l1>updated</l> signal instead.
<356> Emitted when the behavior tree has finished executing and returned <1/> or <2/>.
<357> Argument <1/> holds the status returned by the behavior tree. See <l2>Status</l>.
<358> <b>updated</b>(status: <1/>) <l2>🔗</l>
<359> Emitted when BTPlayer has finished the behavior tree update.
<360> Enumerations
<361> enum <b>UpdateMode</b>: <l1>🔗</l>
<362> <l1>UpdateMode</l> <b>IDLE</b> = <2/>
<363> Execute behavior tree during the idle process.
<364> <l1>UpdateMode</l> <b>PHYSICS</b> = <2/>
<365> Execute behavior tree during the physics process.
<366> <l1>UpdateMode</l> <b>MANUAL</b> = <2/>
<367> Behavior tree is executed manually by calling <l1>update</l>.
<368> <1/> <b>active</b> = <2/> <l3>🔗</l>
<369> <1/> <b>set_active</b>(value: <2/>)
<370> <1/> <b>get_active</b>()
<371> If <1/>, the behavior tree will be executed during update.
<372> <1/> <b>agent_node</b> = <2/> <l3>🔗</l>
<373> <1/> <b>set_agent_node</b>(value: <2/>)
<374> <1/> <b>get_agent_node</b>()
<375> Path to the node that will be used as the agent. Setting it after instantiation will have no effect.
<376> <l1>BehaviorTree</l> <b>behavior_tree</b> <l2>🔗</l>
<377> <1/> <b>set_behavior_tree</b>(value: <l2>BehaviorTree</l>)
<378> <l1>BehaviorTree</l> <b>get_behavior_tree</b>()
<379> <l1>BehaviorTree</l> resource to instantiate and execute at runtime.
<380> <l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>
<381> <1/> <b>set_blackboard</b>(value: <l2>Blackboard</l>)
<382> Holds data shared by the behavior tree tasks. See <l1>Blackboard</l>.
<383> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
<384> <1/> <b>set_blackboard_plan</b>(value: <l2>BlackboardPlan</l>)
<385> <l1>BlackboardPlan</l> <b>get_blackboard_plan</b>()
<386> Stores and manages variables that will be used in constructing new <l1>Blackboard</l> instances.
<387> <1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>
<388> <1/> <b>set_monitor_performance</b>(value: <2/>)
<389> <1/> <b>get_monitor_performance</b>()
<390> If <1/>, adds a performance monitor to “Debugger->Monitors” for each instance of this <b>BTPlayer</b> node.
<391> <l1>UpdateMode</l> <b>update_mode</b> = <2/> <l3>🔗</l>
<392> <1/> <b>set_update_mode</b>(value: <l2>UpdateMode</l>)
<393> <l1>UpdateMode</l> <b>get_update_mode</b>()
<394> Determines when the behavior tree is executed. See <l1>UpdateMode</l>.
<395> <l1>BTInstance</l> <b>get_bt_instance</b>() <l2>🔗</l>
<396> Returns the behavior tree instance.
<397> <1/> <b>restart</b>() <l2>🔗</l>
<398> Resets the behavior tree’s execution. Each running task will be aborted and the next tree execution will start anew. This method does not reset <l1>Blackboard</l>.
<399> <1/> <b>set_bt_instance</b>(bt_instance: <l2>BTInstance</l>) <l3>🔗</l>
<400> Sets the <l1>BTInstance</l> to play. This method is useful when you want to switch to a different behavior tree instance at runtime. See also <l2>BehaviorTree.instantiate</l>.
<401> <1/> <b>set_scene_root_hint</b>(scene_root: <2/>) <l3>🔗</l>
<402> Sets the <1/> that will be used as the scene root for the newly instantiated behavior tree. Should be called before the <b>BTPlayer</b> is added to the scene tree (before <2/>). This is typically useful when creating <b>BTPlayer</b> nodes dynamically from code.
<403> <1/> <b>update</b>(delta: <2/>) <l3>🔗</l>
<404> Executes the root task of the behavior tree instance if <l1>active</l> is <2/>. Call this method when <l3>update_mode</l> is set to <l4>MANUAL</l>. When <l5>update_mode</l> is not <l6>MANUAL</l>, the <l7>update</l> will be called automatically. See <l8>UpdateMode</l>.
<405> Blackboard
<406> A key/value storage for sharing among <l1>LimboHSM</l> states and <l2>BehaviorTree</l> tasks.
<407> Blackboard is where data is stored and shared between states in the <l1>LimboHSM</l> system and tasks in a <l2>BehaviorTree</l>. Each state and task in the <l3>BehaviorTree</l> can access this Blackboard, allowing them to read and write data. This makes it easy to share information between different actions and behaviors.
<408> Blackboard can also act as a parent scope for another Blackboard. If a specific variable is not found in the active scope, it looks in the parent Blackboard to find it. A parent Blackboard can itself have its own parent scope, forming what we call a “blackboard scope chain.” Importantly, there is no limit to how many Blackboards can be in this chain, and the Blackboard doesn’t modify values in the parent scopes.
<409> New scopes can be created using the <l1>BTNewScope</l> and <l2>BTSubtree</l> decorators. Additionally, a new scope is automatically created for any <l3>LimboState</l> that has defined non-empty Blackboard data or for any root-level <l4>LimboHSM</l> node.
<410> <l1>bind_var_to_property</l>(var_name: <2/>, object: <3/>, property: <4/>, create: <5/> = false)
<411> <l1>clear</l>()
<412> <l1>erase_var</l>(var_name: <2/>)
<413> <l1>Blackboard</l>
<414> <l1>get_parent</l>() <2/>
<415> <l1>get_var</l>(var_name: <2/>, default: <3/> = null, complain: <4/> = true) <5/>
<416> <l1>get_vars_as_dict</l>() <2/>
<417> <l1>has_var</l>(var_name: <2/>) <3/>
<418> <l1>link_var</l>(var_name: <2/>, target_blackboard: <l3>Blackboard</l>, target_var: <4/>, create: <5/> = false)
<419> Array[<1/>]
<420> <l1>list_vars</l>() <2/>
<421> <l1>populate_from_dict</l>(dictionary: <2/>)
<422> <l1>print_state</l>() <2/>
<423> <l1>set_parent</l>(blackboard: <l2>Blackboard</l>)
<424> <l1>set_var</l>(var_name: <2/>, value: <3/>)
<425> <l1>top</l>() <2/>
<426> <l1>unbind_var</l>(var_name: <2/>)
<427> <1/> <b>bind_var_to_property</b>(var_name: <2/>, object: <3/>, property: <4/>, create: <5/> = false) <l6>🔗</l>
<428> Establish a binding between a variable and the object’s property specified by <1/> and <2/>. Changes to the variable update the property, and vice versa. If <3/> is <4/>, the variable will be created if it doesn’t exist.
<429> <1/> <b>clear</b>() <l2>🔗</l>
<430> Removes all variables from the Blackboard. Parent scopes are not affected.
<431> <1/> <b>erase_var</b>(var_name: <2/>) <l3>🔗</l>
<432> Removes a variable by its name.
<433> <l1>Blackboard</l> <b>get_parent</b>() <2/> <l3>🔗</l>
<434> Returns a Blackboard that serves as the parent scope for this instance.
<435> <1/> <b>get_var</b>(var_name: <2/>, default: <3/> = null, complain: <4/> = true) <5/> <l6>🔗</l>
<436> Returns variable value or <1/> if variable doesn’t exist. If <2/> is <3/>, an error will be printed if variable doesn’t exist. If the variable doesn’t exist in the current <b>Blackboard</b> scope, it will look in the parent scope <b>Blackboard</b> to find it.
<437> <1/> <b>get_vars_as_dict</b>() <2/> <l3>🔗</l>
<438> Returns all variables in the Blackboard as a dictionary. Keys are the variable names, values are the variable values. Parent scopes are not included.
<439> <1/> <b>has_var</b>(var_name: <2/>) <3/> <l4>🔗</l>
<440> Returns <1/> if the Blackboard contains the <2/> variable, including the parent scopes.
<441> <1/> <b>link_var</b>(var_name: <2/>, target_blackboard: <l3>Blackboard</l>, target_var: <4/>, create: <5/> = false) <l6>🔗</l>
<442> Links a variable to another Blackboard variable. If a variable is linked to another variable, their state will always be identical, and any change to one will be reflected in the other. If <1/> is <2/>, the variable will be created if it doesn’t exist.
<443> You can use this method to link a variable in the current scope to a variable in another scope, or in another Blackboard instance. A variable can only be linked to one other variable. Calling this method again will overwrite the previous link. However, it is possible to link to the same variable from multiple different variables.
<444> Array[<1/>] <b>list_vars</b>() <2/> <l3>🔗</l>
<445> Returns all variable names in the Blackboard. Parent scopes are not included.
<446> <1/> <b>populate_from_dict</b>(dictionary: <2/>) <l3>🔗</l>
<447> Fills the Blackboard with multiple variables from a dictionary. The dictionary keys must be variable names and the dictionary values must be variable values. Keys must be StringName or String.
<448> <1/> <b>print_state</b>() <2/> <l3>🔗</l>
<449> Prints the values of all variables in each scope.
<450> <1/> <b>set_parent</b>(blackboard: <l2>Blackboard</l>) <l3>🔗</l>
<451> Assigns the parent scope. If a value isn’t in the current Blackboard scope, it will look in the parent scope Blackboard to find it.
<452> <1/> <b>set_var</b>(var_name: <2/>, value: <3/>) <l4>🔗</l>
<453> Assigns a value to a variable in the current Blackboard scope. If the variable doesn’t exist, it will be created. If the variable already exists in the parent scope, the parent scope value will NOT be changed.
<454> <l1>Blackboard</l> <b>top</b>() <2/> <l3>🔗</l>
<455> Returns the topmost <b>Blackboard</b> in the scope chain.
<456> <1/> <b>unbind_var</b>(var_name: <2/>) <l3>🔗</l>
<457> Remove binding from a variable.
<458> BBParam
<459> <b>Inherited By:</b> <l1>BBAabb</l>, <l2>BBArray</l>, <l3>BBBasis</l>, <l4>BBBool</l>, <l5>BBByteArray</l>, <l6>BBColor</l>, <l7>BBColorArray</l>, <l8>BBDictionary</l>, <l9>BBFloat</l>, <l10>BBFloat32Array</l>, <l11>BBFloat64Array</l>, <l12>BBInt</l>, <l13>BBInt32Array</l>, <l14>BBInt64Array</l>, <l15>BBNode</l>, <l16>BBPlane</l>, <l17>BBProjection</l>, <l18>BBQuaternion</l>, <l19>BBRect2</l>, <l20>BBRect2i</l>, <l21>BBString</l>, <l22>BBStringArray</l>, <l23>BBStringName</l>, <l24>BBTransform2D</l>, <l25>BBTransform3D</l>, <l26>BBVariant</l>, <l27>BBVector2</l>, <l28>BBVector2Array</l>, <l29>BBVector2i</l>, <l30>BBVector3</l>, <l31>BBVector3Array</l>, <l32>BBVector3i</l>, <l33>BBVector4</l>, <l34>BBVector4i</l>
@@ -0,0 +1,163 @@
<460> A base class for LimboAI typed parameters.
<461> A base class for LimboAI typed parameters, with the ability to reference a <l1>Blackboard</l> variable or hold a raw value of a specific Variant.Type.
<462> <b>Note</b>: Don’t instantiate. Use specific subtypes instead.
<463> <l1>saved_value</l>
<464> <l1>ValueSource</l>
<465> <l1>value_source</l>
<466> <l1>variable</l>
<467> Variant.Type
<468> <l1>get_type</l>() <2/>
<469> <l1>get_value</l>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null)
<470> enum <b>ValueSource</b>: <l1>🔗</l>
<471> <l1>ValueSource</l> <b>SAVED_VALUE</b> = <2/>
<472> The value is stored directly within the BBParam resource.
<473> <l1>ValueSource</l> <b>BLACKBOARD_VAR</b> = <2/>
<474> The value is referenced by a variable name and retrieved from the <l1>Blackboard</l>. The variable name is stored within the BBParam resource.
<475> <1/> <b>saved_value</b> = <2/> <l3>🔗</l>
<476> <1/> <b>set_saved_value</b>(value: <2/>)
<477> <1/> <b>get_saved_value</b>()
<478> Stores the parameter value when <l1>value_source</l> is set to <l2>SAVED_VALUE</l>. The data type of the value is determined by <l3>get_type</l>.
<479> <l1>ValueSource</l> <b>value_source</b> = <2/> <l3>🔗</l>
<480> <1/> <b>set_value_source</b>(value: <l2>ValueSource</l>)
<481> <l1>ValueSource</l> <b>get_value_source</b>()
<482> Specifies the source of the value for BBParam. See <l1>ValueSource</l>.
<483> <1/> <b>variable</b> <l2>🔗</l>
<484> <1/> <b>set_variable</b>(value: <2/>)
<485> <1/> <b>get_variable</b>()
<486> Stores the name of a <l1>Blackboard</l> variable when <l2>value_source</l> is set to <l3>BLACKBOARD_VAR</l>.
<487> Variant.Type <b>get_type</b>() <1/> <l2>🔗</l>
<488> Returns the expected data type of the parameter.
<489> <1/> <b>get_value</b>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null) <l5>🔗</l>
<490> Returns the value of the parameter.
<491> LimboState
<492> <b>Inherited By:</b> <l1>BTState</l>, <l2>LimboHSM</l>
<493> A state node for Hierarchical State Machines (HSM).
<494> A LimboAI state node for Hierarchical State Machines (HSM).
<495> You can create your state behavior by extending this class. To implement your state logic, you can override <l1>_enter</l>, <l2>_exit</l>, <l3>_setup</l>, and <l4>_update</l>. Alternatively, you can delegate state implementation to external methods using the <5/> methods.
<496> For additional details on state machines, refer to <l1>LimboHSM</l>.
<497> <l1>EVENT_FINISHED</l>
<498> <l1>agent</l>
<499> <l1>blackboard</l>
<500> <l1>blackboard_plan</l>
<501> <l1>_enter</l>() <2/>
<502> <l1>_exit</l>() <2/>
<503> <l1>_setup</l>() <2/>
<504> <l1>_update</l>(delta: <2/>) <3/>
<505> <l1>add_event_handler</l>(event: <2/>, handler: <3/>)
<506> <l1>LimboState</l>
<507> <l1>call_on_enter</l>(callable: <2/>)
<508> <l1>call_on_exit</l>(callable: <2/>)
<509> <l1>call_on_update</l>(callable: <2/>)
<510> <l1>clear_guard</l>()
<511> <l1>dispatch</l>(event: <2/>, cargo: <3/> = null)
<512> <l1>get_root</l>() <2/>
<513> <l1>is_active</l>() <2/>
<514> <l1>named</l>(name: <2/>)
<515> <l1>set_guard</l>(guard_callable: <2/>)
<516> <b>entered</b>() <l1>🔗</l>
<517> Emitted when the state is entered.
<518> <b>exited</b>() <l1>🔗</l>
<519> Emitted when the state is exited.
<520> <b>setup</b>() <l1>🔗</l>
<521> Emitted when the state is initialized.
<522> <b>updated</b>(delta: <1/>) <l2>🔗</l>
<523> Emitted when the state is updated.
<524> <1/> <b>EVENT_FINISHED</b> <l2>🔗</l>
<525> <1/> <b>event_finished</b>()
<526> A commonly used event that indicates that the state has finished its work.
<527> <1/> <b>agent</b> <l2>🔗</l>
<528> An agent associated with the state, assigned during initialization.
<529> <l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>
<530> A key/value data store shared by states within the state machine to which this state belongs.
<531> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
<532> <1/> <b>_enter</b>() <2/> <l3>🔗</l>
<533> Called when the state is entered.
<534> <1/> <b>_exit</b>() <2/> <l3>🔗</l>
<535> Called when the state is exited. This happens on a transition to another state, and when the state machine is removed from the scene tree (e.g., when the node is freed with Node.queue_free or the scene changes). Due to implementation details, <l1>_exit</l> will not be called on Object.free!
<536> <1/> <b>_setup</b>() <2/> <l3>🔗</l>
<537> Called once during initialization. Use this method to initialize your state.
<538> <1/> <b>_update</b>(delta: <2/>) <3/> <l4>🔗</l>
<539> Called during the update. Implement your state’s behavior with this method.
<540> <1/> <b>add_event_handler</b>(event: <2/>, handler: <3/>) <l4>🔗</l>
<541> Registers a <1/> to be called when <2/> is dispatched. The handler function should have the following signature:
<542> If the handler returns <1/>, the event will be consumed. Cargo is an optional parameter that can be passed to the handler. See also <l2>dispatch</l>.
<543> <l1>LimboState</l> <b>call_on_enter</b>(callable: <2/>) <l3>🔗</l>
<544> A chained method that connects the <l1>entered</l> signal to a <2/>.
<545> <l1>LimboState</l> <b>call_on_exit</b>(callable: <2/>) <l3>🔗</l>
<546> A chained method that connects the <l1>exited</l> signal to a <2/>.
<547> <l1>LimboState</l> <b>call_on_update</b>(callable: <2/>) <l3>🔗</l>
<548> A chained method that connects the <l1>updated</l> signal to a <2/>.
<549> <1/> <b>clear_guard</b>() <l2>🔗</l>
<550> Clears the guard function, removing the <1/> previously set by <l2>set_guard</l>.
<551> <1/> <b>dispatch</b>(event: <2/>, cargo: <3/> = null) <l4>🔗</l>
<552> Recursively dispatches a state machine event named <1/> with an optional argument <2/>. Returns <3/> if the event was consumed.
<553> Events propagate from the leaf state to the root state, and propagation stops as soon as any state consumes the event. States will consume the event if they have a related transition or event handler. For more information on event handlers, see <l1>add_event_handler</l>.
<554> <l1>LimboState</l> <b>get_root</b>() <2/> <l3>🔗</l>
<555> Returns the root <b>LimboState</b>.
<556> <1/> <b>is_active</b>() <2/> <l3>🔗</l>
<557> Returns <1/> if it is currently active, meaning it is the active substate of the parent <l2>LimboHSM</l>.
<558> <l1>LimboState</l> <b>named</b>(name: <2/>) <l3>🔗</l>
<559> A chained method for setting the name of this state.
<560> <1/> <b>set_guard</b>(guard_callable: <2/>) <l3>🔗</l>
<561> Sets the guard function, which is a function called each time a transition to this state is considered. If the function returns <1/>, the transition will be disallowed.
<562> LimboHSM
<563> <b>Inherits:</b> <l1>LimboState</l>
<564> Event-based Hierarchical State Machine (HSM).
<565> Event-based Hierarchical State Machine (HSM) that manages <l1>LimboState</l> instances and facilitates transitions between them. LimboHSM is a <l2>LimboState</l> in itself and can also serve as a child of another LimboHSM node.
<566> <l1>LimboState</l>
<567> <l1>ANYSTATE</l>
<568> <l1>initial_state</l>
<569> <l1>UpdateMode</l>
<570> <l1>update_mode</l>
<571> <l1>add_transition</l>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable())
<572> <l1>change_active_state</l>(state: <l2>LimboState</l>)
<573> <l1>get_active_state</l>() <2/>
<574> <l1>get_leaf_state</l>() <2/>
<575> <l1>get_previous_active_state</l>() <2/>
<576> <l1>has_transition</l>(from_state: <l2>LimboState</l>, event: <3/>) <4/>
<577> <l1>initialize</l>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null)
<578> <l1>remove_transition</l>(from_state: <l2>LimboState</l>, event: <3/>)
<579> <l1>set_active</l>(active: <2/>)
<580> <l1>update</l>(delta: <2/>)
<581> <b>active_state_changed</b>(current: <l1>LimboState</l>, previous: <l2>LimboState</l>) <l3>🔗</l>
<582> Emitted when the currently active substate is switched to a different substate.
<583> enum <b>UpdateMode</b>: <l1>🔗</l>
<584> <l1>UpdateMode</l> <b>IDLE</b> = <2/>
<585> Update the state machine during the idle process.
<586> <l1>UpdateMode</l> <b>PHYSICS</b> = <2/>
<587> Update the state machine during the physics process.
<588> <l1>UpdateMode</l> <b>MANUAL</b> = <2/>
<589> Manually update the state machine by calling <l1>update</l> from a script.
<590> <l1>LimboState</l> <b>ANYSTATE</b> <l2>🔗</l>
<591> <l1>LimboState</l> <b>anystate</b>()
<592> Useful for defining a transition from any state.
<593> <l1>LimboState</l> <b>initial_state</b> <l2>🔗</l>
<594> <1/> <b>set_initial_state</b>(value: <l2>LimboState</l>)
<595> <l1>LimboState</l> <b>get_initial_state</b>()
<596> The substate that becomes active when the state machine is activated using the <l1>set_active</l> method. If not explicitly set, the first child of the LimboHSM will be considered the initial state.
<597> <l1>UpdateMode</l> <b>update_mode</b> = <2/> <l3>🔗</l>
<598> <1/> <b>set_update_mode</b>(value: <l2>UpdateMode</l>)
<599> <l1>UpdateMode</l> <b>get_update_mode</b>()
<600> Specifies when the state machine should be updated. See <l1>UpdateMode</l>.
<601> <1/> <b>add_transition</b>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable()) <l6>🔗</l>
<602> Establishes a transition from one state to another when <1/> is dispatched. Both <2/> and <3/> must be immediate children of this <b>LimboHSM</b>.
<603> Optionally, a <1/> function can be specified, which must return a boolean value. If the guard function returns <2/>, the transition will not occur. The guard function is called immediately before the transition is considered. For a state-wide guard function, check out <l3>LimboState.set_guard</l>.
<604> <1/> <b>change_active_state</b>(state: <l2>LimboState</l>) <l3>🔗</l>
<605> Changes the currently active substate to <1/>. If <2/> is already active, it will be exited and reentered.
<606> <1/> must be a child of this <b>LimboHSM</b>.
<607> <l1>LimboState</l> <b>get_active_state</b>() <2/> <l3>🔗</l>
<608> Returns the currently active substate.
<609> <l1>LimboState</l> <b>get_leaf_state</b>() <2/> <l3>🔗</l>
<610> Returns the currently active leaf state within the state machine.
<611> <l1>LimboState</l> <b>get_previous_active_state</b>() <2/> <l3>🔗</l>
<612> Returns the previously active substate.
<613> <1/> <b>has_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <4/> <l5>🔗</l>
<614> Returns <1/> if there is a transition from <2/> for a given <3/>.
<615> <1/> <b>initialize</b>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null) <l4>🔗</l>
<616> Initiates the state and calls <l1>LimboState._setup</l> for both itself and all substates.
<617> <1/> <b>remove_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <l4>🔗</l>
<618> Removes a transition from a state associated with specific <1/>.
<619> <1/> <b>set_active</b>(active: <2/>) <l3>🔗</l>
<620> When set to <1/>, switches the state to <l2>initial_state</l> and activates state processing according to <l3>update_mode</l>.
<621> <1/> <b>update</b>(delta: <2/>) <l3>🔗</l>
<622> Calls <l1>LimboState._update</l> on itself and the active substate, with the call cascading down to the leaf state. This method is automatically triggered if <l2>update_mode</l> is not set to <l3>MANUAL</l>.
@@ -0,0 +1,156 @@
<623> BTState
<624> A state node for <l1>LimboHSM</l> that hosts a <l2>BehaviorTree</l>.
<625> BTState is a <l1>LimboState</l> node that manages a <l2>BehaviorTree</l> to provide behavior logic for the state. It instantiates and runs the <l3>BehaviorTree</l> resource, dispatching a state machine event upon <4/> or <5/>. Event names are customizable through <l6>success_event</l> and <l7>failure_event</l>. For further details on state machine events, see <l8>LimboState.dispatch</l>.
<626> <l1>behavior_tree</l>
<627> <l1>failure_event</l>
<628> <l1>monitor_performance</l>
<629> <l1>success_event</l>
<630> <l1>get_bt_instance</l>() <2/>
<631> <l1>set_scene_root_hint</l>(scene_root: <2/>)
<632> <l1>BehaviorTree</l> <b>behavior_tree</b> <l2>🔗</l>
<633> A <l1>BehaviorTree</l> resource that defines state behavior.
<634> <1/> <b>failure_event</b> = <2/> <l3>🔗</l>
<635> <1/> <b>set_failure_event</b>(value: <2/>)
<636> <1/> <b>get_failure_event</b>()
<637> HSM event that will be dispatched when the behavior tree results in <1/>. See <l2>LimboState.dispatch</l>.
<638> <1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>
<639> If <1/>, adds a performance monitor to “Debugger->Monitors” for each instance of this <b>BTState</b> node.
<640> <1/> <b>success_event</b> = <2/> <l3>🔗</l>
<641> <1/> <b>set_success_event</b>(value: <2/>)
<642> <1/> <b>get_success_event</b>()
<643> HSM event that will be dispatched when the behavior tree results in <1/>. See <l2>LimboState.dispatch</l>.
<644> <l1>BTInstance</l> <b>get_bt_instance</b>() <2/> <l3>🔗</l>
<645> <1/> <b>set_scene_root_hint</b>(scene_root: <2/>) <l3>🔗</l>
<646> Sets the <1/> that will be used as the scene root for the newly instantiated behavior tree. Should be called before the state machine is initialized. This is typically useful when creating <b>BTState</b> nodes dynamically from code.
<647> Full class reference is available in the side bar.
<648> BBAabb
<649> <b>Inherits:</b> <l1>BBParam</l>
<650> AABB-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<651> BBArray
<652> Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<653> BBBasis
<654> Basis-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<655> BBBool
<656> Bool-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<657> BBByteArray
<658> ByteArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<659> BBColor
<660> Color-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<661> BBColorArray
<662> ColorArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<663> BBDictionary
<664> Dictionary-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<665> BBFloat
<666> Float-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<667> BBFloat32Array
<668> PackedFloat32Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<669> BBFloat64Array
<670> PackedFloat64Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<671> BBInt
<672> Integer-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<673> BBInt32Array
<674> PackedInt32Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<675> BBInt64Array
<676> PackedInt64Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<677> BBNode
<678> Node-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<679> Node-type parameter intended for use with <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<680> If the source is a blackboard variable, it allows any type extended from <1/>.
<681> BBPlane
<682> Plane-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<683> BBProjection
<684> Projection-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<685> BBQuaternion
<686> Quaternion-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<687> BBRect2
<688> Rect2-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<689> BBRect2i
<690> Rect2i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<691> BBString
<692> String-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<693> BBStringArray
<694> StringArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<695> BBStringName
<696> StringName-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<697> BBTransform2D
<698> Transform2D-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<699> BBTransform3D
<700> Transform3D-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<701> BBVariant
<702> Variant-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<703> Variant-type parameter intended for use with <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<704> The data type is specified by <l1>type</l>.
<705> <l1>type</l>
<706> Variant.Type <b>type</b> = <1/> <l2>🔗</l>
<707> <1/> <b>set_type</b>(value: Variant.Type)
<708> Variant.Type <b>get_type</b>()
<709> Specified Variant.Type for the parameter value.
<710> BBVector2
<711> Vector2-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<712> BBVector2Array
<713> Vector2Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<714> BBVector2i
<715> Vector2i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<716> BBVector3
<717> Vector3-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<718> BBVector3Array
<719> Vector3Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<720> BBVector3i
<721> Vector3i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<722> BBVector4
<723> Vector4-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<724> BBVector4i
<725> Vector4i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<726> BehaviorTree
<727> Contains Behavior Tree data.
<728> Behavior Trees are hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games.
<729> Behavior Trees are composed of tasks that represent specific actions or decision-making rules. Tasks can be broadly categorized into two main types: control tasks and leaf tasks. Control tasks determine the execution flow within the tree. They include <l1>BTSequence</l>, <l2>BTSelector</l>, and <l3>BTInvert</l>. Leaf tasks represent specific actions to perform, like moving or attacking, or conditions that need to be checked. The <l4>BTTask</l> class provides the foundation for various building blocks of the Behavior Trees. BT tasks can share data with the help of <l5>Blackboard</l>. See <l6>BTTask.blackboard</l> and <l7>Blackboard</l>.
<730> <b>Note:</b> To create your own actions, extend the <l1>BTAction</l> class.
<731> The BehaviorTree is executed from the root task and follows the rules specified by the control tasks, all the way down to the leaf tasks, which represent the actual actions that the agent should perform or conditions that should be checked. Each task returns a status when it is executed. It can be <1/>, <2/>, or <3/>. These statuses determine how the tree progresses. They are defined in <l4>Status</l>.
<732> Behavior Trees handle conditional logic using condition tasks. These tasks check for specific conditions and return either <1/> or <2/> based on the state of the agent or its environment (e.g., “IsLowOnHealth”, “IsTargetInSight”). Conditions can be used together with <l3>BTSequence</l> and <l4>BTSelector</l> to craft your decision-making logic.
<733> <b>Note</b>: To create your own conditions, extend the <l1>BTCondition</l> class.
<734> Check out the <l1>BTTask</l> class, which provides the foundation for various building blocks of Behavior Trees.
<735> <l1>blackboard_plan</l>
<736> <l1>description</l>
<737> <l1>BehaviorTree</l>
<738> <l1>clone</l>() <2/>
<739> <l1>copy_other</l>(other: <l2>BehaviorTree</l>)
<740> <l1>BTTask</l>
<741> <l1>get_root_task</l>() <2/>
<742> <l1>instantiate</l>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/>
<743> <l1>set_root_task</l>(task: <l2>BTTask</l>)
<744> <b>plan_changed</b>() <l1>🔗</l>
<745> Emitted when the <l1>BlackboardPlan</l> changes.
<746> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
<747> <1/> <b>description</b> = <2/> <l3>🔗</l>
<748> <1/> <b>set_description</b>(value: <2/>)
<749> <1/> <b>get_description</b>()
<750> User-provided description of the <b>BehaviorTree</b>.
<751> <l1>BehaviorTree</l> <b>clone</b>() <2/> <l3>🔗</l>
<752> Makes a copy of the BehaviorTree resource.
<753> <1/> <b>copy_other</b>(other: <l2>BehaviorTree</l>) <l3>🔗</l>
<754> Become a copy of another behavior tree.
<755> <l1>BTTask</l> <b>get_root_task</b>() <2/> <l3>🔗</l>
<756> Returns the root task of the BehaviorTree resource.
<757> <l1>BTInstance</l> <b>instantiate</b>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/> <l7>🔗</l>
<758> Instantiates the behavior tree and returns <l1>BTInstance</l>. <2/> should be the scene node that will own the behavior tree instance. This is typically a <l3>BTPlayer</l>, <l4>BTState</l>, or a custom player node that controls the behavior tree execution. Make sure to pass a <l5>Blackboard</l> with values populated from <l6>blackboard_plan</l>. See also <l7>BlackboardPlan.populate_blackboard</l> & <l8>BlackboardPlan.create_blackboard</l>.
<759> If <1/> is not <2/>, it will be used as the scene root for the newly instantiated behavior tree; otherwise, the scene root will be set to <3/>. Scene root is essential for <l4>BBNode</l> instances to work properly.
<760> <1/> <b>set_root_task</b>(task: <l2>BTTask</l>) <l3>🔗</l>
<761> Assigns a new root task to the <b>BehaviorTree</b> resource.
<762> BehaviorTreeData
<763> Represents current state of a <l1>BehaviorTree</l> instance.
<764> This class is used by the LimboAI debugger for the serialization and deserialization of <l1>BehaviorTree</l> instance data.
<765> Additionally, it can be used with <l1>BehaviorTreeView</l> to visualize the current state of a <l2>BehaviorTree</l> instance. It is meant to be utilized in custom in-game tools.
<766> <l1>BehaviorTreeData</l>
<767> <l1>create_from_bt_instance</l>(bt_instance: <l2>BTInstance</l>) <3/>
<768> <l1>BehaviorTreeData</l> <b>create_from_bt_instance</b>(bt_instance: <l2>BTInstance</l>) <3/> <l4>🔗</l>
<769> Returns current state of the <1/> encoded as a <b>BehaviorTreeData</b>, suitable for use with <l2>BehaviorTreeView</l>.
<770> Behavior tree instance can be acquired with <l1>BTPlayer.get_bt_instance</l>.
<771> BehaviorTreeView
<772> Visualizes the current state of a <l1>BehaviorTree</l> instance.
<773> Visualizes the current state of a <l1>BehaviorTree</l> instance. See also <l2>BehaviorTreeData</l>.
<774> <l1>update_interval_msec</l>
<775> <l1>clear</l>()
<776> <l1>update_tree</l>(behavior_tree_data: <l2>BehaviorTreeData</l>)
<777> <b>task_selected</b>(type_name: <1/>, script_path: <2/>) <l3>🔗</l>
<778> Emitted when a task item is selected in <b>BehaviorTreeView</b>.
@@ -0,0 +1,164 @@
<779> <1/> <b>update_interval_msec</b> = <2/> <l3>🔗</l>
<780> <1/> <b>set_update_interval_msec</b>(value: <2/>)
<781> <1/> <b>get_update_interval_msec</b>()
<782> Minimum delay between two updates (in milliseconds). Set to higher values for a lower CPU load.
<783> <1/> <b>clear</b>() <l2>🔗</l>
<784> Clears the tree view.
<785> <1/> <b>update_tree</b>(behavior_tree_data: <l2>BehaviorTreeData</l>) <l3>🔗</l>
<786> Updates the representation of a <l1>BehaviorTree</l> instance. See also <l2>BehaviorTreeData</l>.
<787> BlackboardPlan
<788> <l1>prefetch_nodepath_vars</l>
<789> <l1>create_blackboard</l>(prefetch_root: <2/>, parent_scope: <l3>Blackboard</l> = null, prefetch_root_for_base_plan: <4/> = null)
<790> <l1>BlackboardPlan</l>
<791> <l1>get_base_plan</l>() <2/>
<792> <l1>get_parent_scope_plan_provider</l>() <2/>
<793> <l1>is_derived</l>() <2/>
<794> <l1>populate_blackboard</l>(blackboard: <l2>Blackboard</l>, overwrite: <3/>, prefetch_root: <4/>, prefetch_root_for_base_plan: <5/> = null)
<795> <l1>set_base_plan</l>(blackboard_plan: <l2>BlackboardPlan</l>)
<796> <l1>set_parent_scope_plan_provider</l>(callable: <2/>)
<797> <l1>sync_with_base_plan</l>()
<798> <1/> <b>prefetch_nodepath_vars</b> = <2/> <l3>🔗</l>
<799> <1/> <b>set_prefetch_nodepath_vars</b>(value: <2/>)
<800> <1/> <b>is_prefetching_nodepath_vars</b>()
<801> Enables or disables <1/> variable prefetching. If <2/>, <3/> values will be replaced with node instances when the <l4>Blackboard</l> is created.
<802> <l1>Blackboard</l> <b>create_blackboard</b>(prefetch_root: <2/>, parent_scope: <l3>Blackboard</l> = null, prefetch_root_for_base_plan: <4/> = null) <l5>🔗</l>
<803> Constructs a new instance of a <l1>Blackboard</l> using this plan. If <2/> prefetching is enabled, <3/> will be used to retrieve node instances for <4/> variables and substitute their values.
<804> <l1>BlackboardPlan</l> <b>get_base_plan</b>() <2/> <l3>🔗</l>
<805> Returns the base plan. See <l1>is_derived</l>.
<806> <1/> <b>get_parent_scope_plan_provider</b>() <2/> <l3>🔗</l>
<807> Returns the parent scope plan provider - a callable that returns a <b>BlackboardPlan</b>.
<808> <1/> <b>is_derived</b>() <2/> <l3>🔗</l>
<809> Returns <1/> if this plan is derived from another, i.e., the base plan is not <2/>. A derived plan can only contain variables that are present in the base plan, and only variable values can be different.
<810> <1/> <b>populate_blackboard</b>(blackboard: <l2>Blackboard</l>, overwrite: <3/>, prefetch_root: <4/>, prefetch_root_for_base_plan: <5/> = null) <l6>🔗</l>
<811> Populates <1/> with the variables from this plan. If <2/> is <3/>, existing variables with the same names will be overwritten. If <4/> prefetching is enabled, <5/> will be used to retrieve node instances for <6/> variables and substitute their values.
<812> <1/> <b>set_base_plan</b>(blackboard_plan: <l2>BlackboardPlan</l>) <l3>🔗</l>
<813> Sets the base plan. If assigned, this plan will be derived from the base plan.
<814> Use with caution, as it will remove variables not present in the base plan. Only use this for custom tooling.
<815> <1/> <b>set_parent_scope_plan_provider</b>(callable: <2/>) <l3>🔗</l>
<816> Sets the parent scope plan provider - a callable that returns a <b>BlackboardPlan</b>. Used to provide hints in the inspector. When set, mapping feature becomes available.
<817> <1/> <b>sync_with_base_plan</b>() <l2>🔗</l>
<818> Synchronizes this plan with the base plan: removes variables not present in the base plan, and updates type information. Only use this for custom tooling.
<819> BT
<820> <b>Inherited By:</b> <l1>BTTask</l>
<821> Base of <l1>BTTask</l>.
<822> enum <b>Status</b>: <l1>🔗</l>
<823> <l1>Status</l> <b>FRESH</b> = <2/>
<824> Task wasn’t executed yet or it was aborted and reset.
<825> <l1>Status</l> <b>RUNNING</b> = <2/>
<826> Task is being performed and hasn’t finished yet.
<827> <l1>Status</l> <b>FAILURE</b> = <2/>
<828> Task has finished with failure.
<829> <l1>Status</l> <b>SUCCESS</b> = <2/>
<830> Task has finished with success.
<831> BTAction
<832> <b>Inherits:</b> <l1>BTTask</l> <b><</b> <l2>BT</l>
<833> <b>Inherited By:</b> <l1>BTAwaitAnimation</l>, <l2>BTCallMethod</l>, <l3>BTConsolePrint</l>, <l4>BTEvaluateExpression</l>, <l5>BTFail</l>, <l6>BTPauseAnimation</l>, <l7>BTPlayAnimation</l>, <l8>BTRandomWait</l>, <l9>BTSetAgentProperty</l>, <l10>BTSetVar</l>, <l11>BTStopAnimation</l>, <l12>BTWait</l>, <l13>BTWaitTicks</l>
<834> Base class for all <l1>BehaviorTree</l> actions.
<835> Base class for all actions within a <l1>BehaviorTree</l>. You can create your own actions by extending the <b>BTAction</b> class.
<836> Represents a specific behavior or action in a <l1>BehaviorTree</l> that an agent should execute. Actions are the lowest level of the <l2>BehaviorTree</l> hierarchy and are responsible for performing the actual work required to achieve a goal. Actions do not have child tasks.
<837> A single action can perform a task within one or multiple ticks. If it takes more than one tick to complete the task, the action should return <1/> status. When the task is finished, the action returns either <2/> or <3/> to indicate the outcome.
<838> BTAlwaysFail
<839> <b>Inherits:</b> <l1>BTDecorator</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>
<840> BT decorator that converts <1/> into <2/>.
<841> BTAlwaysSucceed
<842> BT decorator that converts <1/> into <2/>.
<843> BTAwaitAnimation
<844> <b>Inherits:</b> <l1>BTAction</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>
<845> BT action that waits for an animation to finish playing.
<846> BTAwaitAnimation action waits for an animation on the specified <1/> node to finish playing and returns <2/>.
<847> Returns <1/> if the specified animation has finished playing or if the specified animation is not currently playing.
<848> Returns <1/> if the specified animation doesn’t exist or if the action fails to get the <2/> node.
<849> <l1>animation_name</l>
<850> <l1>BBNode</l>
<851> <l1>animation_player</l>
<852> <l1>max_time</l>
<853> <1/> <b>animation_name</b> = <2/> <l3>🔗</l>
<854> <1/> <b>set_animation_name</b>(value: <2/>)
<855> <1/> <b>get_animation_name</b>()
<856> Animation’s key within the <1/> node.
<857> <l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>
<858> <1/> <b>set_animation_player</b>(value: <l2>BBNode</l>)
<859> <l1>BBNode</l> <b>get_animation_player</b>()
<860> Parameter that specifies the <1/> node.
<861> <1/> <b>max_time</b> = <2/> <l3>🔗</l>
<862> <1/> <b>set_max_time</b>(value: <2/>)
<863> <1/> <b>get_max_time</b>()
<864> The maximum duration to wait for the animation to complete (in seconds). If the animation doesn’t finish within this time, BTAwaitAnimation will stop waiting and return <1/>.
<865> BTCallMethod
<866> BT action that calls a method on a specified <1/> or <2/>.
<867> BTCallMethod action calls a <l1>method</l> on the specified <2/> or <3/> instance and returns <4/>.
<868> Returns <1/> if the action encounters an issue during the method execution.
<869> Array[<l1>BBVariant</l>]
<870> <l1>args</l>
<871> <l1>args_include_delta</l>
<872> <l1>method</l>
<873> <l1>node</l>
<874> <l1>result_var</l>
<875> Array[<l1>BBVariant</l>] <b>args</b> = <2/> <l3>🔗</l>
<876> <1/> <b>set_args</b>(value: Array[<l2>BBVariant</l>])
<877> Array[<l1>BBVariant</l>] <b>get_args</b>()
<878> The arguments to be passed when calling the method.
<879> <1/> <b>args_include_delta</b> = <2/> <l3>🔗</l>
<880> <1/> <b>set_include_delta</b>(value: <2/>)
<881> <1/> <b>is_delta_included</b>()
<882> Include delta as a first parameter and shift the position of the rest of the arguments if any.
<883> <1/> <b>method</b> = <2/> <l3>🔗</l>
<884> <1/> <b>set_method</b>(value: <2/>)
<885> <1/> <b>get_method</b>()
<886> The name of the method to be called.
<887> <l1>BBNode</l> <b>node</b> <l2>🔗</l>
<888> <1/> <b>set_node_param</b>(value: <l2>BBNode</l>)
<889> <l1>BBNode</l> <b>get_node_param</b>()
<890> Specifies the <1/> or <2/> instance containing the method to be called.
<891> <1/> <b>result_var</b> = <2/> <l3>🔗</l>
<892> <1/> <b>set_result_var</b>(value: <2/>)
<893> <1/> <b>get_result_var</b>()
<894> if non-empty, assign the result of the method call to the blackboard variable specified by this property.
<895> BTCheckAgentProperty
<896> <b>Inherits:</b> <l1>BTCondition</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>
<897> BT condition that checks agent’s property value.
<898> BTCheckAgentProperty examines the agent’s property value and compares it to <l1>value</l>.
<899> Returns <1/> or <2/> based on the <l3>check_type</l>.
<900> <l1>CheckType</l>
<901> <l1>check_type</l>
<902> <l1>property</l>
<903> <l1>BBVariant</l>
<904> <l1>value</l>
<905> <l1>CheckType</l> <b>check_type</b> = <2/> <l3>🔗</l>
<906> <1/> <b>set_check_type</b>(value: <l2>CheckType</l>)
<907> <l1>CheckType</l> <b>get_check_type</b>()
<908> The type of check to be performed.
<909> <1/> <b>property</b> = <2/> <l3>🔗</l>
<910> <1/> <b>set_property</b>(value: <2/>)
<911> <1/> <b>get_property</b>()
<912> Parameter that specifies the agent’s property to be compared.
<913> <l1>BBVariant</l> <b>value</b> <l2>🔗</l>
<914> <1/> <b>set_value</b>(value: <l2>BBVariant</l>)
<915> <l1>BBVariant</l> <b>get_value</b>()
<916> Parameter that specifies the value against which an agent’s property will be compared.
<917> BTCheckTrigger
<918> BT condition that checks a trigger (a boolean variable).
<919> <b>BTCheckTrigger</b> verifies whether the <l1>variable</l> is set to <2/>. If it is, the task switches it to <3/> and returns <4/>. Otherwise, it returns <5/>.
<920> <b>BTCheckTrigger</b> can function as a “gate” within a <l1>BTSequence</l>: when the trigger variable is set to <2/>, it permits the execution of subsequent tasks and then changes the variable to <3/>.
<921> <l1>variable</l>
<922> <1/> <b>variable</b> = <2/> <l3>🔗</l>
<923> A boolean variable on the blackboard used as a trigger. See also <l1>BTTask.blackboard</l>.
<924> If variable’s value is <1/>, <b>BTCheckTrigger</b> will switch it to <2/> and return <3/>.
<925> If variable’s value is <1/>, <b>BTCheckTrigger</b> will return <2/>.
<926> BTCheckVar
<927> BT condition that checks a variable on the blackboard.
<928> BTCheckVar evaluates the <l1>variable</l> against <l2>value</l> and returns <3/> or <4/> based on the <l5>check_type</l>.
<929> <l1>check_type</l>
<930> <l1>value</l>
<931> <l1>variable</l>
<932> <l1>CheckType</l> <b>check_type</b> = <2/> <l3>🔗</l>
<933> <l1>BBVariant</l> <b>value</b> <l2>🔗</l>
<934> A parameter that specifies the value against which the <l1>variable</l> will be compared.
<935> <1/> <b>variable</b> = <2/> <l3>🔗</l>
<936> The name of the variable to check its value.
<937> BTComment
<938> BTComment adds annotations or explanatory notes to a <l1>BehaviorTree</l>.
<939> BTComment is used to add annotations or explanatory notes to a <l1>BehaviorTree</l>.
<940> Comments are not executed as part of the tree and are removed from runtime instances of the <l1>BehaviorTree</l>.
<941> BTComposite
<942> <b>Inherited By:</b> <l1>BTDynamicSelector</l>, <l2>BTDynamicSequence</l>, <l3>BTParallel</l>, <l4>BTProbabilitySelector</l>, <l5>BTRandomSelector</l>, <l6>BTRandomSequence</l>, <l7>BTSelector</l>, <l8>BTSequence</l>
@@ -0,0 +1,131 @@
<943> Base class for BT composite tasks.
<944> Base class for all <l1>BehaviorTree</l> composite tasks. You can create your own composite tasks by extending the BTComposite class.
<945> Composite is a control task within a <l1>BehaviorTree</l> that contains one or more child tasks. It defines the structure and flow of the <l2>BehaviorTree</l> by specifying how child tasks are executed. Composites can be used to group related tasks into a single unit, making it easier to manage and maintain the <l3>BehaviorTree</l>. Examples of <l4>BehaviorTree</l> composites include <l5>BTSelector</l>, <l6>BTSequence</l>, and <l7>BTParallel</l>.
<946> BTCondition
<947> <b>Inherited By:</b> <l1>BTCheckAgentProperty</l>, <l2>BTCheckTrigger</l>, <l3>BTCheckVar</l>
<948> Base class for BT conditions.
<949> Base class for all <l1>BehaviorTree</l> conditions. You can create your own conditions by extending the <b>BTCondition</b> class.
<950> Condition is a task within a <l1>BehaviorTree</l> that checks for a specific condition before executing subsequent tasks. It is often used inside composite tasks to control the execution flow. Conditions are used to verify the state of the environment, check for the presence of an enemy, or evaluate the health status of the agent. The use of condition tasks in a <l2>BehaviorTree</l> can improve system efficiency and prevent unnecessary actions. However, they may not be suitable for complex decision-making processes, and too many condition tasks can make the <l3>BehaviorTree</l> difficult to read.
<951> Conditions typically don’t take multiple ticks to finish and return either <1/> or <2/> immediately.
<952> BTConsolePrint
<953> BT action task that outputs text to the console.
<954> BTConsolePrint action outputs text to the console and returns <1/>. It can include placeholders for format arguments similar to GDScript’s % operator.
<955> <l1>bb_format_parameters</l>
<956> <l1>text</l>
<957> <1/> <b>bb_format_parameters</b> = <2/> <l3>🔗</l>
<958> <1/> <b>set_bb_format_parameters</b>(value: <2/>)
<959> <1/> <b>get_bb_format_parameters</b>()
<960> The values of format parameters are used as format arguments for the text that will be printed.
<961> <b>Note:</b> The returned array is <i>copied</i> and any changes to it will not update the original property value. See <1/> for more details.
<962> <1/> <b>text</b> = <2/> <l3>🔗</l>
<963> <1/> <b>set_text</b>(value: <2/>)
<964> <1/> <b>get_text</b>()
<965> The text to be printed, which can include multiple placeholders to be substituted with format arguments. These placeholders follow the same format as GDScript’s % operator and typically start with ‘%’ followed by a format specifier. For instance: %s for string, %d for integer, %f for real.
<966> BTCooldown
<967> BT decorator that executes its child task only if <l1>duration</l> time has passed since the previous execution.
<968> BTCooldown runs its child task only if <l1>duration</l> time has passed since the last successful child task execution. It will only consider successful executions unless <l2>trigger_on_failure</l> is set to <3/>.
<969> Returns <1/>, if the child task results in <2/>.
<970> Returns <1/>, if the child task results in <2/>, and triggers the cooldown timer.
<971> Returns <1/>, if the child task results in <2/> or if <l3>duration</l> time didn’t pass since the previous execution.
<972> <l1>cooldown_state_var</l>
<973> <l1>duration</l>
<974> <l1>process_pause</l>
<975> <l1>start_cooled</l>
<976> <l1>trigger_on_failure</l>
<977> <1/> <b>cooldown_state_var</b> = <2/> <l3>🔗</l>
<978> <1/> <b>set_cooldown_state_var</b>(value: <2/>)
<979> <1/> <b>get_cooldown_state_var</b>()
<980> A boolean variable used to store the cooldown state in the <l1>Blackboard</l>. If left empty, the variable will be automatically generated and assigned.
<981> If the variable’s value is set to <1/>, it indicates that the cooldown is activated. This feature is useful for checking the cooldown state from other parts of the tree or sharing it among different sections of the <l2>BehaviorTree</l>.
<982> <1/> <b>duration</b> = <2/> <l3>🔗</l>
<983> <1/> <b>set_duration</b>(value: <2/>)
<984> <1/> <b>get_duration</b>()
<985> Time to wait before permitting another child’s execution.
<986> <1/> <b>process_pause</b> = <2/> <l3>🔗</l>
<987> <1/> <b>set_process_pause</b>(value: <2/>)
<988> <1/> <b>get_process_pause</b>()
<989> If <1/>, process cooldown when the <2/> is paused.
<990> <1/> <b>start_cooled</b> = <2/> <l3>🔗</l>
<991> <1/> <b>set_start_cooled</b>(value: <2/>)
<992> <1/> <b>get_start_cooled</b>()
<993> If <1/>, initiate a cooldown as if the child had been executed before the first BT tick.
<994> <1/> <b>trigger_on_failure</b> = <2/> <l3>🔗</l>
<995> <1/> <b>set_trigger_on_failure</b>(value: <2/>)
<996> <1/> <b>get_trigger_on_failure</b>()
<997> If <1/>, the cooldown will be activated if the child task also returns <2/>. Otherwise, the cooldown will only be triggered when the child task returns <3/>.
<998> BTDecorator
<999> <b>Inherited By:</b> <l1>BTAlwaysFail</l>, <l2>BTAlwaysSucceed</l>, <l3>BTCooldown</l>, <l4>BTDelay</l>, <l5>BTForEach</l>, <l6>BTInvert</l>, <l7>BTNewScope</l>, <l8>BTProbability</l>, <l9>BTRepeat</l>, <l10>BTRepeatUntilFailure</l>, <l11>BTRepeatUntilSuccess</l>, <l12>BTRunLimit</l>, <l13>BTTimeLimit</l>
<1000> Base class for BT decorators.
<1001> Base class for all <l1>BehaviorTree</l> decorators. You can create your own decorators by extending the BTDecorator class.
<1002> A decorator is a task within a <l1>BehaviorTree</l> that alters the behavior of its child task. Decorators can have only one child task.
<1003> Decorators can be used to add conditions, limits, or other constraints to the execution of a task. Examples of <l1>BehaviorTree</l> decorators include <l2>BTInvert</l>, <l3>BTRepeat</l>, and <l4>BTCooldown</l>. The use of <l5>BehaviorTree</l> decorators can simplify the design and implementation of complex behaviors by adding additional logic to existing tasks.
<1004> BTDelay
<1005> BT decorator that introduces a delay before executing its child task.
<1006> BTDelay introduces a delay of <l1>seconds</l> before executing its child task. Returns <2/> during the delay period.
<1007> <l1>seconds</l>
<1008> <1/> <b>seconds</b> = <2/> <l3>🔗</l>
<1009> <1/> <b>set_seconds</b>(value: <2/>)
<1010> <1/> <b>get_seconds</b>()
<1011> Delay duration in seconds.
<1012> BTDynamicSelector
<1013> <b>Inherits:</b> <l1>BTComposite</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>
<1014> BT composite that executes tasks from scratch every tick until first <1/>.
<1015> BTDynamicSelector executes its child tasks sequentially, from first to last, until any child returns <1/>. Unlike <l2>BTSelector</l>, it will execute tasks from the beginning every tick, reevaluating their statuses. It is quite useful when you want to retry higher-priority behaviors in every tick.
<1016> Returns <1/> if a child task results in <2/>. BTDynamicSelector will remember the last <3/> child, but, unlike <l4>BTSequence</l>, on the next execution tick, it will reexecute preceding tasks and reevaluate their return statuses. If any of the preceding tasks doesn’t result in <5/>, it will abort the remembered <6/> task.
<1017> Returns <1/> if all child tasks result in <2/>.
<1018> Returns <1/> if a child task results in <2/>.
<1019> BTDynamicSequence
<1020> BT composite that executes tasks from scratch every tick as long as they return <1/>.
<1021> BTDynamicSequence executes its child tasks sequentially, from first to last, for as long as they return <1/>. Unlike <l2>BTSequence</l>, it will execute tasks from the beginning every tick, reevaluating their statuses. It is quite useful when you want to recheck conditions preceding a long-running action during each tick and abort the <3/> action when any condition results in <4/>.
<1022> Returns <1/> if a child task results in <2/>. BTDynamicSequence will remember the last <3/> child, but, unlike <l4>BTSequence</l>, on the next execution tick, it will reexecute preceding tasks and reevaluate their return statuses. If any of the preceding tasks doesn’t result in <5/>, it will abort the remembered <6/> task.
<1023> Returns <1/> if a child task results in <2/>.
<1024> Returns <1/> if all child tasks result in <2/>.
<1025> BTEvaluateExpression
<1026> BT action that evaluates an <1/> against a specified <2/> or <3/>.
<1027> BTEvaluateExpression action evaluates an <l1>expression_string</l> on the specified <2/> or <3/> instance and returns <4/> when the <5/> executes successfully.
<1028> Returns <1/> if the action encounters an issue during the <2/> parsing or execution.
<1029> <l1>expression_string</l>
<1030> <l1>input_include_delta</l>
<1031> <l1>input_names</l>
<1032> <l1>input_values</l>
<1033> <l1>node</l>
<1034> <l1>result_var</l>
<1035> Error
<1036> <l1>parse</l>()
<1037> <1/> <b>expression_string</b> = <2/> <l3>🔗</l>
<1038> <1/> <b>set_expression_string</b>(value: <2/>)
<1039> <1/> <b>get_expression_string</b>()
<1040> The expression string to be parsed and executed.
<1041> <b>Warning:</b> Call <l1>parse</l> after updating <l2>expression_string</l> to update the internal <3/> as it won’t be updated automatically.
<1042> <1/> <b>input_include_delta</b> = <2/> <l3>🔗</l>
<1043> <1/> <b>set_input_include_delta</b>(value: <2/>)
<1044> <1/> <b>is_input_delta_included</b>()
<1045> If enabled, the input variable <1/> will be added to <l2>input_names</l> and <l3>input_values</l>.
<1046> <b>Warning:</b> Call <l1>parse</l> after toggling <l2>input_include_delta</l> to update the internal <3/> as it won’t be updated automatically.
<1047> <1/> <b>input_names</b> = <2/> <l3>🔗</l>
<1048> <1/> <b>set_input_names</b>(value: <2/>)
<1049> <1/> <b>get_input_names</b>()
<1050> List of variable names within <l1>expression_string</l> for which the user will provide values for through <l2>input_values</l>.
<1051> <b>Warning:</b> Call <l1>parse</l> after updating <l2>input_names</l> to update the internal <3/> as it won’t be updated automatically.
<1052> Array[<l1>BBVariant</l>] <b>input_values</b> = <2/> <l3>🔗</l>
<1053> <1/> <b>set_input_values</b>(value: Array[<l2>BBVariant</l>])
<1054> Array[<l1>BBVariant</l>] <b>get_input_values</b>()
<1055> List of values for variables specified in <l1>input_names</l>. The values are mapped to the variables by their array index.
<1056> <l1>BBNode</l> <b>node</b> <l2>🔗</l>
<1057> <1/> <b>result_var</b> = <2/> <l3>🔗</l>
<1058> Error <b>parse</b>() <l1>🔗</l>
<1059> Calls Expression.parse considering <l1>input_include_delta</l> and <l2>input_names</l> and returns its error code.
<1060> BTFail
<1061> BT action that always returns <1/>.
<1062> BTForEach
<1063> BT decorator that executes its child task for each element of an <1/>.
<1064> BTForEach executes its child task for each element of an <1/>. During each iteration, the next element is stored in the specified <l2>Blackboard</l> variable.
<1065> Returns <1/> if the child task results in <2/> or if the child task results in <3/> on a non-last iteration.
<1066> Returns <1/> if the child task results in <2/>.
<1067> Returns <1/> if the child task results in <2/> on the last iteration.
<1068> <l1>array_var</l>
<1069> <l1>save_var</l>
<1070> <1/> <b>array_var</b> = <2/> <l3>🔗</l>
<1071> <1/> <b>set_array_var</b>(value: <2/>)
<1072> <1/> <b>get_array_var</b>()
<1073> A variable within the <l1>Blackboard</l> that holds an <2/>, which is used for the iteration process.
@@ -0,0 +1,158 @@
<1074> <1/> <b>save_var</b> = <2/> <l3>🔗</l>
<1075> <1/> <b>set_save_var</b>(value: <2/>)
<1076> <1/> <b>get_save_var</b>()
<1077> A <l1>Blackboard</l> variable used to store an element of the array referenced by <l2>array_var</l>.
<1078> BTInstance
<1079> Represents a runtime instance of a <l1>BehaviorTree</l> resource.
<1080> Can be created using the <l1>BehaviorTree.instantiate</l> method.
<1081> <l1>monitor_performance</l>
<1082> <l1>get_agent</l>() <2/>
<1083> <l1>get_blackboard</l>() <2/>
<1084> <l1>get_last_status</l>() <2/>
<1085> <l1>get_owner_node</l>() <2/>
<1086> <l1>get_root_task</l>() <2/>
<1087> <l1>get_source_bt_path</l>() <2/>
<1088> <l1>is_instance_valid</l>() <2/>
<1089> <l1>register_with_debugger</l>()
<1090> <l1>unregister_with_debugger</l>()
<1091> <l1>update</l>(delta: <2/>)
<1092> <b>freed</b>() <l1>🔗</l>
<1093> Emitted when the behavior tree instance is freed. Used by debugger to unregister.
<1094> <b>updated</b>(status: <1/>) <l2>🔗</l>
<1095> Emitted when the behavior tree instance has finished updating.
<1096> <1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>
<1097> If <1/>, adds a performance monitor for this instance to “Debugger->Monitors” in the editor.
<1098> <1/> <b>get_agent</b>() <2/> <l3>🔗</l>
<1099> Returns the agent of the behavior tree instance.
<1100> <l1>Blackboard</l> <b>get_blackboard</b>() <2/> <l3>🔗</l>
<1101> Returns the blackboard of the behavior tree instance.
<1102> <l1>Status</l> <b>get_last_status</b>() <2/> <l3>🔗</l>
<1103> Returns the execution status of the last update.
<1104> <1/> <b>get_owner_node</b>() <2/> <l3>🔗</l>
<1105> Returns the scene <1/> that owns this behavior tree instance.
<1106> <l1>BTTask</l> <b>get_root_task</b>() <2/> <l3>🔗</l>
<1107> Returns the root task of the behavior tree instance.
<1108> <1/> <b>get_source_bt_path</b>() <2/> <l3>🔗</l>
<1109> Returns the file path to the behavior tree resource that was used to create this instance.
<1110> <1/> <b>is_instance_valid</b>() <2/> <l3>🔗</l>
<1111> Returns <1/> if the behavior tree instance is properly initialized and can be used.
<1112> <1/> <b>register_with_debugger</b>() <l2>🔗</l>
<1113> Registers the behavior tree instance with the debugger.
<1114> <1/> <b>unregister_with_debugger</b>() <l2>🔗</l>
<1115> Unregisters the behavior tree instance from the debugger. This is typically not necessary, as the debugger will automatically unregister the instance when it is freed.
<1116> <l1>Status</l> <b>update</b>(delta: <2/>) <l3>🔗</l>
<1117> Ticks the behavior tree instance and returns its status.
<1118> BTInvert
<1119> BT decorator that transforms <1/> into <2/> and <3/> into <4/>.
<1120> BTInvert transforms <1/> into <2/> and <3/> into <4/>.
<1121> BTNewScope
<1122> <b>Inherited By:</b> <l1>BTSubtree</l>
<1123> BT decorator that creates a new <l1>Blackboard</l> scope.
<1124> BTNewScope creates a new <l1>Blackboard</l> scope during initialization and populates it with data. See <l2>Blackboard</l>.
<1125> Returns the status of the child task execution.
<1126> <l1>blackboard_plan</l>
<1127> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
<1128> BTParallel
<1129> BT composite that executes all of its child tasks simultaneously.
<1130> BTParallel executes all of its child tasks simultaneously. Note that BTParallel doesn’t involve multithreading. It processes each task sequentially, from first to last, in the same tick before returning a result. If one of the abort criterea is met, any tasks currently <1/> will be terminated, and the result will be either <2/> or <3/>. The <l4>num_failures_required</l> determines when BTParallel fails and <l5>num_successes_required</l> when it succeeds. When both are fullfilled, it gives priority to <l6>num_failures_required</l>.
<1131> If set to <l1>repeat</l>, all child tasks will be re-executed each tick, regardless of whether they previously resulted in <2/> or <3/>.
<1132> Returns <1/> when the required number of child tasks result in <2/>. When <l3>repeat</l> is set to <4/>, if none of the criteria were met and all child tasks resulted in either <5/> or <6/>, BTParallel will return <7/>.
<1133> Returns <1/> when the required number of child tasks result in <2/>.
<1134> Returns <1/> if none of the criterea were fulfilled, and either <l2>repeat</l> is set to <3/> or a child task resulted in <4/>.
<1135> <l1>num_failures_required</l>
<1136> <l1>num_successes_required</l>
<1137> <l1>repeat</l>
<1138> <1/> <b>num_failures_required</b> = <2/> <l3>🔗</l>
<1139> <1/> <b>set_num_failures_required</b>(value: <2/>)
<1140> <1/> <b>get_num_failures_required</b>()
<1141> If the specified number of child tasks return <1/>, BTParallel will also return <2/>.
<1142> <1/> <b>num_successes_required</b> = <2/> <l3>🔗</l>
<1143> <1/> <b>set_num_successes_required</b>(value: <2/>)
<1144> <1/> <b>get_num_successes_required</b>()
<1145> If the specified number of child tasks return <1/>, BTParallel will also return <2/>.
<1146> <1/> <b>repeat</b> = <2/> <l3>🔗</l>
<1147> <1/> <b>set_repeat</b>(value: <2/>)
<1148> <1/> <b>get_repeat</b>()
<1149> When <1/>, the child tasks will be executed again, regardless of whether they previously resulted in a <2/> or <3/>.
<1150> When <1/>, if none of the criteria were met, and all child tasks resulted in a <2/> or <3/>, BTParallel will return <4/>.
<1151> BTPauseAnimation
<1152> BT action that pauses the playback of an animation on the specified <1/> node.
<1153> BTPauseAnimation action pauses the playback of an animation on the specified <1/> node and returns <2/>.
<1154> Returns <1/> if the action fails to get the <2/> node.
<1155> <l1>animation_player</l>
<1156> <l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>
<1157> BTPlayAnimation
<1158> BT action that plays an animation on the specified <1/> node.
<1159> BTPlayAnimation action plays an animation on the specified <1/> node. If the <l2>await_completion</l> is greater than <3/>, the action will wait for the animation to complete, with the maximum waiting time equal to <l4>await_completion</l>.
<1160> Returns <1/> if the animation finishes playing or if the elapsed time exceeds <l2>await_completion</l>. When <l3>await_completion</l> is set to <4/>, BTPlayAnimation doesn’t wait for the animation to finish and immediately returns <5/>.
<1161> Returns <1/> if the animation is still playing and the elapsed time is less than <l2>await_completion</l>.
<1162> Returns <1/> if the action fails to play the requested animation.
<1163> <l1>animation_name</l>
<1164> <l1>animation_player</l>
<1165> <l1>await_completion</l>
<1166> <l1>blend</l>
<1167> <l1>from_end</l>
<1168> <l1>speed</l>
<1169> <1/> <b>animation_name</b> = <2/> <l3>🔗</l>
<1170> Animation’s key within the <1/> node. If empty, BTPlayAnimation will resume the last played animation if the <2/> was previously paused.
<1171> <l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>
<1172> <1/> <b>await_completion</b> = <2/> <l3>🔗</l>
<1173> <1/> <b>set_await_completion</b>(value: <2/>)
<1174> <1/> <b>get_await_completion</b>()
<1175> The maximum duration to wait for the animation to complete (in seconds). If the animation doesn’t finish within this time, BTPlayAnimation will stop waiting and return <1/>.
<1176> <1/> <b>blend</b> = <2/> <l3>🔗</l>
<1177> <1/> <b>set_blend</b>(value: <2/>)
<1178> <1/> <b>get_blend</b>()
<1179> Custom blend time (in seconds). See AnimationPlayer.play.
<1180> <1/> <b>from_end</b> = <2/> <l3>🔗</l>
<1181> <1/> <b>set_from_end</b>(value: <2/>)
<1182> <1/> <b>get_from_end</b>()
<1183> Play animation from the end. Used in combination with negative <l1>speed</l> to play animation in reverse. See AnimationPlayer.play.
<1184> <1/> <b>speed</b> = <2/> <l3>🔗</l>
<1185> <1/> <b>set_speed</b>(value: <2/>)
<1186> <1/> <b>get_speed</b>()
<1187> Custom playback speed scaling ratio. See AnimationPlayer.play.
<1188> BTProbability
<1189> BT decorator that executes its child task with a given probability.
<1190> BTProbability executes its child task with a given probability defined by <l1>run_chance</l>.
<1191> Returns the result of the child task if it was executed; otherwise, it returns <1/>.
<1192> <l1>run_chance</l>
<1193> <1/> <b>run_chance</b> = <2/> <l3>🔗</l>
<1194> <1/> <b>set_run_chance</b>(value: <2/>)
<1195> <1/> <b>get_run_chance</b>()
<1196> Probability that defines how likely the child task will be executed.
<1197> BTProbabilitySelector
<1198> BT composite that chooses a child task to execute based on attached probabilities.
<1199> BTProbabilitySelector chooses a child task to execute based on attached probabilities. It is typically used for decision-making purposes. Probability distribution is calculated based on weights assigned to each child task.
<1200> Returns <1/> when a child task results in <2/>.
<1201> Returns <1/> when a child task results in <2/>.
<1202> The behavior of BTProbabilitySelector when a child task results in <1/> depends on the <l2>abort_on_failure</l> value:
<1203> If <l1>abort_on_failure</l> is <2/>, when a child task results in <3/>, BTProbabilitySelector will normalize the probability distribution over the remaining children and choose a new child task to be executed. If all child tasks fail, the composite will return <4/>.
<1204> If <l1>abort_on_failure</l> is <2/>, when a child task results in <3/>, BTProbabilitySelector will not choose another child task to be executed and will immediately return <4/>.
<1205> <l1>abort_on_failure</l>
<1206> <l1>get_probability</l>(child_idx: <2/>) <3/>
<1207> <l1>get_total_weight</l>() <2/>
<1208> <l1>get_weight</l>(child_idx: <2/>) <3/>
<1209> <l1>has_probability</l>(child_idx: <2/>) <3/>
<1210> <l1>set_probability</l>(child_idx: <2/>, probability: <3/>)
<1211> <l1>set_weight</l>(child_idx: <2/>, weight: <3/>)
<1212> <1/> <b>abort_on_failure</b> = <2/> <l3>🔗</l>
<1213> <1/> <b>set_abort_on_failure</b>(value: <2/>)
<1214> <1/> <b>get_abort_on_failure</b>()
<1215> If <1/>, BTProbabilitySelector will not choose another child to execute and will return <2/> when a child task results in <3/>.
<1216> <1/> <b>get_probability</b>(child_idx: <2/>) <3/> <l4>🔗</l>
<1217> Returns the child task’s selection probability.
<1218> <1/> <b>get_total_weight</b>() <2/> <l3>🔗</l>
<1219> Returns the total weight of all child tasks.
<1220> <1/> <b>get_weight</b>(child_idx: <2/>) <3/> <l4>🔗</l>
<1221> Returns the child task’s weight within the weighted probability selection algorithm.
<1222> <1/> <b>has_probability</b>(child_idx: <2/>) <3/> <l4>🔗</l>
<1223> Returns whether the child task at index <1/> participates within the weighted probability selection algorithm and has a probability assigned to it. Returns <2/> for <l3>BTComment</l> tasks.
<1224> <1/> <b>set_probability</b>(child_idx: <2/>, probability: <3/>) <l4>🔗</l>
<1225> Sets the child task’s weight calculated based on the desired probability.
<1226> <1/> <b>set_weight</b>(child_idx: <2/>, weight: <3/>) <l4>🔗</l>
<1227> Sets the child task’s weight for the weighted probability selection algorithm.
<1228> BTRandomSelector
<1229> BT composite that executes tasks in random order until first <1/>.
<1230> BTRandomSelector executes its child tasks in a random order until any child returns <1/>. If a child task results in <2/>, BTRandomSelector will immediately execute another child task until one of them returns <3/> or all of them result in <4/>.
<1231> Returns <1/> if a child task results in <2/>. BTRandomSelector will remember the execution order and the last child task that returned <3/>, ensuring it resumes from that point in the next tick.
@@ -0,0 +1,159 @@
<1232> BTRandomSequence
<1233> BT composite that executes tasks in random order as long as they return <1/>.
<1234> BTRandomSequence executes its child tasks in a random order as long as they return <1/>. If a child task results in <2/>, BTRandomSequence will immediately execute the next child task until one of them returns <3/> or all of them result in <4/>.
<1235> Returns <1/> if a child task results in <2/>. BTRandomSequence will remember the execution order and the last child task that returned <3/>, ensuring it resumes from that point in the next tick.
<1236> BTRandomWait
<1237> BT action that waits for a randomized duration to elapse and then returns <1/>.
<1238> BTRandomWait action waits for a randomized duration to elapse and then returns <1/>. The duration is randomized within the specified range, defined by <l2>min_duration</l> and <l3>max_duration</l>.
<1239> <l1>max_duration</l>
<1240> <l1>min_duration</l>
<1241> <1/> <b>max_duration</b> = <2/> <l3>🔗</l>
<1242> <1/> <b>set_max_duration</b>(value: <2/>)
<1243> <1/> <b>get_max_duration</b>()
<1244> Maximum duration for the wait.
<1245> <1/> <b>min_duration</b> = <2/> <l3>🔗</l>
<1246> <1/> <b>set_min_duration</b>(value: <2/>)
<1247> <1/> <b>get_min_duration</b>()
<1248> Minimum duration for the wait.
<1249> BTRepeat
<1250> BT decorator that repeats its child a specified number of <l1>times</l>.
<1251> BTRepeat iterates its child task a specified number of times, as defined by <l1>times</l>. If <l2>forever</l> is <3/>, the child’s execution will be repeated indefinitely.
<1252> Returns <1/> if the child task results in <2/>. If <l3>forever</l> is <4/>, BTRepeat will always return <5/>.
<1253> Returns <1/> if the specified number of successful executions is reached. If <l2>abort_on_failure</l> is <3/>, a <4/> status returned by the child is also considered a successful execution.
<1254> Returns <1/> if the child task results in <2/> when <l3>abort_on_failure</l> is <4/>.
<1255> <l1>abort_on_failure</l>
<1256> <l1>forever</l>
<1257> <l1>times</l>
<1258> <1/> <b>abort_on_failure</b> = <2/> <l3>🔗</l>
<1259> If <1/>, <2/> status returned by the child task is also considered as a successful execution.
<1260> <1/> <b>forever</b> = <2/> <l3>🔗</l>
<1261> <1/> <b>set_forever</b>(value: <2/>)
<1262> <1/> <b>get_forever</b>()
<1263> If <1/>, the child’s execution will be repeated indefinitely, always returning <2/>.
<1264> <1/> <b>times</b> = <2/> <l3>🔗</l>
<1265> <1/> <b>set_times</b>(value: <2/>)
<1266> <1/> <b>get_times</b>()
<1267> The number of times to repeat execution of the child task.
<1268> BTRepeatUntilFailure
<1269> BT decorator that repeats its child task until <1/>.
<1270> BTRepeatUntilFailure repeats its child task until it results in <1/>.
<1271> Returns <1/> if the child task results in <2/> or <3/>.
<1272> Returns <1/> if the child task results in <2/>.
<1273> BTRepeatUntilSuccess
<1274> BT decorator that repeats its child task until <1/>.
<1275> BTRepeatUntilSuccess repeats its child task until it results in <1/>.
<1276> Returns <1/> if the child task results in <2/> or <3/>.
<1277> Returns <1/> if the child task results in <2/>.
<1278> BTRunLimit
<1279> BT decorator that restricts the execution of its child a limited number of times.
<1280> BTRunLimit restricts the execution of the child task to a maximum number of times, defined by <l1>run_limit</l>.
<1281> Returns <1/> if the limit on executions is exceeded; otherwise, it returns the status of the child task.
<1282> <l1>CountPolicy</l>
<1283> <l1>count_policy</l>
<1284> <l1>run_limit</l>
<1285> enum <b>CountPolicy</b>: <l1>🔗</l>
<1286> <l1>CountPolicy</l> <b>COUNT_SUCCESSFUL</b> = <2/>
<1287> Count only successful runs towards the limit.
<1288> <l1>CountPolicy</l> <b>COUNT_FAILED</b> = <2/>
<1289> Count only failed runs towards the limit.
<1290> <l1>CountPolicy</l> <b>COUNT_ALL</b> = <2/>
<1291> Count successful and failed runs towards the limit.
<1292> <l1>CountPolicy</l> <b>count_policy</b> = <2/> <l3>🔗</l>
<1293> <1/> <b>set_count_policy</b>(value: <l2>CountPolicy</l>)
<1294> <l1>CountPolicy</l> <b>get_count_policy</b>()
<1295> Which runs should be counted towards the limit: successful, failed, or all?
<1296> <1/> <b>run_limit</b> = <2/> <l3>🔗</l>
<1297> <1/> <b>set_run_limit</b>(value: <2/>)
<1298> <1/> <b>get_run_limit</b>()
<1299> The maximum number of times the child is permitted to be executed.
<1300> BTSelector
<1301> BT composite that sequentially executes tasks until first <1/>.
<1302> BTSelector executes its child tasks sequentially, from first to last, until any child returns <1/>. If a child task results in <2/>, BTSelector will immediately execute the next child task until one of them returns <3/> or all of them result in <4/>. BTSelector and <l5>BTSequence</l> are two of the most common building blocks of behavior trees. Essentially, while <l6>BTSequence</l> is similar to a boolean AND operation, BTSelector is similar to a boolean OR operation. Selectors enable the behavior tree to respond to changes in the environment and trigger transitions between various fallback behaviors.
<1303> Returns <1/> if a child task results in <2/>. BTSelector will remember the last child task that returned <3/>, ensuring it resumes from that point in the next execution tick.
<1304> BTSequence
<1305> BT composite that sequentially executes tasks as long as they return <1/>.
<1306> BTSequence executes its child tasks sequentially, from first to last, as long as they return <1/>. If a child task results in <2/>, BTSequence will immediately execute the next child task until one of them returns <3/> or all of them result in <4/>. BTSequence and <l5>BTSelector</l> are two of the most common building blocks of behavior trees. Essentially, while <l6>BTSelector</l> is similar to a boolean OR operation, BTSequence is similar to a boolean AND operation. Sequences enable the behavior tree to compose complex behaviors from a chain of simpler tasks.
<1307> Returns <1/> if any child task results in <2/>. BTSequence will remember the last child task that returned <3/>, ensuring it resumes from that point in the next execution tick.
<1308> BTSetAgentProperty
<1309> BT action that assigns a value to the specified agent’s property.
<1310> BTSetAgentProperty assigns the specified <l1>value</l> to the agent’s property identified by the <l2>property</l> and returns <3/>. Optionally, it can perform a specific <l4>operation</l> before assignment.
<1311> Returns <1/> if it fails to set the property.
<1312> <l1>Operation</l>
<1313> <l1>operation</l>
<1314> <l1>property</l>
<1315> <l1>value</l>
<1316> <l1>Operation</l> <b>operation</b> = <2/> <l3>🔗</l>
<1317> <1/> <b>set_operation</b>(value: <l2>Operation</l>)
<1318> <l1>Operation</l> <b>get_operation</b>()
<1319> Specifies the operation to be performed before assignment. Operation is executed as follows:
<1320> <1/> <b>property</b> = <2/> <l3>🔗</l>
<1321> Parameter that specifies the agent’s property name.
<1322> <l1>BBVariant</l> <b>value</b> <l2>🔗</l>
<1323> Parameter that specifies the value that will be assigned to agent’s property.
<1324> BTSetVar
<1325> BT action that assigns <l1>value</l> to the <l2>variable</l> and then returns <3/>.
<1326> BTSetVar assigns <l1>value</l> to the <l2>variable</l> and then returns <3/>. Optionally, it can perform a specific <l4>operation</l> before assignment.
<1327> Returns <1/> if it fails to set the <l2>variable</l>.
<1328> <l1>operation</l>
<1329> <l1>value</l>
<1330> <l1>variable</l>
<1331> <l1>Operation</l> <b>operation</b> = <2/> <l3>🔗</l>
<1332> <l1>BBVariant</l> <b>value</b> <l2>🔗</l>
<1333> Parameter that specifies the value to be assigned to the variable.
<1334> <1/> <b>variable</b> = <2/> <l3>🔗</l>
<1335> Name of the variable to which the value will be assigned.
<1336> BTStopAnimation
<1337> BT action that stops the playback of an animation on the specified <1/> node.
<1338> BTStopAnimation action stops the playback of an animation on the specified <1/> node and returns <2/>. If <l3>animation_name</l> is set, it will only stop the playback if the specified animation is currently playing.
<1339> <l1>animation_name</l>
<1340> <l1>animation_player</l>
<1341> <l1>keep_state</l>
<1342> <1/> <b>animation_name</b> = <2/> <l3>🔗</l>
<1343> Animation’s key within the <1/> node. If not empty, BTStopAnimation will only stop the playback if the specified animation is currently playing.
<1344> <l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>
<1345> <1/> <b>keep_state</b> = <2/> <l3>🔗</l>
<1346> <1/> <b>set_keep_state</b>(value: <2/>)
<1347> <1/> <b>get_keep_state</b>()
<1348> If <1/>, the animation state is not updated visually.
<1349> BTSubtree
<1350> <b>Inherits:</b> <l1>BTNewScope</l> <b><</b> <l2>BTDecorator</l> <b><</b> <l3>BTTask</l> <b><</b> <l4>BT</l>
<1351> BT decorator that instantiates and runs a subtree within the larger tree.
<1352> BTSubtree instantiates a <l1>BehaviorTree</l> and includes its root task as a child during initialization, while also creating a new <l2>Blackboard</l> scope.
<1353> Returns the status of the subtree’s execution.
<1354> Subtree blackboard variables can be mapped to the main tree blackboard plan variables. Check out mapping section in the inspector.
<1355> Note: BTSubTree is designed as a simpler loader, and does not support updating <l1>subtree</l> at runtime. A custom subtree decorator is better suited:
<1356> This allows for the <l1>BehaviorTree</l> to load a specific behavior tree from a variable in the blackboard, or from some other location, and use that new behavior tree at runtime.
<1357> <l1>subtree</l>
<1358> <l1>BehaviorTree</l> <b>subtree</b> <l2>🔗</l>
<1359> <1/> <b>set_subtree</b>(value: <l2>BehaviorTree</l>)
<1360> <l1>BehaviorTree</l> <b>get_subtree</b>()
<1361> A <l1>BehaviorTree</l> resource that will be instantiated as a subtree.
<1362> BTTimeLimit
<1363> BT decorator that sets a time limit for its child’s execution.
<1364> BTTimeLimit allocates a limited time for the child’s execution and aborts it, returning <1/> if the <l2>time_limit</l> is exceeded.
<1365> Returns <1/> if the <l2>time_limit</l> is exceeded; otherwise, it returns the status of the child task.
<1366> <l1>time_limit</l>
<1367> <1/> <b>time_limit</b> = <2/> <l3>🔗</l>
<1368> <1/> <b>set_time_limit</b>(value: <2/>)
<1369> <1/> <b>get_time_limit</b>()
<1370> Time allocated for the child task’s execution.
<1371> BTWait
<1372> BT action that waits for a specified <l1>duration</l> to elapse and then returns <2/>.
<1373> <l1>duration</l>
<1374> <1/> <b>duration</b> = <2/> <l3>🔗</l>
<1375> There is currently no description for this property. Please help us by contributing one!
<1376> BTWaitTicks
<1377> BT action that waits for a specified number of ticks to elapse and then returns <1/>.
<1378> <l1>num_ticks</l>
<1379> <1/> <b>num_ticks</b> = <2/> <l3>🔗</l>
<1380> <1/> <b>set_num_ticks</b>(value: <2/>)
<1381> <1/> <b>get_num_ticks</b>()
<1382> The number of ticks to wait before returning <1/>.
<1383> LimboUtility
<1384> Helper functions for LimboAI.
<1385> <l1>decorate_output_var</l>(variable: <2/>) <3/>
<1386> <l1>decorate_var</l>(variable: <2/>) <3/>
<1387> <l1>get_check_operator_string</l>(check: <l2>CheckType</l>) <3/>
<1388> <l1>get_operation_string</l>(operation: <l2>Operation</l>) <3/>
<1389> <l1>get_status_name</l>(status: <2/>) <3/>
<1390> <l1>get_task_icon</l>(class_or_script_path: <2/>) <3/>
@@ -0,0 +1,61 @@
<1391> <l1>perform_check</l>(check: <l2>CheckType</l>, a: <3/>, b: <4/>)
<1392> <l1>perform_operation</l>(operation: <l2>Operation</l>, a: <3/>, b: <4/>)
<1393> enum <b>CheckType</b>: <l1>🔗</l>
<1394> <l1>CheckType</l> <b>CHECK_EQUAL</b> = <2/>
<1395> Equality Check.
<1396> <l1>CheckType</l> <b>CHECK_LESS_THAN</b> = <2/>
<1397> Less Than Check.
<1398> <l1>CheckType</l> <b>CHECK_LESS_THAN_OR_EQUAL</b> = <2/>
<1399> Less Than or Equal To Check.
<1400> <l1>CheckType</l> <b>CHECK_GREATER_THAN</b> = <2/>
<1401> Greater Than Check.
<1402> <l1>CheckType</l> <b>CHECK_GREATER_THAN_OR_EQUAL</b> = <2/>
<1403> Greater Than or Equal To Check
<1404> <l1>CheckType</l> <b>CHECK_NOT_EQUAL</b> = <2/>
<1405> Inequality Check.
<1406> enum <b>Operation</b>: <l1>🔗</l>
<1407> <l1>Operation</l> <b>OPERATION_NONE</b> = <2/>
<1408> No operation.
<1409> <l1>Operation</l> <b>OPERATION_ADDITION</b> = <2/>
<1410> Arithmetic addition.
<1411> <l1>Operation</l> <b>OPERATION_SUBTRACTION</b> = <2/>
<1412> Arithmetic subtraction.
<1413> <l1>Operation</l> <b>OPERATION_MULTIPLICATION</b> = <2/>
<1414> Arithmetic multiplication.
<1415> <l1>Operation</l> <b>OPERATION_DIVISION</b> = <2/>
<1416> Arithmetic division.
<1417> <l1>Operation</l> <b>OPERATION_MODULO</b> = <2/>
<1418> Produces the remainder of an integer division.
<1419> <l1>Operation</l> <b>OPERATION_POWER</b> = <2/>
<1420> Multiply <1/> by itself <2/> times.
<1421> <l1>Operation</l> <b>OPERATION_BIT_SHIFT_LEFT</b> = <2/>
<1422> Bitwise left shift.
<1423> <l1>Operation</l> <b>OPERATION_BIT_SHIFT_RIGHT</b> = <2/>
<1424> Bitwise right shift.
<1425> <l1>Operation</l> <b>OPERATION_BIT_AND</b> = <2/>
<1426> Bitwise AND.
<1427> <l1>Operation</l> <b>OPERATION_BIT_OR</b> = <2/>
<1428> Bitwise OR.
<1429> <l1>Operation</l> <b>OPERATION_BIT_XOR</b> = <2/>
<1430> Bitwise XOR.
<1431> <1/> <b>decorate_output_var</b>(variable: <2/>) <3/> <l4>🔗</l>
<1432> Just like <l1>decorate_var</l>, produces a string with a <l2>Blackboard</l> variable name that is formatted for display, and also adds an additional symbol to indicate that the variable is used as an output.
<1433> <1/> <b>decorate_var</b>(variable: <2/>) <3/> <l4>🔗</l>
<1434> Produces a string with a <l1>Blackboard</l> variable name that is formatted for display or console output.
<1435> <1/> <b>get_check_operator_string</b>(check: <l2>CheckType</l>) <3/> <l4>🔗</l>
<1436> Returns an operator string for a <l1>CheckType</l> enum value. For example, <l2>CHECK_EQUAL</l> returns “==”.
<1437> <1/> <b>get_operation_string</b>(operation: <l2>Operation</l>) <3/> <l4>🔗</l>
<1438> Returns a string representation of an <l1>Operation</l> enum value.
<1439> <1/> <b>get_status_name</b>(status: <2/>) <3/> <l4>🔗</l>
<1440> Returns a name of a <l1>BTTask</l> status code.
<1441> <1/> <b>get_task_icon</b>(class_or_script_path: <2/>) <3/> <l4>🔗</l>
<1442> Returns the icon texture associated with a task based on its class name or script resource path.
<1443> <1/> <b>perform_check</b>(check: <l2>CheckType</l>, a: <3/>, b: <4/>) <l5>🔗</l>
<1444> Performs a <1/> on two values, <2/> and <3/>, and returns <4/> if the check passes.
<1445> <1/> <b>perform_operation</b>(operation: <l2>Operation</l>, a: <3/>, b: <4/>) <l5>🔗</l>
<1446> Performs an <1/> on two values, <2/> and <3/>, and returns the result.
<1447> Getting started
<1448> Behavior Trees
<1449> Hierarchical State MachineS
<1450> Class reference
<1451> LimboAI 1.0 documentation
File diff suppressed because it is too large Load Diff
+294
View File
@@ -0,0 +1,294 @@
"""Rebuild the Chinese HTML from translated templates."""
import json, re, sys, glob, html as htmllib
from bs4 import BeautifulSoup, Comment, NavigableString
ROOT = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable"
SRC = ROOT + "/index.html"
OUT = ROOT + "/index.zh.html"
I18N = ROOT + "/_i18n"
sys.path.insert(0, I18N)
from serialize import collect # noqa: E402
CHECK_ONLY = "--check" in sys.argv
soup = BeautifulSoup(open(SRC, encoding="utf-8").read(), "lxml")
blocks = collect(soup)
title_node = soup.find("title")
uniq = json.load(open(I18N + "/uniq.json", encoding="utf-8"))["uniq"]
def key_of(tpl, markers):
return tpl + "\x00" + json.dumps(markers, sort_keys=True)
key2uid = {k: v["uid"] for k, v in uniq.items()}
trans = {}
for f in sorted(glob.glob(I18N + "/trans/batch*.json")):
for k, v in json.load(open(f, encoding="utf-8")).items():
trans[int(k)] = v
for b in blocks:
b["uid"] = key2uid.get(key_of(b["tpl"], b["markers"]))
tok_re = re.compile(r"<(l\d+)>|</l\d*>|<([bi])>|</[bi]>|<(\d+)/>")
def norm(t):
"""normalise the tolerated closing-tag variants written by the translator"""
return re.sub(r"</l\d*>", "</l>", t)
def tokens(t):
"""only the tokens that MUST round-trip identically: opaque ids and anchor ids"""
return sorted(m.group(0) for m in re.finditer(r"<(l\d+)>|</l\d*>|<(\d+)/>", t)
if m.group(2) or m.group(1))
def balanced(t):
"""<b>/<i> pairs must be balanced (extra emphasis is allowed)"""
depth = 0
for m in re.finditer(r"<([bi])>|</([bi])>", t):
depth += 1 if m.group(1) else -1
if depth < 0:
return False
return depth == 0
def markers_ok(b, zh):
zh = norm(zh)
return tokens(b["tpl"]) == tokens(zh) and balanced(zh)
untranslated = [b for b in blocks if b["uid"] not in trans]
bad = [b for b in blocks if b["uid"] in trans and not markers_ok(b, trans[b["uid"]])]
print("blocks:", len(blocks),
"| untranslated:", len(untranslated),
"| marker problems:", len(bad))
for b in bad[:20]:
print("--- uid", b["uid"])
print(" en:", b["tpl"][:200])
print(" zh:", trans[b["uid"]][:200])
if CHECK_ONLY:
sys.exit(0)
def rebuild(tpl, markers):
"""turn a translated template back into HTML"""
tpl = norm(tpl)
out, pos = [], 0
for m in tok_re.finditer(tpl):
out.append(htmllib.escape(tpl[pos:m.start()], quote=False))
g = m.group(0)
if g.startswith("<l"):
out.append(markers[g[2:-1]]) # nested anchor: keep as-is
elif g == "</l>":
out.append("</a>")
elif g.startswith("<b>") or g.startswith("<i>"):
out.append("<strong>" if g.startswith("<b") else "<em>")
elif g.startswith("</b") or g.startswith("</i"):
out.append("</strong>" if g.startswith("</b") else "</em>")
else:
out.append(markers[re.search(r"\d+", g).group(0)])
pos = m.end()
out.append(htmllib.escape(tpl[pos:], quote=False))
return "".join(out)
def replace_anchor_inner(marker_html, new_inner):
"""keep the original <a> attributes + inner wrapper, swap the text"""
frag = BeautifulSoup(marker_html, "html.parser")
root = frag.find(True)
node = root
while True:
kids = [k for k in node.children if not isinstance(k, Comment)]
if len(kids) == 1 and getattr(kids[0], "name", None):
node = kids[0]
else:
break
for k in list(node.children):
k.extract()
inner = BeautifulSoup(new_inner, "html.parser")
for k in list(inner.children):
node.append(k.extract())
return str(root)
def build_block_html(tpl, markers):
parts = re.split(r"(<l\d+>.*?</l\d*>)", norm(tpl), flags=re.S)
out = []
for p in parts:
m = re.fullmatch(r"<l(\d+)>(.*?)</l\d*>", p, flags=re.S)
if m:
inner = rebuild(m.group(2), markers)
out.append(replace_anchor_inner(markers[m.group(1)], inner))
else:
out.append(rebuild(p, markers))
return "".join(out)
def set_inner(el, html_str):
el.clear()
frag = BeautifulSoup(html_str, "html.parser")
for k in list(frag.children):
el.append(k.extract())
collect_ids = set(id(b["node"]) for b in blocks if b["node"] is not None)
# a block that *contains* other collected blocks (e.g. <td><p>…) must keep its own
# markup untouched - its text is rebuilt by those nested blocks
containers = set()
for b in blocks:
n = b["node"]
if n is None:
continue
if any(id(d) in collect_ids for d in n.find_all(True)):
containers.add(id(n))
print("container blocks kept as-is:", len(containers))
fixed = 0
for b in blocks:
uid = b["uid"]
zh = trans.get(uid, b["tpl"])
if uid not in trans or not markers_ok(b, zh):
continue
if id(b["node"]) in containers:
continue
headerlinks = [h.extract() for h in b["node"].find_all("a", class_="headerlink")]
html_str = build_block_html(zh, b["markers"])
set_inner(b["node"], html_str)
for h in headerlinks:
b["node"].append(h)
fixed += 1
if title_node is not None and 1451 in trans:
title_node.string = trans[1451]
# ---------------------------------------------------------------- polish pass
ABBR_TITLE = {
"No return value.": "无返回值。",
"This method has no side effects. It doesn't modify any of the instance's member variables.":
"该方法没有副作用,不会修改实例的任何成员变量。",
"This method should typically be overridden by the user to have any effect.":
"该方法通常需要由用户重写才能生效。",
"This method doesn't need an instance to be called, so it can be called directly using the class name.":
"该方法无需实例即可调用,因此可以直接用类名调用。",
}
for el in soup.find_all(attrs={"title": True}):
t = el.get("title")
if t in ABBR_TITLE:
el["title"] = ABBR_TITLE[t]
# breadcrumb
for li in soup.select("li.breadcrumb-item"):
if li.get_text(strip=True) == "LimboAI 1.0 documentation":
li.string = "LimboAI 1.0 文档"
# footer
foot = soup.find("footer")
if foot:
info = foot.find("div", {"role": "contentinfo"})
if info and info.find("p"):
info.find("p").string = "© 2023 年至今 Serhii Snitsaruk 及 LimboAI 贡献者。"
for child in list(foot.children):
if isinstance(child, NavigableString):
s = str(child)
s = s.replace("Built with", "使用 ")
s = s.replace("using a", " 构建,")
s = s.replace("provided by", " 由 ")
child.replace_with(s)
elif getattr(child, "name", None) == "a" and child.get_text(strip=True) == "theme":
child.string = "主题(theme)"
last = foot.contents[-1] if foot.contents else None
if isinstance(last, NavigableString):
last.replace_with(" 提供。\n")
# code comments inside <pre>
CODE_COMMENTS = {
"# Set common target shared between agents in a group:": "# 设置组内各智能体共享的公共目标:",
"# to prevent errors when the instance is freed.": "# 以避免实例被释放时出错。",
'# - Important: Avoid specifying a type for "obj" in GDScript': '# - 重要:在 GDScript 中不要为 "obj" 指定类型',
"# Access common target shared between agents in a group:": "# 访问组内各智能体共享的公共目标:",
'# Check if the "speed" variable exists:': '# 检查 "speed" 变量是否存在:',
'# Get object instance stored in the "object" variable.': '# 获取存储在 "object" 变量中的对象实例。',
'# Get the value of the "speed" variable, with a default value of 100.0 if not found:':
'# 获取 "speed" 变量的值,如果不存在则默认为 100.0:',
'# Handle the "movement_started" event here.': '# 在这里处理 "movement_started" 事件。',
"# It's quite handy when you need to pass some data to the event handler.":
"# 当你需要向事件处理器传递一些数据时,这非常方便。",
'# Set the behavior tree, or use a load("res://ai/trees/...") call':
'# 设置行为树,或使用 load("res://ai/trees/...") 调用',
'# Set the value of the "speed" variable:': '# 设置 "speed" 变量的值:',
"# Use chained methods and delegation to set up states:": "# 使用链式方法与委托来配置状态:",
"# `cargo` can be passed with the event when calling `dispatch()`.":
"# 调用 `dispatch()` 时可以随事件一起传入 `cargo`。",
"# Assume `hsm` is a LimboHSM instance and `bt_state` is a BTState instance":
"# 假设 `hsm` 是一个 LimboHSM 实例,`bt_state` 是一个 BTState 实例",
"# Called each time this task is ticked (aka executed).": "# 每次该任务被 tick(即被执行)时调用。",
"# Called to generate a display name for the task (requires @tool).":
"# 调用它来为任务生成显示名称(需要 @tool)。",
"# Called to generate a display name for the task.": "# 调用它来为任务生成显示名称。",
"# Called to initialize the task.": "# 调用它来初始化任务。",
"# Called when the task is entered.": "# 当任务被进入时调用。",
"# Called when the task is executed.": "# 当任务被执行时调用。",
"# Called when the task is exited.": "# 当任务被退出时调用。",
"# Example: programmatically link a BT blackboard variable to an HSM blackboard variable":
"# 示例:用代码把 BT 黑板变量链接到 HSM 黑板变量",
"# NOTE: variable names do not need to match": "# 注意:变量名不必相同",
"# Strings returned from this method are displayed as warnings in the editor.":
"# 此方法返回的字符串会作为警告显示在编辑器中。",
"# Task parameters.": "# 任务参数。",
"## AgentGroup node: Manages the shared Blackboard for agents in a group.":
"## AgentGroup 节点:管理组内各智能体共享的 Blackboard。",
'## At minimum, you only need to define the "_tick" method.': '## 至少只需要定义 "_tick" 方法。',
"## Called each frame when this state is active.": "## 当该状态处于活动状态时每帧调用。",
"## Called once, when state is initialized.": "## 状态初始化时调用一次。",
"## Called when state is entered.": "## 当状态被进入时调用。",
"## Called when state is exited.": "## 当状态被退出时调用。",
"## Children of this node are assumed to be agents that belong to a common group.":
"## 该节点的子节点被假定为属于同一组的智能体。",
"## InRange condition checks if the agent is within a range of target,":
"## InRange 条件检查智能体是否处于目标的某个范围内,",
"## Note: Each method declaration is optional.": "## 注意:每个方法声明都是可选的。",
"## PlayAnimation: Play an animation on AnimationPlayer, and wait for it to finish.":
"## PlayAnimation:在 AnimationPlayer 上播放动画,并等待其播放完毕。",
"## Returns FAILURE if the node is not found.": "## 如果找不到该节点,返回 FAILURE。",
"## Returns SUCCESS if the agent is within the defined range;":
"## 如果智能体处于定义的范围内,返回 SUCCESS;",
"## Shows or hides a node and returns SUCCESS.": "## 显示或隐藏一个节点并返回 SUCCESS。",
'## This implementation assumes that each agent has a "BTPlayer" node for AI.':
'## 该实现假定每个智能体都有一个用于 AI 的 "BTPlayer" 节点。',
"## defined by distance_min and distance_max.": "## 该范围由 distance_min 和 distance_max 定义。",
"## otherwise, returns FAILURE.": "## 否则返回 FAILURE。",
}
hits = 0
for pre in soup.find_all("pre"):
for txt in pre.find_all(string=True):
s = str(txt)
orig = s
for en, zh in CODE_COMMENTS.items():
if en in s:
s = s.replace(en, zh)
if s != orig:
txt.replace_with(s)
hits += 1
print("code comment spans translated:", hits)
# translation badge in the sidebar
logo_link = soup.select_one(".wy-side-nav-search > a")
if logo_link is not None:
badge = BeautifulSoup(
'<p style="font-size:0.78em;opacity:0.8;margin:0.35em 0 0.2em;">'
'中文汉化版 · 基于官方英文文档翻译,欢迎对照原文阅读</p>', "html.parser")
for k in list(badge.children):
logo_link.insert_after(k.extract())
out = str(soup)
out = out.replace('<html class="writer-html5" lang="en"',
'<html class="writer-html5" lang="zh-CN"', 1)
out = out.replace("<title>LimboAI 1.0 documentation</title>",
"<title>LimboAI 1.0 中文文档</title>")
open(OUT, "w", encoding="utf-8").write(out)
print("rebuilt blocks:", fixed, "->", OUT)
+57
View File
@@ -0,0 +1,57 @@
"""Extract translatable text nodes from the Sphinx single-page HTML dump."""
import json, re, sys
from bs4 import BeautifulSoup, NavigableString, Comment
SRC = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/index.html"
OUT = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/_i18n/strings.json"
SKIP_TAGS = {"script", "style", "code", "pre", "kbd", "samp", "var", "tt"}
SKIP_CLASS = {"headerlink", "wy-breadcrumbs-aside", "version-switch", "language-switch"}
html = open(SRC, encoding="utf-8").read()
soup = BeautifulSoup(html, "lxml")
records = []
counter = 0
def parent_skipped(node):
for p in node.parents:
if getattr(p, "name", None) is None:
continue
if p.name in SKIP_TAGS:
return True
cls = p.get("class") or []
if any(c in SKIP_CLASS for c in cls):
return True
return False
def has_letter(t):
return bool(re.search(r"[A-Za-z]", t)) or bool(re.search(r"[\u4e00-\u9fff]", t))
for node in soup.find_all(string=True):
if isinstance(node, Comment):
continue
t = str(node)
if not has_letter(t):
continue
if parent_skipped(node):
continue
# keep trailing/leading spaces for reconstruction
stripped = t.strip()
if not stripped:
continue
counter += 1
records.append({
"id": counter,
"text": t,
"parents": [p.name for p in node.parents if getattr(p, "name", None)][:4],
})
json.dump(records, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
total_chars = sum(len(r["text"]) for r in records)
print("nodes:", len(records), "chars:", total_chars)
from collections import Counter
print(Counter(tuple(r["parents"][:2]) for r in records).most_common(20))
@@ -0,0 +1,83 @@
"""Extract translatable BLOCKS (whole paragraph / list item / heading level units)
from the Sphinx single-page HTML dump, keeping inline markup intact so that
context-aware translation is possible.
Output: _i18n/blocks.json -> list of {id, path, html, text}
Then translator fills _i18n/trans/<n>.json as {"id": "<translated html>"}.
"""
import json, re
from bs4 import BeautifulSoup, NavigableString, Comment
SRC = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/index.html"
OUT = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/_i18n/blocks.json"
BLOCK_TAGS = {"p", "h1", "h2", "h3", "h4", "h5", "h6", "td", "th", "dt", "dd",
"figcaption", "caption", "li", "blockquote"}
# inline tags that must never be translated / never contain translatable prose
OPAQUE = {"code", "pre", "kbd", "samp", "var", "tt", "img", "script", "style"}
SKIP_CLASS = {"headerlink", "version-switch", "language-switch", "wy-breadcrumbs-aside"}
html = open(SRC, encoding="utf-8").read()
soup = BeautifulSoup(html, "lxml")
blocks = []
def clean_html(node):
"""inner HTML of node with headerlink anchors and comments removed."""
clone = BeautifulSoup(str(node), "lxml")
for tag in clone.find_all(True):
cls = tag.get("class") or []
if tag.name == "a" and "headerlink" in cls:
tag.decompose()
out = clone.decode_contents()
out = re.sub(r"<!--.*?-->", "", out, flags=re.S)
return out.strip()
def is_candidate(node):
if node.name not in BLOCK_TAGS:
return False
# li that directly contains p -> the p is the block, li is container
if node.name == "li" and node.find("p", recursive=False):
return False
for p in node.parents:
if getattr(p, "name", None) in OPAQUE:
return False
return True
seen = set()
for node in soup.find_all(True):
if not is_candidate(node):
continue
if node.name == "blockquote" and node.find(["p", "li"]):
continue # inner p handled separately
h = clean_html(node)
txt = node.get_text(" ", strip=True)
if not re.search(r"[A-Za-z]", txt):
continue
key = (node.name, h)
path = "/".join([p.get("id") or p.name for p in list(node.parents)[:3][::-1] if getattr(p, "name", None)])
blocks.append({"tag": node.name, "path": path, "html": h, "text": txt})
seen.add(key)
# title + sidebar captions / nav labels are handled as generic elements too
extra = []
for t in soup.find_all(["title"]):
extra.append({"tag": "title", "path": "head", "html": t.get_text(), "text": t.get_text()})
for cap in soup.select("p.caption span.caption-text, nav a, .wy-menu a"):
txt = cap.get_text(" ", strip=True)
if not re.search(r"[A-Za-z]", txt):
continue
extra.append({"tag": "nav", "path": "nav", "html": clean_html(cap) or txt, "text": txt})
allb = extra + blocks
json.dump(allb, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
uniq = {}
for b in allb:
uniq.setdefault(b["html"], b)
print("blocks:", len(allb), "unique html:", len(uniq), "unique chars:", sum(len(k) for k in uniq))
from collections import Counter
print(Counter(b["tag"] for b in allb).most_common())
+33
View File
@@ -0,0 +1,33 @@
"""Report text that is still English in the localized page (gap finder)."""
import re, sys
from bs4 import BeautifulSoup, NavigableString, Comment
SRC = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/index.zh.html"
SKIP = {"script", "style", "pre", "code", "kbd", "samp", "var", "tt"}
soup = BeautifulSoup(open(SRC, encoding="utf-8").read(), "lxml")
rows = []
for node in soup.find_all(string=True):
if isinstance(node, Comment):
continue
t = str(node).strip()
if not re.search(r"[A-Za-z]", t):
continue
if any(getattr(p, "name", None) in SKIP for p in node.parents):
continue
words = re.findall(r"[A-Za-z][A-Za-z'\-]+", t)
long_words = [w for w in words if len(w) > 2 and not w[0].isupper()]
if len(words) >= 4 or len(long_words) >= 2:
parents = "/".join(p.name for p in list(node.parents)[:3])
rows.append((parents, t))
print("leftover english-ish text nodes:", len(rows))
seen = set()
for p, t in rows:
k = t[:60]
if k in seen:
continue
seen.add(k)
print(" [%s] %s" % (p, t[:150]))
if len(seen) > 40:
break
+42
View File
@@ -0,0 +1,42 @@
"""Assign stable uids to unique translatable templates and slice them into batch files."""
import json, re, os
from bs4 import BeautifulSoup
from serialize import collect, SRC
OUTDIR = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/_i18n"
soup = BeautifulSoup(open(SRC, encoding="utf-8").read(), "lxml")
blocks = collect(soup)
blocks.append({"kind": "title", "tag": "title",
"tpl": soup.find("title").get_text(), "markers": {}, "node": None})
os.makedirs(OUTDIR + "/batches", exist_ok=True)
os.makedirs(OUTDIR + "/trans", exist_ok=True)
def key(b):
return b["tpl"] + "\x00" + json.dumps(b["markers"], sort_keys=True)
uniq = {}
for b in blocks: # document order preserved
k = key(b)
if k not in uniq:
uniq[k] = {"uid": len(uniq) + 1, "tpl": b["tpl"], "markers": b["markers"]}
json.dump({"uniq": uniq},
open(f"{OUTDIR}/uniq.json", "w", encoding="utf-8"), ensure_ascii=False, indent=1)
CHARS = 12000
batch, size, nb = [], 0, 0
for v in uniq.values():
batch.append("<%d> %s" % (v["uid"], v["tpl"].replace("\n", " ⏎ ")))
size += len(v["tpl"]) + 12
if size >= CHARS:
nb += 1
open(f"{OUTDIR}/batches/batch{nb:02d}.txt", "w", encoding="utf-8").write("\n".join(batch))
batch, size = [], 0
if batch:
nb += 1
open(f"{OUTDIR}/batches/batch{nb:02d}.txt", "w", encoding="utf-8").write("\n".join(batch))
print("unique:", len(uniq), "batches:", nb)
+120
View File
@@ -0,0 +1,120 @@
"""Serialize translatable blocks into compact marker templates.
Marker scheme (short => cheap to reproduce while translating):
<n/> opaque inline element (code / img / kbd / abbr-with-code-text) - kept verbatim
<l n>..</l> link (<a>): inner text is translatable, anchor markup is restored later
<b>..</b> <strong>
<i>..</i> <em>
everything else inline is transparent (unwrapped) but its text is translatable
"""
import json, re, sys
from bs4 import BeautifulSoup, NavigableString, Comment
SRC = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/index.html"
OUT = r"C:/Users/yvmou/Downloads/limboai-readthedocs-io-en-stable/limboai-stable/_i18n/blocks.json"
BLOCK_TAGS = {"p", "h1", "h2", "h3", "h4", "h5", "h6", "td", "th", "dt", "dd",
"figcaption", "caption", "li"}
OPAQUE = {"code", "kbd", "samp", "var", "tt", "img", "pre", "script", "style", "math"}
TRANSPARENT = {"span", "cite", "markdown", "mark", "small", "sub", "sup", "u", "s", "q"}
class Ser:
def __init__(self):
self.markers = {}
self.n = 0
def add(self, html):
self.n += 1
self.markers[str(self.n)] = html
return self.n
def walk(self, node, out):
for ch in node.children:
if isinstance(ch, Comment):
continue
if isinstance(ch, NavigableString):
s = re.sub(r"\s+", " ", str(ch))
if s:
out.append(s)
continue
name = ch.name
cls = ch.get("class") or []
if name == "a" and "headerlink" in cls:
continue
if name in OPAQUE or name == "abbr":
out.append("<%d/>" % self.add(str(ch)))
continue
if name in TRANSPARENT:
self.walk(ch, out)
continue
if name == "a":
idx = self.add(str(ch))
out.append("<l%d>" % idx)
self.walk(ch, out)
out.append("</l>")
continue
if name == "strong":
out.append("<b>")
self.walk(ch, out)
out.append("</b>")
continue
if name in ("em", "dfn"):
out.append("<i>")
self.walk(ch, out)
out.append("</i>")
continue
self.walk(ch, out)
def run(self, tag):
out = []
self.walk(tag, out)
tpl = "".join(out)
tpl = re.sub(r"[ \t]*\n[ \t]*", "\n", tpl)
tpl = re.sub(r"\n{2,}", "\n", tpl).strip()
return tpl
def serialize(node, kind, feed):
s = Ser()
tpl = s.run(node)
if not re.search(r"[A-Za-z]", re.sub(r"<[^>]*>", "", tpl)):
return
feed.append({"kind": kind, "tag": node.name, "tpl": tpl, "markers": s.markers,
"node": node})
def collect(soup):
"""Walk the document exactly the way the extractor did."""
feed = []
body = soup.find("div", {"role": "main"})
for node in body.find_all(True):
if node.name not in BLOCK_TAGS:
continue
if node.name == "li" and node.find("p", recursive=False):
continue
for p in node.parents:
if getattr(p, "name", None) in ("pre", "code"):
break
else:
serialize(node, "body", feed)
for cap in soup.select("p.caption span.caption-text"):
serialize(cap, "nav", feed)
for a in soup.select("div.wy-menu a, nav a"):
if a.find_parent("div", class_="wy-menu") is None:
continue
serialize(a, "nav", feed)
return feed
if __name__ == "__main__":
blocks = collect(BeautifulSoup(open(SRC, encoding="utf-8").read(), "lxml"))
plain = [{"kind": b["kind"], "tag": b["tag"], "path": "", "html": b["tpl"],
"text": re.sub(r"<[^>]*>", "", b["tpl"]), "markers": b["markers"]}
for b in blocks]
json.dump(plain, open(OUT, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
uniq = {}
for b in blocks:
uniq.setdefault(b["tpl"] + "\x00" + json.dumps(b["markers"], sort_keys=True), b)
print("blocks:", len(blocks), "unique:", len(uniq),
"unique tpl chars:", sum(len(b["tpl"]) for b in uniq.values()))
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,89 @@
{
"1": "LimboAI 文档",
"2": "<b>LimboAI</b> 是一个面向 <b>Godot Engine 4</b> 的开源 C++ 模块,将<b>行为树</b>与<b>状态机</b>结合在一起,用于打造你游戏的 AI。它自带行为树编辑器、内置文档、可视化调试器等!虽然它是用 C++ 实现的,但完全支持用 GDScript 来<l1>创建你自己的任务</l1>和状态。完整功能列表见 <l2>LimboAI GitHub</l> 页面。",
"3": "<b>行为树</b>是一种强大的层次结构,用于建模和控制游戏中智能体(例如角色、敌人、实体)的行为。它旨在让你更轻松地为游戏创建复杂且高度模块化的行为。想进一步了解行为树,请参阅<l1>行为树简介</l>。",
"4": "<b>分层状态机</b>是一种有限状态机,允许任意状态拥有自己的子状态机。这样你就可以把一个庞大的状态机拆解为多个较小的状态机,从而应对 AI 在状态与状态转换上的复杂度。",
"5": "获取 LimboAI",
"6": "LimboAI 既可以作为 C++ 模块使用,也可以作为 GDExtension 共享库使用。两者之间存在一些差异。简而言之,GDExtension 版本使用起来更方便,但功能上略有受限。模块版本提供更好的编辑器体验,性能也稍好一些,但需要使用包含导出模板的自定义引擎构建。无论你选择哪种方式,你的项目都能同时兼容两者,随时可以互相切换。",
"7": "选择你想使用的版本。如果拿不定主意,就从 GDExtension 版本开始。你随时可以改变决定 —— 两个版本完全兼容。",
"8": "获取 GDExtension 版本",
"9": "官方 <l1>LimboAI GitHub</l> 页面以及资源库(Asset Library)中都提供了预编译版本。",
"10": "GDExtension 是使用 LimboAI 插件最便捷的方式,但它有一些限制:",
"11": "不提供文档提示(tooltip)。",
"12": "由于依赖 Godot API 中不存在的引擎类,扩展版本中无法使用便捷的 <l1>BBParam</l> 属性编辑器。",
"13": "<b>🛈 另见:</b><l1>什么是 GDExtension?</l>",
"14": "安装步骤:",
"15": "确认你正在使用最新稳定版的 Godot 编辑器。",
"16": "为你的 LimboAI 实验创建一个新项目。",
"17": "在 Godot 中点击屏幕顶部的 AssetLib 标签,搜索 LimboAI 并下载。LimboAI 插件会连同示例项目文件一起下载。此时打印出的错误可以忽略,那是因为扩展库尚未加载。",
"18": "用 Project -> Reload project 重新加载项目。现在应该不会再打印任何错误了。",
"19": "在项目文件中找到名为 showcase.tscn 的场景文件并运行它。它是示例的入口点。",
"20": "获取模块版本",
"21": "官方 <l1>LimboAI GitHub</l> 页面提供预编译版本。",
"22": "在 <l1>GitHub releases</l> 中,下载适用于你平台的最新预编译发行版。",
"23": "从同一个发行版中下载示例项目压缩包。",
"24": "解压预编译编辑器与示例项目文件。",
"25": "启动预编译的编辑器可执行文件,导入并打开示例项目。",
"26": "运行项目。",
"27": "<b>重要</b>:使用模块版 LimboAI 导出游戏时,请务必使用同一个 GitHub 发行版构建中附带的预编译导出模板。",
"28": "在 C# 中使用 LimboAI",
"29": "下面介绍如何使用模块版本配合 C# 编写你的任务和状态。",
"30": "找到 LimboAI 的 NuGet 包文件。",
"31": "每个提供的构建都带有 GodotSharp 文件夹,其中的包位于 “GodotSharp/Tools/nupkgs/” 下。记下该目录路径,下一步会用到。",
"32": "使用以下命令添加一个本地 NuGet 包源:",
"33": "你的 C# 项目应该就能看到 LimboAI 的类并成功编译。",
"34": "关于 GDExtension,目前我只能确认模块版本与 C# 可以正常工作。遗憾的是,我在 GDExtension 版本上还没有成功过。如果你用 GDExtension 成功了,请通过 Discord 或邮件告诉我。",
"35": "参与贡献",
"36": "在 Godot 发布第三个 beta 或候选版本之前,我们以 Godot 引擎的最新稳定版作为开发目标。如果你想为本项目做贡献,请确保使用对应的 Godot 版本。",
"37": "我们遵循 <l1>Godot 代码风格指南</l>。请使用 <2/> 来保持风格一致。你可以用 <4/> 为 Git 安装 <3/> 钩子,把这一过程自动化。",
"38": "提交拉取请求(Pull Request)时,请保持次版本向后兼容。",
"39": "我们支持把 LimboAI 构建为 Godot 引擎的模块,也支持构建为 GDExtension 库。请确保你的贡献在两种方式下都兼容。我们的 CI 工作流会验证你的改动能否在两种配置下都编译通过。",
"40": "作为 Godot 引擎模块编译",
"41": "克隆 Godot 引擎仓库。",
"42": "切换到最新的稳定版 tag。",
"43": "把 LimboAI 仓库克隆到 <1/> 目录中。",
"44": "详细的引擎构建说明请参考 <l1>Godot 引擎文档</l>。",
"45": "使用 <1/> 构建选项可以编译<b>单元测试</b>。要运行它们,请带上 <2/> 命令行选项运行编译好的 Godot 可执行文件。",
"46": "构建 C# 包",
"47": "如果你希望从源码构建时启用 LimboAI 的 C# 支持,请按照 Godot 关于带 C# 支持从源码构建的说明操作:<l1>使用 .NET 编译</l>。LimboAI 的类会包含在该构建流程的输出中。",
"48": "作为 GDExtension 库编译",
"49": "你需要 SCons 构建工具和一个 C++ 编译器。另见<l1>编译</l>。运行 <2/> 即可为你当前的平台构建插件库。",
"50": "如果 <2/> 目录中还没有 <1/> 仓库,SCons 会自动克隆它。",
"51": "默认情况下,构建产物会被放到示例项目中:<1/>。",
"52": "其他选项与目标请查看 <1/>。",
"53": "为文档做贡献",
"54": "在线文档使用 <l1>Sphinx</l> 生成。源文件以 RST 格式放在 <2/> 目录中,可以在本地用 <3/> 构建。更多细节请参阅 <l4>Sphinx 文档</l>。",
"55": "类文档存放在 <1/> 目录下的 XML 文件中。如果你新建了类或修改了已有类,可以在 Godot 源码根目录下用 <2/> 选项运行编译好的 Godot 可执行文件,用来生成缺失的 XML 文件或类文档中对应文件的缺失片段。编辑完 XML 文件后,请再次用 <3/> 选项运行编译好的编辑器可执行文件,以更新并整理这些 XML 文件。",
"56": "类文档的 Sphinx RST 文件由 XML 文件经 Godot 脚本 <1/> 生成,并保存在 <2/> 目录中。该过程由我们自己的脚本 <3/> 完成。<4/> 中的 RST 文件不应手动编辑。",
"57": "行为树简介",
"58": "<b>🛈 注意:</b>示例项目中包含一个教程,通过直观的示例带你入门行为树。",
"59": "<b>行为树(BT)</b>是一种层次结构,用于建模和控制游戏中智能体(例如角色、敌人、实体)的行为。它旨在让你更轻松地为游戏创建复杂且高度模块化的行为。",
"60": "行为树由若干任务组成,这些任务代表具体的动作或决策规则。任务大致可分为两大类:控制任务和叶任务。<b>控制任务</b>决定树内的执行流程,包括 <l1>Sequence</l>、<l2>Selector</l> 和 <l3>Invert</l>。<b>叶任务</b>代表要执行的具体动作(例如移动或攻击),或是需要检查的条件。<l4>BTTask</l> 类为行为树的各种积木块提供了基础。这类任务可以<l5>通过 Blackboard 共享数据</l5>。",
"61": "<b>🛈 注意:</b>要<l1>创建你自己的动作</l1>,请继承 <l2>BTAction</l> 类。",
"62": "行为树通常每一帧都会处理一次。它自上而下遍历,由控制任务决定控制流。每个任务都有一个 <l1>_tick</l> 方法,负责执行任务的工作并返回表示进度的状态:<2/>、<3/> 或 <4/>。<5/> 和 <6/> 表示已完成工作的结果,而当一个任务需要不止一个 tick 才能完成时,就会返回 <7/> 状态。这些状态决定树的推进方式,其中 <8/> 状态通常意味着树会在下一帧继续执行。",
"63": "任务共有<i>四种类型</i>:",
"64": "<b>动作(Actions)</b>是执行实际工作的叶任务。",
"65": "例如:<l1>PlayAnimation</l>、<l2>Wait</l>。",
"66": "<b>条件(Conditions)</b>是执行各种检查的叶任务。",
"67": "例如:<l1>CheckVar</l>、<l2>InRange</l>。",
"68": "<b>组合任务(Composites)</b>可以拥有一个或多个子任务,并决定子任务的执行流程。",
"69": "例如:<l1>Sequence</l>、<l2>Selector</l>、<l3>Parallel</l>。",
"70": "<b>装饰器(Decorators)</b>只能拥有一个子任务,用于改变其子任务的运行方式。",
"71": "例如:<l1>AlwaysSucceed</l>、<l2>Invert</l>、<l3>TimeLimit</l>。",
"72": "<l1>Sequence</l> 是核心组合任务之一。它按顺序从第一个到最后一个执行子任务,直到其中一个返回 <2/>,或者全部返回 <3/>。换句话说,只要有任一子任务返回 <4/>,<l5>Sequence</l> 的执行就会被中止,并且 <l6>Sequence</l> 自身会返回 <7/>。",
"73": "<l1>Selector</l> 是另一个必不可少的组合任务。它按顺序从第一个到最后一个执行子任务,直到其中一个返回 <2/> 或全部返回 <3/>。换句话说,当某个子任务返回 <4/> 时,它就继续尝试下一个,直到找到那个返回 <5/> 的子任务。一旦某个子任务返回 <6/>,<l7>Selector</l> 就会停止,并同样返回 <8/>。<l9>Selector</l> 的目的就是找出一个能够成功的子任务。",
"74": "行为树通过<b>条件任务</b>来处理条件逻辑。这些任务检查特定条件,并根据智能体或其环境的状态返回 <1/> 或 <2/>(例如 “IsLowOnHealth”、“IsTargetInSight”)。条件可以与 <l3>Sequence</l> 和 <l4>Selector</l> 搭配使用,构建你的决策逻辑。",
"75": "<b>🛈 注意:</b>要<l1>创建你自己的条件</l1>,请继承 <l2>BTCondition</l> 类。",
"76": "请查阅 <l1>BTTask</l> 类的文档,它为行为树的各种积木块提供了基础。",
"77": "创建行为树",
"78": "本章介绍如何创建和调试行为树。",
"79": "为智能体添加行为树",
"80": "按照以下步骤,为新建或已有的智能体添加行为树:",
"81": "为你的智能体创建一个场景文件,或者打开一个已有的场景。",
"82": "在场景中添加一个 <l1>BTPlayer</l> 节点。",
"83": "选中 <l1>BTPlayer</l>,在检视面板(Inspector)中新建一个行为树。",
"84": "你也可以通过该属性的上下文菜单,把行为树保存到文件中。",
"85": "点击行为树属性,在 LimboAI 编辑器中打开它。",
"86": "调试行为树",
"87": "在 Godot 引擎中,依次打开 “Bottom Panel > Debugger > LimboAI” 标签页。借助 LimboAI 调试器,你可以查看运行中的项目里任何当前处于活动状态的行为树。调试器可以从主编辑器窗口中分离出来,如果你使用 HiDPI 显示器或第二块屏幕,这会特别有用。"
}
@@ -0,0 +1,94 @@
{
"88": "查看任务属性与黑板",
"89": "当你在 LimboAI 调试器中点击某个任务时,它的属性会显示在远程检视面板(Remote Inspector)中,其中包含 <l1>Blackboard</l> 引用。点击 <l2>Blackboard</l> 可以打开它,查看整条作用域链上的所有变量,并按作用域分组。你还可以实时修改变量值,这对测试和调试游戏 AI 很有帮助。",
"90": "创建自定义任务",
"91": "默认情况下,用户任务应放在 <1/> 目录中。你可以在 <2/> 中为用户任务设置其他位置(要看到这些选项,需要在项目设置中启用 <3/>)。",
"92": "用户任务目录下的每个子目录都会被当作一个分类。因此,如果你创建了一个名为 “motion_and_physics” 的子目录,其中的自定义任务会自动归类到 “Motion And Physics” 下。",
"93": "创建自定义任务时,请<b>继承以下基类之一</b>:<l1>BTAction</l>、<l2>BTCondition</l>、<l3>BTDecorator</l>、<l4>BTComposite</l>。关于任务类型的更多内容,可阅读<l5>行为树简介</l>。",
"94": "<b>🛈 注意:</b>为了帮助你编写新任务,你可以通过 “Misc → Create script template” 菜单项向项目中添加脚本模板。",
"95": "<l1>Blackboard</l> 的使用方法见<l2>在任务中访问黑板</l>。",
"96": "任务的结构",
"97": "示例 1:一个简单的动作",
"98": "示例 2:InRange 条件",
"99": "用 C# 创建任务",
"100": "自定义任务可以使用以下脚本模板:",
"101": "使用 Blackboard 共享数据",
"102": "为了在不同任务与状态之间共享数据,我们用到了一个称为 <l1>Blackboard</l> 的特性。<l2>Blackboard</l> 充当中央仓库,任务和状态可以在其中存取具名变量,从而实现无缝的数据交换。每个行为树或状态机实例都拥有自己专属的 <l3>Blackboard</l>。它可以存储多种数据类型,包括对象和资源。",
"103": "借助 <l1>Blackboard</l>,你可以轻松地在行为树中共享数据,让行为树里的任务更加灵活。",
"104": "在任务中访问黑板",
"105": "每个 <l1>BTTask</l> 都能访问 <l2>Blackboard</l>,这为数据交换提供了直截了当的机制。下面是一个在 GDScript 中与 <l3>Blackboard</l> 交互的示例:",
"106": "如果你访问的变量持有对象实例,并且该实例可能为 null 或已被释放,可以这样写:",
"107": "建议给变量名属性加上 <1/> 后缀,如上例所示。这样检视面板就能为该变量提供更便捷的属性编辑器。这个编辑器允许你选择变量,或把它加入黑板计划(blackboard plan),并在黑板计划中不存在该变量时显示警告图标。",
"108": "<b>🛈 注意:</b>在代码中设置变量时,该变量不需要事先存在。",
"109": "编辑黑板计划(Blackboard Plan)",
"110": "黑板计划与每个 <l1>BehaviorTree</l> 资源相关联,它决定 <l2>Blackboard</l> 在每个新的 <l3>BehaviorTree</l> 实例中如何初始化。BlackboardPlan 资源存储 <l4>BehaviorTree</l> 初始化所需的默认值、类型信息和数据绑定。",
"111": "要从黑板计划中添加、修改或删除变量,请按以下步骤操作:",
"112": "打开 LimboAI 编辑器,加载你想编辑的行为树。",
"113": "在编辑器中,点击标签页内的小按钮。这会在检视面板中打开 <l1>BlackboardPlan</l>。",
"114": "在检视面板中点击 “Manage…” 按钮,显示黑板计划编辑器。",
"115": "在黑板计划编辑器中,你可以添加、删除或重新排列变量,并修改它们的数据类型与提示(hint)。",
"116": "提示会向检视面板提供关于该变量的附加信息,例如整数变量的最小值和最大值。更多内容请参阅 <l1>Godot 官方文档中的属性提示</l>。",
"117": "你可以直接在检视面板中指定变量的默认值。",
"118": "在 BTPlayer 中覆盖变量",
"119": "每个 <l1>BTPlayer</l> 节点也有一个 “Blackboard Plan” 属性,可以覆盖 BehaviorTree 中黑板变量的值。这些覆盖只对 BTPlayer 所在的场景生效,不会影响使用同一个 <l2>BehaviorTree</l> 的其他场景。要修改这些值:",
"120": "在场景树中选中 BTPlayer 节点。",
"121": "在检视面板中找到 “Blackboard Plan” 属性。",
"122": "覆盖你想要的值,为特定场景定制黑板变量。",
"123": "任务参数",
"124": "在某些情况下,让行为树任务导出参数会很有帮助,这些参数既可以<b>绑定到黑板变量,也可以由用户直接指定</b>。为此,LimboAI 提供了一些以 “BB” 开头的特殊参数类型,例如 <l1>BBInt</l>、<l2>BBBool</l>、<l3>BBString</l>、<l4>BBFloat</l>、<l5>BBNode</l> 等等。完整列表请查阅 <l6>BBParam</l> 类文档。",
"125": "用法示例:",
"126": "把 BT 中的变量连接到 HSM:变量映射",
"127": "每个 <l1>BTState</l> 都会为其 BehaviorTree 实例创建一个新的黑板作用域。由于 BehaviorTree 是可复用的资源,可以在不同上下文或不同智能体上运行,它们不会自动看到 HSM 中定义的变量。在运行时,HSM 变量通常可以通过父作用域黑板在 BT 中访问,但推荐的访问方式是通过<b>映射(Mapping)</b>。",
"128": "注意",
"129": "要了解更多关于作用域的内容,请参阅 <l1>Blackboard</l>。",
"130": "当 BehaviorTree 和 HSM 各自在它们的 <l1>BlackboardPlan</l> 资源中声明变量后,编辑器会在 BlackboardPlan 检视面板中提供<b>映射(Mapping)</b>区域。映射是连接相关计划之间变量的既定且推荐的方式。",
"131": "关于映射的要点",
"132": "映射会把两个变量连接起来,使它们在运行时表现为同一个逻辑变量。",
"133": "被链接的变量会在两个作用域中立即同步更新 —— 它们在内存中共享同一份状态(没有轮询,也没有复制)。",
"134": "映射是显式的:由你决定 BT 将哪些变量作为输入和输出暴露出来。",
"135": "链接是双向的 —— 输入与输出之间没有区别。",
"136": "映射不会自动创建新变量 —— 变量必须已经存在于两个黑板计划中,才能被链接。",
"137": "检视面板操作流程",
"138": "分别在各 BlackboardPlan(例如 HSM 计划和 BT 计划)中定义所需的变量。",
"139": "在场景中选中 <l1>BTState</l> 节点,或选中行为树内的 <l2>BTSubtree</l>。",
"140": "在检视面板中选择 Blackboard Plan 属性。",
"141": "在 BlackboardPlan 资源检视面板中,找到<b>映射(Mapping)</b>区域。",
"142": "通过配对变量(<1/>)来创建映射。",
"143": "启动时映射会被应用,变量会为运行中的实例自动建立链接。",
"144": "编程替代方案:在代码中链接变量",
"145": "你也可以直接用 <l1>Blackboard.link_var</l> 在代码中链接变量:",
"146": "最佳实践",
"147": "在 BT 自己的 BlackboardPlan 中声明所有 BT 依赖,而不要依赖父作用域。",
"148": "使用<b>映射(Mapping)</b>明确声明哪些变量应与 HSM 共享。",
"149": "优先使用基于检视面板的映射流程,以获得更好的清晰度和编辑器支持;仅在需要运行时或编程式设置时才使用 <1/>。",
"150": "避免在 BT 任务内部写入 <1/>,除非你有非常明确的理由,并且接受由此带来的耦合。",
"151": "进阶话题:黑板作用域",
"152": "LimboAI 中的 <l1>Blackboard</l> 可以作为另一个 <l2>Blackboard</l> 的父作用域。这意味着,如果某个变量在当前作用域中找不到,系统就会到父级 <l3>Blackboard</l> 中查找。这样就形成了“黑板作用域链”,链中每个 <l4>Blackboard</l> 都可以拥有自己的父作用域,而且链中黑板的数量没有上限。需要注意的是,<l5>Blackboard</l> 不会修改父作用域中的值。",
"153": "系统会自动创建作用域,以避免上下文相互独立的环境之间发生命名冲突:",
"154": "在 <l1>BTNewScope</l> 内部。",
"155": "在 <l1>BTSubtree</l> 装饰器之下。",
"156": "对于定义了非空黑板计划的 <l1>LimboState</l>。",
"157": "在 <l1>LimboHSM</l> 节点之下:会在根层级创建一个新作用域,每个 <l2>BTState</l> 子节点也会获得自己独立的作用域。",
"158": "在多个智能体之间共享数据",
"159": "黑板作用域机制也可以用来在多个智能体之间共享数据。在下面的示例中,我们有一组智能体,希望让它们共享一个共同的目标:",
"160": "在这个示例中,<l1>blackboard.top()</l> 访问 <l2>Blackboard</l> 链的根作用域。我们通过代码把该作用域赋给组内的每个智能体:",
"161": "总而言之,<l1>Blackboard</l> 作用域链不仅能避免状态机、行为树与子树之间可能出现的命名冲突,还可以用来在多个智能体之间共享数据。",
"162": "调试黑板变量",
"163": "调试运行中的项目时,你可以在远程检视面板中查看 <l1>Blackboard</l> 变量。在 LimboAI 调试器中点击某个任务以查看其属性,然后点击 <l2>Blackboard</l> 引用,即可看到整条作用域链上的所有变量,并按作用域分组。变量可以实时编辑,以辅助调试。对于状态机,在远程场景树(Remote Scene Tree)中选中 <l3>LimboState</l> 节点,就能以同样的方式访问它的 <l4>Blackboard</l>。",
"164": "访问场景树中的节点",
"165": "有几种方式可以从 <l1>BTTask</l> 中访问智能体场景树里的节点。",
"166": "<b>🛈 注意:</b>智能体场景树的根节点可以通过 <l1>scene_root</l> 属性访问。",
"167": "使用 <1/> 属性",
"168": "使用 <1/> 属性",
"169": "使用黑板计划",
"170": "你可以在编辑器中<l1>创建一个黑板变量</l1>,类型为 <2/>,并让它在 <l3>BTPlayer</l> 的黑板计划中指向合适的节点。默认情况下,当运行时实例化黑板时,任何 <4/> 变量都会被替换为对应的节点实例(见 <l5>BlackboardPlan.prefetch_nodepath_vars</l>)。",
"171": "BTPlayer.prefetch_nodepath_vars 属性应设置为 <1/>。",
"172": "创建状态机",
"173": "本指南将展示如何使用 <l1>LimboHSM</l> 搭建并使用状态机。",
"174": "初始化",
"175": "要使用 <l1>LimboHSM</l> 状态机,你首先需要在代码中初始化它。这通常是在脚本的 <2/> 函数中完成。下面是一个示例:",
"176": "在这个示例中,我们首先声明状态机以及要使用的各个状态。然后在 <1/> 函数中为各状态添加转换。最后初始化状态机,并将其设为活动状态。",
"177": "状态示例",
"178": "你可以在脚本中定义状态的行为,并把该脚本挂到状态节点上。下面是一个状态示例,它会在 <1/> 上播放动画并等待动画播放完毕:",
"179": "在这个示例中,<1/> 方法会在进入该状态时被调用,并播放指定的动画。<2/> 方法每帧都会被调用,用来检查动画是否播放完毕。如果已播放完毕,它就派发 <3/> 事件,从而可能转换到下一个状态。"
}
@@ -0,0 +1,144 @@
{
"180": "事件与转换",
"181": "<l1>LimboHSM</l> 自带一套<b>事件系统</b>,有助于把<b>状态转换与状态实现解耦</b>。一个转换与特定的事件、起始状态和目标状态相关联,当该事件被派发时,转换会自动执行。",
"182": "要注册一个转换并把它与特定事件关联,可以使用 <l1>LimboHSM.add_transition</l> 方法:",
"183": "在这个示例中,我们注册了一个从 <1/> 到 <2/> 的转换,它在 <3/> 事件被派发时发生。",
"184": "转换也可以不与任何特定的起始状态关联:",
"185": "<b>事件通过</b> <l1>LimboState.dispatch</l> 方法<b>派发</b>。需要注意的是,该方法可以从状态机层级中的任何位置调用,也可以在状态机之外调用。事件会<b>从叶状态向根状态传播</b>。这意味着,如果某个事件被某个状态消费掉,它就不会再传播到其父状态。",
"186": "状态还可以定义<b>事件处理器</b>,即对特定事件做出反应的方法。这些事件处理器通常不会导致状态转换;它们只是状态对特定事件做出反应的一种机制。你可以用 <l1>LimboState.add_event_handler</l> 方法在状态中注册事件处理器:",
"187": "如果事件处理器返回 <1/>,该事件将被视为已被消费,不会再继续传播,也不会导致状态转换。",
"188": "状态的结构",
"189": "把行为树与状态机结合使用",
"190": "<l1>BTState</l> 是 <l2>LimboHSM</l> 中一种特殊的状态节点,它可以承载一个行为树。当 <l3>BTState</l> 处于活动状态时,它每帧都会执行所承载的行为树,实际上就是把该行为树当作它的实现。",
"191": "这样你就可以把行为树的强大能力与状态机的结构与控制结合起来。行为树非常适合定义复杂的层次化行为,而状态机则擅长管理不同行为之间的流转与转换。",
"192": "创建好 <l1>LimboHSM</l> 之后,就可以为给定的 <l3>LimboHSM</l> 创建一个 <l2>BTState</l>:",
"193": "单文件状态机配置",
"194": "在某些情况下,例如做原型或参加 Game Jam 时,把状态机代码放在单个文件里更实用。针对这类情况,<l1>LimboHSM</l> <b>支持委托(delegation)</b>,并提供<b>链式方法</b>以便更轻松地完成配置。下面用一个实际的代码示例来说明:",
"195": "重要类",
"196": "LimboAI 中引入了很多类。下面列出你应该了解的最重要的那些:",
"197": "BTTask",
"198": "<b>继承:</b><l1>BT</l>",
"199": "<b>被继承:</b><l1>BTAction</l>、<l2>BTComment</l>、<l3>BTComposite</l>、<l4>BTCondition</l>、<l5>BTDecorator</l>",
"200": "所有 <l1>BehaviorTree</l> 任务的基类。",
"201": "说明",
"202": "所有 <l1>BehaviorTree</l> 任务的基类。任务是 <l2>BehaviorTree</l> 中的基本积木块,代表某个具体行为或控制流。通过按层次组合和嵌套任务,可以构建出复杂的行为。",
"203": "任务可以是以下类型之一:动作、条件、组合或装饰器。每种任务类型都有对应的子类:<l1>BTAction</l>、<l2>BTCondition</l>、<l3>BTDecorator</l>、<l4>BTComposite</l>。",
"204": "任务通过 <l1>_tick</l> 方法执行工作并返回状态。状态值定义在 <l2>Status</l> 中。任务可以用 <l3>_setup</l> 方法初始化。另见 <l4>_enter</l> 与 <l5>_exit</l>。",
"205": "<b>注意:</b>不要直接继承 <b>BTTask</b> 来实现你自己的任务,而应继承上面提到的某个子类型。",
"206": "属性",
"207": "<l1>agent</l>",
"208": "<l1>Blackboard</l>",
"209": "<l1>blackboard</l>",
"210": "<l1>custom_name</l>",
"211": "<l1>elapsed_time</l>",
"212": "<l1>scene_root</l>",
"213": "<l1>Status</l>",
"214": "<l1>status</l>",
"215": "方法",
"216": "<l1>_enter</l>() <2/>",
"217": "<l1>_exit</l>() <2/>",
"218": "<l1>_generate_name</l>() <2/> <3/>",
"219": "<l1>_get_configuration_warnings</l>() <2/> <3/>",
"220": "<l1>_setup</l>() <2/>",
"221": "<l1>_tick</l>(delta: <2/>) <3/>",
"222": "<l1>abort</l>()",
"223": "<l1>add_child</l>(task: <l2>BTTask</l>)",
"224": "<l1>add_child_at_index</l>(task: <l2>BTTask</l>, idx: <3/>)",
"225": "<l1>BTTask</l>",
"226": "<l1>clone</l>() <2/>",
"227": "<l1>BehaviorTree</l>",
"228": "<l1>editor_get_behavior_tree</l>()",
"229": "<l1>execute</l>(delta: <2/>)",
"230": "<l1>get_child</l>(idx: <2/>) <3/>",
"231": "<l1>get_child_count</l>() <2/>",
"232": "<l1>get_child_count_excluding_comments</l>() <2/>",
"233": "<l1>get_index</l>() <2/>",
"234": "<l1>get_parent</l>() <2/>",
"235": "<l1>get_root</l>() <2/>",
"236": "<l1>get_task_name</l>()",
"237": "<l1>has_child</l>(task: <l2>BTTask</l>) <3/>",
"238": "<l1>initialize</l>(agent: <2/>, blackboard: <l3>Blackboard</l>, scene_root: <4/>)",
"239": "<l1>is_descendant_of</l>(task: <l2>BTTask</l>) <3/>",
"240": "<l1>is_root</l>() <2/>",
"241": "<l1>next_sibling</l>() <2/>",
"242": "<l1>print_tree</l>(initial_tabs: <2/> = 0)",
"243": "<l1>remove_child</l>(task: <l2>BTTask</l>)",
"244": "<l1>remove_child_at_index</l>(idx: <2/>)",
"245": "属性说明",
"246": "<1/> <b>agent</b> <l2>🔗</l>",
"247": "<1/> <b>set_agent</b>(value: <2/>)",
"248": "<1/> <b>get_agent</b>()",
"249": "agent 是 <l1>BehaviorTree</l> 实例的上下文对象。通常它是使用 <l3>BehaviorTree</l> 资源的 <l2>BTPlayer</l> 节点的父节点。",
"250": "<l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>",
"251": "<l1>Blackboard</l> <b>get_blackboard</b>()",
"252": "提供对 <l1>Blackboard</l> 的访问。黑板用于在同一 <l2>BehaviorTree</l> 的各任务之间共享数据。",
"253": "更多信息见 <l1>Blackboard</l>。",
"254": "<1/> <b>custom_name</b> = <2/> <l3>🔗</l>",
"255": "<1/> <b>set_custom_name</b>(value: <2/>)",
"256": "<1/> <b>get_custom_name</b>()",
"257": "用户为任务提供的名称。如果不为空,编辑器会用它来表示该任务。见 <l1>get_task_name</l>。",
"258": "<1/> <b>elapsed_time</b> <l2>🔗</l>",
"259": "<1/> <b>get_elapsed_time</b>()",
"260": "自任务被“进入”以来所经过的时间。见 <l1>_enter</l>。",
"261": "当任务不处于 <2/> 状态时返回 <1/>。",
"262": "<1/> <b>scene_root</b> <l2>🔗</l>",
"263": "<1/> <b>get_scene_root</b>()",
"264": "行为树所在场景的根节点(例如 <l1>BTPlayer</l> 节点的拥有者)。可用于获取 <2/> 引用。",
"265": "<b>示例:</b>",
"266": "<l1>Status</l> <b>status</b> <l2>🔗</l>",
"267": "<l1>Status</l> <b>get_status</b>()",
"268": "<l2>_tick</l> 返回的最后一次执行 <l1>Status</l>。",
"269": "方法说明",
"270": "<1/> <b>_enter</b>() <2/> <l3>🔗</l>",
"271": "当任务被“进入”时调用,即任务在不具有 <1/> <l2>status</l> 的情况下被执行时。",
"272": "在执行顺序上,它先于 <l1>_tick</l> 被调用。当主要工作开始前需要做准备时使用此方法,通常是在任务需要不止一个 tick 才能完成时。另见 <l2>execute</l>。",
"273": "<1/> <b>_exit</b>() <2/> <l3>🔗</l>",
"274": "当任务被“退出”时调用,即在 <l1>_tick</l> 返回 <2/> 或 <3/> 状态之后。另见 <l4>execute</l>。",
"275": "<1/> <b>_generate_name</b>() <2/> <3/> <l4>🔗</l>",
"276": "在未设置 <l1>custom_name</l> 时,调用它来为任务生成显示名称。见 <l2>get_task_name</l>。",
"277": "<1/> <b>_get_configuration_warnings</b>() <2/> <3/> <l4>🔗</l>",
"278": "此方法返回的字符串会作为警告消息显示在行为树编辑器中。任何重写了此方法的任务脚本都必须在文件顶部包含 <1/> 注解。",
"279": "<1/> <b>_setup</b>() <2/> <l3>🔗</l>",
"280": "在初始化阶段调用,用于初始化任务。它只会在任务第一次执行 tick 之前被调用一次。借助这个方法,你可以在任务开始执行之前为它设置所需的状态或配置。",
"281": "<l1>Status</l> <b>_tick</b>(delta: <2/>) <3/> <l4>🔗</l>",
"282": "当任务被“tick”时调用,也就是在更新过程中由 <l1>BTPlayer</l> 或 <l2>BTState</l> 执行它时。",
"283": "返回定义在 <l1>Status</l> 中的执行状态。",
"284": "<b>注意:</b>任务通过实现这个方法来执行其主要功能。",
"285": "<1/> <b>abort</b>() <l2>🔗</l>",
"286": "递归地重置该任务及其子任务。如果任务处于 <1/> 状态,它会被退出,并且其状态被重置为 <2/>。",
"287": "<1/> <b>add_child</b>(task: <l2>BTTask</l>) <l3>🔗</l>",
"288": "添加一个子任务。<1/> 会被放到子任务列表的末尾。",
"289": "<1/> <b>add_child_at_index</b>(task: <l2>BTTask</l>, idx: <3/>) <l4>🔗</l>",
"290": "添加一个子任务。<1/> 会被放到子任务列表中的 <2/> 位置。",
"291": "<l1>BTTask</l> <b>clone</b>() <2/> <l3>🔗</l>",
"292": "复制该任务及其子任务,并复制导出的成员。出于效率考虑,子资源是共享的,但 <l1>BBParam</l> 的子类型例外,它们总是会被复制。编辑器用它来实例化 <l2>BehaviorTree</l>,以及复制粘贴任务。",
"293": "<l1>BehaviorTree</l> <b>editor_get_behavior_tree</b>() <l2>🔗</l>",
"294": "返回拥有此任务的行为树。仅在编辑器中可用。",
"295": "<l1>Status</l> <b>execute</b>(delta: <2/>) <l3>🔗</l>",
"296": "执行该任务。执行遵循特定的顺序:",
"297": "如果任务当前的 <l1>status</l> 不是 <2/>,会先调用 <l3>_enter</l> 方法。",
"298": "接着调用 <l1>_tick</l> 方法来执行任务的工作。",
"299": "如果 <l1>_tick</l> 方法返回 <2/> 或 <3/> 状态,接下来会调用 <l4>_exit</l> 方法,作为执行清理的一部分。",
"300": "<l1>BTTask</l> <b>get_child</b>(idx: <2/>) <3/> <l4>🔗</l>",
"301": "通过指定索引返回一个子任务。",
"302": "<1/> <b>get_child_count</b>() <2/> <l3>🔗</l>",
"303": "返回子任务的数量。",
"304": "<1/> <b>get_child_count_excluding_comments</b>() <2/> <l3>🔗</l>",
"305": "返回子任务的数量,不把 <l1>BTComment</l> 任务计算在内。",
"306": "<1/> <b>get_index</b>() <2/> <l3>🔗</l>",
"307": "返回该任务在行为树分支中的位置。如果该任务不属于任务树(也就是没有父任务),则返回 <1/>。",
"308": "<l1>BTTask</l> <b>get_parent</b>() <2/> <l3>🔗</l>",
"309": "返回该任务的父任务。",
"310": "<l1>BTTask</l> <b>get_root</b>() <2/> <l3>🔗</l>",
"311": "返回行为树的根任务。",
"312": "<1/> <b>get_task_name</b>() <l2>🔗</l>",
"313": "此方法返回的字符串用于在编辑器中表示该任务。",
"314": "除非设置了 <l2>custom_name</l>,否则会调用 <l1>_generate_name</l> 方法为任务生成显示名称。",
"315": "<1/> <b>has_child</b>(task: <l2>BTTask</l>) <3/> <l4>🔗</l>",
"316": "如果 <2/> 是此任务的子任务,则返回 <1/>。",
"317": "<1/> <b>initialize</b>(agent: <2/>, blackboard: <l3>Blackboard</l>, scene_root: <4/>) <l5>🔗</l>",
"318": "初始化该任务。为它赋值 <l1>agent</l> 和 <l2>blackboard</l>,并对该任务及其子任务调用 <l3>_setup</l>。",
"319": "该方法会对每个子任务递归调用。<1/> 应当是行为树所在场景的根节点(例如包含该行为树的节点的拥有者)。",
"320": "<1/> <b>is_descendant_of</b>(task: <l2>BTTask</l>) <3/> <l4>🔗</l>",
"321": "如果此任务是 <2/> 的后代,则返回 <1/>。换句话说,此任务必须是 <3/> 的子任务,或者是它的子任务、孙任务之一。"
}
@@ -0,0 +1,140 @@
{
"322": "<1/> <b>is_root</b>() <2/> <l3>🔗</l>",
"323": "如果此任务是其行为树的根任务,则返回 <1/>。一棵行为树只能有一个根任务。",
"324": "<l1>BTTask</l> <b>next_sibling</b>() <2/> <l3>🔗</l>",
"325": "返回父任务子任务列表中紧接在此任务之后的任务。",
"326": "如果此任务没有父任务,或者它是父任务子任务列表中的最后一个子任务,则返回 <1/>。",
"327": "<1/> <b>print_tree</b>(initial_tabs: <2/> = 0) <l3>🔗</l>",
"328": "把以此任务为起点的子树打印到控制台。",
"329": "<1/> <b>remove_child</b>(task: <l2>BTTask</l>) <l3>🔗</l>",
"330": "从子任务中移除 <1/>。",
"331": "<1/> <b>remove_child_at_index</b>(idx: <2/>) <l3>🔗</l>",
"332": "从子任务中移除指定索引处的子任务。",
"333": "BTPlayer",
"334": "<b>继承:</b>",
"335": "<l1>BehaviorTree</l> 资源的播放器。",
"336": "<b>BTPlayer</b> 节点用于在运行时实例化和播放 <l1>BehaviorTree</l> 资源。初始化期间,行为树实例会获得对智能体、<l2>blackboard</l> 以及当前场景根节点的引用。智能体可以通过 <l3>agent_node</l> 属性指定(默认是 BTPlayer 的父节点)。",
"337": "行为树的入门介绍见 <l1>BehaviorTree</l>。",
"338": "<l1>active</l>",
"339": "<l1>agent_node</l>",
"340": "<l1>behavior_tree</l>",
"341": "<l1>blackboard</l>",
"342": "<l1>BlackboardPlan</l>",
"343": "<l1>blackboard_plan</l>",
"344": "<l1>monitor_performance</l>",
"345": "<l1>UpdateMode</l>",
"346": "<l1>update_mode</l>",
"347": "<l1>BTInstance</l>",
"348": "<l1>get_bt_instance</l>()",
"349": "<l1>restart</l>()",
"350": "<l1>set_bt_instance</l>(bt_instance: <l2>BTInstance</l>)",
"351": "<l1>set_scene_root_hint</l>(scene_root: <2/>)",
"352": "<l1>update</l>(delta: <2/>)",
"353": "信号",
"354": "<b>behavior_tree_finished</b>(status: <1/>) <l2>🔗</l>",
"355": "<b>已废弃:</b>请改用 <l1>updated</l> 信号。",
"356": "当行为树执行完毕并返回 <1/> 或 <2/> 时发出。",
"357": "参数 <1/> 保存行为树返回的状态。见 <l2>Status</l>。",
"358": "<b>updated</b>(status: <1/>) <l2>🔗</l>",
"359": "当 BTPlayer 完成行为树更新时发出。",
"360": "枚举",
"361": "enum <b>UpdateMode</b>: <l1>🔗</l>",
"362": "<l1>UpdateMode</l> <b>IDLE</b> = <2/>",
"363": "在空闲(idle)处理期间执行行为树。",
"364": "<l1>UpdateMode</l> <b>PHYSICS</b> = <2/>",
"365": "在物理(physics)处理期间执行行为树。",
"366": "<l1>UpdateMode</l> <b>MANUAL</b> = <2/>",
"367": "通过调用 <l1>update</l> 手动执行行为树。",
"368": "<1/> <b>active</b> = <2/> <l3>🔗</l>",
"369": "<1/> <b>set_active</b>(value: <2/>)",
"370": "<1/> <b>get_active</b>()",
"371": "如果为 <1/>,行为树将在更新期间被执行。",
"372": "<1/> <b>agent_node</b> = <2/> <l3>🔗</l>",
"373": "<1/> <b>set_agent_node</b>(value: <2/>)",
"374": "<1/> <b>get_agent_node</b>()",
"375": "用作智能体的节点路径。在实例化之后再设置它不会生效。",
"376": "<l1>BehaviorTree</l> <b>behavior_tree</b> <l2>🔗</l>",
"377": "<1/> <b>set_behavior_tree</b>(value: <l2>BehaviorTree</l>)",
"378": "<l1>BehaviorTree</l> <b>get_behavior_tree</b>()",
"379": "要在运行时实例化并执行的 <l1>BehaviorTree</l> 资源。",
"380": "<l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>",
"381": "<1/> <b>set_blackboard</b>(value: <l2>Blackboard</l>)",
"382": "保存行为树各任务共享的数据。见 <l1>Blackboard</l>。",
"383": "<l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>",
"384": "<1/> <b>set_blackboard_plan</b>(value: <l2>BlackboardPlan</l>)",
"385": "<l1>BlackboardPlan</l> <b>get_blackboard_plan</b>()",
"386": "存储并管理用于构建新的 <l1>Blackboard</l> 实例的变量。",
"387": "<1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>",
"388": "<1/> <b>set_monitor_performance</b>(value: <2/>)",
"389": "<1/> <b>get_monitor_performance</b>()",
"390": "如果为 <1/>,会为此 <b>BTPlayer</b> 节点的每个实例在 “Debugger->Monitors” 中添加一个性能监视器。",
"391": "<l1>UpdateMode</l> <b>update_mode</b> = <2/> <l3>🔗</l>",
"392": "<1/> <b>set_update_mode</b>(value: <l2>UpdateMode</l>)",
"393": "<l1>UpdateMode</l> <b>get_update_mode</b>()",
"394": "决定行为树何时执行。见 <l1>UpdateMode</l>。",
"395": "<l1>BTInstance</l> <b>get_bt_instance</b>() <l2>🔗</l>",
"396": "返回行为树实例。",
"397": "<1/> <b>restart</b>() <l2>🔗</l>",
"398": "重置行为树的执行。所有正在运行的任务都会被中止,下一次树执行会从头开始。此方法不会重置 <l1>Blackboard</l>。",
"399": "<1/> <b>set_bt_instance</b>(bt_instance: <l2>BTInstance</l>) <l3>🔗</l>",
"400": "设置要播放的 <l1>BTInstance</l>。当你想在运行时切换到另一个行为树实例时,这个方法很有用。另见 <l2>BehaviorTree.instantiate</l>。",
"401": "<1/> <b>set_scene_root_hint</b>(scene_root: <2/>) <l3>🔗</l>",
"402": "设置新实例化的行为树要使用的场景根节点 <1/>。应当在 <b>BTPlayer</b> 被加入场景树之前调用(即 <2/> 之前)。当你需要用代码动态创建 <b>BTPlayer</b> 节点时,这通常很有用。",
"403": "<1/> <b>update</b>(delta: <2/>) <l3>🔗</l>",
"404": "如果 <l1>active</l> 为 <2/>,则执行行为树实例的根任务。当 <l3>update_mode</l> 设为 <l4>MANUAL</l> 时调用此方法。当 <l5>update_mode</l> 不是 <l6>MANUAL</l> 时,会自动调用 <l7>update</l>。见 <l8>UpdateMode</l>。",
"405": "Blackboard",
"406": "用于在 <l1>LimboHSM</l> 状态与 <l2>BehaviorTree</l> 任务之间共享数据的键值存储。",
"407": "Blackboard 是 <l1>LimboHSM</l> 系统中的状态与 <l2>BehaviorTree</l> 中的任务之间存储和共享数据的地方。<l3>BehaviorTree</l> 中的每个状态和任务都能访问这个 Blackboard,从而可以读取和写入数据。这让不同动作与行为之间共享信息变得非常简单。",
"408": "Blackboard 也可以充当另一个 Blackboard 的父作用域。如果在当前作用域中找不到某个变量,它就会到父级 Blackboard 中查找。父级 Blackboard 本身也可以拥有自己的父作用域,从而形成我们所说的“黑板作用域链”。重要的是,这条链中 Blackboard 的数量没有上限,而且 Blackboard 不会修改父作用域中的值。",
"409": "可以用 <l1>BTNewScope</l> 和 <l2>BTSubtree</l> 装饰器创建新作用域。此外,对于任何定义了非空 Blackboard 数据的 <l3>LimboState</l>,或任何根层级的 <l4>LimboHSM</l> 节点,都会自动创建一个新作用域。",
"410": "<l1>bind_var_to_property</l>(var_name: <2/>, object: <3/>, property: <4/>, create: <5/> = false)",
"411": "<l1>clear</l>()",
"412": "<l1>erase_var</l>(var_name: <2/>)",
"413": "<l1>Blackboard</l>",
"414": "<l1>get_parent</l>() <2/>",
"415": "<l1>get_var</l>(var_name: <2/>, default: <3/> = null, complain: <4/> = true) <5/>",
"416": "<l1>get_vars_as_dict</l>() <2/>",
"417": "<l1>has_var</l>(var_name: <2/>) <3/>",
"418": "<l1>link_var</l>(var_name: <2/>, target_blackboard: <l3>Blackboard</l>, target_var: <4/>, create: <5/> = false)",
"419": "Array[<1/>]",
"420": "<l1>list_vars</l>() <2/>",
"421": "<l1>populate_from_dict</l>(dictionary: <2/>)",
"422": "<l1>print_state</l>() <2/>",
"423": "<l1>set_parent</l>(blackboard: <l2>Blackboard</l>)",
"424": "<l1>set_var</l>(var_name: <2/>, value: <3/>)",
"425": "<l1>top</l>() <2/>",
"426": "<l1>unbind_var</l>(var_name: <2/>)",
"427": "<1/> <b>bind_var_to_property</b>(var_name: <2/>, object: <3/>, property: <4/>, create: <5/> = false) <l6>🔗</l>",
"428": "在变量与由 <1/> 和 <2/> 指定的对象属性之间建立绑定。变量发生变化会更新该属性,反之亦然。如果 <3/> 为 <4/>,则变量不存在时会被创建。",
"429": "<1/> <b>clear</b>() <l2>🔗</l>",
"430": "从 Blackboard 中移除所有变量。父作用域不受影响。",
"431": "<1/> <b>erase_var</b>(var_name: <2/>) <l3>🔗</l>",
"432": "按名称移除一个变量。",
"433": "<l1>Blackboard</l> <b>get_parent</b>() <2/> <l3>🔗</l>",
"434": "返回作为此实例父作用域的 Blackboard。",
"435": "<1/> <b>get_var</b>(var_name: <2/>, default: <3/> = null, complain: <4/> = true) <5/> <l6>🔗</l>",
"436": "返回变量值;如果变量不存在则返回 <1/>。如果 <2/> 为 <3/>,变量不存在时会打印错误。如果该变量在当前 <b>Blackboard</b> 作用域中不存在,它会在父作用域 <b>Blackboard</b> 中查找。",
"437": "<1/> <b>get_vars_as_dict</b>() <2/> <l3>🔗</l>",
"438": "以字典形式返回 Blackboard 中的所有变量。键是变量名,值是变量值。不包含父作用域。",
"439": "<1/> <b>has_var</b>(var_name: <2/>) <3/> <l4>🔗</l>",
"440": "如果 Blackboard 包含 <2/> 变量(含父作用域),则返回 <1/>。",
"441": "<1/> <b>link_var</b>(var_name: <2/>, target_blackboard: <l3>Blackboard</l>, target_var: <4/>, create: <5/> = false) <l6>🔗</l>",
"442": "把一个变量链接到另一个 Blackboard 变量。如果一个变量被链接到另一个变量,它们的状态将始终一致,任何一方发生变化都会反映到另一方。如果 <1/> 为 <2/>,则变量不存在时会被创建。",
"443": "你可以用这个方法把当前作用域中的变量链接到另一个作用域或另一个 Blackboard 实例中的变量。一个变量只能链接到另一个变量。再次调用此方法会覆盖之前的链接。不过,同一个变量可以被多个不同的变量链接。",
"444": "Array[<1/>] <b>list_vars</b>() <2/> <l3>🔗</l>",
"445": "返回 Blackboard 中所有变量的名称。不包含父作用域。",
"446": "<1/> <b>populate_from_dict</b>(dictionary: <2/>) <l3>🔗</l>",
"447": "用字典中的多个变量填充 Blackboard。字典的键必须是变量名,字典的值必须是变量值。键必须是 StringName 或 String。",
"448": "<1/> <b>print_state</b>() <2/> <l3>🔗</l>",
"449": "打印每个作用域中所有变量的值。",
"450": "<1/> <b>set_parent</b>(blackboard: <l2>Blackboard</l>) <l3>🔗</l>",
"451": "赋值父作用域。如果某个值不在当前 Blackboard 作用域中,它会在父作用域 Blackboard 中查找。",
"452": "<1/> <b>set_var</b>(var_name: <2/>, value: <3/>) <l4>🔗</l>",
"453": "为当前 Blackboard 作用域中的变量赋值。如果变量不存在,它会被创建。如果该变量已存在于父作用域中,父作用域的值不会被修改。",
"454": "<l1>Blackboard</l> <b>top</b>() <2/> <l3>🔗</l>",
"455": "返回作用域链中最顶层的 <b>Blackboard</b>。",
"456": "<1/> <b>unbind_var</b>(var_name: <2/>) <l3>🔗</l>",
"457": "移除变量的绑定。",
"458": "BBParam",
"459": "<b>被继承:</b><l1>BBAabb</l>、<l2>BBArray</l>、<l3>BBBasis</l>、<l4>BBBool</l>、<l5>BBByteArray</l>、<l6>BBColor</l>、<l7>BBColorArray</l>、<l8>BBDictionary</l>、<l9>BBFloat</l>、<l10>BBFloat32Array</l>、<l11>BBFloat64Array</l>、<l12>BBInt</l>、<l13>BBInt32Array</l>、<l14>BBInt64Array</l>、<l15>BBNode</l>、<l16>BBPlane</l>、<l17>BBProjection</l>、<l18>BBQuaternion</l>、<l19>BBRect2</l>、<l20>BBRect2i</l>、<l21>BBString</l>、<l22>BBStringArray</l>、<l23>BBStringName</l>、<l24>BBTransform2D</l>、<l25>BBTransform3D</l>、<l26>BBVariant</l>、<l27>BBVector2</l>、<l28>BBVector2Array</l>、<l29>BBVector2i</l>、<l30>BBVector3</l>、<l31>BBVector3Array</l>、<l32>BBVector3i</l>、<l33>BBVector4</l>、<l34>BBVector4i</l>"
}
@@ -0,0 +1,165 @@
{
"460": "LimboAI 类型化参数的基类。",
"461": "LimboAI 类型化参数的基类,既可以引用 <l1>Blackboard</l> 变量,也可以直接保存某个 Variant.Type 类型的原始值。",
"462": "<b>注意</b>:不要直接实例化,请改用具体的子类型。",
"463": "<l1>saved_value</l>",
"464": "<l1>ValueSource</l>",
"465": "<l1>value_source</l>",
"466": "<l1>variable</l>",
"467": "Variant.Type",
"468": "<l1>get_type</l>() <2/>",
"469": "<l1>get_value</l>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null)",
"470": "enum <b>ValueSource</b>: <l1>🔗</l>",
"471": "<l1>ValueSource</l> <b>SAVED_VALUE</b> = <2/>",
"472": "值直接存储在 BBParam 资源中。",
"473": "<l1>ValueSource</l> <b>BLACKBOARD_VAR</b> = <2/>",
"474": "值通过变量名引用,并从 <l1>Blackboard</l> 中获取。变量名存储在 BBParam 资源中。",
"475": "<1/> <b>saved_value</b> = <2/> <l3>🔗</l>",
"476": "<1/> <b>set_saved_value</b>(value: <2/>)",
"477": "<1/> <b>get_saved_value</b>()",
"478": "当 <l1>value_source</l> 设为 <l2>SAVED_VALUE</l> 时,用于存储参数值。值的类型由 <l3>get_type</l> 决定。",
"479": "<l1>ValueSource</l> <b>value_source</b> = <2/> <l3>🔗</l>",
"480": "<1/> <b>set_value_source</b>(value: <l2>ValueSource</l>)",
"481": "<l1>ValueSource</l> <b>get_value_source</b>()",
"482": "指定 BBParam 取值的来源。见 <l1>ValueSource</l>。",
"483": "<1/> <b>variable</b> <l2>🔗</l>",
"484": "<1/> <b>set_variable</b>(value: <2/>)",
"485": "<1/> <b>get_variable</b>()",
"486": "当 <l2>value_source</l> 设为 <l3>BLACKBOARD_VAR</l> 时,存储 <l1>Blackboard</l> 变量的名称。",
"487": "Variant.Type <b>get_type</b>() <1/> <l2>🔗</l>",
"488": "返回该参数预期的数据类型。",
"489": "<1/> <b>get_value</b>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null) <l5>🔗</l>",
"490": "返回该参数的值。",
"491": "LimboState",
"492": "<b>被继承:</b><l1>BTState</l>、<l2>LimboHSM</l>",
"493": "用于分层状态机(HSM)的状态节点。",
"494": "LimboAI 中用于分层状态机(HSM)的状态节点。",
"495": "你可以通过继承这个类来编写自己的状态行为。要实现状态逻辑,可以重写 <l1>_enter</l>、<l2>_exit</l>、<l3>_setup</l> 和 <l4>_update</l>。或者,你也可以用 <5/> 方法把状态实现委托给外部方法。",
"496": "关于状态机的更多细节,请参阅 <l1>LimboHSM</l>。",
"497": "<l1>EVENT_FINISHED</l>",
"498": "<l1>agent</l>",
"499": "<l1>blackboard</l>",
"500": "<l1>blackboard_plan</l>",
"501": "<l1>_enter</l>() <2/>",
"502": "<l1>_exit</l>() <2/>",
"503": "<l1>_setup</l>() <2/>",
"504": "<l1>_update</l>(delta: <2/>) <3/>",
"505": "<l1>add_event_handler</l>(event: <2/>, handler: <3/>)",
"506": "<l1>LimboState</l>",
"507": "<l1>call_on_enter</l>(callable: <2/>)",
"508": "<l1>call_on_exit</l>(callable: <2/>)",
"509": "<l1>call_on_update</l>(callable: <2/>)",
"510": "<l1>clear_guard</l>()",
"511": "<l1>dispatch</l>(event: <2/>, cargo: <3/> = null)",
"512": "<l1>get_root</l>() <2/>",
"513": "<l1>is_active</l>() <2/>",
"514": "<l1>named</l>(name: <2/>)",
"515": "<l1>set_guard</l>(guard_callable: <2/>)",
"516": "<b>entered</b>() <l1>🔗</l>",
"517": "当状态被进入时发出。",
"518": "<b>exited</b>() <l1>🔗</l>",
"519": "当状态被退出时发出。",
"520": "<b>setup</b>() <l1>🔗</l>",
"521": "当状态被初始化时发出。",
"522": "<b>updated</b>(delta: <1/>) <l2>🔗</l>",
"523": "当状态被更新时发出。",
"524": "<1/> <b>EVENT_FINISHED</b> <l2>🔗</l>",
"525": "<1/> <b>event_finished</b>()",
"526": "一个常用事件,表示状态已经完成其工作。",
"527": "<1/> <b>agent</b> <l2>🔗</l>",
"528": "与该状态关联的智能体,在初始化时赋值。",
"529": "<l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>",
"530": "该状态所属状态机中各状态共享的键值数据存储。",
"531": "<l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>",
"532": "<1/> <b>_enter</b>() <2/> <l3>🔗</l>",
"533": "当状态被进入时调用。",
"534": "<1/> <b>_exit</b>() <2/> <l3>🔗</l>",
"535": "当状态被退出时调用。这会在转换到另一个状态时发生,也会在状态机从场景树中被移除时发生(例如节点被 Node.queue_free 释放或场景切换)。由于实现细节,<l1>_exit</l> 不会在调用 Object.free 时被执行!",
"536": "<1/> <b>_setup</b>() <2/> <l3>🔗</l>",
"537": "在初始化期间被调用一次。用这个方法初始化你的状态。",
"538": "<1/> <b>_update</b>(delta: <2/>) <3/> <l4>🔗</l>",
"539": "在更新期间调用。用这个方法实现你状态的行为。",
"540": "<1/> <b>add_event_handler</b>(event: <2/>, handler: <3/>) <l4>🔗</l>",
"541": "注册一个 <1/>,在 <2/> 被派发时调用。处理函数应具有以下签名:",
"542": "如果处理函数返回 <1/>,事件将被消费。Cargo 是可选参数,可以传给处理函数。另见 <l2>dispatch</l>。",
"543": "<l1>LimboState</l> <b>call_on_enter</b>(callable: <2/>) <l3>🔗</l>",
"544": "链式方法,把 <l1>entered</l> 信号连接到一个 <2/>。",
"545": "<l1>LimboState</l> <b>call_on_exit</b>(callable: <2/>) <l3>🔗</l>",
"546": "链式方法,把 <l1>exited</l> 信号连接到一个 <2/>。",
"547": "<l1>LimboState</l> <b>call_on_update</b>(callable: <2/>) <l3>🔗</l>",
"548": "链式方法,把 <l1>updated</l> 信号连接到一个 <2/>。",
"549": "<1/> <b>clear_guard</b>() <l2>🔗</l>",
"550": "清除守卫函数,移除之前由 <l2>set_guard</l> 设置的 <1/>。",
"551": "<1/> <b>dispatch</b>(event: <2/>, cargo: <3/> = null) <l4>🔗</l>",
"552": "递归派发一个名为 <1/> 的状态机事件,可选参数为 <2/>。如果事件被消费则返回 <3/>。",
"553": "事件会从叶状态向根状态传播,一旦某个状态消费了该事件,传播就会停止。如果状态有相关的转换或事件处理器,它就会消费该事件。关于事件处理器的更多信息,见 <l1>add_event_handler</l>。",
"554": "<l1>LimboState</l> <b>get_root</b>() <2/> <l3>🔗</l>",
"555": "返回根 <b>LimboState</b>。",
"556": "<1/> <b>is_active</b>() <2/> <l3>🔗</l>",
"557": "如果当前处于活动状态(即它是父级 <l2>LimboHSM</l> 的活动子状态),则返回 <1/>。",
"558": "<l1>LimboState</l> <b>named</b>(name: <2/>) <l3>🔗</l>",
"559": "用于设置此状态名称的链式方法。",
"560": "<1/> <b>set_guard</b>(guard_callable: <2/>) <l3>🔗</l>",
"561": "设置守卫(guard)函数,每当考虑转换到该状态时都会调用它。如果该函数返回 <1/>,该转换将被禁止。",
"562": "LimboHSM",
"563": "<b>继承:</b><l1>LimboState</l>",
"564": "基于事件的分层状态机(HSM)。",
"565": "基于事件的分层状态机(HSM),用于管理 <l1>LimboState</l> 实例并处理它们之间的转换。LimboHSM 本身就是一个 <l2>LimboState</l>,也可以作为另一个 LimboHSM 节点的子节点。",
"566": "<l1>LimboState</l>",
"567": "<l1>ANYSTATE</l>",
"568": "<l1>initial_state</l>",
"569": "<l1>UpdateMode</l>",
"570": "<l1>update_mode</l>",
"571": "<l1>add_transition</l>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable())",
"572": "<l1>change_active_state</l>(state: <l2>LimboState</l>)",
"573": "<l1>get_active_state</l>() <2/>",
"574": "<l1>get_leaf_state</l>() <2/>",
"575": "<l1>get_previous_active_state</l>() <2/>",
"576": "<l1>has_transition</l>(from_state: <l2>LimboState</l>, event: <3/>) <4/>",
"577": "<l1>initialize</l>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null)",
"578": "<l1>remove_transition</l>(from_state: <l2>LimboState</l>, event: <3/>)",
"579": "<l1>set_active</l>(active: <2/>)",
"580": "<l1>update</l>(delta: <2/>)",
"581": "<b>active_state_changed</b>(current: <l1>LimboState</l>, previous: <l2>LimboState</l>) <l3>🔗</l>",
"582": "当当前活动的子状态切换到另一个子状态时发出。",
"583": "enum <b>UpdateMode</b>: <l1>🔗</l>",
"584": "<l1>UpdateMode</l> <b>IDLE</b> = <2/>",
"585": "在空闲处理期间更新状态机。",
"586": "<l1>UpdateMode</l> <b>PHYSICS</b> = <2/>",
"587": "在物理处理期间更新状态机。",
"588": "<l1>UpdateMode</l> <b>MANUAL</b> = <2/>",
"589": "通过在脚本中调用 <l1>update</l> 来手动更新状态机。",
"590": "<l1>LimboState</l> <b>ANYSTATE</b> <l2>🔗</l>",
"591": "<l1>LimboState</l> <b>anystate</b>()",
"592": "用于定义“从任意状态出发”的转换。",
"593": "<l1>LimboState</l> <b>initial_state</b> <l2>🔗</l>",
"594": "<1/> <b>set_initial_state</b>(value: <l2>LimboState</l>)",
"595": "<l1>LimboState</l> <b>get_initial_state</b>()",
"596": "使用 <l1>set_active</l> 方法激活状态机时会变为活动的子状态。如果没有显式设置,LimboHSM 的第一个子节点将被视为初始状态。",
"597": "<l1>UpdateMode</l> <b>update_mode</b> = <2/> <l3>🔗</l>",
"598": "<1/> <b>set_update_mode</b>(value: <l2>UpdateMode</l>)",
"599": "<l1>UpdateMode</l> <b>get_update_mode</b>()",
"600": "指定状态机应在何时更新。见 <l1>UpdateMode</l>。",
"601": "<1/> <b>add_transition</b>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable()) <l6>🔗</l>",
"602": "建立从一个状态到另一个状态的转换,在 <1/> 被派发时触发。<2/> 和 <3/> 都必须是此 <b>LimboHSM</b> 的直接子节点。",
"603": "可选地,可以指定一个 <1/> 函数,它必须返回布尔值。如果守卫函数返回 <2/>,则不会发生转换。守卫函数会在考虑该转换之前立即被调用。关于状态级别的守卫函数,请查看 <l3>LimboState.set_guard</l>。",
"604": "<1/> <b>change_active_state</b>(state: <l2>LimboState</l>) <l3>🔗</l>",
"605": "把当前活动的子状态切换为 <1/>。如果 <2/> 已经处于活动状态,它会被退出并重新进入。",
"606": "<1/> 必须是此 <b>LimboHSM</b> 的子节点。",
"607": "<l1>LimboState</l> <b>get_active_state</b>() <2/> <l3>🔗</l>",
"608": "返回当前活动的子状态。",
"609": "<l1>LimboState</l> <b>get_leaf_state</b>() <2/> <l3>🔗</l>",
"610": "返回状态机中当前活动的叶状态。",
"611": "<l1>LimboState</l> <b>get_previous_active_state</b>() <2/> <l3>🔗</l>",
"612": "返回上一个活动的子状态。",
"613": "<1/> <b>has_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <4/> <l5>🔗</l>",
"614": "如果存在从 <2/> 出发、针对给定 <3/> 的转换,则返回 <1/>。",
"615": "<1/> <b>initialize</b>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null) <l4>🔗</l>",
"616": "初始化该状态,并为它自身及所有子状态调用 <l1>LimboState._setup</l>。",
"617": "<1/> <b>remove_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <l4>🔗</l>",
"618": "移除某个状态上与特定 <1/> 关联的转换。",
"619": "<1/> <b>set_active</b>(active: <2/>) <l3>🔗</l>",
"620": "设为 <1/> 时,会把状态切换到 <l2>initial_state</l>,并根据 <l3>update_mode</l> 激活状态处理。",
"621": "<1/> <b>update</b>(delta: <2/>) <l3>🔗</l>",
"622": "对它自身和活动子状态调用 <l1>LimboState._update</l>,调用会逐级向下传递到叶状态。如果 <l2>update_mode</l> 未设为 <l3>MANUAL</l>,此方法会自动触发。"
}
@@ -0,0 +1,158 @@
{
"623": "BTState",
"624": "用于 <l1>LimboHSM</l>、承载 <l2>BehaviorTree</l> 的状态节点。",
"625": "BTState 是一种 <l1>LimboState</l> 节点,它通过管理 <l2>BehaviorTree</l> 来为该状态提供行为逻辑。它会实例化并运行 <l3>BehaviorTree</l> 资源,并在 <4/> 或 <5/> 时派发状态机事件。事件名称可以通过 <l6>success_event</l> 和 <l7>failure_event</l> 自定义。关于状态机事件的更多细节,见 <l8>LimboState.dispatch</l>。",
"626": "<l1>behavior_tree</l>",
"627": "<l1>failure_event</l>",
"628": "<l1>monitor_performance</l>",
"629": "<l1>success_event</l>",
"630": "<l1>get_bt_instance</l>() <2/>",
"631": "<l1>set_scene_root_hint</l>(scene_root: <2/>)",
"632": "<l1>BehaviorTree</l> <b>behavior_tree</b> <l2>🔗</l>",
"633": "定义状态行为的 <l1>BehaviorTree</l> 资源。",
"634": "<1/> <b>failure_event</b> = <2/> <l3>🔗</l>",
"635": "<1/> <b>set_failure_event</b>(value: <2/>)",
"636": "<1/> <b>get_failure_event</b>()",
"637": "当行为树结果为 <1/> 时将被派发的 HSM 事件。见 <l2>LimboState.dispatch</l>。",
"638": "<1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>",
"639": "如果为 <1/>,会为此 <b>BTState</b> 节点的每个实例在 “Debugger->Monitors” 中添加一个性能监视器。",
"640": "<1/> <b>success_event</b> = <2/> <l3>🔗</l>",
"641": "<1/> <b>set_success_event</b>(value: <2/>)",
"642": "<1/> <b>get_success_event</b>()",
"643": "当行为树结果为 <1/> 时将被派发的 HSM 事件。见 <l2>LimboState.dispatch</l>。",
"644": "<l1>BTInstance</l> <b>get_bt_instance</b>() <2/> <l3>🔗</l>",
"645": "<1/> <b>set_scene_root_hint</b>(scene_root: <2/>) <l3>🔗</l>",
"646": "设置新实例化的行为树要使用的场景根节点 <1/>。应当在状态机初始化之前调用。当你需要用代码动态创建 <b>BTState</b> 节点时,这通常很有用。",
"647": "完整的类参考可以在侧边栏中找到。",
"648": "BBAabb",
"649": "<b>继承:</b><l1>BBParam</l>",
"650": "用于 <l1>BehaviorTree</l> 任务的 AABB 类型参数。见 <l2>BBParam</l>。",
"651": "BBArray",
"652": "用于 <l1>BehaviorTree</l> 任务的 Array 类型参数。见 <l2>BBParam</l>。",
"653": "BBBasis",
"654": "用于 <l1>BehaviorTree</l> 任务的 Basis 类型参数。见 <l2>BBParam</l>。",
"655": "BBBool",
"656": "用于 <l1>BehaviorTree</l> 任务的 Bool 类型参数。见 <l2>BBParam</l>。",
"657": "BBByteArray",
"658": "用于 <l1>BehaviorTree</l> 任务的 ByteArray 类型参数。见 <l2>BBParam</l>。",
"659": "BBColor",
"660": "用于 <l1>BehaviorTree</l> 任务的 Color 类型参数。见 <l2>BBParam</l>。",
"661": "BBColorArray",
"662": "用于 <l1>BehaviorTree</l> 任务的 ColorArray 类型参数。见 <l2>BBParam</l>。",
"663": "BBDictionary",
"664": "用于 <l1>BehaviorTree</l> 任务的 Dictionary 类型参数。见 <l2>BBParam</l>。",
"665": "BBFloat",
"666": "用于 <l1>BehaviorTree</l> 任务的 Float 类型参数。见 <l2>BBParam</l>。",
"667": "BBFloat32Array",
"668": "用于 <l1>BehaviorTree</l> 任务的 PackedFloat32Array 类型参数。见 <l2>BBParam</l>。",
"669": "BBFloat64Array",
"670": "用于 <l1>BehaviorTree</l> 任务的 PackedFloat64Array 类型参数。见 <l2>BBParam</l>。",
"671": "BBInt",
"672": "用于 <l1>BehaviorTree</l> 任务的 Integer 类型参数。见 <l2>BBParam</l>。",
"673": "BBInt32Array",
"674": "用于 <l1>BehaviorTree</l> 任务的 PackedInt32Array 类型参数。见 <l2>BBParam</l>。",
"675": "BBInt64Array",
"676": "用于 <l1>BehaviorTree</l> 任务的 PackedInt64Array 类型参数。见 <l2>BBParam</l>。",
"677": "BBNode",
"678": "用于 <l1>BehaviorTree</l> 任务的 Node 类型参数。见 <l2>BBParam</l>。",
"679": "面向 <l1>BehaviorTree</l> 任务使用的 Node 类型参数。见 <l2>BBParam</l>。",
"680": "如果来源是黑板变量,则允许任何继承自 <1/> 的类型。",
"681": "BBPlane",
"682": "用于 <l1>BehaviorTree</l> 任务的 Plane 类型参数。见 <l2>BBParam</l>。",
"683": "BBProjection",
"684": "用于 <l1>BehaviorTree</l> 任务的 Projection 类型参数。见 <l2>BBParam</l>。",
"685": "BBQuaternion",
"686": "用于 <l1>BehaviorTree</l> 任务的 Quaternion 类型参数。见 <l2>BBParam</l>。",
"687": "BBRect2",
"688": "用于 <l1>BehaviorTree</l> 任务的 Rect2 类型参数。见 <l2>BBParam</l>。",
"689": "BBRect2i",
"690": "用于 <l1>BehaviorTree</l> 任务的 Rect2i 类型参数。见 <l2>BBParam</l>。",
"691": "BBString",
"692": "用于 <l1>BehaviorTree</l> 任务的 String 类型参数。见 <l2>BBParam</l>。",
"693": "BBStringArray",
"694": "用于 <l1>BehaviorTree</l> 任务的 StringArray 类型参数。见 <l2>BBParam</l>。",
"695": "BBStringName",
"696": "用于 <l1>BehaviorTree</l> 任务的 StringName 类型参数。见 <l2>BBParam</l>。",
"697": "BBTransform2D",
"698": "用于 <l1>BehaviorTree</l> 任务的 Transform2D 类型参数。见 <l2>BBParam</l>。",
"699": "BBTransform3D",
"700": "用于 <l1>BehaviorTree</l> 任务的 Transform3D 类型参数。见 <l2>BBParam</l>。",
"701": "BBVariant",
"702": "用于 <l1>BehaviorTree</l> 任务的 Variant 类型参数。见 <l2>BBParam</l>。",
"703": "面向 <l1>BehaviorTree</l> 任务使用的 Variant 类型参数。见 <l2>BBParam</l>。",
"704": "数据类型由 <l1>type</l> 指定。",
"705": "<l1>type</l>",
"706": "Variant.Type <b>type</b> = <1/> <l2>🔗</l>",
"707": "<1/> <b>set_type</b>(value: Variant.Type)",
"708": "Variant.Type <b>get_type</b>()",
"709": "为该参数值指定的 Variant.Type。",
"710": "BBVector2",
"711": "用于 <l1>BehaviorTree</l> 任务的 Vector2 类型参数。见 <l2>BBParam</l>。",
"712": "BBVector2Array",
"713": "用于 <l1>BehaviorTree</l> 任务的 Vector2Array 类型参数。见 <l2>BBParam</l>。",
"714": "BBVector2i",
"715": "用于 <l1>BehaviorTree</l> 任务的 Vector2i 类型参数。见 <l2>BBParam</l>。",
"716": "BBVector3",
"717": "用于 <l1>BehaviorTree</l> 任务的 Vector3 类型参数。见 <l2>BBParam</l>。",
"718": "BBVector3Array",
"719": "用于 <l1>BehaviorTree</l> 任务的 Vector3Array 类型参数。见 <l2>BBParam</l>。",
"720": "BBVector3i",
"721": "用于 <l1>BehaviorTree</l> 任务的 Vector3i 类型参数。见 <l2>BBParam</l>。",
"722": "BBVector4",
"723": "用于 <l1>BehaviorTree</l> 任务的 Vector4 类型参数。见 <l2>BBParam</l>。",
"724": "BBVector4i",
"725": "用于 <l1>BehaviorTree</l> 任务的 Vector4i 类型参数。见 <l2>BBParam</l>。",
"726": "BehaviorTree",
"727": "包含行为树数据。",
"728": "行为树是一种层次结构,用于建模和控制游戏中智能体(例如角色、敌人、实体)的行为。它旨在让你更轻松地为游戏创建复杂且高度模块化的行为。",
"729": "行为树由若干任务组成,这些任务代表具体的动作或决策规则。任务大致可分为两大类:控制任务和叶任务。控制任务决定树内的执行流程,包括 <l1>BTSequence</l>、<l2>BTSelector</l> 和 <l3>BTInvert</l>。叶任务代表要执行的具体动作(例如移动或攻击),或是需要检查的条件。<l4>BTTask</l> 类为行为树的各种积木块提供了基础。BT 任务可以借助 <l5>Blackboard</l> 共享数据。见 <l6>BTTask.blackboard</l> 和 <l7>Blackboard</l>。",
"730": "<b>注意:</b>要创建你自己的动作,请继承 <l1>BTAction</l> 类。",
"731": "BehaviorTree 从根任务开始执行,遵循控制任务规定的规则,一路向下直到叶任务 —— 叶任务代表智能体应当执行的实际动作,或应当检查的条件。每个任务在执行时都会返回一个状态,可能是 <1/>、<2/> 或 <3/>。这些状态决定树的推进方式,它们定义在 <l4>Status</l> 中。",
"732": "行为树通过条件任务处理条件逻辑。这些任务检查特定条件,并根据智能体或其环境的状态返回 <1/> 或 <2/>(例如 “IsLowOnHealth”、“IsTargetInSight”)。条件可以与 <l3>BTSequence</l> 和 <l4>BTSelector</l> 搭配使用,构建你的决策逻辑。",
"733": "<b>注意</b>:要创建你自己的条件,请继承 <l1>BTCondition</l> 类。",
"734": "请查阅 <l1>BTTask</l> 类,它为行为树的各种积木块提供了基础。",
"735": "<l1>blackboard_plan</l>",
"736": "<l1>description</l>",
"737": "<l1>BehaviorTree</l>",
"738": "<l1>clone</l>() <2/>",
"739": "<l1>copy_other</l>(other: <l2>BehaviorTree</l>)",
"740": "<l1>BTTask</l>",
"741": "<l1>get_root_task</l>() <2/>",
"742": "<l1>instantiate</l>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/>",
"743": "<l1>set_root_task</l>(task: <l2>BTTask</l>)",
"744": "<b>plan_changed</b>() <l1>🔗</l>",
"745": "当 <l1>BlackboardPlan</l> 发生变化时发出。",
"746": "<l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>",
"747": "<1/> <b>description</b> = <2/> <l3>🔗</l>",
"748": "<1/> <b>set_description</b>(value: <2/>)",
"749": "<1/> <b>get_description</b>()",
"750": "用户为 <b>BehaviorTree</b> 提供的描述。",
"751": "<l1>BehaviorTree</l> <b>clone</b>() <2/> <l3>🔗</l>",
"752": "复制一份 BehaviorTree 资源。",
"753": "<1/> <b>copy_other</b>(other: <l2>BehaviorTree</l>) <l3>🔗</l>",
"754": "变成另一棵行为树的副本。",
"755": "<l1>BTTask</l> <b>get_root_task</b>() <2/> <l3>🔗</l>",
"756": "返回 BehaviorTree 资源的根任务。",
"757": "<l1>BTInstance</l> <b>instantiate</b>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/> <l7>🔗</l>",
"758": "实例化行为树并返回 <l1>BTInstance</l>。<2/> 应当是拥有该行为树实例的场景节点,通常是 <l3>BTPlayer</l>、<l4>BTState</l>,或是负责控制行为树执行的自定义播放器节点。请确保传入的 <l5>Blackboard</l> 已从 <l6>blackboard_plan</l> 填充了值。另见 <l7>BlackboardPlan.populate_blackboard</l> 与 <l8>BlackboardPlan.create_blackboard</l>。",
"759": "如果 <1/> 不是 <2/>,它将被用作新实例化的行为树的场景根节点;否则场景根节点会被设为 <3/>。场景根节点对于 <l4>BBNode</l> 实例正常工作至关重要。",
"760": "<1/> <b>set_root_task</b>(task: <l2>BTTask</l>) <l3>🔗</l>",
"761": "为 <b>BehaviorTree</b> 资源指定一个新的根任务。",
"762": "BehaviorTreeData",
"763": "表示 <l1>BehaviorTree</l> 实例的当前状态。",
"764": "该类被 LimboAI 调试器用于 <l1>BehaviorTree</l> 实例数据的序列化与反序列化。",
"765": "此外,它还可以配合 <l1>BehaviorTreeView</l> 可视化 <l2>BehaviorTree</l> 实例的当前状态。它的设计用途是在自定义的运行时工具中使用。",
"766": "<l1>BehaviorTreeData</l>",
"767": "<l1>create_from_bt_instance</l>(bt_instance: <l2>BTInstance</l>) <3/>",
"768": "<l1>BehaviorTreeData</l> <b>create_from_bt_instance</b>(bt_instance: <l2>BTInstance</l>) <3/> <l4>🔗</l>",
"769": "返回编码为 <b>BehaviorTreeData</b> 的 <1/> 当前状态,适合与 <l2>BehaviorTreeView</l> 一起使用。",
"770": "行为树实例可以通过 <l1>BTPlayer.get_bt_instance</l> 获取。",
"771": "BehaviorTreeView",
"772": "可视化 <l1>BehaviorTree</l> 实例的当前状态。",
"773": "可视化 <l1>BehaviorTree</l> 实例的当前状态。另见 <l2>BehaviorTreeData</l>。",
"774": "<l1>update_interval_msec</l>",
"775": "<l1>clear</l>()",
"776": "<l1>update_tree</l>(behavior_tree_data: <l2>BehaviorTreeData</l>)",
"777": "<b>task_selected</b>(type_name: <1/>, script_path: <2/>) <l3>🔗</l>",
"778": "在 <b>BehaviorTreeView</b> 中选中某个任务项时发出。"
}
@@ -0,0 +1,166 @@
{
"779": "<1/> <b>update_interval_msec</b> = <2/> <l3>🔗</l>",
"780": "<1/> <b>set_update_interval_msec</b>(value: <2/>)",
"781": "<1/> <b>get_update_interval_msec</b>()",
"782": "两次更新之间的最小延迟(毫秒)。设为更大的值可以降低 CPU 负载。",
"783": "<1/> <b>clear</b>() <l2>🔗</l>",
"784": "清除树视图。",
"785": "<1/> <b>update_tree</b>(behavior_tree_data: <l2>BehaviorTreeData</l>) <l3>🔗</l>",
"786": "更新 <l1>BehaviorTree</l> 实例的显示。另见 <l2>BehaviorTreeData</l>。",
"787": "BlackboardPlan",
"788": "<l1>prefetch_nodepath_vars</l>",
"789": "<l1>create_blackboard</l>(prefetch_root: <2/>, parent_scope: <l3>Blackboard</l> = null, prefetch_root_for_base_plan: <4/> = null)",
"790": "<l1>BlackboardPlan</l>",
"791": "<l1>get_base_plan</l>() <2/>",
"792": "<l1>get_parent_scope_plan_provider</l>() <2/>",
"793": "<l1>is_derived</l>() <2/>",
"794": "<l1>populate_blackboard</l>(blackboard: <l2>Blackboard</l>, overwrite: <3/>, prefetch_root: <4/>, prefetch_root_for_base_plan: <5/> = null)",
"795": "<l1>set_base_plan</l>(blackboard_plan: <l2>BlackboardPlan</l>)",
"796": "<l1>set_parent_scope_plan_provider</l>(callable: <2/>)",
"797": "<l1>sync_with_base_plan</l>()",
"798": "<1/> <b>prefetch_nodepath_vars</b> = <2/> <l3>🔗</l>",
"799": "<1/> <b>set_prefetch_nodepath_vars</b>(value: <2/>)",
"800": "<1/> <b>is_prefetching_nodepath_vars</b>()",
"801": "启用或禁用 <1/> 变量预取。如果为 <2/>,在创建 <l4>Blackboard</l> 时,<3/> 值会被替换为对应的节点实例。",
"802": "<l1>Blackboard</l> <b>create_blackboard</b>(prefetch_root: <2/>, parent_scope: <l3>Blackboard</l> = null, prefetch_root_for_base_plan: <4/> = null) <l5>🔗</l>",
"803": "使用该计划构建一个新的 <l1>Blackboard</l> 实例。如果启用了 <2/> 预取,将用 <3/> 为 <4/> 变量获取节点实例并替换其值。",
"804": "<l1>BlackboardPlan</l> <b>get_base_plan</b>() <2/> <l3>🔗</l>",
"805": "返回基础计划。见 <l1>is_derived</l>。",
"806": "<1/> <b>get_parent_scope_plan_provider</b>() <2/> <l3>🔗</l>",
"807": "返回父作用域计划提供者 —— 一个返回 <b>BlackboardPlan</b> 的可调用对象。",
"808": "<1/> <b>is_derived</b>() <2/> <l3>🔗</l>",
"809": "如果此计划派生自另一个计划(即基础计划不为 <2/>),则返回 <1/>。派生计划只能包含基础计划中已有的变量,并且只有变量值可以不同。",
"810": "<1/> <b>populate_blackboard</b>(blackboard: <l2>Blackboard</l>, overwrite: <3/>, prefetch_root: <4/>, prefetch_root_for_base_plan: <5/> = null) <l6>🔗</l>",
"811": "用该计划中的变量填充 <1/>。如果 <2/> 为 <3/>,同名变量将被覆盖。如果启用了 <4/> 预取,将用 <5/> 为 <6/> 变量获取节点实例并替换其值。",
"812": "<1/> <b>set_base_plan</b>(blackboard_plan: <l2>BlackboardPlan</l>) <l3>🔗</l>",
"813": "设置基础计划。一旦指定,该计划将从基础计划派生。",
"814": "请谨慎使用,它会移除基础计划中不存在的变量。仅用于自定义工具开发。",
"815": "<1/> <b>set_parent_scope_plan_provider</b>(callable: <2/>) <l3>🔗</l>",
"816": "设置父作用域计划提供者 —— 一个返回 <b>BlackboardPlan</b> 的可调用对象。用于在检视面板中提供提示。设置之后即可使用映射功能。",
"817": "<1/> <b>sync_with_base_plan</b>() <l2>🔗</l>",
"818": "将此计划与基础计划同步:移除基础计划中不存在的变量,并更新类型信息。仅用于自定义工具开发。",
"819": "BT",
"820": "<b>被继承:</b><l1>BTTask</l>",
"821": "<l1>BTTask</l> 的基类。",
"822": "enum <b>Status</b>: <l1>🔗</l>",
"823": "<l1>Status</l> <b>FRESH</b> = <2/>",
"824": "任务尚未执行,或者已被中止并重置。",
"825": "<l1>Status</l> <b>RUNNING</b> = <2/>",
"826": "任务正在执行,尚未完成。",
"827": "<l1>Status</l> <b>FAILURE</b> = <2/>",
"828": "任务以失败结束。",
"829": "<l1>Status</l> <b>SUCCESS</b> = <2/>",
"830": "任务以成功结束。",
"831": "BTAction",
"832": "<b>继承:</b><l1>BTTask</l> <b><</b> <l2>BT</l>",
"833": "<b>被继承:</b><l1>BTAwaitAnimation</l>、<l2>BTCallMethod</l>、<l3>BTConsolePrint</l>、<l4>BTEvaluateExpression</l>、<l5>BTFail</l>、<l6>BTPauseAnimation</l>、<l7>BTPlayAnimation</l>、<l8>BTRandomWait</l>、<l9>BTSetAgentProperty</l>、<l10>BTSetVar</l>、<l11>BTStopAnimation</l>、<l12>BTWait</l>、<l13>BTWaitTicks</l>",
"834": "所有 <l1>BehaviorTree</l> 动作的基类。",
"835": "<l1>BehaviorTree</l> 中所有动作的基类。你可以通过继承 <b>BTAction</b> 类来创建自己的动作。",
"836": "表示 <l1>BehaviorTree</l> 中智能体应当执行的某个具体行为或动作。动作是 <l2>BehaviorTree</l> 层次结构的最底层,负责执行达成目标所需的实际工作。动作没有子任务。",
"837": "单个动作可以在一个或多个 tick 内完成任务。如果完成任务需要不止一个 tick,该动作应返回 <1/> 状态。任务完成时,动作返回 <2/> 或 <3/> 来表示结果。",
"838": "BTAlwaysFail",
"839": "<b>继承:</b><l1>BTDecorator</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>",
"840": "把 <1/> 转换为 <2/> 的 BT 装饰器。",
"841": "BTAlwaysSucceed",
"842": "把 <1/> 转换为 <2/> 的 BT 装饰器。",
"843": "BTAwaitAnimation",
"844": "<b>继承:</b><l1>BTAction</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>",
"845": "等待动画播放完毕的 BT 动作。",
"846": "BTAwaitAnimation 动作会等待指定 <1/> 节点上的动画播放完毕,然后返回 <2/>。",
"847": "如果指定动画已播放完毕,或者指定动画当前未在播放,则返回 <1/>。",
"848": "如果指定动画不存在,或者该动作获取 <2/> 节点失败,则返回 <1/>。",
"849": "<l1>animation_name</l>",
"850": "<l1>BBNode</l>",
"851": "<l1>animation_player</l>",
"852": "<l1>max_time</l>",
"853": "<1/> <b>animation_name</b> = <2/> <l3>🔗</l>",
"854": "<1/> <b>set_animation_name</b>(value: <2/>)",
"855": "<1/> <b>get_animation_name</b>()",
"856": "动画在 <1/> 节点中的键名。",
"857": "<l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>",
"858": "<1/> <b>set_animation_player</b>(value: <l2>BBNode</l>)",
"859": "<l1>BBNode</l> <b>get_animation_player</b>()",
"860": "指定 <1/> 节点的参数。",
"861": "<1/> <b>max_time</b> = <2/> <l3>🔗</l>",
"862": "<1/> <b>set_max_time</b>(value: <2/>)",
"863": "<1/> <b>get_max_time</b>()",
"864": "等待动画完成的最长时长(秒)。如果动画在此时间内没有播放完毕,BTAwaitAnimation 会停止等待并返回 <1/>。",
"865": "BTCallMethod",
"866": "在指定的 <1/> 或 <2/> 上调用方法的 BT 动作。",
"867": "BTCallMethod 动作会在指定的 <2/> 或 <3/> 实例上调用 <l1>method</l>,然后返回 <4/>。",
"868": "如果该动作在方法执行期间遇到问题,则返回 <1/>。",
"869": "Array[<l1>BBVariant</l>]",
"870": "<l1>args</l>",
"871": "<l1>args_include_delta</l>",
"872": "<l1>method</l>",
"873": "<l1>node</l>",
"874": "<l1>result_var</l>",
"875": "Array[<l1>BBVariant</l>] <b>args</b> = <2/> <l3>🔗</l>",
"876": "<1/> <b>set_args</b>(value: Array[<l2>BBVariant</l>])",
"877": "Array[<l1>BBVariant</l>] <b>get_args</b>()",
"878": "调用方法时要传入的实参。",
"879": "<1/> <b>args_include_delta</b> = <2/> <l3>🔗</l>",
"880": "<1/> <b>set_include_delta</b>(value: <2/>)",
"881": "<1/> <b>is_delta_included</b>()",
"882": "把 delta 作为第一个参数包含进来,并相应地后移其余参数的位置(如果有的话)。",
"883": "<1/> <b>method</b> = <2/> <l3>🔗</l>",
"884": "<1/> <b>set_method</b>(value: <2/>)",
"885": "<1/> <b>get_method</b>()",
"886": "要调用的方法名。",
"887": "<l1>BBNode</l> <b>node</b> <l2>🔗</l>",
"888": "<1/> <b>set_node_param</b>(value: <l2>BBNode</l>)",
"889": "<l1>BBNode</l> <b>get_node_param</b>()",
"890": "指定包含要调用方法的 <1/> 或 <2/> 实例。",
"891": "<1/> <b>result_var</b> = <2/> <l3>🔗</l>",
"892": "<1/> <b>set_result_var</b>(value: <2/>)",
"893": "<1/> <b>get_result_var</b>()",
"894": "如果不为空,则把方法调用的结果赋给该属性指定的黑板变量。",
"895": "BTCheckAgentProperty",
"896": "<b>继承:</b><l1>BTCondition</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>",
"897": "检查智能体属性值的 BT 条件。",
"898": "BTCheckAgentProperty 会检查智能体的属性值,并将其与 <l1>value</l> 进行比较。",
"899": "根据 <l3>check_type</l> 返回 <1/> 或 <2/>。",
"900": "<l1>CheckType</l>",
"901": "<l1>check_type</l>",
"902": "<l1>property</l>",
"903": "<l1>BBVariant</l>",
"904": "<l1>value</l>",
"905": "<l1>CheckType</l> <b>check_type</b> = <2/> <l3>🔗</l>",
"906": "<1/> <b>set_check_type</b>(value: <l2>CheckType</l>)",
"907": "<l1>CheckType</l> <b>get_check_type</b>()",
"908": "要执行的检查类型。",
"909": "<1/> <b>property</b> = <2/> <l3>🔗</l>",
"910": "<1/> <b>set_property</b>(value: <2/>)",
"911": "<1/> <b>get_property</b>()",
"912": "指定要比较的智能体属性的参数。",
"913": "<l1>BBVariant</l> <b>value</b> <l2>🔗</l>",
"914": "<1/> <b>set_value</b>(value: <l2>BBVariant</l>)",
"915": "<l1>BBVariant</l> <b>get_value</b>()",
"916": "指定智能体属性将与之比较的值的参数。",
"917": "BTCheckTrigger",
"918": "检查触发器(一个布尔变量)的 BT 条件。",
"919": "<b>BTCheckTrigger</b> 检查 <l1>variable</l> 是否被设为 <2/>。如果是,它会把该变量切换为 <3/> 并返回 <4/>;否则返回 <5/>。",
"920": "<b>BTCheckTrigger</b> 可以在 <l1>BTSequence</l> 中充当“门闩”:当触发器变量被设为 <2/> 时,它允许执行后续任务,随后把该变量改为 <3/>。",
"921": "<l1>variable</l>",
"922": "<1/> <b>variable</b> = <2/> <l3>🔗</l>",
"923": "黑板上用作触发器的布尔变量。另见 <l1>BTTask.blackboard</l>。",
"924": "如果变量的值为 <1/>,<b>BTCheckTrigger</b> 会把它切换为 <2/> 并返回 <3/>。",
"925": "如果变量的值为 <1/>,<b>BTCheckTrigger</b> 会返回 <2/>。",
"926": "BTCheckVar",
"927": "检查黑板上变量的 BT 条件。",
"928": "BTCheckVar 会把 <l1>variable</l> 与 <l2>value</l> 进行比较,并根据 <l5>check_type</l> 返回 <3/> 或 <4/>。",
"929": "<l1>check_type</l>",
"930": "<l1>value</l>",
"931": "<l1>variable</l>",
"932": "<l1>CheckType</l> <b>check_type</b> = <2/> <l3>🔗</l>",
"933": "<l1>BBVariant</l> <b>value</b> <l2>🔗</l>",
"934": "指定 <l1>variable</l> 将与之比较的值的参数。",
"935": "<1/> <b>variable</b> = <2/> <l3>🔗</l>",
"936": "要检查其值的变量名。",
"937": "BTComment",
"938": "BTComment 为 <l1>BehaviorTree</l> 添加注解或说明性文字。",
"939": "BTComment 用于为 <l1>BehaviorTree</l> 添加注解或说明性备注。",
"940": "注释不会作为树的一部分被执行,并且在 <l1>BehaviorTree</l> 的运行时实例中会被移除。",
"941": "BTComposite",
"942": "<b>被继承:</b><l1>BTDynamicSelector</l>、<l2>BTDynamicSequence</l>、<l3>BTParallel</l>、<l4>BTProbabilitySelector</l>、<l5>BTRandomSelector</l>、<l6>BTRandomSequence</l>、<l7>BTSelector</l>、<l8>BTSequence</l>"
}
@@ -0,0 +1,133 @@
{
"943": "BT 组合任务的基类。",
"944": "所有 <l1>BehaviorTree</l> 组合任务的基类。你可以通过继承 BTComposite 类来创建自己的组合任务。",
"945": "组合任务(Composite)是 <l1>BehaviorTree</l> 中的一种控制任务,包含一个或多个子任务。它通过规定子任务的执行方式,定义 <l2>BehaviorTree</l> 的结构与流程。组合任务可以把相关任务归组为一个单元,让 <l3>BehaviorTree</l> 更易管理和维护。<l4>BehaviorTree</l> 组合任务的例子包括 <l5>BTSelector</l>、<l6>BTSequence</l> 和 <l7>BTParallel</l>。",
"946": "BTCondition",
"947": "<b>被继承:</b><l1>BTCheckAgentProperty</l>、<l2>BTCheckTrigger</l>、<l3>BTCheckVar</l>",
"948": "BT 条件的基类。",
"949": "所有 <l1>BehaviorTree</l> 条件的基类。你可以通过继承 <b>BTCondition</b> 类来创建自己的条件。",
"950": "条件(Condition)是 <l1>BehaviorTree</l> 中的一种任务,它在执行后续任务之前检查特定条件。条件常用于组合任务内部以控制执行流程,用来验证环境状态、检查敌人是否存在,或评估智能体的生命值状态。在 <l2>BehaviorTree</l> 中使用条件任务可以提高系统效率并避免不必要的动作。不过,它们可能不适合复杂的决策过程,而且条件任务过多会让 <l3>BehaviorTree</l> 难以阅读。",
"951": "条件通常不需要多个 tick 就能完成,会立即返回 <1/> 或 <2/>。",
"952": "BTConsolePrint",
"953": "向控制台输出文本的 BT 动作任务。",
"954": "BTConsolePrint 动作会向控制台输出文本并返回 <1/>。它可以包含类似于 GDScript % 运算符的格式化参数占位符。",
"955": "<l1>bb_format_parameters</l>",
"956": "<l1>text</l>",
"957": "<1/> <b>bb_format_parameters</b> = <2/> <l3>🔗</l>",
"958": "<1/> <b>set_bb_format_parameters</b>(value: <2/>)",
"959": "<1/> <b>get_bb_format_parameters</b>()",
"960": "格式化参数的值会作为将要打印文本的格式化实参。",
"961": "<b>注意:</b>返回的数组是<i>副本</i>,对它的任何修改都不会更新原始属性值。更多细节见 <1/>。",
"962": "<1/> <b>text</b> = <2/> <l3>🔗</l>",
"963": "<1/> <b>set_text</b>(value: <2/>)",
"964": "<1/> <b>get_text</b>()",
"965": "要打印的文本,可以包含多个占位符,用于替换为格式化实参。这些占位符遵循与 GDScript % 运算符相同的格式,通常以 ‘%’ 开头并后接格式说明符。例如:%s 表示字符串,%d 表示整数,%f 表示实数。",
"966": "BTCooldown",
"967": "只有距上次执行已过去 <l1>duration</l> 时间时,才执行其子任务的 BT 装饰器。",
"968": "只有距上次子任务成功执行已过去 <l1>duration</l> 时间时,BTCooldown 才运行其子任务。除非把 <l2>trigger_on_failure</l> 设为 <3/>,否则它只考虑成功的执行。",
"969": "如果子任务结果为 <2/>,返回 <1/>。",
"970": "如果子任务结果为 <2/>,返回 <1/>,并触发冷却计时器。",
"971": "如果子任务结果为 <2/>,或者距上次执行尚未过去 <l3>duration</l> 时间,返回 <1/>。",
"972": "<l1>cooldown_state_var</l>",
"973": "<l1>duration</l>",
"974": "<l1>process_pause</l>",
"975": "<l1>start_cooled</l>",
"976": "<l1>trigger_on_failure</l>",
"977": "<1/> <b>cooldown_state_var</b> = <2/> <l3>🔗</l>",
"978": "<1/> <b>set_cooldown_state_var</b>(value: <2/>)",
"979": "<1/> <b>get_cooldown_state_var</b>()",
"980": "用于在 <l1>Blackboard</l> 中存储冷却状态的布尔变量。如果留空,该变量会被自动生成并赋值。",
"981": "如果该变量的值被设为 <1/>,表示冷却已激活。此特性可用于从树的其他部分检查冷却状态,或在 <l2>BehaviorTree</l> 的不同部分之间共享它。",
"982": "<1/> <b>duration</b> = <2/> <l3>🔗</l>",
"983": "<1/> <b>set_duration</b>(value: <2/>)",
"984": "<1/> <b>get_duration</b>()",
"985": "允许下一次执行子任务之前需要等待的时间。",
"986": "<1/> <b>process_pause</b> = <2/> <l3>🔗</l>",
"987": "<1/> <b>set_process_pause</b>(value: <2/>)",
"988": "<1/> <b>get_process_pause</b>()",
"989": "如果为 <1/>,则在 <2/> 暂停时也处理冷却。",
"990": "<1/> <b>start_cooled</b> = <2/> <l3>🔗</l>",
"991": "<1/> <b>set_start_cooled</b>(value: <2/>)",
"992": "<1/> <b>get_start_cooled</b>()",
"993": "如果为 <1/>,则像子任务在第一次 BT tick 之前已执行过一样开始冷却。",
"994": "<1/> <b>trigger_on_failure</b> = <2/> <l3>🔗</l>",
"995": "<1/> <b>set_trigger_on_failure</b>(value: <2/>)",
"996": "<1/> <b>get_trigger_on_failure</b>()",
"997": "如果为 <1/>,当子任务结果为 <2/> 时也会激活冷却。否则,只有子任务结果为 <3/> 时才会触发冷却。",
"998": "BTDecorator",
"999": "<b>被继承:</b><l1>BTAlwaysFail</l>、<l2>BTAlwaysSucceed</l>、<l3>BTCooldown</l>、<l4>BTDelay</l>、<l5>BTForEach</l>、<l6>BTInvert</l>、<l7>BTNewScope</l>、<l8>BTProbability</l>、<l9>BTRepeat</l>、<l10>BTRepeatUntilFailure</l>、<l11>BTRepeatUntilSuccess</l>、<l12>BTRunLimit</l>、<l13>BTTimeLimit</l>",
"1000": "BT 装饰器的基类。",
"1001": "所有 <l1>BehaviorTree</l> 装饰器的基类。你可以通过继承 BTDecorator 类来创建自己的装饰器。",
"1002": "装饰器是 <l1>BehaviorTree</l> 中用于改变其子任务行为的一种任务。装饰器只能拥有一个子任务。",
"1003": "装饰器可以为任务的执行添加条件、限制或其他约束。<l1>BehaviorTree</l> 装饰器的例子包括 <l2>BTInvert</l>、<l3>BTRepeat</l> 和 <l4>BTCooldown</l>。使用 <l5>BehaviorTree</l> 装饰器可以为现有任务添加额外逻辑,从而简化复杂行为的设计与实现。",
"1004": "BTDelay",
"1005": "在执行其子任务之前引入延迟的 BT 装饰器。",
"1006": "BTDelay 在执行其子任务之前引入 <l1>seconds</l> 的延迟。在延迟期间返回 <2/>。",
"1007": "<l1>seconds</l>",
"1008": "<1/> <b>seconds</b> = <2/> <l3>🔗</l>",
"1009": "<1/> <b>set_seconds</b>(value: <2/>)",
"1010": "<1/> <b>get_seconds</b>()",
"1011": "延迟时长(秒)。",
"1012": "BTDynamicSelector",
"1013": "<b>继承:</b><l1>BTComposite</l> <b><</b> <l2>BTTask</l> <b><</b> <l3>BT</l>",
"1014": "每个 tick 都从头执行任务、直到出现第一个 <1/> 的 BT 组合任务。",
"1015": "BTDynamicSelector 按顺序从第一个到最后一个执行子任务,直到任一子任务返回 <1/>。与 <l2>BTSelector</l> 不同,它每个 tick 都会从头开始执行任务,重新评估它们的状态。当你希望每个 tick 都重试更高优先级的行为时,它非常有用。",
"1016": "如果某个子任务结果为 <2/>,返回 <1/>。BTDynamicSelector 会记住最后一个 <3/> 的子任务,但与 <l4>BTSequence</l> 不同,在下一个执行 tick 中它会重新执行之前的任务并重新评估它们的返回状态。如果之前的任一任务没有返回 <5/>,它会中止所记住的那个 <6/> 任务。",
"1017": "如果所有子任务结果都为 <2/>,返回 <1/>。",
"1018": "如果某个子任务结果为 <2/>,返回 <1/>。",
"1019": "BTDynamicSequence",
"1020": "每个 tick 都从头执行任务、只要它们返回 <1/> 就继续的 BT 组合任务。",
"1021": "BTDynamicSequence 按顺序从第一个到最后一个执行子任务,只要它们返回 <1/> 就继续。与 <l2>BTSequence</l> 不同,它每个 tick 都会从头开始执行任务,重新评估它们的状态。当你希望在每个 tick 都重新检查某个长时间运行动作之前的条件,并在任一条件结果为 <4/> 时中止那个 <3/> 动作时,它非常有用。",
"1022": "如果某个子任务结果为 <2/>,返回 <1/>。BTDynamicSequence 会记住最后一个 <3/> 的子任务,但与 <l4>BTSequence</l> 不同,在下一个执行 tick 中它会重新执行之前的任务并重新评估它们的返回状态。如果之前的任一任务没有返回 <5/>,它会中止所记住的那个 <6/> 任务。",
"1023": "如果某个子任务结果为 <2/>,返回 <1/>。",
"1024": "如果所有子任务结果都为 <2/>,返回 <1/>。",
"1025": "BTEvaluateExpression",
"1026": "在指定的 <2/> 或 <3/> 上求值 <1/> 的 BT 动作。",
"1027": "BTEvaluateExpression 动作会在指定的 <2/> 或 <3/> 实例上求值 <l1>expression_string</l>,当 <5/> 执行成功时返回 <4/>。",
"1028": "如果该动作在 <2/> 解析或执行期间遇到问题,则返回 <1/>。",
"1029": "<l1>expression_string</l>",
"1030": "<l1>input_include_delta</l>",
"1031": "<l1>input_names</l>",
"1032": "<l1>input_values</l>",
"1033": "<l1>node</l>",
"1034": "<l1>result_var</l>",
"1035": "Error",
"1036": "<l1>parse</l>()",
"1037": "<1/> <b>expression_string</b> = <2/> <l3>🔗</l>",
"1038": "<1/> <b>set_expression_string</b>(value: <2/>)",
"1039": "<1/> <b>get_expression_string</b>()",
"1040": "要解析并执行的表达式字符串。",
"1041": "<b>警告:</b>更新 <l2>expression_string</l> 后请调用 <l1>parse</l> 来更新内部的 <3/>,因为它不会自动更新。",
"1042": "<1/> <b>input_include_delta</b> = <2/> <l3>🔗</l>",
"1043": "<1/> <b>set_input_include_delta</b>(value: <2/>)",
"1044": "<1/> <b>is_input_delta_included</b>()",
"1045": "如果启用,输入变量 <1/> 会被加入 <l2>input_names</l> 和 <l3>input_values</l>。",
"1046": "<b>警告:</b>切换 <l2>input_include_delta</l> 后请调用 <l1>parse</l> 来更新内部的 <3/>,因为它不会自动更新。",
"1047": "<1/> <b>input_names</b> = <2/> <l3>🔗</l>",
"1048": "<1/> <b>set_input_names</b>(value: <2/>)",
"1049": "<1/> <b>get_input_names</b>()",
"1050": "<l1>expression_string</l> 中的变量名列表,用户将通过 <l2>input_values</l> 为这些变量提供值。",
"1051": "<b>警告:</b>更新 <l2>input_names</l> 后请调用 <l1>parse</l> 来更新内部的 <3/>,因为它不会自动更新。",
"1052": "Array[<l1>BBVariant</l>] <b>input_values</b> = <2/> <l3>🔗</l>",
"1053": "<1/> <b>set_input_values</b>(value: Array[<l2>BBVariant</l>])",
"1054": "Array[<l1>BBVariant</l>] <b>get_input_values</b>()",
"1055": "<l1>input_names</l> 中指定变量对应的值列表。这些值通过数组索引与变量一一对应。",
"1056": "<l1>BBNode</l> <b>node</b> <l2>🔗</l>",
"1057": "<1/> <b>result_var</b> = <2/> <l3>🔗</l>",
"1058": "Error <b>parse</b>() <l1>🔗</l>",
"1059": "在考虑 <l1>input_include_delta</l> 和 <l2>input_names</l> 的前提下调用 Expression.parse,并返回其错误码。",
"1060": "BTFail",
"1061": "总是返回 <1/> 的 BT 动作。",
"1062": "BTForEach",
"1063": "针对 <1/> 的每个元素执行其子任务的 BT 装饰器。",
"1064": "BTForEach 针对 <1/> 的每个元素执行其子任务。在每次迭代中,当前元素会被存入指定的 <l2>Blackboard</l> 变量中。",
"1065": "如果子任务结果为 <2/>,或者子任务在非最后一次迭代中结果为 <3/>,则返回 <1/>。",
"1066": "如果子任务结果为 <2/>,返回 <1/>。",
"1067": "如果子任务在最后一次迭代中结果为 <2/>,返回 <1/>。",
"1068": "<l1>array_var</l>",
"1069": "<l1>save_var</l>",
"1070": "<1/> <b>array_var</b> = <2/> <l3>🔗</l>",
"1071": "<1/> <b>set_array_var</b>(value: <2/>)",
"1072": "<1/> <b>get_array_var</b>()",
"1073": "<l1>Blackboard</l> 中存放 <2/> 的变量,用于迭代过程。"
}
@@ -0,0 +1,160 @@
{
"1074": "<1/> <b>save_var</b> = <2/> <l3>🔗</l>",
"1075": "<1/> <b>set_save_var</b>(value: <2/>)",
"1076": "<1/> <b>get_save_var</b>()",
"1077": "用于存储 <l2>array_var</l> 所引用数组中某个元素的 <l1>Blackboard</l> 变量。",
"1078": "BTInstance",
"1079": "表示 <l1>BehaviorTree</l> 资源的运行时实例。",
"1080": "可以使用 <l1>BehaviorTree.instantiate</l> 方法创建。",
"1081": "<l1>monitor_performance</l>",
"1082": "<l1>get_agent</l>() <2/>",
"1083": "<l1>get_blackboard</l>() <2/>",
"1084": "<l1>get_last_status</l>() <2/>",
"1085": "<l1>get_owner_node</l>() <2/>",
"1086": "<l1>get_root_task</l>() <2/>",
"1087": "<l1>get_source_bt_path</l>() <2/>",
"1088": "<l1>is_instance_valid</l>() <2/>",
"1089": "<l1>register_with_debugger</l>()",
"1090": "<l1>unregister_with_debugger</l>()",
"1091": "<l1>update</l>(delta: <2/>)",
"1092": "<b>freed</b>() <l1>🔗</l>",
"1093": "当行为树实例被释放时发出。调试器用它来注销实例。",
"1094": "<b>updated</b>(status: <1/>) <l2>🔗</l>",
"1095": "当行为树实例完成更新时发出。",
"1096": "<1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>",
"1097": "如果为 <1/>,会在编辑器的 “Debugger->Monitors” 中为此实例添加一个性能监视器。",
"1098": "<1/> <b>get_agent</b>() <2/> <l3>🔗</l>",
"1099": "返回行为树实例的智能体。",
"1100": "<l1>Blackboard</l> <b>get_blackboard</b>() <2/> <l3>🔗</l>",
"1101": "返回行为树实例的黑板。",
"1102": "<l1>Status</l> <b>get_last_status</b>() <2/> <l3>🔗</l>",
"1103": "返回上一次更新的执行状态。",
"1104": "<1/> <b>get_owner_node</b>() <2/> <l3>🔗</l>",
"1105": "返回拥有此行为树实例的场景 <1/>。",
"1106": "<l1>BTTask</l> <b>get_root_task</b>() <2/> <l3>🔗</l>",
"1107": "返回行为树实例的根任务。",
"1108": "<1/> <b>get_source_bt_path</b>() <2/> <l3>🔗</l>",
"1109": "返回用于创建此实例的行为树资源的文件路径。",
"1110": "<1/> <b>is_instance_valid</b>() <2/> <l3>🔗</l>",
"1111": "如果行为树实例已正确初始化并可以使用,则返回 <1/>。",
"1112": "<1/> <b>register_with_debugger</b>() <l2>🔗</l>",
"1113": "向调试器注册该行为树实例。",
"1114": "<1/> <b>unregister_with_debugger</b>() <l2>🔗</l>",
"1115": "从调试器注销该行为树实例。通常不需要这样做,因为实例被释放时调试器会自动注销它。",
"1116": "<l1>Status</l> <b>update</b>(delta: <2/>) <l3>🔗</l>",
"1117": "对行为树实例执行一次 tick 并返回其状态。",
"1118": "BTInvert",
"1119": "把 <1/> 转换为 <2/>、把 <3/> 转换为 <4/> 的 BT 装饰器。",
"1120": "BTInvert 把 <1/> 转换为 <2/>、把 <3/> 转换为 <4/>。",
"1121": "BTNewScope",
"1122": "<b>被继承:</b><l1>BTSubtree</l>",
"1123": "创建新 <l1>Blackboard</l> 作用域的 BT 装饰器。",
"1124": "BTNewScope 在初始化期间创建一个新的 <l1>Blackboard</l> 作用域并向其中填充数据。见 <l2>Blackboard</l>。",
"1125": "返回子任务的执行状态。",
"1126": "<l1>blackboard_plan</l>",
"1127": "<l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>",
"1128": "BTParallel",
"1129": "同时执行所有子任务的 BT 组合任务。",
"1130": "BTParallel 同时执行其所有子任务。注意 BTParallel 并不涉及多线程:它在同一个 tick 内按顺序从第一个到最后一个处理每个任务,然后返回结果。如果满足任一中止条件,所有当前处于 <1/> 的任务都会被终止,结果将是 <2/> 或 <3/> 之一。<l4>num_failures_required</l> 决定 BTParallel 何时失败,<l5>num_successes_required</l> 决定它何时成功。当两者都满足时,它优先考虑 <l6>num_failures_required</l>。",
"1131": "如果设为 <l1>repeat</l>,每个 tick 都会重新执行所有子任务,无论它们之前的结果是 <2/> 还是 <3/>。",
"1132": "当所需数量的子任务结果为 <2/> 时返回 <1/>。当 <l3>repeat</l> 设为 <4/> 时,如果没有满足任何条件,且所有子任务的结果都是 <5/> 或 <6/>,BTParallel 将返回 <7/>。",
"1133": "当所需数量的子任务结果为 <2/> 时返回 <1/>。",
"1134": "如果没有任何条件被满足,并且 <l2>repeat</l> 设为 <3/> 或某个子任务结果为 <4/>,则返回 <1/>。",
"1135": "<l1>num_failures_required</l>",
"1136": "<l1>num_successes_required</l>",
"1137": "<l1>repeat</l>",
"1138": "<1/> <b>num_failures_required</b> = <2/> <l3>🔗</l>",
"1139": "<1/> <b>set_num_failures_required</b>(value: <2/>)",
"1140": "<1/> <b>get_num_failures_required</b>()",
"1141": "如果有指定数量的子任务返回 <1/>,BTParallel 也会返回 <2/>。",
"1142": "<1/> <b>num_successes_required</b> = <2/> <l3>🔗</l>",
"1143": "<1/> <b>set_num_successes_required</b>(value: <2/>)",
"1144": "<1/> <b>get_num_successes_required</b>()",
"1145": "如果有指定数量的子任务返回 <1/>,BTParallel 也会返回 <2/>。",
"1146": "<1/> <b>repeat</b> = <2/> <l3>🔗</l>",
"1147": "<1/> <b>set_repeat</b>(value: <2/>)",
"1148": "<1/> <b>get_repeat</b>()",
"1149": "为 <1/> 时,子任务会被再次执行,无论它们之前的结果是 <2/> 还是 <3/>。",
"1150": "为 <1/> 时,如果没有满足任何条件,且所有子任务的结果都是 <2/> 或 <3/>,BTParallel 将返回 <4/>。",
"1151": "BTPauseAnimation",
"1152": "暂停指定 <1/> 节点上动画播放的 BT 动作。",
"1153": "BTPauseAnimation 动作会暂停指定 <1/> 节点上的动画播放并返回 <2/>。",
"1154": "如果该动作获取 <2/> 节点失败,则返回 <1/>。",
"1155": "<l1>animation_player</l>",
"1156": "<l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>",
"1157": "BTPlayAnimation",
"1158": "在指定 <1/> 节点上播放动画的 BT 动作。",
"1159": "BTPlayAnimation 动作会在指定的 <1/> 节点上播放动画。如果 <l2>await_completion</l> 大于 <3/>,该动作会等待动画完成,最长等待时间等于 <l4>await_completion</l>。",
"1160": "如果动画播放完毕,或者经过的时间超过 <l2>await_completion</l>,则返回 <1/>。当 <l3>await_completion</l> 设为 <4/> 时,BTPlayAnimation 不会等待动画结束,而是立即返回 <5/>。",
"1161": "如果动画仍在播放且经过的时间小于 <l2>await_completion</l>,则返回 <1/>。",
"1162": "如果该动作播放所请求的动画失败,则返回 <1/>。",
"1163": "<l1>animation_name</l>",
"1164": "<l1>animation_player</l>",
"1165": "<l1>await_completion</l>",
"1166": "<l1>blend</l>",
"1167": "<l1>from_end</l>",
"1168": "<l1>speed</l>",
"1169": "<1/> <b>animation_name</b> = <2/> <l3>🔗</l>",
"1170": "动画在 <1/> 节点中的键名。如果为空,并且 <2/> 之前被暂停过,BTPlayAnimation 会继续播放上一次播放的动画。",
"1171": "<l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>",
"1172": "<1/> <b>await_completion</b> = <2/> <l3>🔗</l>",
"1173": "<1/> <b>set_await_completion</b>(value: <2/>)",
"1174": "<1/> <b>get_await_completion</b>()",
"1175": "等待动画完成的最长时长(秒)。如果动画在此时间内没有播放完毕,BTPlayAnimation 会停止等待并返回 <1/>。",
"1176": "<1/> <b>blend</b> = <2/> <l3>🔗</l>",
"1177": "<1/> <b>set_blend</b>(value: <2/>)",
"1178": "<1/> <b>get_blend</b>()",
"1179": "自定义混合时间(秒)。见 AnimationPlayer.play。",
"1180": "<1/> <b>from_end</b> = <2/> <l3>🔗</l>",
"1181": "<1/> <b>set_from_end</b>(value: <2/>)",
"1182": "<1/> <b>get_from_end</b>()",
"1183": "从末尾开始播放动画。配合负的 <l1>speed</l> 可反向播放动画。见 AnimationPlayer.play。",
"1184": "<1/> <b>speed</b> = <2/> <l3>🔗</l>",
"1185": "<1/> <b>set_speed</b>(value: <2/>)",
"1186": "<1/> <b>get_speed</b>()",
"1187": "自定义播放速度缩放比例。见 AnimationPlayer.play。",
"1188": "BTProbability",
"1189": "以给定概率执行其子任务的 BT 装饰器。",
"1190": "BTProbability 以 <l1>run_chance</l> 定义的给定概率执行其子任务。",
"1191": "如果子任务被执行,返回其结果;否则返回 <1/>。",
"1192": "<l1>run_chance</l>",
"1193": "<1/> <b>run_chance</b> = <2/> <l3>🔗</l>",
"1194": "<1/> <b>set_run_chance</b>(value: <2/>)",
"1195": "<1/> <b>get_run_chance</b>()",
"1196": "定义子任务被执行的可能性的概率。",
"1197": "BTProbabilitySelector",
"1198": "根据所附加的概率选择要执行的子任务的 BT 组合任务。",
"1199": "BTProbabilitySelector 根据所附加的概率选择要执行的子任务,通常用于决策。概率分布根据分配给每个子任务的权重计算得出。",
"1200": "当某个子任务结果为 <2/> 时返回 <1/>。",
"1201": "当某个子任务结果为 <2/> 时返回 <1/>。",
"1202": "当某个子任务结果为 <1/> 时,BTProbabilitySelector 的行为取决于 <l2>abort_on_failure</l> 的值:",
"1203": "如果 <l1>abort_on_failure</l> 为 <2/>,当某个子任务结果为 <3/> 时,BTProbabilitySelector 会在剩余子任务上重新归一化概率分布,并选择一个新的子任务来执行。如果所有子任务都失败,该组合任务将返回 <4/>。",
"1204": "如果 <l1>abort_on_failure</l> 为 <2/>,当某个子任务结果为 <3/> 时,BTProbabilitySelector 不会再选择其他子任务执行,而是立即返回 <4/>。",
"1205": "<l1>abort_on_failure</l>",
"1206": "<l1>get_probability</l>(child_idx: <2/>) <3/>",
"1207": "<l1>get_total_weight</l>() <2/>",
"1208": "<l1>get_weight</l>(child_idx: <2/>) <3/>",
"1209": "<l1>has_probability</l>(child_idx: <2/>) <3/>",
"1210": "<l1>set_probability</l>(child_idx: <2/>, probability: <3/>)",
"1211": "<l1>set_weight</l>(child_idx: <2/>, weight: <3/>)",
"1212": "<1/> <b>abort_on_failure</b> = <2/> <l3>🔗</l>",
"1213": "<1/> <b>set_abort_on_failure</b>(value: <2/>)",
"1214": "<1/> <b>get_abort_on_failure</b>()",
"1215": "如果为 <1/>,当某个子任务结果为 <3/> 时,BTProbabilitySelector 不会再选择其他子任务执行,而是返回 <2/>。",
"1216": "<1/> <b>get_probability</b>(child_idx: <2/>) <3/> <l4>🔗</l>",
"1217": "返回该子任务被选中的概率。",
"1218": "<1/> <b>get_total_weight</b>() <2/> <l3>🔗</l>",
"1219": "返回所有子任务的权重总和。",
"1220": "<1/> <b>get_weight</b>(child_idx: <2/>) <3/> <l4>🔗</l>",
"1221": "返回该子任务在加权概率选择算法中的权重。",
"1222": "<1/> <b>has_probability</b>(child_idx: <2/>) <3/> <l4>🔗</l>",
"1223": "返回索引为 <1/> 的子任务是否参与加权概率选择算法并分配了概率。对于 <l3>BTComment</l> 任务返回 <2/>。",
"1224": "<1/> <b>set_probability</b>(child_idx: <2/>, probability: <3/>) <l4>🔗</l>",
"1225": "根据期望的概率来设置该子任务的权重。",
"1226": "<1/> <b>set_weight</b>(child_idx: <2/>, weight: <3/>) <l4>🔗</l>",
"1227": "为加权概率选择算法设置该子任务的权重。",
"1228": "BTRandomSelector",
"1229": "以随机顺序执行任务、直到出现第一个 <1/> 的 BT 组合任务。",
"1230": "BTRandomSelector 以随机顺序执行其子任务,直到任一子任务返回 <1/>。如果某个子任务结果为 <2/>,BTRandomSelector 会立即执行另一个子任务,直到其中一个返回 <3/>,或者全部结果为 <4/>。",
"1231": "如果某个子任务结果为 <2/>,返回 <1/>。BTRandomSelector 会记住执行顺序以及最后一个返回 <3/> 的子任务,确保在下一个 tick 从该位置继续。"
}
@@ -0,0 +1,161 @@
{
"1232": "BTRandomSequence",
"1233": "以随机顺序执行任务、只要它们返回 <1/> 就继续的 BT 组合任务。",
"1234": "BTRandomSequence 以随机顺序执行其子任务,只要它们返回 <1/> 就继续。如果某个子任务结果为 <2/>,BTRandomSequence 会立即执行下一个子任务,直到其中一个返回 <3/>,或者全部结果为 <4/>。",
"1235": "如果某个子任务结果为 <2/>,返回 <1/>。BTRandomSequence 会记住执行顺序以及最后一个返回 <3/> 的子任务,确保在下一个 tick 从该位置继续。",
"1236": "BTRandomWait",
"1237": "等待一段随机时长后返回 <1/> 的 BT 动作。",
"1238": "BTRandomWait 动作会等待一段随机时长,然后返回 <1/>。该时长在指定的范围内随机取值,范围由 <l2>min_duration</l> 和 <l3>max_duration</l> 定义。",
"1239": "<l1>max_duration</l>",
"1240": "<l1>min_duration</l>",
"1241": "<1/> <b>max_duration</b> = <2/> <l3>🔗</l>",
"1242": "<1/> <b>set_max_duration</b>(value: <2/>)",
"1243": "<1/> <b>get_max_duration</b>()",
"1244": "等待的最长时长。",
"1245": "<1/> <b>min_duration</b> = <2/> <l3>🔗</l>",
"1246": "<1/> <b>set_min_duration</b>(value: <2/>)",
"1247": "<1/> <b>get_min_duration</b>()",
"1248": "等待的最短时长。",
"1249": "BTRepeat",
"1250": "把其子任务重复指定 <l1>times</l> 次的 BT 装饰器。",
"1251": "BTRepeat 会按 <l1>times</l> 定义的次数迭代其子任务。如果 <l2>forever</l> 为 <3/>,子任务的执行会无限重复。",
"1252": "如果子任务结果为 <2/>,返回 <1/>。如果 <l3>forever</l> 为 <4/>,BTRepeat 总是返回 <5/>。",
"1253": "如果达到指定的成功执行次数,返回 <1/>。如果 <l2>abort_on_failure</l> 为 <3/>,子任务返回的 <4/> 状态也被视为一次成功执行。",
"1254": "如果子任务结果为 <2/> 且 <l3>abort_on_failure</l> 为 <4/>,则返回 <1/>。",
"1255": "<l1>abort_on_failure</l>",
"1256": "<l1>forever</l>",
"1257": "<l1>times</l>",
"1258": "<1/> <b>abort_on_failure</b> = <2/> <l3>🔗</l>",
"1259": "如果为 <1/>,子任务返回的 <2/> 状态也被视为一次成功执行。",
"1260": "<1/> <b>forever</b> = <2/> <l3>🔗</l>",
"1261": "<1/> <b>set_forever</b>(value: <2/>)",
"1262": "<1/> <b>get_forever</b>()",
"1263": "如果为 <1/>,子任务的执行会无限重复,并总是返回 <2/>。",
"1264": "<1/> <b>times</b> = <2/> <l3>🔗</l>",
"1265": "<1/> <b>set_times</b>(value: <2/>)",
"1266": "<1/> <b>get_times</b>()",
"1267": "重复执行子任务的次数。",
"1268": "BTRepeatUntilFailure",
"1269": "重复其子任务直到 <1/> 的 BT 装饰器。",
"1270": "BTRepeatUntilFailure 重复其子任务,直到结果为 <1/>。",
"1271": "如果子任务结果为 <2/> 或 <3/>,返回 <1/>。",
"1272": "如果子任务结果为 <2/>,返回 <1/>。",
"1273": "BTRepeatUntilSuccess",
"1274": "重复其子任务直到 <1/> 的 BT 装饰器。",
"1275": "BTRepeatUntilSuccess 重复其子任务,直到结果为 <1/>。",
"1276": "如果子任务结果为 <2/> 或 <3/>,返回 <1/>。",
"1277": "如果子任务结果为 <2/>,返回 <1/>。",
"1278": "BTRunLimit",
"1279": "限制其子任务执行次数的 BT 装饰器。",
"1280": "BTRunLimit 把子任务的执行次数限制在 <l1>run_limit</l> 定义的最大次数以内。",
"1281": "如果执行次数超出限制,返回 <1/>;否则返回子任务的状态。",
"1282": "<l1>CountPolicy</l>",
"1283": "<l1>count_policy</l>",
"1284": "<l1>run_limit</l>",
"1285": "enum <b>CountPolicy</b>: <l1>🔗</l>",
"1286": "<l1>CountPolicy</l> <b>COUNT_SUCCESSFUL</b> = <2/>",
"1287": "只把成功的运行计入限制。",
"1288": "<l1>CountPolicy</l> <b>COUNT_FAILED</b> = <2/>",
"1289": "只把失败的运行计入限制。",
"1290": "<l1>CountPolicy</l> <b>COUNT_ALL</b> = <2/>",
"1291": "把成功和失败的运行都计入限制。",
"1292": "<l1>CountPolicy</l> <b>count_policy</b> = <2/> <l3>🔗</l>",
"1293": "<1/> <b>set_count_policy</b>(value: <l2>CountPolicy</l>)",
"1294": "<l1>CountPolicy</l> <b>get_count_policy</b>()",
"1295": "哪些运行应计入限制:成功的、失败的,还是全部?",
"1296": "<1/> <b>run_limit</b> = <2/> <l3>🔗</l>",
"1297": "<1/> <b>set_run_limit</b>(value: <2/>)",
"1298": "<1/> <b>get_run_limit</b>()",
"1299": "允许子任务执行的最大次数。",
"1300": "BTSelector",
"1301": "顺序执行任务、直到出现第一个 <1/> 的 BT 组合任务。",
"1302": "BTSelector 按顺序从第一个到最后一个执行子任务,直到任一子任务返回 <1/>。如果某个子任务结果为 <2/>,BTSelector 会立即执行下一个子任务,直到其中一个返回 <3/>,或者全部返回 <4/>。BTSelector 与 <l5>BTSequence</l> 是行为树中最常见的两种积木块。本质上,<l6>BTSequence</l> 类似布尔 AND 运算,而 BTSelector 类似布尔 OR 运算。选择器让行为树能够响应环境变化,并在各种后备行为之间触发转换。",
"1303": "如果某个子任务结果为 <2/>,返回 <1/>。BTSelector 会记住最后一个返回 <3/> 的子任务,确保在下一个执行 tick 从该位置继续。",
"1304": "BTSequence",
"1305": "顺序执行任务、只要它们返回 <1/> 就继续的 BT 组合任务。",
"1306": "BTSequence 按顺序从第一个到最后一个执行子任务,只要它们返回 <1/> 就继续。如果某个子任务结果为 <2/>,BTSequence 会立即执行下一个子任务,直到其中一个返回 <3/>,或者全部返回 <4/>。BTSequence 与 <l5>BTSelector</l> 是行为树中最常见的两种积木块。本质上,<l6>BTSelector</l> 类似布尔 OR 运算,而 BTSequence 类似布尔 AND 运算。序列让行为树能够把一串更简单的任务组合成复杂行为。",
"1307": "如果任一子任务结果为 <2/>,返回 <1/>。BTSequence 会记住最后一个返回 <3/> 的子任务,确保在下一个执行 tick 从该位置继续。",
"1308": "BTSetAgentProperty",
"1309": "为指定的智能体属性赋值的 BT 动作。",
"1310": "BTSetAgentProperty 把指定的 <l1>value</l> 赋给由 <l2>property</l> 标识的智能体属性并返回 <3/>。可选地,它可以在赋值之前执行特定的 <l4>operation</l>。",
"1311": "如果设置该属性失败,则返回 <1/>。",
"1312": "<l1>Operation</l>",
"1313": "<l1>operation</l>",
"1314": "<l1>property</l>",
"1315": "<l1>value</l>",
"1316": "<l1>Operation</l> <b>operation</b> = <2/> <l3>🔗</l>",
"1317": "<1/> <b>set_operation</b>(value: <l2>Operation</l>)",
"1318": "<l1>Operation</l> <b>get_operation</b>()",
"1319": "指定赋值之前要执行的操作。操作的执行方式如下:",
"1320": "<1/> <b>property</b> = <2/> <l3>🔗</l>",
"1321": "指定智能体属性名的参数。",
"1322": "<l1>BBVariant</l> <b>value</b> <l2>🔗</l>",
"1323": "指定将要赋给智能体属性的值的参数。",
"1324": "BTSetVar",
"1325": "把 <l1>value</l> 赋给 <l2>variable</l>,然后返回 <3/> 的 BT 动作。",
"1326": "BTSetVar 把 <l1>value</l> 赋给 <l2>variable</l>,然后返回 <3/>。可选地,它可以在赋值之前执行特定的 <l4>operation</l>。",
"1327": "如果设置 <l2>variable</l> 失败,则返回 <1/>。",
"1328": "<l1>operation</l>",
"1329": "<l1>value</l>",
"1330": "<l1>variable</l>",
"1331": "<l1>Operation</l> <b>operation</b> = <2/> <l3>🔗</l>",
"1332": "<l1>BBVariant</l> <b>value</b> <l2>🔗</l>",
"1333": "指定将要赋给该变量的值的参数。",
"1334": "<1/> <b>variable</b> = <2/> <l3>🔗</l>",
"1335": "将要被赋值的变量名。",
"1336": "BTStopAnimation",
"1337": "停止指定 <1/> 节点上动画播放的 BT 动作。",
"1338": "BTStopAnimation 动作会停止指定 <1/> 节点上的动画播放并返回 <2/>。如果设置了 <l3>animation_name</l>,则只有当指定动画正在播放时才会停止播放。",
"1339": "<l1>animation_name</l>",
"1340": "<l1>animation_player</l>",
"1341": "<l1>keep_state</l>",
"1342": "<1/> <b>animation_name</b> = <2/> <l3>🔗</l>",
"1343": "动画在 <1/> 节点中的键名。如果不为空,则只有当指定动画正在播放时 BTStopAnimation 才会停止播放。",
"1344": "<l1>BBNode</l> <b>animation_player</b> <l2>🔗</l>",
"1345": "<1/> <b>keep_state</b> = <2/> <l3>🔗</l>",
"1346": "<1/> <b>set_keep_state</b>(value: <2/>)",
"1347": "<1/> <b>get_keep_state</b>()",
"1348": "如果为 <1/>,动画状态不会在视觉上被更新。",
"1349": "BTSubtree",
"1350": "<b>继承:</b><l1>BTNewScope</l> <b><</b> <l2>BTDecorator</l> <b><</b> <l3>BTTask</l> <b><</b> <l4>BT</l>",
"1351": "在更大的树中实例化并运行子树的 BT 装饰器。",
"1352": "BTSubtree 会实例化一个 <l1>BehaviorTree</l>,在初始化期间把它的根任务作为子任务加入,同时创建一个新的 <l2>Blackboard</l> 作用域。",
"1353": "返回子树执行的状态。",
"1354": "子树的黑板变量可以映射到主树黑板计划的变量。请查看检视面板中的映射(mapping)部分。",
"1355": "注意:BTSubTree 被设计为一个更简单的加载器,不支持在运行时更新 <l1>subtree</l>。自定义的子树装饰器更适合这种需求:",
"1356": "这样 <l1>BehaviorTree</l> 就能从黑板中的某个变量或其他位置加载指定的行为树,并在运行时使用那棵新的行为树。",
"1357": "<l1>subtree</l>",
"1358": "<l1>BehaviorTree</l> <b>subtree</b> <l2>🔗</l>",
"1359": "<1/> <b>set_subtree</b>(value: <l2>BehaviorTree</l>)",
"1360": "<l1>BehaviorTree</l> <b>get_subtree</b>()",
"1361": "将被实例化为子树的 <l1>BehaviorTree</l> 资源。",
"1362": "BTTimeLimit",
"1363": "为其子任务执行设置时间限制的 BT 装饰器。",
"1364": "BTTimeLimit 为子任务的执行分配有限的时间;如果超过 <l2>time_limit</l>,它会中止子任务并返回 <1/>。",
"1365": "如果超过 <l2>time_limit</l>,返回 <1/>;否则返回子任务的状态。",
"1366": "<l1>time_limit</l>",
"1367": "<1/> <b>time_limit</b> = <2/> <l3>🔗</l>",
"1368": "<1/> <b>set_time_limit</b>(value: <2/>)",
"1369": "<1/> <b>get_time_limit</b>()",
"1370": "分配给子任务执行的时间。",
"1371": "BTWait",
"1372": "等待指定 <l1>duration</l> 时间后返回 <2/> 的 BT 动作。",
"1373": "<l1>duration</l>",
"1374": "<1/> <b>duration</b> = <2/> <l3>🔗</l>",
"1375": "该属性目前还没有描述。欢迎贡献一份描述!",
"1376": "BTWaitTicks",
"1377": "等待指定数量的 tick 后返回 <1/> 的 BT 动作。",
"1378": "<l1>num_ticks</l>",
"1379": "<1/> <b>num_ticks</b> = <2/> <l3>🔗</l>",
"1380": "<1/> <b>set_num_ticks</b>(value: <2/>)",
"1381": "<1/> <b>get_num_ticks</b>()",
"1382": "返回 <1/> 之前需要等待的 tick 数。",
"1383": "LimboUtility",
"1384": "LimboAI 的辅助函数。",
"1385": "<l1>decorate_output_var</l>(variable: <2/>) <3/>",
"1386": "<l1>decorate_var</l>(variable: <2/>) <3/>",
"1387": "<l1>get_check_operator_string</l>(check: <l2>CheckType</l>) <3/>",
"1388": "<l1>get_operation_string</l>(operation: <l2>Operation</l>) <3/>",
"1389": "<l1>get_status_name</l>(status: <2/>) <3/>",
"1390": "<l1>get_task_icon</l>(class_or_script_path: <2/>) <3/>"
}
@@ -0,0 +1,63 @@
{
"1391": "<l1>perform_check</l>(check: <l2>CheckType</l>, a: <3/>, b: <4/>)",
"1392": "<l1>perform_operation</l>(operation: <l2>Operation</l>, a: <3/>, b: <4/>)",
"1393": "enum <b>CheckType</b>: <l1>🔗</l>",
"1394": "<l1>CheckType</l> <b>CHECK_EQUAL</b> = <2/>",
"1395": "相等性检查。",
"1396": "<l1>CheckType</l> <b>CHECK_LESS_THAN</b> = <2/>",
"1397": "小于检查。",
"1398": "<l1>CheckType</l> <b>CHECK_LESS_THAN_OR_EQUAL</b> = <2/>",
"1399": "小于或等于检查。",
"1400": "<l1>CheckType</l> <b>CHECK_GREATER_THAN</b> = <2/>",
"1401": "大于检查。",
"1402": "<l1>CheckType</l> <b>CHECK_GREATER_THAN_OR_EQUAL</b> = <2/>",
"1403": "大于或等于检查。",
"1404": "<l1>CheckType</l> <b>CHECK_NOT_EQUAL</b> = <2/>",
"1405": "不等性检查。",
"1406": "enum <b>Operation</b>: <l1>🔗</l>",
"1407": "<l1>Operation</l> <b>OPERATION_NONE</b> = <2/>",
"1408": "无操作。",
"1409": "<l1>Operation</l> <b>OPERATION_ADDITION</b> = <2/>",
"1410": "算术加法。",
"1411": "<l1>Operation</l> <b>OPERATION_SUBTRACTION</b> = <2/>",
"1412": "算术减法。",
"1413": "<l1>Operation</l> <b>OPERATION_MULTIPLICATION</b> = <2/>",
"1414": "算术乘法。",
"1415": "<l1>Operation</l> <b>OPERATION_DIVISION</b> = <2/>",
"1416": "算术除法。",
"1417": "<l1>Operation</l> <b>OPERATION_MODULO</b> = <2/>",
"1418": "取整数除法的余数。",
"1419": "<l1>Operation</l> <b>OPERATION_POWER</b> = <2/>",
"1420": "把 <1/> 自乘 <2/> 次。",
"1421": "<l1>Operation</l> <b>OPERATION_BIT_SHIFT_LEFT</b> = <2/>",
"1422": "按位左移。",
"1423": "<l1>Operation</l> <b>OPERATION_BIT_SHIFT_RIGHT</b> = <2/>",
"1424": "按位右移。",
"1425": "<l1>Operation</l> <b>OPERATION_BIT_AND</b> = <2/>",
"1426": "按位与。",
"1427": "<l1>Operation</l> <b>OPERATION_BIT_OR</b> = <2/>",
"1428": "按位或。",
"1429": "<l1>Operation</l> <b>OPERATION_BIT_XOR</b> = <2/>",
"1430": "按位异或。",
"1431": "<1/> <b>decorate_output_var</b>(variable: <2/>) <3/> <l4>🔗</l>",
"1432": "与 <l1>decorate_var</l> 类似,生成一个经格式化、用于显示的 <l2>Blackboard</l> 变量名字符串,并额外添加一个符号来表明该变量被用作输出。",
"1433": "<1/> <b>decorate_var</b>(variable: <2/>) <3/> <l4>🔗</l>",
"1434": "生成一个经格式化、适合显示或控制台输出的 <l1>Blackboard</l> 变量名字符串。",
"1435": "<1/> <b>get_check_operator_string</b>(check: <l2>CheckType</l>) <3/> <l4>🔗</l>",
"1436": "返回 <l1>CheckType</l> 枚举值对应的运算符字符串。例如,<l2>CHECK_EQUAL</l> 返回 “==”。",
"1437": "<1/> <b>get_operation_string</b>(operation: <l2>Operation</l>) <3/> <l4>🔗</l>",
"1438": "返回 <l1>Operation</l> 枚举值的字符串表示。",
"1439": "<1/> <b>get_status_name</b>(status: <2/>) <3/> <l4>🔗</l>",
"1440": "返回 <l1>BTTask</l> 状态码的名称。",
"1441": "<1/> <b>get_task_icon</b>(class_or_script_path: <2/>) <3/> <l4>🔗</l>",
"1442": "根据任务的类名或脚本资源路径,返回与之关联的图标纹理。",
"1443": "<1/> <b>perform_check</b>(check: <l2>CheckType</l>, a: <3/>, b: <4/>) <l5>🔗</l>",
"1444": "对两个值 <2/> 和 <3/> 执行 <1/>,如果检查通过则返回 <4/>。",
"1445": "<1/> <b>perform_operation</b>(operation: <l2>Operation</l>, a: <3/>, b: <4/>) <l5>🔗</l>",
"1446": "对两个值 <2/> 和 <3/> 执行 <1/>,并返回结果。",
"1447": "开始使用",
"1448": "行为树",
"1449": "分层状态机",
"1450": "类参考",
"1451": "LimboAI 1.0 文档"
}
File diff suppressed because one or more lines are too long