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

;; name: bombbot.gc
;; name in dgo: bombbot
;; dgos: LBOMBBOT

;; DECOMP BEGINS

(define *bombbot-body-constants* (new 'static 'rigid-body-object-constants
                                   :info (new 'static 'rigid-body-info
                                     :mass 1.0
                                     :inv-mass 1.0
                                     :linear-damping 0.8
                                     :angular-damping 0.8
                                     :bounce-factor 0.5
                                     :friction-factor 0.1
                                     :cm-offset-joint (new 'static 'vector :w 1.0)
                                     :inertial-tensor-box (new 'static 'array meters 3 (meters 2) (meters 2) (meters 2))
                                     )
                                   :extra (new 'static 'rigid-body-object-extra-info
                                     :max-time-step 0.02
                                     :gravity (meters 10)
                                     :idle-distance (meters 200)
                                     :attack-force-scale 2.0
                                     )
                                   :name '*bombbot-body-constants*
                                   )
        )

(defpartgroup group-bombbot-explode0
  :id 1060
  :duration (seconds 3)
  :linger-duration (seconds 2)
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 2)
  :parts ((sp-item 4608 :fade-after (meters 200) :falloff-to (meters 200) :period (seconds 32) :length (seconds 0.085))
    (sp-item 4609 :period (seconds 32) :length (seconds 0.035) :offset 10)
    (sp-item 4610 :fade-after (meters 120) :falloff-to (meters 120) :period (seconds 32) :length (seconds 0.335) :offset 25)
    (sp-item 4611 :fade-after (meters 60) :period (seconds 32) :length (seconds 0.117) :offset 10)
    (sp-item 4612 :period (seconds 32) :length (seconds 0.167) :offset 15)
    (sp-item 4613 :period (seconds 32) :length (seconds 0.017))
    (sp-item 4614 :period (seconds 32) :length (seconds 0.167) :offset 15)
    (sp-item 4615 :period (seconds 32) :length (seconds 0.017))
    )
  )

(defpart 4613
  :init-specs ((:texture (glow effects))
    (:num 1.0)
    (:y (meters -2.5))
    (:scale-x (meters 32))
    (:rot-x (degrees 45))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 96.0)
    (:scalevel-x (meters 0.5))
    (:rotvel-z (degrees 0.3))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -1.28)
    (:fade-b -5.1)
    (:fade-a 0.0)
    (:timer (seconds 0.217))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 40960.0)
    (:next-time (seconds 0.1))
    (:next-launcher 4616)
    )
  )

(defpart 4616
  :init-specs ((:scalevel-x (meters -0.2857143))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -3.6571429)
    (:fade-b 0.0)
    (:fade-a -2.7428572)
    )
  )

(defpart 4615
  :init-specs ((:texture (glow-soft effects))
    (:num 1.0)
    (:scale-x (meters 120))
    (:rot-x (degrees 45))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 24.0)
    (:scalevel-x (meters 0.13333334))
    (:rotvel-z (degrees 0.3))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -4.266667)
    (:fade-b -4.266667)
    (:fade-a 0.0)
    (:timer (seconds 0.5))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow))
    (:userdata 40960.0)
    (:next-time (seconds 0.25))
    (:next-launcher 4617)
    )
  )

(defpart 4617
  :init-specs ((:scalevel-x (meters 0))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.85333335)
    (:fade-g -1.7066667)
    (:fade-b -1.7066667)
    (:fade-a -0.64)
    )
  )

(defpart 4611
  :init-specs ((:texture (motion-blur-part effects))
    (:num 16.0)
    (:y (meters -3.5) (meters 2))
    (:scale-x (meters 2.5))
    (:rot-x 4)
    (:scale-y (meters 0.1) (meters 0.2))
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 64.0 32.0)
    (:omega (degrees 0.0675))
    (:vel-y (meters 0.26666668) (meters 0.2))
    (:fade-b -8.0)
    (:accel-y (meters -0.0033333334) (meters -0.0016666667))
    (:friction 0.9 0.08)
    (:timer (seconds 1.5) (seconds 0.997))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:next-time (seconds 0.05))
    (:next-launcher 4618)
    (:conerot-x (degrees 0) (degrees 140))
    (:conerot-y (degrees 0) (degrees 10000))
    (:rotate-y (degrees 90))
    )
  )

(defpart 4618
  :init-specs ((:r 255.0)
    (:g 255.0)
    (:b 0.0)
    (:fade-r 0.0)
    (:fade-g -2.6133332)
    (:fade-b -1.7066667)
    (:fade-a -0.096 -0.096)
    (:next-time (seconds 0.25))
    (:next-launcher 4619)
    )
  )

(defpart 4619
  :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0))
  )

(defpart 4614
  :init-specs ((:texture (explosion-wave effects))
    (:num 5.0 5.0)
    (:y (meters -2.5))
    (:scale-x (meters 3) (meters 2))
    (:rot-x 4)
    (:rot-z (degrees 0) (degrees 360) :store)
    (:scale-y (meters 8) (meters 4))
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 32.0 32.0)
    (:vel-y (meters 0.033333335) (meters 0.06666667))
    (:scalevel-x (meters 0.033333335) (meters 0.13333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -0.36)
    (:fade-b -4.24)
    (:fade-a -0.26666668)
    (:friction 0.92 0.02)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-2))
    (:func 'sparticle-motion-blur)
    (:next-time (seconds 0.085))
    (:next-launcher 4620)
    (:conerot-x '*sp-temp*)
    (:conerot-y (degrees 0) (degrees 3600))
    (:rotate-y (degrees 90))
    (:conerot-radius (meters 0) (meters 2))
    )
  )

(defpart 4620
  :init-specs ((:scalevel-x (meters 0.016666668) (meters 0.016666668))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.55)
    (:fade-g -2.95)
    (:fade-b -3.3)
    (:next-time (seconds 0.1) (seconds 0.03))
    (:next-launcher 4621)
    )
  )

(defpart 4621
  :init-specs ((:scalevel-x (meters 0.008333334) (meters 0.008333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -1.2944444)
    (:fade-g -0.7111111)
    (:fade-b -0.2)
    (:fade-a -0.225 -0.225)
    )
  )

(defpart 4612
  :init-specs ((:texture (explosion-nebula effects))
    (:birth-func 'birth-func-texture-group)
    (:num 16.0 10.0)
    (:y (meters -2.5))
    (:scale-x (meters 3) (meters 2))
    (:rot-z (degrees 0))
    (:scale-y (meters 6.8) (meters 1.2))
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 32.0 32.0)
    (:vel-y (meters 0) (meters 0.13333334))
    (:scalevel-x (meters 0.06666667) (meters 0.13333334))
    (:rotvel-z (degrees -0.12) (degrees 0.24))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -0.36)
    (:fade-b -4.24)
    (:fade-a -0.32)
    (:friction 0.94)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-2))
    (:userdata :data (new 'static 'boxed-array :type int32 40 1 0 #xc00000 #xc03300))
    (:next-time (seconds 0.085))
    (:next-launcher 4622)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    (:rotate-y (degrees 90))
    (:conerot-radius (meters 0) (meters 8))
    )
  )

(defpart 4622
  :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:next-time (seconds 0.017) (seconds 0.065)) (:next-launcher 4623))
  )

(defpart 4623
  :init-specs ((:scalevel-x (meters 0.016666668) (meters 0.016666668))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.44)
    (:fade-g -2.36)
    (:fade-b -2.64)
    (:next-time (seconds 0.117) (seconds 0.047))
    (:next-launcher 4624)
    )
  )

(defpart 4624
  :init-specs ((:scalevel-x (meters 0.008333334) (meters 0.008333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -1.2)
    (:fade-g -0.7111111)
    (:fade-b -0.2)
    (:fade-a -0.06545454 -0.06545454)
    (:next-time (seconds 0.5) (seconds 0.097))
    (:next-launcher 4625)
    )
  )

(defpart 4625
  :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:fade-a -0.1125))
  )

(defpart 4610
  :init-specs ((:texture (specs effects))
    (:num 6.0 8.0)
    (:x (meters 0.25))
    (:y (meters -2.5))
    (:scale-x (meters 3) (meters 5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 16.0 48.0)
    (:vel-y (meters 0.06666667) (meters 0.4))
    (:scalevel-x (meters 0.013333334) (meters 0.013333334))
    (:rotvel-z (degrees -0.12) (degrees 0.24))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -0.18)
    (:fade-b -2.12)
    (:accel-y (meters -0.00033333333) (meters -0.0023333333))
    (:friction 0.88 0.02)
    (:timer (seconds 10))
    (:flags (sp-cpuinfo-flag-2))
    (:next-time (seconds 0.117) (seconds 0.047))
    (:next-launcher 4626)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    (:rotate-y (degrees 90))
    (:conerot-radius (meters 3) (meters 5))
    )
  )

(defpart 4626
  :init-specs ((:scalevel-x (meters 0.0016666667))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g 0.02)
    (:fade-b 0.23555556)
    (:next-time (seconds 0.15) (seconds 0.047))
    (:next-launcher 4627)
    )
  )

(defpart 4627
  :init-specs ((:fade-r -0.5543478) (:fade-g -0.5543478) (:fade-b -0.5543478) (:fade-a -0.10666667 -0.10666667))
  )

(defpart 4608
  :init-specs ((:texture (bigpuff effects))
    (:num 4.0 8.0)
    (:x (meters 0) (meters 0.6))
    (:y (meters -2.5))
    (:scale-x (meters 8.5) (meters 8))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 70.0 20.0)
    (:g 70.0 20.0)
    (:b 70.0 20.0)
    (:a 0.0 40.0)
    (:vel-y (meters 0) (meters 0.2))
    (:scalevel-x (meters 0.033333335) (meters 0.086666666))
    (:rotvel-z (degrees -0.12) (degrees 0.24))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 3.3)
    (:fade-g 3.12)
    (:fade-b 1.18)
    (:fade-a 1.76)
    (:friction 0.89)
    (:timer (seconds 2.367))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:next-time (seconds 0.117) (seconds 0.047))
    (:next-launcher 4628)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    (:rotate-y (degrees 90))
    )
  )

(defpart 4628
  :init-specs ((:scalevel-x (meters 0.0033333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.53333336)
    (:fade-g -1.9666667)
    (:fade-b -2.2)
    (:fade-a -0.41666666)
    (:next-time (seconds 0.15) (seconds 0.047))
    (:next-launcher 4629)
    )
  )

(defpart 4629
  :init-specs ((:scalevel-x (meters 0))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.38833332)
    (:fade-g -0.21333334)
    (:fade-b -0.028333334)
    (:fade-a -0.38833332)
    )
  )

(defpart 4609
  :init-specs ((:texture (flamingstick effects))
    (:num 9.0)
    (:y (meters -2.5))
    (:scale-x (meters 4) (meters 8))
    (:rot-x 4)
    (:rot-z (degrees 0) (degrees 3600))
    (:scale-y (meters 1) (meters 0.5))
    (:r 128.0 128.0)
    (:g 96.0)
    (:b 64.0)
    (:a 64.0 64.0)
    (:scalevel-x (meters 0.13333334) (meters 0.4))
    (:fade-g 1.6)
    (:fade-b 3.2)
    (:fade-a -1.6)
    (:timer (seconds 0.3))
    (:flags (sp-cpuinfo-flag-2))
    )
  )

(defpart 4630
  :init-specs ((:texture (pal-lightning effects))
    (:birth-func 'birth-func-set-quat)
    (:num 1.0)
    (:scale-x (meters 2))
    (:scale-y (meters 40))
    (:r 128.0 64.0)
    (:g 128.0 64.0)
    (:b 128.0 64.0)
    (:a 128.0)
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat))
    )
  )

(defpart 4631
  :init-specs ((:texture (glow-hotdot effects))
    (:num 1.0)
    (:scale-x (meters 4))
    (:scale-y :copy scale-x)
    (:r 128.0 64.0)
    (:g 128.0 64.0)
    (:b 128.0 64.0)
    (:a 128.0)
    (:rotvel-z (degrees 0.3))
    (:fade-g -1.0666667)
    (:fade-b -1.0666667)
    (:fade-a -8.533334)
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    )
  )

(defpart 4632
  :init-specs ((:texture (glow-hotdot effects))
    (:num 1.0)
    (:scale-x (meters 2))
    (:scale-y :copy scale-x)
    (:r 128.0 64.0)
    (:g 128.0 64.0)
    (:b 128.0 64.0)
    (:a 128.0)
    (:rotvel-z (degrees 0.3))
    (:fade-g -1.0666667)
    (:fade-b -1.0666667)
    (:fade-a -8.533334)
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    )
  )

