;;-*-Lisp-*-
(in-package goal)

;; name: sig-states.gc
;; name in dgo: sig-states
;; dgos: ATE, UNB

;; DECOMP BEGINS

(defstate waiting-crouched (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (logclear! (-> self enemy-flags) (enemy-flag vulnerable))
    (logior! (-> self focus-status) (focus-status disable))
    )
  :exit (behavior ()
    (local-vars (v1-1 enemy-flag))
    (let ((v1-0 (-> self enemy-flags)))
      (if (logtest? v1-0 (enemy-flag vulnerable-backup))
          (set! v1-1 (logior v1-0 (enemy-flag vulnerable)))
          (set! v1-1 (logclear v1-0 (enemy-flag vulnerable)))
          )
      )
    (set! (-> self enemy-flags) v1-1)
    (logclear! (-> self focus-status) (focus-status disable))
    )
  :trans (behavior ()
    (if (and (not (focus-test? self grabbed))
             (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
             )
        (go-virtual traveling)
        )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (until #f
      (ja-no-eval :group! sig-idle-crouch-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate waiting-far (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (cond
        ((bot-method-214 self)
         (go-hostile self)
         )
        ((sig-method-252 self)
         (go-virtual gun-jam)
         )
        ((sig-method-255 self)
         (go-virtual repair-gun)
         )
        ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
         (go-virtual traveling)
         )
        ((sig-method-251 self)
         (go-virtual charge-plasma)
         )
        ((sig-method-254 self)
         (go-virtual clean-gun)
         )
        )
      )
    (if (and (-> self focus-info fproc)
             (or (< (-> self focus-info bullseye-xz-dist) 90112.0)
                 (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223))
                 )
             )
        (go-virtual waiting-close)
        )
    )
  :code (behavior ()
    (let ((v1-2 (ja-group)))
      (cond
        ((and v1-2 (= v1-2 sig-ready0-to-idle-right0-ja))
         (ja-no-eval :num! (seek!))
         (while (not (ja-done? 0))
           (suspend)
           (ja-eval)
           )
         (ja-channel-push! 1 (seconds 0.2))
         )
        ((let ((v1-17 (ja-group)))
           (and v1-17 (= v1-17 sig-idle-right0-ja))
           )
         (ja-no-eval :num! (seek!))
         (while (not (ja-done? 0))
           (suspend)
           (ja-eval)
           )
         )
        (else
          (ja-channel-push! 1 (seconds 0.3))
          (ja-no-eval :group! sig-ready0-to-idle-right0-ja :num! (seek!) :frame-num 0.0)
          (until (ja-done? 0)
            (suspend)
            (ja :num! (seek!))
            )
          (ja-channel-push! 1 (seconds 0.2))
          )
        )
      )
    (until #f
      (ja-no-eval :group! sig-idle-right0-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate waiting-close (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (cond
        ((bot-method-214 self)
         (go-hostile self)
         )
        ((sig-method-252 self)
         (go-virtual gun-jam)
         )
        ((sig-method-255 self)
         (go-virtual repair-gun)
         )
        ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
         (go-virtual traveling)
         )
        ((and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223))
         (go-virtual waiting-turn)
         )
        ((sig-method-251 self)
         (go-virtual charge-plasma)
         )
        ((sig-method-254 self)
         (go-virtual clean-gun)
         )
        )
      )
    (if (and (time-elapsed? (-> self state-time) (seconds 1))
             (or (not (-> self focus-info fproc)) (>= (-> self focus-info bullseye-xz-dist) 102400.0))
             )
        (go-virtual waiting-far)
        )
    )
  :code (behavior ()
    (let* ((v1-2 (ja-group))
           (gp-0 (-> self
                     draw
                     art-group
                     data
                     (cond
                       ((and v1-2 (= v1-2 sig-idle-right0-ja))
                        (ja-channel-push! 1 (seconds 0.1))
                        (ja-no-eval :group! sig-idle-right0-to-ready0-ja :num! (seek!) :frame-num 0.0)
                        (until (ja-done? 0)
                          (suspend)
                          (ja :num! (seek!))
                          )
                        7
                        )
                       (else
                         (let ((v1-32 (ja-group)))
                           (cond
                             ((and v1-32 (= v1-32 sig-idle-right0-to-ready0-ja))
                              (ja-no-eval :num! (seek!))
                              (while (not (ja-done? 0))
                                (suspend)
                                (ja-eval)
                                )
                              7
                              )
                             (else
                               (let ((v1-46 (ja-group)))
                                 (cond
                                   ((and v1-46 (= v1-46 sig-ready0-ja))
                                    (ja-no-eval :num! (seek!))
                                    (while (not (ja-done? 0))
                                      (suspend)
                                      (ja-eval)
                                      )
                                    7
                                    )
                                   (else
                                     7
                                     )
                                   )
                                 )
                               )
                             )
                           )
                         )
                       )
                     )
                 )
           )
      (let ((v1-62 (ja-group)))
        (if (not (and v1-62 (= v1-62 gp-0)))
            (ja-channel-push! 1 (seconds 0.3))
            )
        )
      (until #f
        (ja-no-eval :group! gp-0 :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate waiting-turn (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (cond
        ((bot-method-214 self)
         (go-hostile self)
         )
        ((sig-method-252 self)
         (go-virtual gun-jam)
         )
        ((sig-method-255 self)
         (go-virtual repair-gun)
         )
        ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
         (go-virtual traveling)
         )
        )
      )
    )
  :code (behavior ()
    (local-vars (s4-1 art-element) (f0-19 float))
    (let ((gp-0 (new 'stack-no-clear 'bot-turn-info)))
      (let ((s5-0 (-> self focus-info fproc)))
        (if (not s5-0)
            (go-virtual waiting-close)
            )
        (turn-to-target self gp-0 s5-0 1.4361539)
        )
      (let ((v1-8 (ja-group)))
        (cond
          ((and v1-8 (or (= v1-8 sig-idle-right0-ja) (= v1-8 sig-ready0-to-idle-right0-ja)))
           (ja-channel-push! 1 (seconds 0.1))
           (ja-no-eval :group! sig-idle-right0-to-ready0-ja :num! (seek!) :frame-num 0.0)
           (until (ja-done? 0)
             (suspend)
             (ja :num! (seek!))
             )
           (ja-channel-push! 1 (seconds 0.04))
           )
          (else
            (let ((v1-38 (ja-group)))
              (cond
                ((and v1-38 (= v1-38 sig-idle-right0-to-ready0-ja))
                 (ja-no-eval :num! (seek!))
                 (while (not (ja-done? 0))
                   (suspend)
                   (ja-eval)
                   )
                 (ja-channel-push! 1 (seconds 0.04))
                 )
                (else
                  (let ((v1-53 (ja-group)))
                    (if (and v1-53 (= v1-53 sig-ready0-ja))
                        (ja-channel-push! 1 (seconds 0.1))
                        (ja-channel-push! 1 (seconds 0.3))
                        )
                    )
                  )
                )
              )
            )
          )
        )
      (let ((a2-4 (-> self focus-info fproc)))
        (if a2-4
            (turn-to-target self gp-0 a2-4 1.4361539)
            )
        )
      (let ((s4-0 (>= (-> gp-0 predicted-ry-diff) 0.0)))
        (let ((a1-11 (-> self draw art-group data (if s4-0
                                                      48
                                                      52
                                                      )
                         )
                     )
              )
          (ja-no-eval :group! a1-11 :num! (seek! max 1.3) :frame-num 0.0)
          )
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek! max 1.3))
          )
        (let ((a2-7 (-> self focus-info fproc)))
          (if a2-7
              (turn-to-target self gp-0 a2-7 1.2307693)
              )
          )
        (let ((s5-1 (new 'stack-no-clear 'quaternion))
              (f0-18 (-> gp-0 predicted-ry-diff))
              (f30-0 4.0)
              (f28-0 28.0)
              )
          (cond
            (s4-0
              (if (< f0-18 0.0)
                  (set! f0-18 (+ 65536.0 f0-18))
                  )
              (cond
                ((< f0-18 18204.445)
                 (set! f0-19 9102.223)
                 (set! s4-1 sig-turn-left50-end0-ja)
                 (set! f28-0 18.0)
                 )
                ((< f0-18 27306.666)
                 (set! f0-19 18204.445)
                 (set! s4-1 sig-turn-left100-end0-ja)
                 )
                (else
                  (set! f0-19 27306.666)
                  (set! s4-1 sig-turn-left150-end0-ja)
                  )
                )
              )
            (else
              (if (>= f0-18 0.0)
                  (set! f0-18 (+ -65536.0 f0-18))
                  )
              (cond
                ((< -18204.445 f0-18)
                 (set! f0-19 -9102.223)
                 (set! s4-1 sig-turn-right50-end0-ja)
                 (set! f28-0 18.0)
                 )
                ((< -27306.666 f0-18)
                 (set! f0-19 -18204.445)
                 (set! s4-1 sig-turn-right100-end0-ja)
                 )
                (else
                  (set! f0-19 -27306.666)
                  (set! s4-1 sig-turn-right150-end0-ja)
                  )
                )
              )
            )
          (quaternion-rotate-y! s5-1 (-> gp-0 src-quat) f0-19)
          (ja-no-eval :group! s4-1 :num! (seek! max 1.3) :frame-num 0.0)
          (until (ja-done? 0)
            (let ((f0-24 (ja-aframe-num 0)))
              (cond
                ((< f0-24 f28-0)
                 (if (>= f0-24 f30-0)
                     (quaternion-slerp! (-> self root quat) (-> gp-0 src-quat) s5-1 (/ (- f0-24 f30-0) (- f28-0 f30-0)))
                     )
                 )
                (else
                  (quaternion-copy! (-> self root quat) s5-1)
                  )
                )
              )
            (suspend)
            (ja :num! (seek! max 1.3))
            )
          )
        )
      )
    (go-virtual waiting-close)
    )
  :post nav-enemy-simple-post
  )

