sploreg/goap

what is purpose of hasActionPlan test twice in GoapAgent.

madan-ram opened this issue · 1 comments

I see in line 135 of GoapAgent.cs as shown below code, but there is else condition at 170 which solves a similar problem. can you explain in which condition this is needed?
if (!hasActionPlan()) { // no actions to perform Debug.Log("<color=red>Done actions</color>"); fsm.popState(); fsm.pushState(idleState); dataProvider.actionsFinished(); return; }

In that case it doesn't seems to make much a difference.

However, if you land in the first if (!hasActionPlan()) it means you're in the performActionState while not having any plan.
If you land in the else condition, line 170 in the code, it means you have successfully achieved every action in your plan (since you had a plan when entering the state but the last action has been removed line 146).

Hope this is correct and it helps you @madan-ram