(defskelgroup skel-bombbot bombbot bombbot-lod0-jg bombbot-idle-ja
              ((bombbot-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 12)
              :shadow bombbot-shadow-mg
              )

(defskelgroup skel-bombbot-exploding bombbot bombbot-exploding-lod0-jg bombbot-exploding-idle-ja
              ((bombbot-exploding-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 12)
              )

(define *bombbot-exploder-params*
  (new 'static 'joint-exploder-static-params
    :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params
      (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 20 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 21 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 22 :parent-joint-index -1)
      )
    :collide-spec #x241
    )
  )

(deftype bombbot-foot (structure)
  ((pos-offset     vector  :inline)
   (joint-index    uint32)
   (offset         float)
   (position       vector  :inline)
   (next-position  vector  :inline)
   (real-position  vector  :inline)
   (speed          vector  :inline)
   (moving         symbol)
   (main-y         float)
   (delta-y        float)
   )
  :pack-me
  )


(deftype bombbot (nav-enemy)
  ((joint-ik                joint-mod-ik  4)
   (feet                    bombbot-foot  4 :inline)
   (legs-strength           float         4)
   (last-trans              vector        :inline)
   (linear-speed            vector        :inline)
   (last-quat               quaternion    :inline)
   (y-angular-velocity      float)
   (main-quat               quaternion    :inline)
   (main-spd-y              float)
   (main-pos-y              float)
   (main-pos                vector        :inline)
   (city-path               bombbot-path)
   (current-node            uint32)
   (shot-count              uint32)
   (next-shoot              uint64)
   (stop-shoot              uint64)
   (next-target             uint64)
   (start-target            uint64)
   (beep-time               time-frame)
   (target-pos              vector        :inline)
   (start-target-pos        vector        :inline)
   (start-target-vel        vector        :inline)
   (top-quat                quaternion    :inline)
   (gun-swivel-quat         quaternion    :inline)
   (gun-quat                quaternion    :inline)
   (angle-turret            float)
   (angle-gun               float)
   (high                    float)
   (shield-hit-points       float)
   (hit-axis                vector        :inline)
   (rigidbody               rigid-body-control)
   (info                    rigid-body-object-constants)
   (explosing               symbol)
   (minimap                 connection-minimap)
   (lazer-sound             sound-id)
   (head-sound              sound-id)
   (cannon-sound            sound-id)
   (last-head-roty-speed    float)
   (head-roty-speed         float)
   (last-cannon-roty-speed  float)
   (cannon-roty-speed       float)
   )
  (:state-methods
    explode
    )
  (:methods
    (bombbot-method-179 (_type_) none)
    (bombbot-method-180 (_type_) none)
    (bombbot-method-181 (_type_ vector) none)
    (bombbot-method-182 (_type_) none)
    (bombbot-method-183 (_type_) none)
    (bombbot-method-184 (_type_) none)
    )
  )


(define *bombbot-nav-enemy-info*
  (new 'static 'nav-enemy-info
    :use-die-falling #f
    :use-victory #f
    :use-jump-blocked #f
    :debug-draw-neck #f
    :jump-debug-draw #f
    :move-to-ground #f
    :hover-if-no-ground #f
    :idle-anim-script (new 'static 'array idle-control-frame 4
      (new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x1e)
      (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x64 :param1 #x64)
      (new 'static 'idle-control-frame)
      (new 'static 'idle-control-frame)
      )
    :idle-anim 3
    :notice-anim 3
    :hostile-anim 3
    :hit-anim 3
    :knocked-anim 3
    :knocked-land-anim 3
    :die-anim 3
    :die-falling-anim 3
    :victory-anim -1
    :jump-wind-up-anim 3
    :jump-in-air-anim 3
    :jump-land-anim 3
    :neck-joint -1
    :look-at-joint 4
    :bullseye-joint 4
    :sound-hit (static-sound-name "bombbot-hit")
    :sound-die (static-sound-name "bombbot-die")
    :notice-distance (meters 20)
    :notice-distance-delta (meters 10)
    :proximity-notice-distance (meters 20)
    :default-hit-points 90
    :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list)
    :movement-gravity (meters -100)
    :friction 0.8
    :attack-shove-back (meters 3.5)
    :attack-shove-up (meters 2)
    :attack-mode 'shock
    :attack-damage 2
    :recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher)
    :jump-height-min (meters 3)
    :jump-height-factor 0.5
    :knocked-seek-ry-clamp 6371.5557
    :knocked-soft-vxz-lo 72089.6
    :knocked-soft-vxz-hi 108134.4
    :knocked-soft-vy-lo 81920.0
    :knocked-soft-vy-hi 122880.0
    :knocked-medium-vxz-lo 147456.0
    :knocked-medium-vxz-hi 196608.0
    :knocked-medium-vy-lo 135168.0
    :knocked-medium-vy-hi 151552.0
    :knocked-hard-vxz-lo 78643.2
    :knocked-hard-vxz-hi 117964.8
    :knocked-hard-vy-lo 183500.8
    :knocked-hard-vy-hi 209715.2
    :knocked-huge-vxz-lo 164659.2
    :knocked-huge-vxz-hi 249036.8
    :knocked-huge-vy-lo 183500.8
    :knocked-huge-vy-hi 217907.2
    :knocked-yellow-vxz-lo 40960.0
    :knocked-yellow-vxz-hi 49152.0
    :knocked-yellow-vy-lo 57344.0
    :knocked-yellow-vy-hi 81920.0
    :knocked-red-vxz-lo 24576.0
    :knocked-red-vxz-hi 196608.0
    :knocked-red-vy-lo 94208.0
    :knocked-red-vy-hi 151552.0
    :knocked-blue-vxz-lo 40960.0
    :knocked-blue-vxz-hi 49152.0
    :knocked-blue-vy-lo 24576.0
    :knocked-blue-vy-hi 81920.0
    :shadow-size (meters 1)
    :shadow-max-y (meters 1)
    :shadow-min-y (meters -1)
    :shadow-locus-dist (meters 150)
    :gem-joint -1
    :gem-offset (new 'static 'sphere :r 163840.0)
    :callback-info #f
    :use-momentum #t
    :use-frustration #t
    :use-stop-chase #f
    :use-circling #t
    :use-pacing #f
    :walk-anim 3
    :turn-anim -1
    :run-anim 3
    :taunt-anim -1
    :run-travel-speed (meters 8)
    :run-acceleration (meters 8)
    :run-turning-acceleration (meters 10)
    :walk-travel-speed (meters 4)
    :walk-acceleration (meters 16)
    :walk-turning-acceleration (meters 40)
    :maximum-rotation-rate (degrees 60)
    :notice-nav-radius (meters 2)
    :frustration-distance (meters 8)
    :frustration-time (seconds 4)
    :blocked-time (seconds 0.3)
    :circle-dist-lo 20480.0
    :circle-dist-hi 61440.0
    :nav-mesh #f
    )
  )

(set! (-> *bombbot-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*)

(deftype ik-setup (structure)
  ((elbow-index  int32)
   (hand-dist    float)
   )
  )


(define *bombbot-ik-setup* (new 'static 'boxed-array :type ik-setup
                             (new 'static 'ik-setup :elbow-index 19 :hand-dist 14880.768)
                             (new 'static 'ik-setup :elbow-index 13 :hand-dist -14880.768)
                             (new 'static 'ik-setup :elbow-index 15 :hand-dist 14880.768)
                             (new 'static 'ik-setup :elbow-index 17 :hand-dist -14880.768)
                             )
        )

(defun bombbot-do-spline ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float))
  (rlet ((acc :class vf)
         (vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         (vf7 :class vf)
         )
    (init-vf0-vector)
    (let* ((f1-1 (* arg5 arg5))
           (f0-2 (* arg5 f1-1))
           )
      (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2))
            (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5)))
            (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1)))
            )
        (vector-float*! arg0 arg1 f2-3)
        (let ((t2-0 arg0))
          (let ((v1-10 arg0))
            (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2)))
              (let ((a1-1 f3-7))
                (.mov vf7 a1-1)
                )
              (.lvf vf5 (&-> t1-3 quad))
              )
            (.lvf vf4 (&-> v1-10 quad))
            )
          (.add.x.vf.w vf6 vf0 vf0)
          (.mul.x.vf.xyz acc vf5 vf7)
          (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
          (.svf (&-> t2-0 quad) vf6)
          )
        (let ((a2-1 arg0))
          (let ((v1-11 arg0))
            (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4)))
              (let ((t0-1 f1-3))
                (.mov vf7 t0-1)
                )
              (.lvf vf5 (&-> a1-3 quad))
              )
            (.lvf vf4 (&-> v1-11 quad))
            )
          (.add.x.vf.w vf6 vf0 vf0)
          (.mul.x.vf.xyz acc vf5 vf7)
          (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
          (.svf (&-> a2-1 quad) vf6)
          )
        )
      (let ((v0-0 arg0))
        (let ((v1-12 arg0))
          (let ((a0-1 arg3))
            (let ((a1-4 f0-2))
              (.mov vf7 a1-4)
              )
            (.lvf vf5 (&-> a0-1 quad))
            )
          (.lvf vf4 (&-> v1-12 quad))
          )
        (.add.x.vf.w vf6 vf0 vf0)
        (.mul.x.vf.xyz acc vf5 vf7)
        (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
        (.svf (&-> v0-0 quad) vf6)
        v0-0
        )
      )
    )
  )

(defmethod bombbot-method-180 ((this bombbot))
  (let ((a1-0 (new 'stack-no-clear 'traffic-danger-info)))
    (set! (-> a1-0 sphere quad) (-> this root trans quad))
    (set! (-> a1-0 sphere r) 40960.0)
    (set! (-> a1-0 velocity quad) (-> this root transv quad))
    (vector-reset! (-> a1-0 velocity))
    (set! (-> a1-0 notify-radius) 122880.0)
    (set! (-> a1-0 danger-level) 1.0)
    (set! (-> a1-0 decay-rate) 0.0)
    (set! (-> a1-0 flags) (traffic-danger-flags tdf0))
    (set! (-> a1-0 danger-type) (traffic-danger-type tdt0))
    (add-danger *traffic-engine* a1-0)
    )
  (none)
  )

