from olives_object import SlotType, ContainedStatus, ContainedStatusChange
from olives_objectcontrollable import ObjectControllable
from olives_job import Job
from olives_gamestate import GameState


def lie_down(self, job: Job, game_state: GameState, elapsed_ticks: int, obj: ObjectControllable, parameter: str):
    current_step = job.get_step().get_current_step()
    if current_step == 0:
        # navigate to the context object and set the appropriate animation when done (successfully)
        self.handle_context_transition_step(job, game_state, obj, None, 'entry', SlotType.LYING)

    elif current_step == 1:
        # nothing to do but to wait for the change to finish
        if obj.get_contained_status_change() == ContainedStatusChange.NONE:
            job.clear_running(False)
