Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix registry instances #12

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

s-kania
Copy link

@s-kania s-kania commented Jun 23, 2023

This is my draft proposal to fix #8.
What I changed?

  • instead of creating a new instance of a node that is then added to the registry and used in multiple trees, the user now creates templates,
  • when the user requests a node from the registry, a new instance is created, but with function references from template -> start, finish, run
  • if we run the tree again that uses registered nodes, it will use the previously created

Example:

local templates = {
  sail_to = {
      type = BehaviourTree.Task,
      run = function(task, ship_id)
         [code]
      end
  },
  sink_ship = {
      type = BehaviourTree.Sequence,
      nodes = {
          'sail_to',
          {
	      type = BehaviourTree.Task,
	      run = function(task, ship_id)
                  [code]
	      end
          },
      },
  },
}
BehaviourTree.register(templates)

@tanema
Copy link
Owner

tanema commented Jun 26, 2023

Okay this all looks like it makes sense and is a good looking changeset. Can you add some unit tests to ensure that it does what is expected and will not break in the future?

@tanema
Copy link
Owner

tanema commented Jun 26, 2023

Please rebase, I updated the testing for PRs from travis to github actions so that you can get automated feedback on your work.

@s-kania
Copy link
Author

s-kania commented Jun 28, 2023

Okay this all looks like it makes sense and is a good looking changeset. Can you add some unit tests to ensure that it does what is expected and will not break in the future?

Yes, I will add tests and check if everything is OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple instances with same task name used in BT
2 participants