in data/envs/babyai/bot_agent.py [0:0]
def replan_after_action(self, action_taken):
if action_taken is None or action_taken == self.actions.toggle:
self.bot.stack.pop()
if self.reason == "Unlock":
# The reason why this has to be planned after the action is taken
# is because if the position for dropping is chosen in advance,
# then by the time the key is dropped there, it might already
# be occupied.
drop_key_pos = self.bot._find_drop_pos()
self.bot.stack.append(DropSubgoal(self.bot))
self.bot.stack.append(GoNextToSubgoal(self.bot, drop_key_pos))
else:
self._plan_undo_action(action_taken)