Skip to content

Commit

Permalink
Removed stopAction_==false check for default GOAPAction preconditions
Browse files Browse the repository at this point in the history
Erroneous default `GOAPAction` behaviour:
- `GOAPAction.PreconditionsSatisfied()` checks if `stopAction_==false`. 
- Default `GOAPAction.OnDeactivate()` sets `stopAction_=false`, and is called by `GOAPPlanner` when completing/stopping an action
- `stopAction_` is only set to `true` again in `GOAPAction.OnActivate()`, called by `GOAPPlanner` when selecting the action
- However `GOAPAction.PreconditionsSatisfied()` is called in the planning stage when seeing if a path is viable, and so by default if a `GOAPAction` was deactivated by the planner, it could not be selected again for a viable path. 
- This just removes the `stopAction_==false` check
  • Loading branch information
toastisme authored Aug 13, 2022
1 parent a341bc5 commit df6f2e6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Runtime/GOAP/GOAPAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public virtual bool PreconditionsSatisfied(WorldState worldState){
* true if worldState is a superset of preconditions
*/

if (stopAction_){ return false; }
return(worldState.IsSubset(preconditions));
}

Expand Down Expand Up @@ -268,4 +267,4 @@ protected void ClearTemporaryStates(){
}

}
}
}

0 comments on commit df6f2e6

Please sign in to comment.