from olives_object import MovingSpeed, NavigationStatus
from olives_objectcontrollable import ObjectControllable
from olives_job import Job
from olives_gamestate import GameState


def walk(self, job: Job, game_state: GameState, elapsed_ticks: int, obj: ObjectControllable, parameter: str):
    # no ticks have elapsed yet, as such we are just starting this job
    if job.get_step().get_ticks_elapsed() == 0:
        # only do this once, as this job as no time limit
        job.set_ticks_elapsed(1)
        obj.set_target(job.get_context().get_position(), job.get_context().get_position(), MovingSpeed.WALKING)
    elif obj.get_navigation_status() != NavigationStatus.ONGOING:
        # we arrived, signal that this job step is done
        job.increment_step(1)
