Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
svencc committed Sep 17, 2023
1 parent fac18b3 commit ca2f954
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/lib/gecom/agent/state/PerformActionState.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lib.gecom.action.GeAction;
import lib.gecom.agent.GeAgent;
import lib.gecom.agent.event.RequestTransitionChangeEvent;
import lib.gecom.stuff.GeNullTarget;
import lombok.Getter;
import lombok.NonNull;
Expand Down Expand Up @@ -35,7 +36,6 @@ public void execute(@NonNull final GeAgent agent) {
profile();
if (!agent.getCurrentActionStack().isEmpty()) {
if (agent.getCurrentActionStack().peek().getTarget() instanceof GeNullTarget) {
// dont move; execute action
System.out.println("... executing action without moving");
agent.setCurrentAction(agent.getCurrentActionStack().pop());
final GeAction currentAction = agent.getCurrentAction();
Expand All @@ -53,6 +53,8 @@ public void execute(@NonNull final GeAgent agent) {
} else {
// check agent position and target position: calculate distance
// then move ...
System.out.println("... agent has to move before performing the action");
getSubject().notifyObserversWith(new RequestTransitionChangeEvent(FSMStates.MOVABLE, true));
// ... or execute action
}
}
Expand Down

0 comments on commit ca2f954

Please sign in to comment.