(defstate charge-plasma (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (stop-looking-at-target! self)
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (logclear! (-> self plasma flags) (plasma-flags pf02 pf03 pf04))
    (logclear! (-> self bot-flags) (bot-flags bf11))
    )
  :exit (behavior ()
    (logclear! (-> self plasma flags) (plasma-flags pf01 pf02 pf03))
    (logior! (-> self bot-flags) (bot-flags bf11))
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (cond
        ((bot-method-214 self)
         (go-hostile self)
         )
        ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
         (go-virtual traveling)
         )
        ((not (sig-method-251 self))
         (go-virtual waiting-close)
         )
        )
      )
    (if (>= (-> self plasma level) 1.0)
        (logior! (-> self plasma flags) (plasma-flags pf02))
        (logclear! (-> self plasma flags) (plasma-flags pf02))
        )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.15))
    (ja-no-eval :group! sig-charge-to-crouch-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (logior! (-> self plasma flags) (plasma-flags pf01))
    (ja-channel-push! 1 (seconds 0.07))
    (until #f
      (ja-no-eval :group! sig-charge0-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (if (and (logtest? (-> self plasma flags) (plasma-flags pf02))
                 (logtest? (-> self plasma flags) (plasma-flags pf03))
                 )
            (goto cfg-12)
            )
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    (label cfg-12)
    (ja-channel-push! 1 (seconds 0.1))
    (ja-no-eval :group! sig-charge-to-ready-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.07))
    (until #f
      (ja-no-eval :group! sig-charge-ready-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (if (logtest? (-> self plasma flags) (plasma-flags pf03))
            (logior! (-> self plasma flags) (plasma-flags pf04))
            (logclear! (-> self plasma flags) (plasma-flags pf04))
            )
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post (behavior ()
    (logclear! (-> self plasma flags) (plasma-flags pf03))
    (nav-enemy-simple-post)
    )
  )

(defstate gun-jam (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    ((-> (method-of-type nav-enemy hostile) enter))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (logclear! (-> self bot-flags) (bot-flags bf11))
    )
  :exit (behavior ()
    (logior! (-> self bot-flags) (bot-flags bf11))
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja-no-eval :group! sig-blast-forward-ja :num! (seek! (ja-aframe 8.0 0)) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! (ja-aframe 8.0 0)))
      )
    (sound-play "sig-gun-jam")
    (logclear! (-> self bot-flags) (bot-flags bf20))
    (logior! (-> self bot-flags) (bot-flags bf19))
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (go-virtual repair-gun)
    )
  :post nav-enemy-simple-post
  )

