(include "sci.sh")
(use "Cycle")
(script 961)



(class StopWalk of Fwd
    (properties
        client 0
        caller 0
        cycleDir 1
        cycleCnt 0
        completed 0
        vWalking 0
        vStopped 0
    )

    (method (init theClient theVStopped)
        (if (paramTotal)
            = vWalking (send ((= client theClient)):view)
            (if (>= paramTotal 2)
                = vStopped theVStopped
            )
        )
        (super:init(client))
    )


    (method (doit)
        (var temp0, clientMover)
        (if ((send client:isStopped()))
            (if (== (send client:view) vWalking)
                (send client:view(vStopped))
                = clientMover (send client:mover)
                (if ((= clientMover (send client:mover)) and not (send ((= clientMover (send client:mover))):completed))
                    (send client:setMotion(0))
                )
                (super:doit())
            )
        )(else
            (if (== (send client:view) vStopped)
                (send client:view(vWalking))
            )
            (super:doit())
        )
    )


    (method (dispose)
        (if (== (send client:view) vStopped)
            (send client:view(vWalking))
        )
        (super:dispose())
    )

)
