{"size": 1011, "ext": "js", "max_stars_repo_path": "src/behavior/assign-bed.js", "max_stars_repo_name": "sarathkshatri/examples", "max_stars_repo_stars_event_min_datetime": "2021-08-31T16:13:40.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-31T16:13:40.000Z", "max_issues_repo_path": "src/behavior/assign-bed.js", "max_issues_repo_name": "sarathkshatri/examples", "max_issues_repo_issues_event_min_datetime": "2021-01-08T11:29:20.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-05T14:23:41.000Z", "max_forks_repo_path": "src/behavior/assign-bed.js", "max_forks_repo_name": "sarathkshatri/examples", "max_forks_repo_forks_event_min_datetime": "2020-11-20T18:40:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-29T17:45:58.000Z"}
{"max_stars_count": 1, "max_issues_count": 32, "max_forks_count": 4, "avg_line_length": 30.6363636364, "max_line_length": 97, "alphanum_fraction": 0.6567754698}
import fluentBehaviorTree from "@crowdedjs/fluent-behavior-tree"
class AssignBed {
  constructor(myIndex, bed) {
    this.index = myIndex;
    this.bed = bed;

    const builder = new fluentBehaviorTree.BehaviorTreeBuilder();
    let self = this;//Since we need to reference this in anonymous functions, we need a reference

    this.tree = builder

      // FINDS FIRST AVAILABLE BED, THEN ADDS ROOM TO NURSE'S LIST
      // NEED TO HAVE LIST OF AVAILABLE BEDS/ROOMS THEN FIND
      // ONE THAT IS AVAILABLE, AND ADD TO NURSE'S LIST

      // CURRENTLY USER FEEDS LOCATION TO THIS BEHAVIOR, THEN IT 
      // ADDS VECTOR3 TO NURSE'S LIST

      .sequence("Assign Bed")
      .do("Set Bed Location", (t) => {
        let agent = Hospital.agents.find(a => a.id == myIndex);
        agent.addRoom(Vector3.fromObject(this.bed));
        //console.log("Assigning bed " + myIndex);

        return fluentBehaviorTree.BehaviorTreeStatus.Success;
      })
      .end()
      .build();
  }

}

export default AssignBed;