(defstate repair-gun (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (stop-looking-at-target! self)
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (if (logtest? (-> self bot-flags) (bot-flags attacked))
        (reset-attacker! self)
        )
    (logclear! (-> self bot-flags) (bot-flags bf11))
    )
  :exit (behavior ()
    (logior! (-> self bot-flags) (bot-flags bf11))
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (if (bot-method-214 self)
          (go-hostile self)
          )
      )
    (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) (zero? (-> self played-unjam-time)))
      (set-time! (-> self played-unjam-time))
      (sound-play "sig-gun-unjam")
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja-no-eval :group! sig-gun-fix-start-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (ja-channel-push! 1 (seconds 0.07))
      (countdown (gp-0 (rnd-int-range self 2 4))
        (ja-no-eval :group! sig-gun-fix-hit-ja :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                   (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                   )
          (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
          (go-virtual waiting-close)
          )
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-gun-fix-hit-to-look-a-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      (ja-channel-push! 1 (seconds 0.13))
      (ja-no-eval :group! sig-gun-fix-look-a-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-gun-fix-shake-look-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      (ja-channel-push! 1 (seconds 0.13))
      (ja-no-eval :group! sig-gun-fix-look-b-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-gun-fix-look-to-stomp-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      (countdown (gp-1 (rnd-int-range self 2 3))
        (ja-channel-push! 1 (seconds 0.07))
        (ja-no-eval :group! sig-gun-fix-stomp-ja :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                   (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                   )
          (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
          (go-virtual waiting-close)
          )
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-gun-fix-stomp-to-hit-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (and (logtest? (bot-flags bf21) (-> self bot-flags))
                 (time-elapsed? (-> self played-unjam-time) (seconds 0.35))
                 )
        (logclear! (-> self bot-flags) (bot-flags bf19 bf21))
        (go-virtual waiting-close)
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate clean-gun (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (stop-looking-at-target! self)
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (if (logtest? (-> self bot-flags) (bot-flags attacked))
        (reset-attacker! self)
        )
    (logclear! (-> self bot-flags) (bot-flags bf11))
    )
  :exit (behavior ()
    (logior! (-> self bot-flags) (bot-flags bf11))
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (not (focus-test? self grabbed))
      (cond
        ((bot-method-214 self)
         (go-hostile self)
         )
        ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f))
         (go-virtual traveling)
         )
        )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.15))
    (ja-no-eval :group! sig-ready0-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (countdown (gp-0 2)
        0
        (cond
          ((= gp-0 1)
           (let ((s5-0 (rnd-int-range self 1 2)))
             (ja-channel-push! 1 (seconds 0.13))
             (while (nonzero? s5-0)
               (+! s5-0 -1)
               (ja-no-eval :group! sig-gun-fix-look-a-ja :num! (seek!) :frame-num 0.0)
               (until (ja-done? 0)
                 (suspend)
                 (ja :num! (seek!))
                 )
               )
             )
           )
          (else
            (let ((s5-1 (rnd-int-range self 1 4)))
              (ja-channel-push! 1 (seconds 0.13))
              (while (nonzero? s5-1)
                (+! s5-1 -1)
                (ja-no-eval :group! sig-gun-fix-look-b-ja :num! (seek!) :frame-num 0.0)
                (until (ja-done? 0)
                  (suspend)
                  (ja :num! (seek!))
                  )
                )
              )
            )
          )
        (when (nonzero? gp-0)
          (ja-channel-push! 1 (seconds 0.07))
          (ja-no-eval :group! sig-gun-fix-shake-look-ja :num! (seek!) :frame-num 0.0)
          (until (ja-done? 0)
            (suspend)
            (ja :num! (seek!))
            )
          )
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate traveling (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))
          (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags))))
          )
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))))
      (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info callback-info))
      )
    0
    (let ((v1-5 self))
      (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags))))
      )
    0
    (stop-looking-at-target! self)
    (nav-enemy-method-166 self)
    (set! (-> self skel top-anim interp) 1.0)
    (set! (-> self player-blocking) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (cond
      ((bot-method-214 self)
       (go-hostile self)
       )
      ((sig-method-252 self)
       (go-virtual gun-jam)
       )
      ((sig-method-255 self)
       (go-virtual repair-gun)
       )
      ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t)
       (go-virtual waiting-close)
       )
      ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self))
       (go-virtual traveling-blocked)
       )
      ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time)))
       (go-stare2 self)
       )
      )
    0
    )
  :code (behavior ()
    (until #f
      (sig-method-258 self)
      (suspend)
      )
    #f
    )
  :post (behavior ()
    (let ((a0-0 (-> self nav state))
          (v1-1 (-> self spot))
          )
      (logclear! (-> a0-0 flags) (nav-state-flag directional-mode))
      (logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty))
      (set! (-> a0-0 target-post quad) (-> v1-1 center quad))
      )
    0
    (nav-enemy-travel-post)
    )
  )