;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16
;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16
(defmethod bombbot-method-179 ((this bombbot))
  (local-vars
    (at-0 int)
    (sv-864 vector)
    (sv-880 vector)
    (sv-896 float)
    (sv-912 float)
    (sv-928 (function vector vector float))
    (sv-944 uint)
    )
  (with-pp
    (rlet ((acc :class vf)
           (vf0 :class vf)
           (vf1 :class vf)
           (vf2 :class vf)
           (vf3 :class vf)
           (vf4 :class vf)
           (vf5 :class vf)
           (vf6 :class vf)
           (vf7 :class vf)
           )
      (init-vf0-vector)
      (let ((s5-0 (new 'stack-no-clear 'collide-query)))
        (let ((v1-0 (-> s5-0 bbox))
              (a0-2 (-> this root trans))
              (a1-0 (new 'stack-no-clear 'vector))
              )
          (set! (-> a1-0 x) 24576.0)
          (set! (-> a1-0 y) 22528.0)
          (set! (-> a1-0 z) 24576.0)
          (set! (-> a1-0 w) 1.0)
          (vector-! (-> v1-0 min) a0-2 a1-0)
          )
        (let ((v1-2 (-> s5-0 bbox max))
              (a0-4 (-> this root trans))
              (a1-1 (new 'stack-no-clear 'vector))
              )
          (set! (-> a1-1 x) 24576.0)
          (set! (-> a1-1 y) 22528.0)
          (set! (-> a1-1 z) 24576.0)
          (set! (-> a1-1 w) 1.0)
          (vector+! v1-2 a0-4 a1-1)
          )
        (set! (-> s5-0 collide-with) (collide-spec backgnd))
        (set! (-> s5-0 ignore-process0) #f)
        (set! (-> s5-0 ignore-process1) #f)
        (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
        (fill-using-bounding-box *collide-cache* s5-0)
        (dotimes (s4-0 4)
          (-> this joint-ik s4-0 shoulder-matrix-no-ik)
          (-> this joint-ik s4-0 elbow-matrix-no-ik)
          (new 'stack-no-clear 'vector)
          (let ((s2-0 (new 'stack-no-clear 'vector)))
            (set! (-> s2-0 quad) (-> this node-list data 3 bone transform vector 1 quad))
            (new 'stack-no-clear 'vector)
            (let ((s3-0 (new 'stack-no-clear 'vector)))
              (let ((f30-0 0.4))
                (vector-normalize! s2-0 1.0)
                (let ((s1-0 (-> this feet s4-0)))
                  (let* ((f0-10 (+ (* 0.0033333334 (the float (mod (current-time) 300))) (-> s1-0 offset)))
                         (f28-0 (- f0-10 (* (the float (the int (/ f0-10 1.0))) 1.0)))
                         (s0-0 (new 'stack-no-clear 'vector))
                         )
                    (cond
                      ((>= f30-0 f28-0)
                       (vector-orient-by-quat! s3-0 (-> s1-0 pos-offset) (-> this root quat))
                       (let ((f26-0 (- f30-0 f28-0)))
                         (set! sv-880 s0-0)
                         (set! sv-864 (new 'stack-no-clear 'vector))
                         (set! (-> sv-864 x) 0.0)
                         (set! (-> sv-864 y) (sin (* (-> this y-angular-velocity) (-> pp clock frames-per-second))))
                         (set! (-> sv-864 z) 0.0)
                         (set! (-> sv-864 w) 1.0)
                         (let ((v1-39 s3-0))
                           (.lvf vf1 (&-> sv-864 quad))
                           (.lvf vf2 (&-> v1-39 quad))
                           )
                         (.outer.product.a.vf acc vf1 vf2)
                         (.outer.product.b.vf vf3 vf2 vf1 acc)
                         (.svf (&-> sv-880 quad) vf3)
                         (let ((a1-5 s0-0)
                               (v1-41 s0-0)
                               (a0-11 (new 'stack-no-clear 'vector))
                               )
                           (.lvf vf1 (&-> (-> this linear-speed) quad))
                           (let ((f0-17 (-> pp clock frames-per-second)))
                             (.mov at-0 f0-17)
                             )
                           (.mov vf2 at-0)
                           (.mov.vf.w vf1 vf0)
                           (.mul.x.vf.xyz vf1 vf1 vf2)
                           (.svf (&-> a0-11 quad) vf1)
                           (vector+! a1-5 v1-41 a0-11)
                           )
                         (let ((a1-7 (-> s1-0 speed)))
                           (let ((v1-42 (-> s1-0 speed)))
                             (let ((a0-13 (vector-! (new 'stack-no-clear 'vector) s0-0 (-> s1-0 speed))))
                               (let ((a2-14 (* 4.0 (seconds-per-frame))))
                                 (.mov vf7 a2-14)
                                 )
                               (.lvf vf5 (&-> a0-13 quad))
                               )
                             (.lvf vf4 (&-> v1-42 quad))
                             )
                           (.add.x.vf.w vf6 vf0 vf0)
                           (.mul.x.vf.xyz acc vf5 vf7)
                           (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                           (.svf (&-> a1-7 quad) vf6)
                           )
                         (let ((a1-8 s3-0))
                           (let ((v1-43 s3-0))
                             (let ((a0-14 (-> s1-0 speed)))
                               (let ((a2-16 (+ 0.2 f26-0)))
                                 (.mov vf7 a2-16)
                                 )
                               (.lvf vf5 (&-> a0-14 quad))
                               )
                             (.lvf vf4 (&-> v1-43 quad))
                             )
                           (.add.x.vf.w vf6 vf0 vf0)
                           (.mul.x.vf.xyz acc vf5 vf7)
                           (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                           (.svf (&-> a1-8 quad) vf6)
                           )
                         )
                       (vector+! s3-0 s3-0 (-> this root trans))
                       (let ((a1-11 (-> s5-0 start-pos)))
                         (let ((v1-45 s3-0))
                           (let ((a0-17 s2-0))
                             (let ((a2-18 24576.0))
                               (.mov vf7 a2-18)
                               )
                             (.lvf vf5 (&-> a0-17 quad))
                             )
                           (.lvf vf4 (&-> v1-45 quad))
                           )
                         (.add.x.vf.w vf6 vf0 vf0)
                         (.mul.x.vf.xyz acc vf5 vf7)
                         (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                         (.svf (&-> a1-11 quad) vf6)
                         )
                       (vector-float*! (-> s5-0 move-dist) s2-0 -49152.0)
                       (let ((v1-48 s5-0))
                         (set! (-> v1-48 radius) 40.96)
                         (set! (-> v1-48 collide-with) (collide-spec backgnd))
                         (set! (-> v1-48 ignore-process0) #f)
                         (set! (-> v1-48 ignore-process1) #f)
                         (set! (-> v1-48 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
                         (set! (-> v1-48 action-mask) (collide-action solid))
                         )
                       (let ((f0-25 (probe-using-line-sphere *collide-cache* s5-0)))
                         (when (>= f0-25 0.0)
                           (let ((v1-50 (new 'stack-no-clear 'vector)))
                             (let ((a0-25 (-> s5-0 start-pos)))
                               (let ((a1-14 (-> s5-0 move-dist)))
                                 (let ((a2-19 f0-25))
                                   (.mov vf7 a2-19)
                                   )
                                 (.lvf vf5 (&-> a1-14 quad))
                                 )
                               (.lvf vf4 (&-> a0-25 quad))
                               )
                             (.add.x.vf.w vf6 vf0 vf0)
                             (.mul.x.vf.xyz acc vf5 vf7)
                             (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                             (.svf (&-> v1-50 quad) vf6)
                             (- (-> s3-0 y) (-> v1-50 y))
                             (set! (-> s3-0 quad) (-> v1-50 quad))
                             )
                           )
                         )
                       (set! (-> s1-0 next-position quad) (-> s3-0 quad))
                       (set! (-> s1-0 moving) #t)
                       (let ((a1-15 s3-0))
                         (let ((v1-54 (-> s1-0 position)))
                           (let ((a0-30 (vector-! (new 'stack-no-clear 'vector) (-> s1-0 next-position) (-> s1-0 position))))
                             (let ((a2-21 (/ f28-0 f30-0)))
                               (.mov vf7 a2-21)
                               )
                             (.lvf vf5 (&-> a0-30 quad))
                             )
                           (.lvf vf4 (&-> v1-54 quad))
                           )
                         (.add.x.vf.w vf6 vf0 vf0)
                         (.mul.x.vf.xyz acc vf5 vf7)
                         (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                         (.svf (&-> a1-15 quad) vf6)
                         )
                       (let ((t9-5 bombbot-do-spline)
                             (a0-31 (new 'stack-no-clear 'vector))
                             (a1-16 (new 'stack-no-clear 'vector))
                             )
                         (set! (-> a1-16 x) 0.0)
                         (set! (-> a1-16 y) 0.0)
                         (set! (-> a1-16 z) 0.0)
                         (set! (-> a1-16 w) 1.0)
                         (let ((a2-22 (new 'stack-no-clear 'vector)))
                           (set! (-> a2-22 x) 0.0)
                           (set! (-> a2-22 y) 0.0)
                           (set! (-> a2-22 z) 0.5)
                           (set! (-> a2-22 w) 1.0)
                           (let ((a3-1 (new 'stack-no-clear 'vector)))
                             (set! (-> a3-1 x) 0.0)
                             (set! (-> a3-1 y) 0.0)
                             (set! (-> a3-1 z) 1.0)
                             (set! (-> a3-1 w) 1.0)
                             (let ((t0-0 (new 'stack-no-clear 'vector)))
                               (set! (-> t0-0 x) 0.0)
                               (set! (-> t0-0 y) 4.0)
                               (set! (-> t0-0 z) 0.0)
                               (set! (-> t0-0 w) 1.0)
                               (let ((v0-5 (t9-5 a0-31 a1-16 a2-22 a3-1 t0-0 (/ f28-0 f30-0))))
                                 (set! (-> s1-0 delta-y) (* (/ (-> v0-5 y) 20) (vector-length (-> s1-0 speed))))
                                 )
                               )
                             )
                           )
                         )
                       (+! (-> s3-0 y) (-> s1-0 delta-y))
                       )
                      (else
                        (when (-> s1-0 moving)
                          (set! (-> s1-0 position quad) (-> s1-0 next-position quad))
                          (set! (-> s1-0 moving) #f)
                          (let ((s0-1 lerp-scale))
                            (set! sv-896 (the-as float 819.2))
                            (set! sv-912 (the-as float 0.0))
                            (set! sv-928 vector-vector-distance)
                            (let* ((a0-34 (camera-pos))
                                   (a1-17 (-> s1-0 position))
                                   (a2-23 (sv-928 a0-34 a1-17))
                                   (a3-2 40960.0)
                                   (t0-1 409600.0)
                                   (f30-1 (s0-1 sv-896 sv-912 a2-23 a3-2 t0-1))
                                   )
                              (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed))))
                                (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock))
                                (part-tracker-spawn :to this :group group-land-poof-stn :mat-joint (-> s1-0 position))
                                (when (or (zero? s4-0) (= s4-0 1))
                                  (let ((s0-3 sound-play-by-name))
                                    (set! sv-944 (make-u128 0 (the-as uint #x6b6c61772d6262)))
                                    (let ((a1-23 (new-sound-id))
                                          (a2-30 1024)
                                          (a3-6 0)
                                          (t0-4 0)
                                          (t1-3 1)
                                          (t2-2 (-> s1-0 position))
                                          )
                                      (s0-3 (the-as sound-name sv-944) a1-23 a2-30 a3-6 t0-4 (the-as sound-group t1-3) t2-2)
                                      )
                                    )
                                  (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.0012207031 f30-1))) (seconds 0.2))
                                  )
                                )
                              )
                            )
                          )
                        (set! (-> s1-0 delta-y) 0.0)
                        (set! (-> s3-0 quad) (-> s1-0 position quad))
                        )
                      )
                    )
                  (let ((a1-25 (-> s5-0 start-pos)))
                    (let ((v1-96 s3-0))
                      (let ((a0-45 s2-0))
                        (let ((a2-33 12288.0))
                          (.mov vf7 a2-33)
                          )
                        (.lvf vf5 (&-> a0-45 quad))
                        )
                      (.lvf vf4 (&-> v1-96 quad))
                      )
                    (.add.x.vf.w vf6 vf0 vf0)
                    (.mul.x.vf.xyz acc vf5 vf7)
                    (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                    (.svf (&-> a1-25 quad) vf6)
                    )
                  (vector-float*! (-> s5-0 move-dist) s2-0 -24576.0)
                  (let ((v1-99 s5-0))
                    (set! (-> v1-99 radius) 40.96)
                    (set! (-> v1-99 collide-with) (collide-spec backgnd))
                    (set! (-> v1-99 ignore-process0) #f)
                    (set! (-> v1-99 ignore-process1) #f)
                    (set! (-> v1-99 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
                    (set! (-> v1-99 action-mask) (collide-action solid))
                    )
                  (let ((f0-62 (probe-using-line-sphere *collide-cache* s5-0)))
                    (when (>= f0-62 0.0)
                      (let ((s0-4 (new 'stack-no-clear 'vector)))
                        (let ((v1-102 (-> s5-0 start-pos)))
                          (let ((a0-52 (-> s5-0 move-dist)))
                            (let ((a1-28 f0-62))
                              (.mov vf7 a1-28)
                              )
                            (.lvf vf5 (&-> a0-52 quad))
                            )
                          (.lvf vf4 (&-> v1-102 quad))
                          )
                        (.add.x.vf.w vf6 vf0 vf0)
                        (.mul.x.vf.xyz acc vf5 vf7)
                        (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                        (.svf (&-> s0-4 quad) vf6)
                        (let ((f0-64 (- (-> s3-0 y) (-> s0-4 y))))
                          (lerp-scale 1.0 0.0 f0-64 0.0 8192.0)
                          )
                        (- (-> s0-4 y) (-> this root trans y))
                        (vector-dot s2-0 (vector-! (new 'stack-no-clear 'vector) s0-4 (-> this root trans)))
                        )
                      )
                    )
                  (set! (-> s1-0 real-position quad) (-> s3-0 quad))
                  )
                )
              (handle-copy! (-> this joint-ik s4-0) s3-0)
              )
            )
          )
        )
      0
      (none)
      )
    )
  )

(defmethod common-post ((this bombbot))
  "Does a lot of various things relating to interacting with the target
   - tracks when the enemy was last drawn
   - looks at the target and handles attacking
   @TODO Not extremely well understood yet"
  (local-vars (sv-16 sparticle-launcher) (sv-20 sparticle-launcher))
  (let ((t9-0 (method-of-type nav-enemy common-post)))
    (t9-0 this)
    )
  (cond
    ((= (-> this nav state mesh) *default-nav-mesh*)
     (dotimes (s5-0 4)
       (enable-set! (-> this joint-ik s5-0) #f)
       )
     )
    (else
      (bombbot-method-179 this)
      (dotimes (s5-1 4)
        (enable-set! (-> this joint-ik s5-1) #t)
        )
      )
    )
  (vector-! (-> this linear-speed) (-> this root trans) (-> this last-trans))
  (set! (-> this last-trans quad) (-> this root trans quad))
  (set! (-> this y-angular-velocity)
        (deg- (quaternion-y-angle (-> this root quat)) (quaternion-y-angle (-> this last-quat)))
        )
  (quaternion-copy! (-> this last-quat) (-> this root quat))
  (set! (-> this rigidbody state force-callback)
        (the-as (function object float none) (method-of-object this bombbot-method-183))
        )
  (bombbot-method-184 this)
  (set! sv-16 (the-as sparticle-launcher #f))
  (set! sv-20 (the-as sparticle-launcher #f))
  (cond
    ((< (-> this hit-points) 30)
     (set! sv-16 (-> *part-id-table* 778))
     (set! sv-20 (-> *part-id-table* 774))
     )
    ((< (-> this hit-points) 60)
     (set! sv-16 (-> *part-id-table* 781))
     )
    (else
      (if (< (rand-vu) 0.05)
          (set! sv-16 (-> *part-id-table* 783))
          )
      )
    )
  (when sv-16
    (let ((gp-1 (-> this node-list data 4 bone transform))
          (s5-3 (new 'stack-no-clear 'vector))
          )
      (dotimes (s4-1 2)
        (vector-matrix*!
          s5-3
          (vector-rotate-around-y! (new 'stack-no-clear 'vector) (new 'static 'vector :z 6144.0 :w 1.0) (if (< s4-1 1)
                                                                                                            5461.3335
                                                                                                            38229.332
                                                                                                            )
                                   )
          gp-1
          )
        (vector-! *particle-vel* s5-3 (matrix->trans gp-1 (new 'stack-no-clear 'vector)))
        (+! (-> *particle-vel* y) 4096.0)
        (vector-float*! *particle-vel* *particle-vel* 0.0033333334)
        (when (and sv-20 (< (rand-vu) 0.005))
          (let ((t9-14 sp-launch-particles-var)
                (a0-22 *sp-particle-system-2d*)
                (a1-9 sv-16)
                (a2-2 *launch-matrix*)
                )
            (set! (-> a2-2 trans quad) (-> s5-3 quad))
            (t9-14 a0-22 a1-9 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
            )
          )
        (let ((t9-15 sp-launch-particles-var)
              (a0-23 *sp-particle-system-2d*)
              (a1-10 sv-16)
              (a2-3 *launch-matrix*)
              )
          (set! (-> a2-3 trans quad) (-> s5-3 quad))
          (t9-15 a0-23 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
          )
        )
      )
    )
  0
  (none)
  )

(defmethod run-logic? ((this bombbot))
  "Should this process be run? Checked by execute-process-tree."
  #t
  )

(defmethod enemy-method-58 ((this bombbot) (arg0 process) (arg1 event-message-block))
  ((method-of-type nav-enemy enemy-method-58) this arg0 arg1)
  'hit-flinch
  )

(defmethod damage-amount-from-attack ((this bombbot) (arg0 process) (arg1 event-message-block))
  "@returns the amount of damage taken from an attack.  This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]"
  (-> arg1 param 1)
  (let ((f0-1 (the float (penetrate-using->damage (-> this incoming penetrate-using)))))
    (cond
      ((logtest? (penetrate dark-bomb dark-giant) (-> this incoming penetrate-using))
       (if (and (logtest? (penetrate dark-bomb) (-> this incoming penetrate-using))
                (logtest? (penetrate dark-giant) (-> this incoming penetrate-using))
                )
           #x42c80000
           (the int (* 1.8 f0-1))
           )
       )
      ((logtest? (penetrate dark-punch) (-> this incoming penetrate-using))
       (the int (* 2.0 f0-1))
       )
      (else
        (the int f0-1)
        )
      )
    )
  )

(defmethod general-event-handler ((this bombbot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  "Handles various events for the enemy
   @TODO - unsure if there is a pattern for the events and this should have a more specific name"
  (case arg2
    (('nav-mesh-kill)
     (change-to *default-nav-mesh* this)
     #t
     )
    (('hit-flinch)
     (send-event *traffic-manager* 'set-alert-level 1)
     (cond
       ((zero? (-> this hit-points))
        (if (not (and (-> this next-state) (= (-> this next-state name) 'die)))
            (kill-prefer-falling this)
            )
        )
       (else
         (let ((a1-3 (-> arg3 param 1)))
           (when arg0
             (let ((v1-14 (find-offending-process-focusable arg0 (the-as attack-info a1-3))))
               (when v1-14
                 (let ((s5-1 (new 'stack-no-clear 'vector)))
                   (let ((s4-1 (new 'stack-no-clear 'vector)))
                     (set! (-> s4-1 quad) (-> v1-14 root trans quad))
                     (let ((s3-1 (matrix->trans (-> this node-list data 3 bone transform) (new 'stack-no-clear 'vector))))
                       (+! (-> s4-1 x) (* 4096.0 (rand-vu-float-range -20.0 20.0)))
                       (+! (-> s4-1 y) (* 4096.0 (rand-vu-float-range -20.0 20.0)))
                       (+! (-> s4-1 z) (* 4096.0 (rand-vu-float-range -20.0 20.0)))
                       (vector-! s5-1 s3-1 s4-1)
                       )
                     )
                   (vector-normalize! s5-1 4096000.0)
                   (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat))
                   (let* ((s4-2 (-> this rigidbody))
                          (v1-26 (-> this rigidbody))
                          (a1-10 (new 'stack-no-clear 'vector))
                          (a1-11 (rigid-body-method-23 (-> v1-26 state) a1-10))
                          )
                     (rigid-body-method-18 (-> s4-2 state) a1-11 s5-1)
                     )
                   )
                 )
               )
             )
           )
         'back
         )
       )
     )
    (('explode)
     (if (not (and (-> this next-state) (= (-> this next-state name) 'explode)))
         (go (method-of-object this explode))
         )
     )
    (('touched 'touch 'attack)
     (if (logtest? (process-mask vehicle) (-> arg0 mask))
         (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((id (new-attack-id)) (mode 'mine))))
         )
     ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
     )
    (else
      ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
      )
    )
  )

(defstate notice (bombbot)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy notice) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (react-to-focus self)
    )
  )

(defmethod bombbot-method-181 ((this bombbot) (arg0 vector))
  (rlet ((acc :class vf)
         (vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         (vf7 :class vf)
         )
    (init-vf0-vector)
    (let ((gp-0 (the-as process-drawable #f)))
      (let ((f30-0 (the-as float #x7f800000))
            (s3-0 (new 'stack-no-clear 'array 'collide-shape 64))
            )
        (countdown (s2-0 (fill-actor-list-for-sphere *actor-hash* (the-as sphere arg0) s3-0 64))
          (let ((a0-3 (as-type (-> s3-0 s2-0) collide-shape)))
            (when a0-3
              (let ((s1-1 (the-as process-drawable (as-type (-> a0-3 process) process-focusable))))
                (when (and s1-1
                           (!= this s1-1)
                           (not (focus-test? this inactive))
                           (not (focus-test? this disable))
                           (not (focus-test? this dead))
                           (not (logtest? (process-mask guard) (-> s1-1 mask)))
                           (not (logtest? (process-mask crate) (-> s1-1 mask)))
                           (logtest? (process-mask vehicle) (-> s1-1 mask))
                           s1-1
                           (not (logtest? (-> (the-as process-focusable s1-1) focus-status) (focus-status disable dead ignore grabbed)))
                           )
                  (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> s1-1 root trans))))
                    (when (or (not gp-0) (< f0-0 f30-0))
                      (set! gp-0 s1-1)
                      (set! f30-0 f0-0)
                      )
                    )
                  )
                )
              )
            )
          )
        )
      (if (and *target* (< (vector-vector-distance (target-pos 0) arg0) (-> arg0 w)))
          (set! gp-0 *target*)
          )
      (cond
        (gp-0
          (set! (-> this target-pos quad) (-> (get-trans (the-as process-focusable gp-0) 3) quad))
          (let ((v1-34 (-> this target-pos)))
            (let ((a0-16 (-> gp-0 root trans)))
              (let ((a1-8 (-> gp-0 root transv)))
                (let ((a2-1 0.0))
                  (.mov vf7 a2-1)
                  )
                (.lvf vf5 (&-> a1-8 quad))
                )
              (.lvf vf4 (&-> a0-16 quad))
              )
            (.add.x.vf.w vf6 vf0 vf0)
            (.mul.x.vf.xyz acc vf5 vf7)
            (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
            (.svf (&-> v1-34 quad) vf6)
            )
          (set! (-> this start-target-pos quad) (-> gp-0 root trans quad))
          (set! (-> this start-target-vel quad) (-> gp-0 root transv quad))
          (try-update-focus (-> this focus) (the-as process-focusable gp-0) this)
          )
        (else
          (clear-focused (-> this focus))
          )
        )
      )
    0
    (none)
    )
  )

;; WARN: Return type mismatch symbol vs none.
(defun bombbot-spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector))
  (local-vars (sv-656 vector) (sv-672 vector) (sv-688 int) (sv-704 vector))
  (rlet ((acc :class vf)
         (vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         (vf7 :class vf)
         )
    (init-vf0-vector)
    (set! sv-656 arg1)
    (let ((s5-0 (new 'stack-no-clear 'vector)))
      (set! (-> s5-0 quad) (-> sv-656 quad))
      (let ((s4-0 (new 'stack-no-clear 'vector)))
        (set! (-> s4-0 quad) (-> arg2 quad))
        (let ((s3-0 (new 'stack-no-clear 'vector)))
          (set! sv-672 (new 'stack-no-clear 'vector))
          (let ((s2-0 (new 'stack-no-clear 'quaternion)))
            (vector-length arg2)
            (let ((s1-0 (new 'stack-no-clear 'vector)))
              (set! (-> s1-0 quad) (-> arg3 quad))
              (let ((s0-0 (new 'stack-no-clear 'collide-query))
                    (f30-0 6144.0)
                    )
                (vector-normalize! s4-0 f30-0)
                (let ((v1-9 (-> sv-656 quad)))
                  (set! (-> sv-672 quad) v1-9)
                  )
                (set! sv-688 0)
                (while (< sv-688 15)
                  (let ((v1-11 s0-0))
                    (set! (-> v1-11 radius) 6144.0)
                    (set! (-> v1-11 collide-with) (collide-spec vehicle-sphere hit-by-others-list))
                    (set! (-> v1-11 ignore-process0) #f)
                    (set! (-> v1-11 ignore-process1) #f)
                    (set! (-> v1-11 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
                    (set! (-> v1-11 action-mask) (collide-action solid))
                    )
                  (set! (-> s0-0 start-pos quad) (-> s5-0 quad))
                  (set! (-> s0-0 move-dist quad) (-> s4-0 quad))
                  (set-from-point-offset-pad! (-> s0-0 bbox) (-> s0-0 start-pos) (-> s0-0 move-dist) (-> s0-0 radius))
                  (fill-using-bounding-box *collide-cache* s0-0)
                  (set! (-> s0-0 radius) 819.2)
                  (let ((f0-4 (probe-using-line-sphere *collide-cache* s0-0)))
                    (cond
                      ((>= f0-4 0.0)
                       (let ((a1-5 s3-0))
                         (let ((v1-18 (-> s0-0 start-pos)))
                           (let ((a0-14 (-> s0-0 move-dist)))
                             (let ((a2-2 f0-4))
                               (.mov vf7 a2-2)
                               )
                             (.lvf vf5 (&-> a0-14 quad))
                             )
                           (.lvf vf4 (&-> v1-18 quad))
                           )
                         (.add.x.vf.w vf6 vf0 vf0)
                         (.mul.x.vf.xyz acc vf5 vf7)
                         (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                         (.svf (&-> a1-5 quad) vf6)
                         )
                       (set! (-> s5-0 quad) (-> s3-0 quad))
                       )
                      (else
                        (vector+! (-> s0-0 start-pos) s5-0 s4-0)
                        (let ((a1-8 (-> s0-0 start-pos)))
                          (let ((v1-21 (-> s0-0 start-pos)))
                            (let ((a0-18 s1-0))
                              (let ((a2-4 -4096.0))
                                (.mov vf7 a2-4)
                                )
                              (.lvf vf5 (&-> a0-18 quad))
                              )
                            (.lvf vf4 (&-> v1-21 quad))
                            )
                          (.add.x.vf.w vf6 vf0 vf0)
                          (.mul.x.vf.xyz acc vf5 vf7)
                          (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                          (.svf (&-> a1-8 quad) vf6)
                          )
                        (vector-negate! (-> s0-0 move-dist) s4-0)
                        (set! f0-4 (probe-using-line-sphere *collide-cache* s0-0))
                        (when (>= f0-4 0.0)
                          (let ((a1-11 s3-0))
                            (let ((v1-24 (-> s0-0 start-pos)))
                              (let ((a0-21 (-> s0-0 move-dist)))
                                (let ((a2-5 f0-4))
                                  (.mov vf7 a2-5)
                                  )
                                (.lvf vf5 (&-> a0-21 quad))
                                )
                              (.lvf vf4 (&-> v1-24 quad))
                              )
                            (.add.x.vf.w vf6 vf0 vf0)
                            (.mul.x.vf.xyz acc vf5 vf7)
                            (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                            (.svf (&-> a1-11 quad) vf6)
                            )
                          (let ((a1-12 s3-0))
                            (let ((v1-25 s3-0))
                              (let ((a0-22 s1-0))
                                (let ((a2-7 4096.0))
                                  (.mov vf7 a2-7)
                                  )
                                (.lvf vf5 (&-> a0-22 quad))
                                )
                              (.lvf vf4 (&-> v1-25 quad))
                              )
                            (.add.x.vf.w vf6 vf0 vf0)
                            (.mul.x.vf.xyz acc vf5 vf7)
                            (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                            (.svf (&-> a1-12 quad) vf6)
                            )
                          (set! (-> s5-0 quad) (-> s3-0 quad))
                          )
                        )
                      )
                    (cond
                      ((>= f0-4 0.0)
                       (+! (-> s3-0 x) (rand-vu-float-range -409.6 409.6))
                       (+! (-> s3-0 y) (rand-vu-float-range -409.6 409.6))
                       (+! (-> s3-0 z) (rand-vu-float-range -409.6 409.6))
                       (set-point! arg0 (-> arg0 state points-to-draw) s3-0)
                       (+! (-> arg0 state points-to-draw) 1)
                       (set! sv-704 (-> s0-0 best-other-tri normal))
                       (quaternion-from-two-vectors! s2-0 s1-0 sv-704)
                       (vector-orient-by-quat! s4-0 s4-0 s2-0)
                       (set! (-> s1-0 quad) (-> sv-704 quad))
                       (vector-flatten! s4-0 s4-0 sv-704)
                       (vector-normalize! s4-0 f30-0)
                       )
                      (else
                        (vector+! s5-0 s5-0 s4-0)
                        (when (< sv-688 14)
                          (set-point! arg0 (-> arg0 state points-to-draw) s5-0)
                          (+! (-> arg0 state points-to-draw) 1)
                          )
                        )
                      )
                    )
                  (set! sv-688 (+ sv-688 1))
                  )
                )
              )
            )
          )
        )
      )
    (none)
    )
  )

(defmethod bombbot-method-182 ((this bombbot))
  (local-vars
    (v1-28 symbol)
    (sv-880 matrix)
    (sv-896 (function vector vector quaternion vector))
    (sv-912 vector)
    (sv-928 vector)
    (sv-944 (function quaternion vector float quaternion))
    (sv-960 quaternion)
    (sv-976 vector)
    (sv-992 basic)
    (sv-1008 process)
    (sv-1024 (pointer process))
    )
  (rlet ((acc :class vf)
         (vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         (vf7 :class vf)
         )
    (init-vf0-vector)
    (let ((s2-0 (handle->process (-> this focus handle))))
      (set! sv-880 (new 'stack-no-clear 'matrix))
      (let* ((a0-4 (-> this node-list data 6 bone transform))
             (a2-0 (-> a0-4 quad 0))
             (a1-1 (-> a0-4 quad 1))
             (v1-7 (-> a0-4 quad 2))
             (a0-5 (-> a0-4 trans quad))
             )
        (set! (-> sv-880 quad 0) a2-0)
        (set! (-> sv-880 quad 1) a1-1)
        (set! (-> sv-880 quad 2) v1-7)
        (set! (-> sv-880 trans quad) a0-5)
        )
      (new 'stack-no-clear 'matrix)
      (let ((s3-0 (new 'stack-no-clear 'collide-query))
            (s5-0 (new 'stack-no-clear 'vector))
            (s4-0 (new 'stack-no-clear 'vector))
            (s0-0 (new 'stack-no-clear 'vector))
            (s1-0 (new 'stack-no-clear 'vector))
            )
        (matrix->trans sv-880 s4-0)
        (let ((a0-7 s4-0))
          (let ((v1-10 s4-0))
            (let ((a1-5 (-> sv-880 vector 2)))
              (let ((a2-3 8192.0))
                (.mov vf7 a2-3)
                )
              (.lvf vf5 (&-> a1-5 quad))
              )
            (.lvf vf4 (&-> v1-10 quad))
            )
          (.add.x.vf.w vf6 vf0 vf0)
          (.mul.x.vf.xyz acc vf5 vf7)
          (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
          (.svf (&-> a0-7 quad) vf6)
          )
        (vector-normalize-copy! s5-0 (-> sv-880 vector 2) 327680.0)
        (set! (-> s3-0 start-pos quad) (-> s4-0 quad))
        (set! (-> s3-0 move-dist quad) (-> s5-0 quad))
        (let ((v1-14 s3-0))
          (set! (-> v1-14 radius) 40.96)
          (set! (-> v1-14 collide-with) (collide-spec
                                          backgnd
                                          jak
                                          civilian
                                          enemy
                                          obstacle
                                          vehicle-sphere
                                          hit-by-player-list
                                          hit-by-others-list
                                          player-list
                                          )
                )
          (set! (-> v1-14 ignore-process0) this)
          (set! (-> v1-14 ignore-process1) #f)
          (set! (-> v1-14 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
          (set! (-> v1-14 action-mask) (collide-action solid))
          )
        (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s3-0)))
          (when (>= f0-2 0.0)
            (vector-float*! s5-0 s5-0 f0-2)
            (vector+! s1-0 (-> s3-0 start-pos) s5-0)
            (point-in-plane-<-point+normal! s0-0 s1-0 (-> s3-0 best-other-tri normal))
            (vector-! s0-0 s0-0 s1-0)
            (set! sv-896 vector-orient-by-quat!)
            (set! sv-912 s0-0)
            (set! sv-928 s0-0)
            (set! sv-944 quaternion-vector-angle!)
            (set! sv-960 (new 'stack-no-clear 'quaternion))
            (set! sv-976 (-> s3-0 best-other-tri normal))
            (let* ((a2-6 (rand-vu-float-range 0.0 65536.0))
                   (a2-7 (sv-944 sv-960 sv-976 a2-6))
                   )
              (sv-896 sv-912 sv-928 a2-7)
              )
            (set! sv-992 (-> s3-0 best-other-tri collide-ptr))
            (let ((v1-25 (if (type? sv-992 collide-shape-prim)
                             sv-992
                             )
                         )
                  )
              (when v1-25
                (cond
                  ((logtest? (-> (the-as collide-shape-prim v1-25) prim-core collide-as) (collide-spec vehicle-sphere))
                   (set! sv-1008 (get-process *default-dead-pool* lightning-tracker #x4000))
                   (set! v1-28
                         (when sv-1008
                           (set! sv-1024 (the-as (pointer process) v1-28))
                           (let ((t9-9 (method-of-type lightning-tracker activate)))
                             (t9-9
                               (the-as lightning-tracker sv-1008)
                               *entity-pool*
                               (symbol->string (-> lightning-tracker symbol))
                               (the-as pointer #x70004000)
                               )
                             )
                           (run-now-in-process sv-1008 lightning-tracker-init (-> *lightning-spec-id-table* 13) 30 #f #f #f #f)
                           (set! sv-1024 (-> sv-1008 ppointer))
                           v1-28
                           )
                         )
                   (set-point! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning) 0 s1-0)
                   (set! (-> (the-as lightning-tracker (-> sv-1024 0)) offset0 quad) (-> s1-0 quad))
                   (set! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning state points-to-draw) 1)
                   (bombbot-spread-lightning-lazer
                     (-> (the-as lightning-tracker (-> sv-1024 0)) lightning)
                     s1-0
                     s0-0
                     (-> s3-0 best-other-tri normal)
                     )
                   (+! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning state points-to-draw) -1)
                   (set! (-> (the-as lightning-tracker (-> sv-1024 0)) offset1 quad)
                         (-> (the-as lightning-tracker (-> sv-1024 0))
                             lightning
                             state
                             path
                             data
                             (+ (-> (the-as lightning-tracker (-> sv-1024 0)) lightning state points-to-draw) -1)
                             quad
                             )
                         )
                   )
                  ((logtest? (-> (the-as collide-shape-prim v1-25) prim-core collide-as) (collide-spec civilian))
                   (process-drawable-shock-skel-effect
                     (the-as process-drawable (as-type (-> (the-as collide-shape-prim v1-25) cshape process) process-focusable))
                     (-> *lightning-spec-id-table* 5)
                     lightning-probe-callback
                     (-> *part-id-table* 166)
                     2048.0
                     -1
                     -1
                     )
                   )
                  ((logtest? (-> (the-as collide-shape-prim v1-25) prim-core collide-as) (collide-spec jak))
                   )
                  (else
                    )
                  )
                (when (and s2-0
                           s2-0
                           (not (logtest? (-> (the-as process-focusable s2-0) focus-status) (focus-status disable dead ignore grabbed)))
                           )
                  (let ((s2-1 (new 'stack-no-clear 'projectile-init-by-other-params)))
                    (set! (-> s2-1 ent) (-> this entity))
                    (set! (-> s2-1 charge) 1.0)
                    (set! (-> s2-1 options) (projectile-options))
                    (set! (-> s2-1 notify-handle) (process->handle this))
                    (set! (-> s2-1 owner-handle) (the-as handle #f))
                    (set! (-> s2-1 ignore-handle) (process->handle this))
                    (let* ((v1-69 *game-info*)
                           (a0-67 (+ (-> v1-69 attack-id) 1))
                           )
                      (set! (-> v1-69 attack-id) a0-67)
                      (set! (-> s2-1 attack-id) a0-67)
                      )
                    (set! (-> s2-1 timeout) (seconds 4))
                    (set! (-> s2-1 pos quad) (-> s3-0 start-pos quad))
                    (vector+! (-> s2-1 vel) (-> s3-0 start-pos) s5-0)
                    (vector-normalize-copy! (-> s2-1 vel) (-> s3-0 move-dist) 40960000.0)
                    (spawn-projectile guard-lazer-shot s2-1 this *default-dead-pool*)
                    )
                  )
                )
              )
            (when (zero? (-> this lazer-sound))
              (let ((s3-1 sound-play-by-spec)
                    (s2-2 (static-sound-spec "bb-laser-fire" :volume 0.0 :mask (pitch)))
                    )
                (set! (-> s2-2 volume) 1024)
                (set! (-> s2-2 pitch-mod) 0)
                (set! (-> this lazer-sound) (s3-1 s2-2 (new-sound-id) s4-0))
                )
              )
            (set! (-> *part-id-table* 4630 init-specs 4 initial-valuef) (vector-length s5-0))
            (draw-beam (-> *part-id-table* 4630) s4-0 s5-0 #f #t)
            (launch-particles (-> *part-id-table* 4631) s4-0)
            (launch-particles (-> *part-id-table* 4632) (vector+! (new 'stack-no-clear 'vector) s5-0 s4-0))
            )
          )
        )
      )
    0
    (none)
    )
  )

(defstate hostile (bombbot)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (logior! (-> self enemy-flags) (enemy-flag lock-focus))
    (+! (-> self shield-hit-points) -1.0)
    )
  :exit (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy hostile) exit)))
      (if t9-0
          (t9-0)
          )
      )
    (sound-stop (-> self lazer-sound))
    (sound-stop (-> self head-sound))
    (sound-stop (-> self cannon-sound))
    )
  :trans (behavior ()
    (rlet ((acc :class vf)
           (vf0 :class vf)
           (vf4 :class vf)
           (vf5 :class vf)
           (vf6 :class vf)
           (vf7 :class vf)
           )
      (init-vf0-vector)
      (when (>= (the int (* 30.0 (-> self shield-hit-points))) (-> self hit-points))
        )
      (when (< (the-as time-frame (-> self next-target)) (current-time))
        (let ((a1-0 (new 'stack-no-clear 'vector)))
          (set! (-> a1-0 quad) (-> self root trans quad))
          (set! (-> a1-0 w) 122880.0)
          (bombbot-method-181 self a1-0)
          )
        (set! (-> self next-target) (the-as uint (+ (current-time) (seconds 2))))
        (set! (-> self start-target) (the-as uint (current-time)))
        )
      (let ((gp-0 (handle->process (-> self focus handle))))
        (let ((f30-0 1.0))
          (when (and gp-0 (< (fabs (- (-> self target-pos y) (-> self root trans y))) 20480.0))
            )
          (seek! (-> self legs-strength 0) f30-0 (* 0.5 (seconds-per-frame)))
          (seek! (-> self legs-strength 1) f30-0 (* 0.5 (seconds-per-frame)))
          (seek! (-> self legs-strength 2) f30-0 (* 0.5 (seconds-per-frame)))
          (seek! (-> self legs-strength 3) f30-0 (* 0.5 (seconds-per-frame)))
          )
        (cond
          (gp-0
            (let ((a1-6 (-> self target-pos)))
              (let ((v1-34 (-> self start-target-pos)))
                (let ((a0-14 (-> self start-target-vel)))
                  (let ((a2-8 (* 0.0033333334 (the float (- (current-time) (the-as int (-> self start-target)))))))
                    (.mov vf7 a2-8)
                    )
                  (.lvf vf5 (&-> a0-14 quad))
                  )
                (.lvf vf4 (&-> v1-34 quad))
                )
              (.add.x.vf.w vf6 vf0 vf0)
              (.mul.x.vf.xyz acc vf5 vf7)
              (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
              (.svf (&-> a1-6 quad) vf6)
              )
            (cond
              ((< (the-as time-frame (+ (-> self next-target) -300)) (current-time))
               (bombbot-method-182 self)
               )
              (else
                (sound-stop (-> self lazer-sound))
                (set! (-> self lazer-sound) (new 'static 'sound-id))
                0
                )
              )
            )
          (else
            (sound-stop (-> self lazer-sound))
            (set! (-> self lazer-sound) (new 'static 'sound-id))
            0
            )
          )
        )
      (when (= (-> self nav state mesh) *default-nav-mesh*)
        (let ((a0-23 (find-nearest-nav-mesh (-> self root trans) 0.0)))
          (when a0-23
            (change-to a0-23 self)
            (dotimes (gp-1 4)
              (let ((s5-0 (-> self feet gp-1)))
                (let ((s4-0 (new 'stack-no-clear 'vector)))
                  (vector-orient-by-quat! s4-0 (-> s5-0 pos-offset) (-> self root quat))
                  (vector+! s4-0 s4-0 (-> self root trans))
                  (set! (-> s5-0 next-position quad) (-> s4-0 quad))
                  (set! (-> s5-0 position quad) (-> s4-0 quad))
                  )
                (set! (-> s5-0 delta-y) 0.0)
                )
              (set! (-> self legs-strength gp-1) 1.0)
              )
            )
          )
        )
      (new 'stack-no-clear 'vector)
      (let ((f0-28 (* 0.25 (+ (-> self feet 0 next-position y)
                              (-> self feet 1 next-position y)
                              (-> self feet 2 next-position y)
                              (-> self feet 3 next-position y)
                              )
                      )
                   )
            )
        (if (!= (-> self nav state mesh) *default-nav-mesh*)
            (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-28 (-> self root trans y))))
            )
        )
      (if (= (vector-length (-> self root transv)) 0.0)
          (set-time! (-> self state-time))
          )
      (set! (-> self last-head-roty-speed) (-> self head-roty-speed))
      (set! (-> self head-roty-speed) (vector-y-angle (-> self node-list data 4 bone transform vector 2)))
      (set! (-> self last-cannon-roty-speed) (-> self cannon-roty-speed))
      (set! (-> self cannon-roty-speed) (vector-y-angle (-> self node-list data 6 bone transform vector 2)))
      (let ((f0-39 (deg- (-> self last-head-roty-speed) (-> self head-roty-speed))))
        (cond
          ((< 364.0889 (fabs f0-39))
           (when (zero? (-> self head-sound))
             (let ((gp-2 sound-play-by-spec)
                   (s5-1 (static-sound-spec "bb-turret-loop" :volume 0.0 :mask (pitch)))
                   )
               (set! (-> s5-1 volume) 1024)
               (set! (-> s5-1 pitch-mod) 0)
               (set! (-> self head-sound) (gp-2 s5-1 (new-sound-id) (-> self root trans)))
               )
             )
           )
          (else
            (when (nonzero? (-> self head-sound))
              (sound-play "bb-turret-end")
              (sound-stop (-> self head-sound))
              (set! (-> self head-sound) (new 'static 'sound-id))
              0
              )
            )
          )
        )
      (let ((f0-43 (deg- (-> self last-cannon-roty-speed) (-> self cannon-roty-speed))))
        (cond
          ((< 364.0889 (fabs f0-43))
           (when (zero? (-> self cannon-sound))
             (let ((gp-4 sound-play-by-spec)
                   (s5-3 (static-sound-spec "bb-laser-loop" :volume 0.0 :mask (pitch)))
                   )
               (set! (-> s5-3 volume) 1024)
               (set! (-> s5-3 pitch-mod) 0)
               (set! (-> self cannon-sound) (gp-4 s5-3 (new-sound-id) (-> self root trans)))
               )
             )
           )
          (else
            (when (nonzero? (-> self cannon-sound))
              (sound-stop (-> self cannon-sound))
              (sound-play "bb-laser-end")
              (set! (-> self cannon-sound) (new 'static 'sound-id))
              0
              )
            )
          )
        )
      (bombbot-method-180 self)
      )
    )
  :code (behavior ()
    (until #f
      (suspend)
      (ja-no-eval :group! bombbot-idle-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post (behavior ()
    (-> self current-node)
    (let ((gp-1 (min (the-as int (+ (-> self current-node) 1)) (the-as int (+ (-> self city-path node-count) -1)))))
      (cond
        ((= (-> self nav state mesh) *default-nav-mesh*)
         (vector-v+!
           (-> self root trans)
           (-> self root trans)
           (vector-normalize!
             (vector-! (new 'stack-no-clear 'vector) (-> self city-path node gp-1 position) (-> self root trans))
             (-> *bombbot-nav-enemy-info* run-travel-speed)
             )
           )
         (seek! (-> self root trans y) (-> self city-path node gp-1 position y) (* 16384.0 (seconds-per-frame)))
         (common-post self)
         (update-transforms (-> self root))
         )
        (else
          (let ((v1-25 (-> self nav state))
                (a0-10 (-> self city-path node gp-1))
                )
            (logclear! (-> v1-25 flags) (nav-state-flag directional-mode))
            (logior! (-> v1-25 flags) (nav-state-flag target-poly-dirty))
            (set! (-> v1-25 target-post quad) (-> a0-10 position quad))
            )
          0
          (nav-enemy-method-176 self)
          )
        )
      (if (< (vector-vector-xz-distance (-> self root trans) (-> self city-path node gp-1 position)) 32768.0)
          (set! (-> self current-node)
                (the-as
                  uint
                  (min (the-as int (+ (-> self current-node) 1)) (the-as int (+ (-> self city-path node-count) -1)))
                  )
                )
          )
      )
    )
  )

(defstate die (bombbot)
  :virtual #t
  :enter (behavior ()
    (when (-> self minimap)
      (logior! (-> self minimap flags) (minimap-flag fade-out))
      (set! (-> self minimap) #f)
      )
    (set! (-> self explosing) #f)
    (set! (-> self beep-time) 0)
    (set-time! (-> self state-time))
    )
  :trans (behavior ()
    (let ((v1-0 (-> self nav)))
      (set! (-> v1-0 target-speed)
            (- (-> self nav target-speed) (* 0.4 (seconds-per-frame) (-> self nav target-speed)))
            )
      )
    0
    (if (>= (- (current-time) (-> self state-time)) 0)
        (seek! (-> self legs-strength 0) 0.8 (* 10.0 (seconds-per-frame)))
        )
    (if (time-elapsed? (-> self state-time) (seconds 0.8))
        (seek! (-> self legs-strength 3) 0.4 (* 10.0 (seconds-per-frame)))
        )
    (if (time-elapsed? (-> self state-time) (seconds 1.6))
        (seek! (-> self legs-strength 1) 0.0 (* 10.0 (seconds-per-frame)))
        )
    (if (time-elapsed? (-> self state-time) (seconds 2.4))
        (seek! (-> self legs-strength 2) 0.5 (* 10.0 (seconds-per-frame)))
        )
    (when (time-elapsed? (-> self state-time) (seconds 2.8))
      (sound-play "bb-explode")
      (go-virtual explode)
      )
    (when (< (-> self beep-time) (current-time))
      (sound-play "bb-beep")
      (set! (-> self beep-time)
            (+ (current-time) (the int (* 0.2 (the float (- (seconds 2.8) (- (current-time) (-> self state-time)))))))
            )
      )
    )
  :code (behavior ()
    (until #f
      (suspend)
      (ja-no-eval :group! bombbot-idle-ja :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post (behavior ()
    (nav-enemy-method-176 self)
    )
  )

(defstate explode (bombbot)
  :virtual #t
  :enter (behavior ()
    (when (-> self minimap)
      (logior! (-> self minimap flags) (minimap-flag fade-out))
      (set! (-> self minimap) #f)
      )
    (set! (-> self explosing) #f)
    (set-time! (-> self state-time))
    (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 1))))
      (set! (-> gp-0 fountain-rand-transv-lo quad) (-> self root trans quad))
      (set! (-> gp-0 duration) (seconds 3))
      (set! (-> gp-0 gravity) -163840.0)
      (set! (-> gp-0 fountain-rand-transv-hi x) 8192.0)
      (set! (-> gp-0 fountain-rand-transv-hi y) 32768.0)
      (set! (-> gp-0 fountain-rand-transv-hi z) 8192.0)
      (set! (-> gp-0 fountain-rand-transv-hi w) 24576.0)
      (process-spawn
        joint-exploder
        (art-group-get-by-name *level* "skel-bombbot-exploding" (the-as (pointer uint32) #f))
        6
        gp-0
        *bombbot-exploder-params*
        :to self
        )
      )
    (let ((v1-23 (new 'stack-no-clear 'vector)))
      (set! (-> v1-23 quad) (-> self root trans quad))
      (+! (-> v1-23 y) 2048.0)
      )
    (let ((gp-1 (new 'stack-no-clear 'vector)))
      (set! (-> gp-1 quad) (-> self node-list data 3 bone transform trans quad))
      (new 'stack-no-clear 'vector)
      4.0
      (activate! *camera-smush-control* 1024.0 37 210 1.0 0.995 (-> self clock))
      (let ((s5-1 (new 'stack-no-clear 'explosion-init-params)))
        (set! (-> s5-1 spawn-point quad) (-> gp-1 quad))
        (quaternion-copy! (-> s5-1 spawn-quat) (-> self root quat))
        (set! (-> s5-1 radius) 61440.0)
        (set! (-> s5-1 group) group-bombbot-explode0)
        (set! (-> s5-1 collide-with)
              (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
              )
        (set! (-> s5-1 penetrate-using) (penetrate explode))
        (explosion-spawn self explosion s5-1)
        )
      )
    (dotimes (gp-2 4)
      (let ((s4-1 (new 'stack-no-clear 'vector))
            (s5-2 (new 'stack-no-clear 'vector))
            )
        (let ((f30-0 (* 16384.0 (the float gp-2))))
          (set-vector! s4-1 (cos f30-0) 0.0 (sin f30-0) 1.0)
          )
        (vector-float*! s4-1 s4-1 (* 4096.0 (+ 2.0 (* 2.0 (rand-vu)))))
        (set! (-> s5-2 quad) (-> self root trans quad))
        (vector+! (-> self root trans) (-> self root trans) s4-1)
        (set! (-> self fact pickup-type) (pickup-type ammo-random))
        (set! (-> self fact pickup-amount) 10.0)
        (set! (-> self fact pickup-spawn-amount) 1.0)
        (drop-pickup (-> self fact) #t *entity-pool* (-> self fact) 0)
        (set! (-> self root trans quad) (-> s5-2 quad))
        )
      )
    (set! (-> self explosing) #t)
    (let ((v1-62 (-> self root root-prim)))
      (set! (-> v1-62 prim-core collide-as) (collide-spec))
      (set! (-> v1-62 prim-core collide-with) (collide-spec))
      )
    0
    (ja-channel-set! 0)
    (ja-post)
    )
  :code (behavior ()
    (while (-> self child)
      (suspend)
      )
    )
  )

(defmethod relocate ((this bombbot) (offset int))
  (dotimes (v1-0 4)
    (if (nonzero? (-> this joint-ik v1-0))
        (&+! (-> this joint-ik v1-0) offset)
        )
    )
  (if (nonzero? (-> this rigidbody))
      (&+! (-> this rigidbody) offset)
      )
  (call-parent-method this offset)
  )

(defmethod init-enemy-collision! ((this bombbot))
  "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly"
  (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) cshape-reaction-default)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-query vector vector object) nothing)
          )
    (set! (-> s5-0 penetrated-by) (penetrate))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 33) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 34))
      (set! (-> s4-0 prim-core collide-as) (collide-spec enemy))
      (set! (-> s4-0 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> s4-0 prim-core action) (collide-action solid no-standon))
      (set-vector! (-> s4-0 local-sphere) 0.0 12288.0 0.0 24576.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-12 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-12 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-12 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-12 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-12 transform-index) 3)
      (set-vector! (-> v1-12 local-sphere) 0.0 1638.4 0.0 8192.0)
      )
    (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-14 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-14 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-14 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-14 transform-index) 19)
      (set-vector! (-> v1-14 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-16 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-16 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-16 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-16 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-16 transform-index) 19)
      (set-vector! (-> v1-16 local-sphere) 0.0 4096.0 0.0 2867.2)
      )
    (let ((v1-18 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-18 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-18 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-18 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-18 transform-index) 19)
      (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 2867.2)
      )
    (let ((v1-20 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-20 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-20 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-20 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-20 transform-index) 19)
      (set-vector! (-> v1-20 local-sphere) 0.0 12288.0 0.0 2867.2)
      )
    (let ((v1-22 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-22 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-22 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-22 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-22 transform-index) 18)
      (set-vector! (-> v1-22 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-24 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-24 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-24 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-24 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-24 transform-index) 18)
      (set-vector! (-> v1-24 local-sphere) 0.0 4096.0 0.0 2867.2)
      )
    (let ((v1-26 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-26 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-26 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-26 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-26 transform-index) 18)
      (set-vector! (-> v1-26 local-sphere) 0.0 8192.0 0.0 2867.2)
      )
    (let ((v1-28 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-28 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-28 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-28 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-28 transform-index) 18)
      (set-vector! (-> v1-28 local-sphere) 0.0 12288.0 0.0 2867.2)
      )
    (let ((v1-30 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-30 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-30 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-30 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-30 transform-index) 13)
      (set-vector! (-> v1-30 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-32 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-32 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-32 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-32 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-32 transform-index) 13)
      (set-vector! (-> v1-32 local-sphere) 0.0 -4096.0 0.0 2867.2)
      )
    (let ((v1-34 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-34 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-34 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-34 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-34 transform-index) 13)
      (set-vector! (-> v1-34 local-sphere) 0.0 -8192.0 0.0 2867.2)
      )
    (let ((v1-36 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-36 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-36 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-36 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-36 transform-index) 13)
      (set-vector! (-> v1-36 local-sphere) 0.0 -12288.0 0.0 2867.2)
      )
    (let ((v1-38 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-38 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-38 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-38 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-38 transform-index) 12)
      (set-vector! (-> v1-38 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-40 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-40 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-40 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-40 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-40 transform-index) 12)
      (set-vector! (-> v1-40 local-sphere) 0.0 -4096.0 0.0 2867.2)
      )
    (let ((v1-42 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-42 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-42 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-42 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-42 transform-index) 12)
      (set-vector! (-> v1-42 local-sphere) 0.0 -8192.0 0.0 2867.2)
      )
    (let ((v1-44 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-44 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-44 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-44 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-44 transform-index) 12)
      (set-vector! (-> v1-44 local-sphere) 0.0 -12288.0 0.0 2867.2)
      )
    (let ((v1-46 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-46 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-46 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-46 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-46 transform-index) 17)
      (set-vector! (-> v1-46 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-48 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-48 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-48 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-48 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-48 transform-index) 17)
      (set-vector! (-> v1-48 local-sphere) 0.0 -4096.0 0.0 2867.2)
      )
    (let ((v1-50 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-50 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-50 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-50 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-50 transform-index) 17)
      (set-vector! (-> v1-50 local-sphere) 0.0 -8192.0 0.0 2867.2)
      )
    (let ((v1-52 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-52 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-52 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-52 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-52 transform-index) 17)
      (set-vector! (-> v1-52 local-sphere) 0.0 -12288.0 0.0 2867.2)
      )
    (let ((v1-54 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-54 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-54 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-54 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-54 transform-index) 16)
      (set-vector! (-> v1-54 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-56 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-56 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-56 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-56 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-56 transform-index) 16)
      (set-vector! (-> v1-56 local-sphere) 0.0 -4096.0 0.0 2867.2)
      )
    (let ((v1-58 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-58 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-58 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-58 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-58 transform-index) 16)
      (set-vector! (-> v1-58 local-sphere) 0.0 -8192.0 0.0 2867.2)
      )
    (let ((v1-60 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-60 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-60 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-60 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-60 transform-index) 16)
      (set-vector! (-> v1-60 local-sphere) 0.0 -12288.0 0.0 2867.2)
      )
    (let ((v1-62 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-62 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-62 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-62 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-62 transform-index) 15)
      (set-vector! (-> v1-62 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-64 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-64 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-64 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-64 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-64 transform-index) 15)
      (set-vector! (-> v1-64 local-sphere) 0.0 4096.0 0.0 2867.2)
      )
    (let ((v1-66 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-66 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-66 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-66 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-66 transform-index) 15)
      (set-vector! (-> v1-66 local-sphere) 0.0 8192.0 0.0 2867.2)
      )
    (let ((v1-68 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-68 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-68 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-68 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-68 transform-index) 15)
      (set-vector! (-> v1-68 local-sphere) 0.0 12288.0 0.0 2867.2)
      )
    (let ((v1-70 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-70 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-70 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-70 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-70 transform-index) 14)
      (set-vector! (-> v1-70 local-sphere) 0.0 0.0 0.0 2867.2)
      )
    (let ((v1-72 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-72 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-72 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-72 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-72 transform-index) 14)
      (set-vector! (-> v1-72 local-sphere) 0.0 4096.0 0.0 2867.2)
      )
    (let ((v1-74 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-74 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-74 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-74 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-74 transform-index) 14)
      (set-vector! (-> v1-74 local-sphere) 0.0 8192.0 0.0 2867.2)
      )
    (let ((v1-76 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-76 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-76 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list))
      (set! (-> v1-76 prim-core action) (collide-action solid no-standon))
      (set! (-> v1-76 transform-index) 14)
      (set-vector! (-> v1-76 local-sphere) 0.0 12288.0 0.0 2867.2)
      )
    (set! (-> s5-0 nav-radius) 16384.0)
    (let ((v1-78 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-78 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-78 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

(defmethod coin-flip? ((this bombbot))
  "@returns The result of a 50/50 RNG roll"
  #f
  )

(defun bombbot-callback ((arg0 cspace) (arg1 transformq))
  (local-vars
    (sv-176 (function quaternion quaternion quaternion quaternion))
    (sv-192 quaternion)
    (sv-208 quaternion)
    (sv-224 vector)
    (sv-240 vector)
    )
  (rlet ((acc :class vf)
         (vf0 :class vf)
         (vf1 :class vf)
         (vf2 :class vf)
         (vf3 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         (vf7 :class vf)
         )
    (init-vf0-vector)
    (let ((s4-0 (the-as bombbot (-> arg0 param1))))
      (let ((s1-0 (new 'stack-no-clear 'vector))
            (s3-0 (quaternion-copy! (new 'stack-no-clear 'quaternion) *unity-quaternion*))
            )
        (let ((f30-0 0.0)
              (s2-0 (vector-reset! (new 'stack-no-clear 'vector)))
              )
          (dotimes (s0-0 4)
            (let ((v1-3 (-> s4-0 feet s0-0)))
              (let ((a1-2 s2-0))
                (let ((a0-2 s2-0))
                  (let ((a2-1 (+ (the-as uint (-> s4-0 feet 0 real-position)) (* 112 s0-0))))
                    (let ((a3-3 0.25))
                      (.mov vf7 a3-3)
                      )
                    (.lvf vf5 (&-> (the-as (pointer int128) a2-1)))
                    )
                  (.lvf vf4 (&-> a0-2 quad))
                  )
                (.add.x.vf.w vf6 vf0 vf0)
                (.mul.x.vf.xyz acc vf5 vf7)
                (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
                (.svf (&-> a1-2 quad) vf6)
                )
              (set! (-> v1-3 main-y) (- (-> s4-0 feet s0-0 real-position y) (-> s4-0 root trans y)))
              (set! (-> v1-3 main-y) (-> v1-3 delta-y))
              (+! f30-0 (/ (-> v1-3 main-y) 4))
              (set! (-> s1-0 quad) (-> v1-3 pos-offset quad))
              (set! (-> s1-0 y) (* -2.0 (-> v1-3 main-y)))
              (new 'stack-no-clear 'vector)
              (set! sv-224 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> v1-3 pos-offset) 1.0))
              )
            (set! sv-240 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-0 1.0))
            (let ((f0-8 (vector-vector-angle-safe sv-224 sv-240)))
              (when (!= f0-8 0.0)
                (set! sv-176 quaternion*!)
                (set! sv-192 s3-0)
                (set! sv-208 s3-0)
                (let ((t9-4 quaternion-vector-angle!)
                      (a0-14 (new 'stack-no-clear 'quaternion))
                      (a1-8 (new 'stack-no-clear 'vector))
                      )
                  (.lvf vf1 (&-> sv-224 quad))
                  (.lvf vf2 (&-> sv-240 quad))
                  (.outer.product.a.vf acc vf1 vf2)
                  (.outer.product.b.vf vf3 vf2 vf1 acc)
                  (.svf (&-> a1-8 quad) vf3)
                  (let ((a2-5 (t9-4 a0-14 a1-8 f0-8)))
                    (sv-176 sv-192 sv-208 a2-5)
                    )
                  )
                )
              )
            )
          (let* ((f0-9 0.0)
                 (f0-10 (+ -16384.0 f0-9))
                 (f2-0 (- f30-0 (-> s4-0 main-pos-y)))
                 (f1-7 (- (-> s4-0 main-spd-y)))
                 (f0-12 (+ f0-10 (* 60.0 f2-0) (* 10.0 f1-7)))
                 )
            (+! (-> s4-0 main-spd-y) (* f0-12 (seconds-per-frame)))
            )
          (+! (-> s4-0 main-pos-y) (* (-> s4-0 main-spd-y) (seconds-per-frame)))
          (vector-! s2-0 s2-0 (-> s4-0 root trans))
          (vector-inv-orient-by-quat! s2-0 s2-0 (-> s4-0 root quat))
          (let ((a1-13 (-> s4-0 main-pos)))
            (let ((v1-19 (-> s4-0 main-pos)))
              (let ((a0-20 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 main-pos))))
                (let ((a2-10 (* 4.0 (seconds-per-frame))))
                  (.mov vf7 a2-10)
                  )
                (.lvf vf5 (&-> a0-20 quad))
                )
              (.lvf vf4 (&-> v1-19 quad))
              )
            (.add.x.vf.w vf6 vf0 vf0)
            (.mul.x.vf.xyz acc vf5 vf7)
            (.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
            (.svf (&-> a1-13 quad) vf6)
            )
          )
        (quaternion-slerp! (-> s4-0 main-quat) (-> s4-0 main-quat) s3-0 0.8)
        )
      (quaternion-copy! (-> arg1 quat) (-> s4-0 main-quat))
      (set! (-> arg1 trans quad) (-> s4-0 main-pos quad))
      (set! (-> arg1 trans y) (+ 16384.0 (-> s4-0 main-pos-y)))
      (quaternion-copy! (-> arg1 quat) (-> s4-0 rigidbody state rotation))
      (let ((s3-1 (-> arg1 trans))
            (v1-23 (-> s4-0 rigidbody))
            (a1-17 (new 'stack-no-clear 'vector))
            )
        (set! (-> s3-1 quad) (-> (rigid-body-method-23 (-> v1-23 state) a1-17) quad))
        )
      )
    (cspace<-parented-transformq-joint! arg0 arg1)
    0
    (none)
    )
  )

(defun bombbot-head-callback ((arg0 cspace) (arg1 transformq))
  (let ((s4-0 (the-as bombbot (-> arg0 param1))))
    (let ((s2-0 (new 'stack-no-clear 'vector))
          (s3-0 (new 'stack-no-clear 'quaternion))
          )
      (let ((a1-1 (-> s4-0 nav state)))
        (set! (-> s2-0 quad) (-> a1-1 target-post quad))
        )
      (vector-! s2-0 s2-0 (-> s4-0 root trans))
      (set! (-> s2-0 y) 0.0)
      (vector-normalize! s2-0 1.0)
      (quaternion-from-two-vectors!
        s3-0
        (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 root quat))
        s2-0
        )
      (quaternion-smooth-seek! (-> s4-0 top-quat) (-> s4-0 top-quat) s3-0 (* 4.0 (seconds-per-frame)))
      )
    (quaternion-copy! (-> arg1 quat) (-> s4-0 top-quat))
    )
  (cspace<-parented-transformq-joint! arg0 arg1)
  0
  (none)
  )

(defun bombbot-gun-swivel-callback ((arg0 cspace) (arg1 transformq))
  (local-vars (sv-128 vector) (sv-144 vector) (sv-160 vector))
  (rlet ((vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         )
    (init-vf0-vector)
    (cspace<-parented-transformq-joint! arg0 arg1)
    (let ((s3-0 (the-as bombbot (-> arg0 param1))))
      (set! sv-160 (new 'stack-no-clear 'vector))
      (let ((s4-0 (new 'stack-no-clear 'quaternion))
            (s0-0 (new 'stack-no-clear 'vector))
            (s1-0 (new 'stack-no-clear 'vector))
            (s2-0 (new 'stack-no-clear 'vector))
            (s5-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))
            )
        (set! sv-144 sv-160)
        (set! sv-128 (-> s3-0 target-pos))
        (let ((v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))))
          (.lvf vf4 (&-> sv-128 quad))
          (.lvf vf5 (&-> v0-2 quad))
          )
        (.mov.vf.w vf6 vf0)
        (.sub.vf.xyz vf6 vf4 vf5)
        (.svf (&-> sv-144 quad) vf6)
        (rot-zxy-from-vector! s0-0 (-> arg0 bone transform vector 2))
        (rot-zxy-from-vector! s0-0 *z-vector*)
        (rot-zxy-from-vector! s1-0 sv-160)
        (set! (-> s2-0 x) (deg- (-> s1-0 x) (-> s0-0 x)))
        (set! (-> s2-0 y) (deg- (-> s1-0 y) (-> s0-0 y)))
        (set! (-> s2-0 y) (deg- (-> s1-0 y) 0.0))
        (set! (-> s3-0 angle-turret) (deg-seek (-> s3-0 angle-turret) (-> s2-0 y) (* 36408.89 (seconds-per-frame))))
        (quaternion-vector-angle! s4-0 *up-vector* (-> s3-0 angle-turret))
        (quaternion->matrix (-> arg0 bone transform) s4-0)
        (set! (-> arg0 bone transform trans quad) (-> s5-0 quad))
        )
      )
    0
    (none)
    )
  )

(defun bombbot-gun-callback ((arg0 cspace) (arg1 transformq))
  (local-vars (sv-112 vector) (sv-128 vector))
  (rlet ((vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         )
    (init-vf0-vector)
    (cspace<-parented-transformq-joint! arg0 arg1)
    (let ((s4-0 (the-as bombbot (-> arg0 param1))))
      (let ((s0-0 (new 'stack-no-clear 'vector)))
        (new 'stack-no-clear 'vector)
        (let ((s2-0 (new 'stack-no-clear 'vector))
              (s1-0 (new 'stack-no-clear 'vector))
              (s3-0 (new 'stack-no-clear 'vector))
              )
          (set! sv-128 s0-0)
          (set! sv-112 (-> s4-0 target-pos))
          (let ((v0-1 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))))
            (.lvf vf4 (&-> sv-112 quad))
            (.lvf vf5 (&-> v0-1 quad))
            )
          (.mov.vf.w vf6 vf0)
          (.sub.vf.xyz vf6 vf4 vf5)
          (.svf (&-> sv-128 quad) vf6)
          (rot-zxy-from-vector! s2-0 (-> arg0 bone transform vector 2))
          (rot-zxy-from-vector! s1-0 s0-0)
          (set! (-> s3-0 x) (fmax -2730.6667 (fmin 2730.6667 (deg- (-> s1-0 x) (-> s2-0 x)))))
          (set! (-> s3-0 y) (deg- (-> s1-0 y) (-> s2-0 y)))
          (set! (-> s4-0 angle-gun) (deg-seek (-> s4-0 angle-gun) (-> s3-0 x) (* 7281.778 (seconds-per-frame))))
          )
        )
      (quaternion-vector-angle! (-> arg1 quat) *x-vector* (-> s4-0 angle-gun))
      )
    (cspace<-parented-transformq-joint! arg0 arg1)
    0
    (none)
    )
  )

(deftype spring-setup (structure)
  ((bpos1  vector)
   (wpos2  vector)
   )
  )


(define *bombbot-spring-setup* (new 'static 'boxed-array :type spring-setup
                                 (new 'static 'spring-setup
                                   :bpos1 (new 'static 'vector :x 4096.0 :y -4096.0 :z 4096.0 :w 1.0)
                                   :wpos2 (new 'static 'vector :x 6144.0 :y 14336.0 :z 6144.0 :w 1.0)
                                   )
                                 (new 'static 'spring-setup
                                   :bpos1 (new 'static 'vector :x 4096.0 :y -4096.0 :z -4096.0 :w 1.0)
                                   :wpos2 (new 'static 'vector :x 6144.0 :y 14336.0 :z -6144.0 :w 1.0)
                                   )
                                 (new 'static 'spring-setup
                                   :bpos1 (new 'static 'vector :x -4096.0 :y -4096.0 :z -4096.0 :w 1.0)
                                   :wpos2 (new 'static 'vector :x -6144.0 :y 14336.0 :z -6144.0 :w 1.0)
                                   )
                                 (new 'static 'spring-setup
                                   :bpos1 (new 'static 'vector :x -4096.0 :y -4096.0 :z 4096.0 :w 1.0)
                                   :wpos2 (new 'static 'vector :x -6144.0 :y 14336.0 :z 6144.0 :w 1.0)
                                   )
                                 )
        )

(defmethod bombbot-method-183 ((this bombbot))
  (local-vars (at-0 int) (sv-160 vector) (sv-176 vector))
  (with-pp
    (rlet ((vf0 :class vf)
           (vf1 :class vf)
           (vf2 :class vf)
           (vf4 :class vf)
           (vf5 :class vf)
           (vf6 :class vf)
           )
      (init-vf0-vector)
      (let ((a1-0 (new 'stack-no-clear 'vector)))
        (vector-reset! a1-0)
        (set! (-> a1-0 y) (* -1.0 (-> this info extra gravity) (-> this rigidbody state info mass)))
        (rigid-body-method-20 (-> this rigidbody state) a1-0)
        )
      (rigid-body-method-24 (-> this rigidbody state))
      (logclear! (-> this rigidbody state flags) (rigid-body-flag active))
      (dotimes (s5-0 4)
        (let ((s4-0 (vector-matrix*!
                      (new 'stack-no-clear 'vector)
                      (-> *bombbot-spring-setup* s5-0 bpos1)
                      (-> this rigidbody state matrix)
                      )
                    )
              )
          (set! sv-160 (new 'stack-no-clear 'vector))
          (let ((v1-22 (-> *bombbot-spring-setup* s5-0 wpos2 quad)))
            (set! (-> sv-160 quad) v1-22)
            )
          (set! sv-176 (new 'stack-no-clear 'vector))
          (let ((s0-0 (new 'stack-no-clear 'vector))
                (s2-0 (new 'stack-no-clear 'vector))
                (s1-0 (new 'stack-no-clear 'vector))
                (s3-0 (new 'stack-no-clear 'vector))
                )
            (set! (-> sv-160 y) (* (-> this legs-strength s5-0) (-> sv-160 y)))
            (+! (-> sv-160 y) (-> this feet s5-0 main-y))
            0.0
            0.0
            0.0
            (let ((v1-33 (-> this rigidbody))
                  (a1-3 s4-0)
                  (a2-1 sv-176)
                  )
              (rigid-body-method-22 (-> v1-33 state) a1-3 a2-1)
              )
            (let ((v1-36 s0-0))
              (.lvf vf4 (&-> s4-0 quad))
              (.lvf vf5 (&-> sv-160 quad))
              (.mov.vf.w vf6 vf0)
              (.sub.vf.xyz vf6 vf4 vf5)
              (.svf (&-> v1-36 quad) vf6)
              )
            (let ((a1-4 s1-0)
                  (v1-37 *null-vector*)
                  )
              (vector-! a1-4 sv-176 v1-37)
              )
            (let ((f0-10 (vector-length s0-0)))
              (vector-float*! s2-0 s0-0 (/ 1.0 f0-10))
              (let ((f0-12 (* 60.0 (+ -40.96 f0-10)))
                    (f1-8 (* 0.8 (vector-dot s1-0 s2-0)))
                    )
                (vector-float*! s3-0 s2-0 (- (+ f0-12 f1-8)))
                )
              )
            (rigid-body-method-18 (-> this rigidbody state) s4-0 s3-0)
            )
          )
        )
      (let ((v1-54 (new 'stack-no-clear 'vector)))
        (.lvf vf1 (&-> (-> this linear-speed) quad))
        (let ((f0-15 (-> pp clock frames-per-second)))
          (.mov at-0 f0-15)
          )
        (.mov vf2 at-0)
        (.mov.vf.w vf1 vf0)
        (.mul.x.vf.xyz vf1 vf1 vf2)
        (.svf (&-> v1-54 quad) vf1)
        )
      0
      (none)
      )
    )
  )

(defmethod bombbot-method-184 ((this bombbot))
  (rigid-body-control-method-10
    (-> this rigidbody)
    (the-as rigid-body-object this)
    (seconds-per-frame)
    0.033333335
    )
  0
  (none)
  )

(defmethod init-enemy! ((this bombbot))
  "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods"
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-bombbot" (the-as (pointer uint32) #f)))
    (the-as pair 0)
    )
  (init-enemy-behaviour-and-stats! this *bombbot-nav-enemy-info*)
  (set-vector! (-> this root scale) 1.0 1.0 1.0 1.0)
  (let ((v1-7 (-> this nav)))
    (set! (-> v1-7 speed-scale) 1.0)
    )
  0
  (set-gravity-length (-> this root dynam) 573440.0)
  (logior! (-> this nav flags) (nav-control-flag momentum-ignore-heading))
  (dotimes (s5-1 4)
    (set! (-> this joint-ik s5-1)
          (new
            'process
            'joint-mod-ik
            this
            (-> *bombbot-ik-setup* s5-1 elbow-index)
            (-> *bombbot-ik-setup* s5-1 hand-dist)
            )
          )
    (set! (-> this joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2))
    (set! (-> this joint-ik s5-1 elbow-rotation-axis) (the-as uint 0))
    )
  (logior! (-> this joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg))
  (logior! (-> this joint-ik 3 flags) (joint-mod-ik-flags elbow-trans-neg))
  (logior! (-> this joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg))
  (logior! (-> this joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg))
  (logior! (-> this joint-ik 2 flags) (joint-mod-ik-flags elbow-rot-neg))
  (logior! (-> this joint-ik 3 flags) (joint-mod-ik-flags elbow-rot-neg))
  (let ((f1-0 11878.4)
        (f0-6 10240.0)
        )
    (let ((f2-0 -10240.0))
      (let ((v1-51 (-> this feet)))
        (set! (-> v1-51 0 pos-offset x) f1-0)
        (set! (-> v1-51 0 pos-offset y) 0.0)
        (set! (-> v1-51 0 pos-offset z) f0-6)
        (set! (-> v1-51 0 pos-offset w) 1.0)
        )
      (set! (-> this feet 0 offset) 0.0)
      (let ((v1-52 (-> this feet 1)))
        (set! (-> v1-52 pos-offset x) f1-0)
        (set! (-> v1-52 pos-offset y) 0.0)
        (set! (-> v1-52 pos-offset z) f2-0)
        (set! (-> v1-52 pos-offset w) 1.0)
        )
      (set! (-> this feet 1 offset) 0.5)
      (let ((v1-54 (-> this feet 2)))
        (set! (-> v1-54 pos-offset x) (- f1-0))
        (set! (-> v1-54 pos-offset y) 0.0)
        (set! (-> v1-54 pos-offset z) f2-0)
        (set! (-> v1-54 pos-offset w) 1.0)
        )
      )
    (set! (-> this feet 2 offset) 0.1)
    (let ((v1-56 (-> this feet 3)))
      (set! (-> v1-56 pos-offset x) (- f1-0))
      (set! (-> v1-56 pos-offset y) 0.0)
      (set! (-> v1-56 pos-offset z) f0-6)
      (set! (-> v1-56 pos-offset w) 1.0)
      )
    )
  (set! (-> this feet 3 offset) 0.6)
  (quaternion-copy! (-> this last-quat) (-> this root quat))
  (quaternion-copy! (-> this main-quat) *unity-quaternion*)
  (let ((v1-60 (-> this nav)))
    (set! (-> v1-60 sphere-mask) (the-as uint 64))
    )
  0
  (let ((a0-28 (-> this node-list data 3)))
    (set! (-> a0-28 param0) bombbot-callback)
    (set! (-> a0-28 param1) this)
    )
  (let ((a0-29 (-> this node-list data 4)))
    (set! (-> a0-29 param0) bombbot-head-callback)
    (set! (-> a0-29 param1) this)
    )
  (let ((a0-30 (-> this node-list data 5)))
    (set! (-> a0-30 param0) bombbot-gun-swivel-callback)
    (set! (-> a0-30 param1) this)
    )
  (let ((a0-31 (-> this node-list data 6)))
    (set! (-> a0-31 param0) bombbot-gun-callback)
    (set! (-> a0-31 param1) this)
    )
  (set! (-> this rigidbody) (new 'process 'rigid-body-control this))
  (set! (-> this info) *bombbot-body-constants*)
  (rigid-body-method-25
    (-> this rigidbody state)
    (-> this info info)
    *null-vector*
    *unity-quaternion*
    (method-of-object this bombbot-method-183)
    )
  (set! (-> this shield-hit-points) 3.0)
  (set! (-> this lazer-sound) (new-sound-id))
  (set! (-> this head-sound) (new 'static 'sound-id))
  (set! (-> this cannon-sound) (new 'static 'sound-id))
  (transform-post)
  (dotimes (s5-2 4)
    (let ((s4-1 (-> this feet s5-2)))
      (let ((s3-0 (new 'stack-no-clear 'vector)))
        (vector-orient-by-quat! s3-0 (-> s4-1 pos-offset) (-> this root quat))
        (vector+! s3-0 s3-0 (-> this root trans))
        (set! (-> s4-1 next-position quad) (-> s3-0 quad))
        (set! (-> s4-1 position quad) (-> s3-0 quad))
        )
      (set! (-> s4-1 delta-y) 0.0)
      )
    (set! (-> this legs-strength s5-2) 1.0)
    )
  (set! (-> this draw light-index) (the-as uint 10))
  0
  (none)
  )

(deftype bombbot-spawn-params (structure)
  ((position  vector      :inline)
   (quat      quaternion  :inline)
   (nav-mesh  basic)
   (path      bombbot-path)
   )
  )


;; WARN: Return type mismatch object vs none.
(defbehavior bombbot-init-by-other bombbot ((arg0 bombbot-spawn-params))
  (stack-size-set! (-> self main-thread) 512)
  (set! (-> self city-path) (-> arg0 path))
  (set! (-> self current-node) (the-as uint 0))
  (init-enemy-collision! self)
  (set! (-> self root trans quad) (-> self city-path node (-> self current-node) position quad))
  (quaternion-copy! (-> self root quat) (-> arg0 quat))
  (vector-identity! (-> self root scale))
  (-> arg0 nav-mesh)
  (set! (-> *bombbot-nav-enemy-info* nav-mesh) *default-nav-mesh*)
  (init-enemy! self)
  (set! (-> self shot-count) (the-as uint 5))
  (set! (-> self last-trans quad) (-> self root trans quad))
  (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 15) (the-as int #f) (the-as vector #t) 0))
  (logior! (-> self mask) (process-mask enemy guard))
  (go-virtual hostile)
  (none)
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_INIT_HOOK
  (lambda :behavior task-manager
    ()
    (set-setting! 'minimap 'clear 0.0 (minimap-flag task-graph))
    (set-setting! 'exclusive-task #f 0.0 (-> self node-info task))
    (set! (-> self data-int32 0) 0)
    0
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_CLEANUP_HOOK
  (lambda :behavior task-manager () (send-event *traffic-manager* 'restore-default-settings) (none))
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_UPDATE_HOOK
  (lambda :behavior task-manager
    ()
    (when (nonzero? (-> self data-int32 0))
      (let ((gp-0 0))
        (let ((s5-0 10000))
          (dotimes (s4-0 3)
            (let ((s3-0 (as-type (-> self slave s4-0 process 0) bombbot)))
              (when s3-0
                (+! gp-0 1)
                (let ((v1-14 (the int (* 0.000030517578 (vector-vector-xz-distance
                                                          (-> s3-0 root trans)
                                                          (-> s3-0 city-path node (+ (-> s3-0 city-path node-count) -1) position)
                                                          )
                                         )
                                  )
                             )
                      )
                  (if (< v1-14 s5-0)
                      (set! s5-0 v1-14)
                      )
                  )
                (when (= (-> s3-0 current-node) (+ (-> s3-0 city-path node-count) -1))
                  )
                )
              )
            )
          (set! (-> self data-int32 1) s5-0)
          (cond
            ((< s5-0 10)
             (set! (-> *game-info* timer) (the-as time-frame (the int (* 300.0 (the float s5-0)))))
             (let ((v1-25 (handle->process (-> self hud-timer))))
               (if (and *target* (not v1-25))
                   (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*)))
                   )
               )
             (when (zero? s5-0)
               (send-event (handle->process (-> self hud-timer)) 'hide-and-die)
               (go-virtual fail)
               )
             )
            (else
              (if (handle->process (-> self hud-timer))
                  (send-event (handle->process (-> self hud-timer)) 'hide-and-die)
                  )
              )
            )
          )
        (if (zero? gp-0)
            (go-virtual complete)
            )
        )
      )
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_CODE_HOOK
  (lambda :behavior task-manager
    ()
    (while (!= (-> (level-get-target-inside *level*) name) 'ctysluma)
      (suspend)
      )
    (set! (-> self data-int32 0) 1)
    (set-setting! 'airlock #f 0.0 0)
    (set-setting! 'sound-mode #f 0.0 1)
    (let ((gp-1 *traffic-manager*))
      (send-event gp-1 'set-guard-target-count-range 4 0 0)
      (send-event gp-1 'set-guard-target-count-range 5 0 0)
      )
    (let ((gp-2 (new 'stack 'bombbot-spawn-params)))
      (set! (-> gp-2 nav-mesh) (get-nav-mesh (the-as actor-id 9592)))
      (set! (-> gp-2 position quad)
            (-> (new 'static 'quaternion :x 4387619.0 :y 37262.54 :z 230567.11 :w 1.0) quad)
            )
      (quaternion-copy! (-> gp-2 quat) (new 'static 'quaternion :x 0.0006 :y -0.8345 :z -0.0013 :w -0.5509))
      (set! (-> gp-2 path) *bombbot-path-1*)
      (set! (-> self slave 0) (ppointer->handle (process-spawn bombbot gp-2 :to self)))
      (set! (-> gp-2 path) *bombbot-path-2*)
      (set! (-> self slave 1) (ppointer->handle (process-spawn bombbot gp-2 :to self)))
      (set! (-> gp-2 path) *bombbot-path-3*)
      (set! (-> self slave 2) (ppointer->handle (process-spawn bombbot gp-2 :to self)))
      )
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_COMPLETE_HOOK
  (lambda :behavior task-manager
    ()
    (set-time! (-> self state-time))
    (talker-spawn-func (-> *talker-speech* 117) *entity-pool* (target-pos 0) (the-as region #f))
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_FAIL_HOOK
  (lambda :behavior task-manager
    ()
    (when (and *target*
               (not (focus-test? *target* dead))
               (zero? (-> self data-int32 1))
               (nonzero? (-> self data-int32 0))
               )
      (cond
        ((= (level-status *level* 'ctysluma) 'active)
         (set-setting! 'entity-name "camera-236" 0.0 0)
         (set-setting! 'minimap 'clear 0.0 (minimap-flag minimap))
         (set-time! (-> self state-time))
         (while (not (time-elapsed? (-> self state-time) (seconds 2)))
           (suspend)
           )
         (add-process *gui-control* self (gui-channel sig) (gui-action play) "bbotxplo" -99.0 0)
         (dotimes (gp-1 3)
           (let ((a0-7 (the-as process (as-type (-> self slave gp-1 process 0) bombbot))))
             (if a0-7
                 (send-event a0-7 'explode)
                 )
             )
           )
         (set-time! (-> self state-time))
         (while (not (time-elapsed? (-> self state-time) (seconds 0.3)))
           (suspend)
           )
         (setup
           *screen-filter*
           (new 'static 'vector :x 255.0 :y 255.0 :z 255.0)
           (new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
           (seconds-per-frame)
           (bucket-id tex-all-map)
           )
         (while (not (time-elapsed? (-> self state-time) (seconds 1)))
           (suspend)
           )
         (set-setting! 'interp-time 'abs 0.0 0)
         (remove-setting! 'entity-name)
         )
        (else
          )
        )
      )
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-stop-bomb-bots-destroy)
  TASK_MANAGER_CLEANUP_HOOK
  (lambda :behavior task-manager () (disable *screen-filter*) (none))
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-burning-bush-bombbot-1-resolution)
  TASK_MANAGER_INIT_HOOK
  (lambda :behavior task-manager
    ()
    (set-setting! 'minimap 'clear 0.0 (minimap-flag task-graph))
    (set-setting! 'airlock #f 0.0 0)
    (set-setting! 'exclusive-task #f 0.0 (-> self node-info task))
    (let ((gp-0 *traffic-manager*))
      (send-event gp-0 'set-guard-target-count-range 4 0 0)
      (send-event gp-0 'set-guard-target-count-range 5 0 0)
      )
    (let ((gp-1 (new 'stack 'bombbot-spawn-params)))
      (set! (-> gp-1 nav-mesh) (get-nav-mesh (the-as actor-id 9592)))
      (set! (-> gp-1 position quad)
            (-> (new 'static 'quaternion :x 4387619.0 :y 37262.54 :z 230567.11 :w 1.0) quad)
            )
      (quaternion-copy! (-> gp-1 quat) (new 'static 'quaternion :x 0.0006 :y -0.8345 :z -0.0013 :w -0.5509))
      (set! (-> gp-1 path) *bombbot-path-4*)
      (set! (-> self slave 0) (ppointer->handle (process-spawn bombbot gp-1 :to self)))
      (set! (-> gp-1 path) *bombbot-path-5*)
      (set! (-> self slave 1) (ppointer->handle (process-spawn bombbot gp-1 :to self)))
      (set! (-> gp-1 path) *bombbot-path-6*)
      (set! (-> self slave 2) (ppointer->handle (process-spawn bombbot gp-1 :to self)))
      )
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-burning-bush-bombbot-1-resolution)
  TASK_MANAGER_CLEANUP_HOOK
  (lambda :behavior task-manager () (send-event *traffic-manager* 'restore-default-settings) (none))
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-burning-bush-bombbot-1-resolution)
  TASK_MANAGER_UPDATE_HOOK
  (lambda :behavior task-manager
    ()
    (let ((gp-0 0))
      10000
      (dotimes (s5-0 3)
        (let ((v1-6 (as-type (-> self slave s5-0 process 0) bombbot)))
          (when v1-6
            (+! gp-0 1)
            (when (= (-> v1-6 current-node) (+ (-> v1-6 city-path node-count) -1))
              (set! (-> v1-6 current-node) (the-as uint 0))
              0
              )
            )
          )
        )
      (if (zero? gp-0)
          (go-virtual complete)
          )
      )
    (none)
    )
  )

(set-subtask-hook!
  *game-info*
  (game-task-node city-burning-bush-bombbot-1-resolution)
  TASK_MANAGER_CODE_HOOK
  (lambda :behavior task-manager
    ()
    (set-time! (-> self state-time))
    (until #f
      (suspend)
      )
    #f
    (none)
    )
  )