(defstate traveling-blocked (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (cond
      ((bot-method-214 self)
       (go-hostile self)
       )
      ((sig-method-252 self)
       (go-virtual gun-jam)
       )
      ((sig-method-255 self)
       (go-virtual repair-gun)
       )
      ((and (time-elapsed? (-> self state-time) (seconds 1)) (not (bot-method-208 self)))
       (go-virtual traveling)
       )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.3))
    (until #f
      (ja-no-eval :group! sig-ready0-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate stare (sig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type bot stare) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (let ((v1-4 self))
      (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    (when (time-elapsed? (-> self state-time) (seconds 0.1))
      (when (bot-method-214 self)
        (cond
          ((sig-method-246 self)
           (go-virtual whip)
           )
          ((sig-method-245 self)
           (go-virtual blast)
           )
          )
        )
      (cond
        ((sig-method-252 self)
         (go-virtual gun-jam)
         )
        ((sig-method-255 self)
         (go-virtual repair-gun)
         )
        ((not (nav-enemy-method-163 self))
         (go-virtual traveling)
         )
        )
      )
    )
  :code (behavior ()
    (let* ((v1-2 (ja-group))
           (gp-0 (-> self
                     draw
                     art-group
                     data
                     (cond
                       ((and v1-2 (= v1-2 sig-idle-right0-ja))
                        (ja-channel-push! 1 (seconds 0.1))
                        (ja-no-eval :group! sig-idle-right0-to-ready0-ja :num! (seek!) :frame-num 0.0)
                        (until (ja-done? 0)
                          (suspend)
                          (ja :num! (seek!))
                          )
                        7
                        )
                       (else
                         (let ((v1-32 (ja-group)))
                           (cond
                             ((and v1-32 (= v1-32 sig-idle-right0-to-ready0-ja))
                              (ja-no-eval :num! (seek!))
                              (while (not (ja-done? 0))
                                (suspend)
                                (ja-eval)
                                )
                              7
                              )
                             (else
                               (let ((v1-46 (ja-group)))
                                 (cond
                                   ((and v1-46 (= v1-46 sig-ready0-ja))
                                    (ja-no-eval :num! (seek!))
                                    (while (not (ja-done? 0))
                                      (suspend)
                                      (ja-eval)
                                      )
                                    7
                                    )
                                   (else
                                     7
                                     )
                                   )
                                 )
                               )
                             )
                           )
                         )
                       )
                     )
                 )
           )
      (let ((v1-62 (ja-group)))
        (if (not (and v1-62 (= v1-62 gp-0)))
            (ja-channel-push! 1 (seconds 0.3))
            )
        )
      (until #f
        (ja-no-eval :group! gp-0 :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        )
      )
    #f
    )
  )

(defstate whip (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    ((-> (method-of-type nav-enemy hostile) enter))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (logior! (-> self enemy-flags) (enemy-flag lock-focus))
    (logior! (-> self focus-status) (focus-status dangerous))
    (let* ((v1-11 *game-info*)
           (a0-6 (+ (-> v1-11 attack-id) 1))
           )
      (set! (-> v1-11 attack-id) a0-6)
      (set! (-> self attack-id) a0-6)
      )
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :exit (behavior ()
    (logclear! (-> self enemy-flags) (enemy-flag lock-focus))
    (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
        (logior! (-> self focus-status) (focus-status dangerous))
        (logclear! (-> self focus-status) (focus-status dangerous))
        )
    (enemy-method-46 self 0)
    )
  :trans (behavior ()
    (bot-method-223 self #f)
    )
  :code (behavior ()
    (local-vars (a1-2 art-element))
    (enemy-method-46 self 3)
    (ja-channel-push! 1 (seconds 0.1))
    0.0
    (let ((f30-0 (cond
                   ((< (fabs (-> self focus-info ry-diff)) 8192.0)
                    (set! a1-2 sig-whip-forward-ja)
                    18.0
                    )
                   ((< (-> self focus-info ry-diff) 0.0)
                    (set! a1-2 sig-whip-right-ja)
                    16.0
                    )
                   (else
                     (set! a1-2 sig-whip-left-ja)
                     18.0
                     )
                   )
                 )
          )
      (ja-no-eval :group! a1-2 :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (when (and (focus-test? self dangerous) (< f30-0 (ja-aframe-num 0)))
          (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
              (logior! (-> self focus-status) (focus-status dangerous))
              (logclear! (-> self focus-status) (focus-status dangerous))
              )
          )
        (suspend)
        (ja :num! (seek!))
        )
      )
    (if (logtest? (-> self bot-flags) (bot-flags attacked))
        (reset-attacker! self)
        )
    (react-to-focus self)
    )
  :post (behavior ()
    (seek-toward-heading-vec! (-> self root) (-> self focus-info bullseye-xz-dir) 131072.0 (seconds 0.05))
    (nav-enemy-simple-post)
    )
  )

(defstate blast (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    ((-> (method-of-type nav-enemy hostile) enter))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (logior! (-> self enemy-flags) (enemy-flag lock-focus))
    (if (not (handle->process (-> self focus handle)))
        (react-to-focus self)
        )
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :exit (behavior ()
    (logclear! (-> self enemy-flags) (enemy-flag lock-focus))
    )
  :code (behavior ()
    (local-vars (gp-0 art-element))
    (let ((f30-0 8.0))
      (cond
        ((< (fabs (-> self focus-info ry-diff)) 8192.0)
         (ja-channel-push! 1 (seconds 0.1))
         (set! gp-0 sig-blast-forward-ja)
         )
        ((< (-> self focus-info ry-diff) 0.0)
         (ja-channel-push! 1 (seconds 0.1))
         (set! gp-0 sig-blast-right-ja)
         )
        (else
          (ja-channel-push! 1 (seconds 0.1))
          (set! gp-0 sig-blast-left-ja)
          )
        )
      (let ((f30-1 (ja-aframe f30-0 0)))
        (ja-no-eval :group! gp-0 :num! (seek! f30-1) :frame-num 0.0)
        (until (ja-done? 0)
          (seek-toward-heading-vec! (-> self root) (-> self focus-info bullseye-xz-dir) 131072.0 (seconds 0.05))
          (bot-method-223 self #t)
          (if (and (time-elapsed? (-> self state-time) (seconds 0.1))
                   (or (not (bot-method-214 self)) (not (sig-method-245 self)))
                   )
              (react-to-focus self)
              )
          (suspend)
          (ja :num! (seek! f30-1))
          )
        )
      )
    (bot-method-223 self #t)
    (if (and (bot-method-214 self) (sig-method-245 self))
        (fire-gun self (-> self focus-info bullseye))
        )
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (bot-method-223 self #f)
      (if (and (bot-method-214 self) (sig-method-246 self))
          (go-virtual whip)
          )
      (suspend)
      (ja-eval)
      )
    (if (logtest? (-> self bot-flags) (bot-flags attacked))
        (reset-attacker! self)
        )
    (react-to-focus self)
    )
  :post nav-enemy-simple-post
  )

(defstate chase (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    ((-> (method-of-type nav-enemy hostile) enter))
    (set! (-> self skel top-anim interp) 1.0)
    )
  :trans (behavior ()
    (bot-method-223 self #t)
    (cond
      ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time)))
       (go-stare2 self)
       )
      ((not (bot-method-214 self))
       (go-virtual traveling)
       )
      ((sig-method-246 self)
       (go-virtual whip)
       )
      ((sig-method-245 self)
       (go-virtual blast)
       )
      ((and (not (logtest? (bot-flags bf19) (-> self bot-flags)))
            (= (-> self focus-info los) 1)
            (-> self focus-info fproc)
            (>= 3640.889 (fabs (-> self focus-info ry-diff)))
            (>= 81920.0 (-> self focus-info bullseye-xz-dist))
            )
       (go-virtual chase-attack)
       )
      )
    )
  :code (behavior ()
    (until #f
      (sig-method-258 self)
      (suspend)
      )
    #f
    )
  :post (behavior ()
    (let ((gp-0 (-> self nav state))
          (v1-6 (get-trans (the-as process-focusable (handle->process (-> self focus handle))) 0))
          )
      (logclear! (-> gp-0 flags) (nav-state-flag directional-mode))
      (logior! (-> gp-0 flags) (nav-state-flag target-poly-dirty))
      (set! (-> gp-0 target-post quad) (-> v1-6 quad))
      )
    0
    (nav-enemy-travel-post)
    )
  )

(defstate chase-attack (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    ((-> (method-of-type sig chase) enter))
    (set! (-> self skel top-anim interp) 1.0)
    (if (not (handle->process (-> self focus handle)))
        (go-virtual traveling)
        )
    (logior! (-> self enemy-flags) (enemy-flag lock-focus))
    )
  :exit (behavior ()
    (logclear! (-> self enemy-flags) (enemy-flag lock-focus))
    )
  :code (behavior ()
    (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim sig-upper-shoot-ja) 0.0 9 9 1.0 0.0 #f)
    (until (time-elapsed? (-> self state-time) (seconds 0.167))
      (sig-method-258 self)
      (suspend)
      )
    (bot-method-223 self #t)
    (let ((a1-2 (-> self focus-info fproc)))
      (cond
        ((and a1-2
              (logtest? (-> self bot-flags) (bot-flags bf00))
              (not (logtest? (bot-flags bf19) (-> self bot-flags)))
              (attacked-by-player? self a1-2)
              (= (-> self focus-info los) 1)
              )
         (fire-gun self (-> self focus-info bullseye))
         0
         )
        (else
          (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim sig-upper-base-high-ja) 0.0 30 0 1.0 0.0 #f)
          )
        )
      )
    (until (time-elapsed? (-> self state-time) (seconds 0.8))
      (sig-method-258 self)
      (suspend)
      )
    (if (logtest? (-> self bot-flags) (bot-flags attacked))
        (reset-attacker! self)
        )
    (go-virtual chase)
    )
  :post (behavior ()
    (let ((a0-1 (handle->process (-> self focus handle))))
      (when a0-1
        (let ((gp-0 (-> self nav state))
              (v1-7 (get-trans (the-as process-focusable a0-1) 0))
              )
          (logclear! (-> gp-0 flags) (nav-state-flag directional-mode))
          (logior! (-> gp-0 flags) (nav-state-flag target-poly-dirty))
          (set! (-> gp-0 target-post quad) (-> v1-7 quad))
          )
        0
        )
      )
    (nav-enemy-travel-post)
    )
  )

(defstate hit (sig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type bot hit) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :code (behavior ()
    (local-vars (v1-31 enemy-flag) (v1-39 enemy-flag))
    (ja-channel-push! 1 (seconds 0.1))
    (ja-no-eval :group! sig-idle-right0-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
        (logior! (-> self focus-status) (focus-status dangerous))
        (logclear! (-> self focus-status) (focus-status dangerous))
        )
    (let ((v1-30 (-> self enemy-flags)))
      (if (logtest? v1-30 (enemy-flag vulnerable-backup))
          (set! v1-31 (logior v1-30 (enemy-flag vulnerable)))
          (set! v1-31 (logclear v1-30 (enemy-flag vulnerable)))
          )
      )
    (set! (-> self enemy-flags) v1-31)
    (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup))
        (logior! (-> self mask) (process-mask collectable))
        (logclear! (-> self mask) (process-mask collectable))
        )
    (let ((v1-38 (-> self enemy-flags)))
      (if (logtest? (enemy-flag trackable-backup) v1-38)
          (set! v1-39 (logior (enemy-flag trackable) v1-38))
          (set! v1-39 (logclear v1-38 (enemy-flag trackable)))
          )
      )
    (set! (-> self enemy-flags) v1-39)
    (logclear! (-> self enemy-flags) (enemy-flag lock-focus))
    (logclear! (-> self focus-status) (focus-status hit))
    (react-to-focus self)
    )
  )

(defstate knocked (sig)
  :virtual #t
  :enter (behavior ()
    (sig-plasma-method-12 (-> self plasma))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (let ((t9-1 (-> (method-of-type bot knocked) enter)))
      (if t9-1
          (t9-1)
          )
      )
    (if (logtest? (bot-flags bf19 bf20) (-> self bot-flags))
        (logclear! (-> self bot-flags) (bot-flags bf12))
        )
    )
  )

(defstate die-falling (sig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type bot die-falling) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (sig-plasma-method-11 (-> self plasma) #f)
    (set! (-> self travel-anim-interp) 0.0)
    (set! (-> self skel top-anim interp) 0.0)
    (play-death-sound self "sigt093")
    )
  )

(defstate failed (sig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type bot failed) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (sig-plasma-method-11 (-> self plasma) #f)
    (set! (-> self travel-anim-interp) 0.0)
    (set! (-> self skel top-anim interp) 0.0)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja-no-eval :group! sig-ready0-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.2))
    (ja-no-eval :group! sig-ready0-to-idle-right0-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.2))
    (set-time! (-> self state-time))
    (until #f
      (ja-no-eval :group! sig-idle-right0-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (if (and (logtest? (-> self bot-flags) (bot-flags failed))
                 (time-elapsed? (-> self state-time) (seconds 0.5))
                 (reset? *fail-mission-control*)
                 )
            (reset! *fail-mission-control*)
            )
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  )

(defstate sig-path-run (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'sig-path-sample)))
      (sig-method-248 self gp-0)
      (if (logtest? (-> gp-0 flags) 1)
          (go-virtual sig-path-jump)
          )
      (if (logtest? (-> gp-0 flags) 2)
          (go-virtual sig-path-shoot-jump)
          )
      (let ((v1-14 (-> self root)))
        (set! (-> v1-14 trans quad) (-> gp-0 pos quad))
        (set! (-> v1-14 trans w) 1.0)
        (quaternion-copy! (-> v1-14 quat) (-> gp-0 quat))
        )
      )
    (if (sig-method-257 self)
        (go-virtual sig-path-idle)
        )
    )
  :code (behavior ()
    (let ((v1-2 (ja-group)))
      (if (and v1-2 (or (= v1-2 sig-chased-run-jump-land0-ja) (= v1-2 sig-chased-shoot-jump-land0-ja)))
          (ja-channel-push! 1 (seconds 0.07))
          (ja-channel-push! 1 (seconds 0.15))
          )
      )
    (ja-no-eval :group! sig-chased-run0-ja :num! (loop!))
    (until #f
      (suspend)
      (let* ((f0-1 (vector-length (-> self root transv)))
             (f0-3 (fmax 0.1 (/ f0-1 (meters 12))))
             )
        (ja :num! (loop! f0-3))
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate sig-path-jump (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (logior! (-> self bot-flags) (bot-flags bf24))
    )
  :trans (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'sig-path-sample)))
      (sig-method-248 self gp-0)
      (let ((s5-0 (-> gp-0 flags)))
        (if (not (logtest? s5-0 1))
            (logclear! (-> self bot-flags) (bot-flags bf24))
            )
        (if (and (logtest? s5-0 1) (not (logtest? (bot-flags bf24) (-> self bot-flags))))
            (go-virtual sig-path-jump)
            )
        (if (logtest? s5-0 2)
            (go-virtual sig-path-shoot-jump)
            )
        (if (and (time-elapsed? (-> self state-time) (seconds 0.05)) (not (logtest? s5-0 4)))
            (go-virtual sig-path-jump-land)
            )
        )
      (let ((v1-27 (-> self root)))
        (set! (-> v1-27 trans quad) (-> gp-0 pos quad))
        (set! (-> v1-27 trans w) 1.0)
        (quaternion-copy! (-> v1-27 quat) (-> gp-0 quat))
        )
      )
    )
  :code (behavior ()
    (let ((f30-0 0.0))
      (let ((v1-2 (ja-group)))
        (if (and v1-2 (= v1-2 sig-chased-run-jump0-ja))
            (set! f30-0 1.0)
            )
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-chased-run-jump0-ja :num! (seek!) :frame-num f30-0)
      )
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (suspend)
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate sig-path-jump-land (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'sig-path-sample)))
      (sig-method-248 self gp-0)
      (let ((s5-0 (-> gp-0 flags)))
        (if (not (logtest? s5-0 1))
            (logclear! (-> self bot-flags) (bot-flags bf24))
            )
        (if (and (logtest? s5-0 1) (not (logtest? (bot-flags bf24) (-> self bot-flags))))
            (go-virtual sig-path-jump)
            )
        (if (logtest? s5-0 2)
            (go-virtual sig-path-shoot-jump)
            )
        )
      (let ((v1-18 (-> self root)))
        (set! (-> v1-18 trans quad) (-> gp-0 pos quad))
        (set! (-> v1-18 trans w) 1.0)
        (quaternion-copy! (-> v1-18 quat) (-> gp-0 quat))
        )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.15))
    (let* ((f0-0 (vector-length (-> self root transv)))
           (f0-2 (fmax 0.1 (/ f0-0 (meters 12))))
           )
      (ja-no-eval :group! sig-chased-run-jump-land0-ja :num! (seek! max f0-2) :frame-num 0.0)
      )
    (until (ja-done? 0)
      (suspend)
      (let* ((f0-4 (vector-length (-> self root transv)))
             (f0-6 (fmax 0.1 (/ f0-4 (meters 12))))
             )
        (ja :num! (seek! max f0-6))
        )
      )
    (go-virtual sig-path-run)
    )
  :post nav-enemy-simple-post
  )

(defstate sig-path-shoot-jump (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (logior! (-> self bot-flags) (bot-flags bf24))
    (logclear! (-> self bot-flags) (bot-flags bf25))
    )
  :trans (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'sig-path-sample)))
      (sig-method-248 self gp-0)
      (let ((s5-0 (-> gp-0 flags)))
        (if (not (logtest? s5-0 2))
            (logclear! (-> self bot-flags) (bot-flags bf24))
            )
        (if (and (logtest? s5-0 2) (not (logtest? (bot-flags bf24) (-> self bot-flags))))
            (go-virtual sig-path-shoot-jump)
            )
        (if (and (logtest? s5-0 1) (logtest? (bot-flags bf25) (-> self bot-flags)))
            (go-virtual sig-path-jump)
            )
        (if (and (time-elapsed? (-> self state-time) (seconds 0.05)) (not (logtest? s5-0 4)))
            (go-virtual sig-path-shoot-jump-land)
            )
        )
      (let ((v1-29 (-> self root)))
        (set! (-> v1-29 trans quad) (-> gp-0 pos quad))
        (set! (-> v1-29 trans w) 1.0)
        (quaternion-copy! (-> v1-29 quat) (-> gp-0 quat))
        )
      )
    )
  :code (behavior ()
    (let ((f30-0 0.0))
      (let ((v1-2 (ja-group)))
        (if (and v1-2 (= v1-2 sig-chased-shoot-jump0-ja))
            (set! f30-0 1.0)
            )
        )
      (ja-channel-push! 1 (seconds 0.07))
      (ja-no-eval :group! sig-chased-shoot-jump0-ja :num! (seek!) :frame-num f30-0)
      )
    (until (ja-done? 0)
      (if (and (not (logtest? (bot-flags bf25) (-> self bot-flags)))
               (and (< 5.0 (ja-aframe-num 0)) (sig-method-250 self))
               )
          (logior! (-> self bot-flags) (bot-flags bf25))
          )
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (suspend)
      )
    #f
    )
  :post nav-enemy-simple-post
  )

(defstate sig-path-shoot-jump-land (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    )
  :trans (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'sig-path-sample)))
      (sig-method-248 self gp-0)
      (let ((s5-0 (-> gp-0 flags)))
        (if (not (logtest? s5-0 2))
            (logclear! (-> self bot-flags) (bot-flags bf24))
            )
        (if (and (logtest? s5-0 2) (not (logtest? (bot-flags bf24) (-> self bot-flags))))
            (go-virtual sig-path-shoot-jump)
            )
        (if (logtest? s5-0 1)
            (go-virtual sig-path-jump)
            )
        )
      (let ((v1-18 (-> self root)))
        (set! (-> v1-18 trans quad) (-> gp-0 pos quad))
        (set! (-> v1-18 trans w) 1.0)
        (quaternion-copy! (-> v1-18 quat) (-> gp-0 quat))
        )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.15))
    (let* ((f0-0 (vector-length (-> self root transv)))
           (f0-2 (fmax 0.1 (/ f0-0 (meters 12))))
           )
      (ja-no-eval :group! sig-chased-shoot-jump-land0-ja :num! (seek! max f0-2) :frame-num 0.0)
      )
    (until (ja-done? 0)
      (suspend)
      (let* ((f0-4 (vector-length (-> self root transv)))
             (f0-6 (fmax 0.1 (/ f0-4 (meters 12))))
             )
        (ja :num! (seek! max f0-6))
        )
      )
    (go-virtual sig-path-run)
    )
  :post nav-enemy-simple-post
  )

(defstate sig-path-idle (sig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (let ((v1-2 self))
      (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
      (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
      )
    0
    (nav-enemy-method-167 self)
    (let ((v1-7 self))
      (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37))))
      )
    0
    (look-at-target! self (enemy-flag look-at-focus))
    (set! (-> self skel top-anim interp) 0.0)
    (set! (-> self travel-anim-interp) 0.0)
    (vector-reset! (-> self root transv))
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.15))
    (ja-no-eval :group! sig-chased-idle-start-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (ja-no-eval :group! sig-chased-idle-loop-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post nav-enemy-simple-post
  )
