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

;; name: mh-bat.gc
;; name in dgo: mh-bat
;; dgos: NSA

;; DECOMP BEGINS

(defpartgroup group-mh-bat-charge-up
  :id 635
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 40)
  :parts ((sp-item 2460 :flags (sp7) :period (seconds 40) :length (seconds 0.667))
    (sp-item 2461 :flags (sp7) :period (seconds 40) :length (seconds 0.835))
    (sp-item 2462 :flags (sp6) :period (seconds 40) :length (seconds 1))
    (sp-item 2463 :flags (sp6) :period (seconds 40) :length (seconds 1))
    )
  )

(defpart 2460
  :init-specs ((:texture (flame01 level-default-sprite))
    (:num 1.0)
    (:x (meters 4))
    (:scale-x (meters 3))
    (:scale-y (meters 6))
    (:r 255.0)
    (:g 0.0)
    (:b 255.0)
    (:a 0.0)
    (:scalevel-x (meters -0.0033333334))
    (:scalevel-y (meters -0.013333334))
    (:fade-a 0.42666668)
    (:accel-x (meters -0.001))
    (:friction 0.98 0.01)
    (:timer (seconds 0.5))
    (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat))
    (:func 'sparticle-2d-spline-align-instant)
    (:rotate-x (degrees 0) (degrees 36000))
    (:rotate-y (degrees 0) (degrees 36000))
    (:rotate-z (degrees 0) (degrees 36000))
    )
  )

(defpart 2461
  :init-specs ((:texture (specs level-default-sprite))
    (:num 0.1)
    (:scale-x (meters 10) (meters 2))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 32.0 20.0)
    (:b 128.0 128.0)
    (:a 0.0)
    (:scalevel-x (meters -0.02) (meters -0.016666668))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 0.64)
    (:timer (seconds 1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    (:next-time (seconds 0.335))
    (:next-launcher 2464)
    )
  )

(defpart 2464
  :init-specs ((:fade-a 0.0))
  )

(defpart 2462
  :init-specs ((:texture (starflash level-default-sprite))
    (:num 0.5)
    (:scale-x (meters 2))
    (:rot-x (degrees 2.25))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 140.0)
    (:b 128.0)
    (:a 20.0 30.0)
    (:omega (degrees 4511.25))
    (:timer (seconds 0.167))
    (:flags (glow))
    (:userdata 409.6)
    )
  )

(defpart 2463
  :init-specs ((:texture (ring level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 5) (meters 0.01))
    (:rot-x (degrees 22.5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 0.0)
    (:b 0.0)
    (:a 10.0 5.0)
    (:omega (degrees 4511.25))
    (:timer (seconds 0.017))
    (:flags (glow))
    (:userdata 4096.0)
    )
  )

(defpartgroup group-mh-bat-explosion
  :id 636
  :duration (seconds 2)
  :linger-duration (seconds 1)
  :flags (sp0 sp5 sp6 sp7)
  :bounds (static-bspherem 0 0 0 15)
  :rotate ((degrees 0) (degrees 90) (degrees 0))
  :scale (0.75 0.75 0.75)
  :parts ((sp-item 2465 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 2466 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 2467 :period (seconds 3) :length (seconds 0.05))
    (sp-item 2468 :fade-after (meters 60) :period (seconds 3) :length (seconds 0.035) :offset 10)
    (sp-item 2469 :fade-after (meters 60) :falloff-to (meters 60) :period (seconds 3) :length (seconds 0.167) :offset 20)
    (sp-item 2470 :fade-after (meters 200) :falloff-to (meters 200) :period (seconds 3) :length (seconds 0.085) :offset 20)
    (sp-item 2471 :fade-after (meters 150) :falloff-to (meters 150) :period (seconds 3) :length (seconds 0.067) :offset 30)
    )
  )

(defpartgroup group-mh-bat-jet-explosion
  :id 637
  :duration (seconds 2)
  :linger-duration (seconds 1)
  :flags (sp0 sp5 sp6 sp7)
  :bounds (static-bspherem 0 0 0 15)
  :rotate ((degrees 0) (degrees 90) (degrees 0))
  :scale (0.3 0.3 0.3)
  :parts ((sp-item 2465 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 2466 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 2467 :period (seconds 3) :length (seconds 0.05))
    (sp-item 2468 :fade-after (meters 60) :period (seconds 3) :length (seconds 0.035) :offset 10)
    (sp-item 2469 :fade-after (meters 60) :falloff-to (meters 60) :period (seconds 3) :length (seconds 0.167) :offset 20)
    (sp-item 2470 :fade-after (meters 200) :falloff-to (meters 200) :period (seconds 3) :length (seconds 0.085) :offset 20)
    (sp-item 2471 :fade-after (meters 150) :falloff-to (meters 150) :period (seconds 3) :length (seconds 0.067) :offset 30)
    )
  )

(defpart 2466
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 2))
    (:rot-x (degrees 11.25))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 24.0)
    (:scalevel-x (meters 0.10666667))
    (: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))
    (:next-time (seconds 0.25))
    (:next-launcher 2472)
    )
  )

(defpart 2472
  :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 2471
  :init-specs ((:texture (explosion-edge level-default-sprite))
    (:num 2.0 0.2)
    (:scale-x (meters 1) (meters 1))
    (:rot-z (degrees 0) (degrees 3600) :store)
    (:scale-y (meters 0.8) (meters 0.2))
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 32.0 32.0)
    (:scalevel-x (meters 0.01) (meters 0.13333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 0.0)
    (:fade-g -0.36)
    (:fade-b -4.24)
    (:fade-a -0.22068965)
    (:friction 0.95)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:next-time (seconds 0.085))
    (:next-launcher 2473)
    (:conerot-x '*sp-temp*)
    (:conerot-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2470
  :init-specs ((:texture (explosion-nebula level-default-sprite))
    (:birth-func 'birth-func-texture-group)
    (:num 3.0)
    (:scale-x (meters 1) (meters 1))
    (:rot-z (degrees 0))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 32.0 32.0)
    (:vel-y (meters 0.02) (meters 0.01))
    (:scalevel-x (meters 0.01) (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.22068965)
    (:friction 0.95)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-2))
    (:userdata :data (new 'static 'boxed-array :type int32 40 1 0 #x400000 #x400700))
    (:next-time (seconds 0.085))
    (:next-launcher 2473)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    )
  )

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

(defpart 2474
  :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 2475)
    )
  )

(defpart 2475
  :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.094444446)
    (:fade-a -0.06545454 -0.06545454)
    (:next-time (seconds 0.5) (seconds 0.097))
    (:next-launcher 2476)
    )
  )

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

(defpart 2465
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 5))
    (:rot-x (degrees 11.25))
    (: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))
    (:next-time (seconds 0.1))
    (:next-launcher 2477)
    )
  )

(defpart 2477
  :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 2469
  :init-specs ((:texture (specs level-default-sprite))
    (:num 8.0 2.0)
    (:x (meters 0.25))
    (:scale-x (meters 1) (meters 0.25))
    (: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.083333336) (meters 0.083333336))
    (:scalevel-x (meters 0.006666667) (meters 0.0016666667))
    (: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.00016666666) (meters -0.00033333333))
    (:friction 0.87)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-2))
    (:next-time (seconds 0.117) (seconds 0.047))
    (:next-launcher 2478)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2478
  :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 2479)
    )
  )

(defpart 2479
  :init-specs ((:fade-r -0.5543478) (:fade-g -0.5543478) (:fade-a -0.13913043))
  )

(defpart 2467
  :init-specs ((:texture (bigpuff level-default-sprite))
    (:num 8.0 1.0)
    (:x (meters 0) (meters 0.6))
    (:scale-x (meters 2.5) (meters 2))
    (: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.1))
    (:scalevel-x (meters 0.033333335) (meters 0.02))
    (: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.88)
    (:timer (seconds 2.367))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:next-time (seconds 0.117) (seconds 0.047))
    (:next-launcher 2480)
    (:conerot-x (degrees 0) (degrees 3600))
    (:conerot-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2480
  :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 2481)
    )
  )

(defpart 2481
  :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 2468
  :init-specs ((:texture (motion-blur-part level-default-sprite))
    (:num 4.0 2.0)
    (:scale-x (meters 0.2) (meters 0.5))
    (:rot-x 4)
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y (meters 0.2) (meters 0.1))
    (:r 128.0 128.0)
    (:g 96.0)
    (:b 64.0)
    (:a 64.0 64.0)
    (:scalevel-x (meters 0.13333334) (meters 0.02))
    (:fade-g 1.6)
    (:fade-b 3.2)
    (:fade-a -1.6)
    (:timer (seconds 0.3))
    (:flags (sp-cpuinfo-flag-2))
    )
  )

(defskelgroup skel-mh-bat mh-bat mh-bat-lod0-jg -1
              ((mh-bat-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 2 -2 8)
              :shadow mh-bat-shadow-mg
              )

(deftype mh-bat (enemy)
  ((rotation-matrix       matrix       :inline)
   (move-curve            cubic-curve  :inline)
   (start-pos             vector       :inline)
   (up-vector             vector       :inline)
   (focus-bullseye-pos    vector       :inline)
   (focus-xz-dir          vector       :inline :offset 752)
   (target-velocity       vector       :inline)
   (target-speed          float)
   (y-offset              float)
   (max-time-step         float)
   (orbit-angle           float)
   (orbit-angular-speed   float)
   (orbit-distance        float)
   (bank-angle            float)
   (pitch-angle           float)
   (anim-speed            float)
   (last-off-screen-time  time-frame)
   (nav-mesh              nav-mesh)
   (flap-interp           float)
   (shadow-id             int32)
   (move-dest             vector       :inline :overlay-at event-param-point)
   )
  (:state-methods
    retreat
    attack-0
    attack-1
    )
  (:methods
    (mh-bat-method-158 (_type_) vector)
    (mh-bat-method-159 (_type_) none)
    (set-scale! (_type_ float) none)
    (probe-shadow (_type_) none)
    )
  )


(define *fact-info-mh-bat-defaults*
  (new 'static 'fact-info-enemy-defaults :idle-distance (meters 80) :pickup-type 9)
  )

(define *mh-bat-enemy-info* (new 'static 'enemy-info
                              :use-die-falling #t
                              :use-victory #f
                              :use-jump-blocked #f
                              :debug-draw-neck #f
                              :jump-debug-draw #f
                              :move-to-ground #f
                              :hover-if-no-ground #t
                              :idle-anim-script #f
                              :idle-anim 5
                              :notice-anim 5
                              :hostile-anim 5
                              :hit-anim 5
                              :knocked-anim 5
                              :knocked-land-anim 5
                              :die-anim 5
                              :die-falling-anim 5
                              :victory-anim -1
                              :jump-wind-up-anim -1
                              :jump-in-air-anim -1
                              :jump-land-anim -1
                              :neck-joint 6
                              :look-at-joint 6
                              :bullseye-joint 4
                              :sound-hit (static-sound-name "mh-bat-get-hit")
                              :sound-die (static-sound-name "mh-bat-die")
                              :notice-distance (meters 100)
                              :notice-distance-delta (meters 10)
                              :proximity-notice-distance (meters 5)
                              :default-hit-points 8.0
                              :gnd-collide-with (collide-spec backgnd)
                              :overlaps-others-collide-with-filter (collide-spec jak bot player-list)
                              :penetrate-knocked (penetrate
                                touch
                                generic-attack
                                lunge
                                flop
                                punch
                                spin
                                roll
                                uppercut
                                bonk
                                tube
                                vehicle
                                flut-attack
                                board
                                mech
                                mech-punch
                                mech-bonk
                                dark-skin
                                dark-punch
                                dark-bomb
                                dark-smack
                                flut
                                shield
                                explode
                                jak-yellow-shot
                                jak-red-shot
                                jak-blue-shot
                                jak-dark-shot
                                enemy-yellow-shot
                                enemy-dark-shot
                                eco-yellow
                                eco-red
                                eco-blue
                                eco-green
                                knocked
                                jak-red-shockwave
                                jak-dark-nuke
                                jak-dark-blackhole
                                emp-blast
                                penetrate38
                                penetrate39
                                penetrate40
                                penetrate41
                                penetrate42
                                penetrate43
                                penetrate44
                                penetrate45
                                penetrate46
                                penetrate47
                                penetrate48
                                penetrate49
                                penetrate50
                                penetrate51
                                penetrate52
                                penetrate53
                                penetrate54
                                penetrate55
                                penetrate56
                                penetrate57
                                penetrate58
                                penetrate59
                                penetrate60
                                penetrate61
                                penetrate64
                                penetrate63
                                )
                              :movement-gravity (meters -100)
                              :friction 0.8
                              :attack-shove-back (meters 3)
                              :attack-shove-up (meters 2)
                              :attack-mode 'generic
                              :attack-damage 2
                              :recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher)
                              :knocked-can-land-timeout (seconds 0.5)
                              :knocked-recover-timeout (seconds 2)
                              :ragdoll-blend-out-time (seconds 0.4)
                              :ragdoll-rotate-velocity-mult 1.0
                              :jump-height-min (meters 3)
                              :jump-height-factor 0.5
                              :knocked-seek-ry-clamp 364.0889
                              :knocked-soft-vxz-lo (meters 17.6)
                              :knocked-soft-vxz-hi (meters 26.4)
                              :knocked-soft-vy-lo (meters 20)
                              :knocked-soft-vy-hi (meters 30)
                              :knocked-medium-vxz-lo (meters 36)
                              :knocked-medium-vxz-hi (meters 48)
                              :knocked-medium-vy-lo (meters 33)
                              :knocked-medium-vy-hi (meters 37)
                              :knocked-hard-vxz-lo (meters 19.2)
                              :knocked-hard-vxz-hi (meters 28.8)
                              :knocked-hard-vy-lo (meters 44.8)
                              :knocked-hard-vy-hi (meters 51.2)
                              :knocked-huge-vxz-lo (meters 40.2)
                              :knocked-huge-vxz-hi (meters 60.8)
                              :knocked-huge-vy-lo (meters 44.8)
                              :knocked-huge-vy-hi (meters 53.2)
                              :knocked-yellow-vxz-lo (meters 10)
                              :knocked-yellow-vxz-hi (meters 12)
                              :knocked-yellow-vy-lo (meters 14)
                              :knocked-yellow-vy-hi (meters 20)
                              :knocked-red-vxz-lo (meters 6)
                              :knocked-red-vxz-hi (meters 48)
                              :knocked-red-vy-lo (meters 23)
                              :knocked-red-vy-hi (meters 37)
                              :knocked-blue-vxz-lo (meters 10)
                              :knocked-blue-vxz-hi (meters 12)
                              :knocked-blue-vy-lo (meters 6)
                              :knocked-blue-vy-hi (meters 20)
                              :ragdoll-info (new 'static 'ragdoll-setup
                                :scale (new 'static 'vector :x 1.0 :y 1.0 :z 1.0)
                                :bg-collide-with (collide-spec backgnd)
                                :joint-setup (new 'static 'boxed-array :type ragdoll-joint-setup
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 3
                                    :parent-joint -1
                                    :axial-slop 1887.9647
                                    :max-angle 1828.4725
                                    :coll-rad 2253.2097
                                    :hit-sound (static-sound-name "mh-bat-bf")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 4
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 1.0 :w 8247.761)
                                    :geo-tform (new 'static 'vector :x -1.0 :w 2592.404)
                                    :axial-slop 1887.9647
                                    :max-angle 1884.2693
                                    :coll-rad 2172.109
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 5
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 1.0 :w 13791.578)
                                    :geo-tform (new 'static 'vector :x -1.0 :w 6063.536)
                                    :axial-slop 1887.9647
                                    :max-angle 2151.4558
                                    :coll-rad 2430.976
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 6
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -1.0 :w 6328.3564)
                                    :geo-tform (new 'static 'vector :x 1.0 :w 21944.402)
                                    :axial-slop 1887.9647
                                    :max-angle 2562.5303
                                    :coll-rad 1696.9728
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 7
                                    :parent-joint 4
                                    :pre-tform (new 'static 'vector :x -0.2846 :z -0.9585 :w 7849.993)
                                    :geo-tform (new 'static 'vector :x -0.1595 :y -0.9862 :z -0.0413 :w 6464.9995)
                                    :axial-slop 1887.9647
                                    :max-angle 2870.841
                                    :coll-rad 1848.9344
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 8
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.8472 :z -0.5309 :w 1049.6501)
                                    :geo-tform (new 'static 'vector :x 0.852 :y 0.2493 :z -0.4598 :w 35559.47)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 9
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.8358 :z -0.5487 :w 10444.982)
                                    :geo-tform (new 'static 'vector :x -0.7911 :y -0.552 :z -0.263 :w 13496.703)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1318.5024
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 10
                                    :parent-joint 4
                                    :pre-tform (new 'static 'vector :x -0.2855 :z 0.9582 :w 7833.354)
                                    :geo-tform (new 'static 'vector :x 0.9534 :y 0.0133 :z -0.3009 :w 31748.514)
                                    :axial-slop 1887.9647
                                    :max-angle 2864.961
                                    :coll-rad 1774.7968
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 11
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.8392 :z 0.5436 :w 1057.5873)
                                    :geo-tform (new 'static 'vector :x 0.9259 :y 0.1576 :z -0.3427 :w 22837.203)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 12
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.795 :z 0.6062 :w 10426.122)
                                    :geo-tform (new 'static 'vector :x 0.904 :y 0.1843 :z -0.3851 :w 22428.13)
                                    :axial-slop 1887.9647
                                    :max-angle 3766.3723
                                    :coll-rad 1318.5024
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 13
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x -0.6204 :z 0.784 :w 40801.75)
                                    :geo-tform (new 'static 'vector :x 0.0112 :y 0.9036 :z -0.4279 :w 39265.93)
                                    :axial-slop 1887.9647
                                    :max-angle 2403.9697
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 14
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.9649 :z 0.2619 :w 8321.415)
                                    :geo-tform (new 'static 'vector :x 0.0583 :y 0.979 :z 0.1943 :w 39636.37)
                                    :axial-slop 1887.9647
                                    :max-angle 2680.7136
                                    :coll-rad 1060.864
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 15
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.8092 :z -0.5871 :w 4034.0503)
                                    :geo-tform (new 'static 'vector :x 0.1021 :y 0.9505 :z 0.2931 :w 39452.543)
                                    :axial-slop 1887.9647
                                    :max-angle 3055.8164
                                    :coll-rad 996.5568
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 16
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x 0.6217 :z 0.783 :w 24744.848)
                                    :geo-tform (new 'static 'vector :x -0.3088 :y 0.4058 :z 0.86 :w 32838.07)
                                    :axial-slop 1887.9647
                                    :max-angle 2584.5579
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 17
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.9715 :z -0.2362 :w 8353.983)
                                    :geo-tform (new 'static 'vector :x -0.3226 :y -0.1866 :z 0.9278 :w 33548.844)
                                    :axial-slop 1887.9647
                                    :max-angle 2685.8474
                                    :coll-rad 1008.0256
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 18
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.8614 :z 0.5077 :w 3994.5286)
                                    :geo-tform (new 'static 'vector :x -0.3154 :y -0.2796 :z 0.9066 :w 34789.88)
                                    :axial-slop 1887.9647
                                    :max-angle 3281.1692
                                    :coll-rad 984.2688
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 19
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x 0.6761 :z 0.7365 :w 40678.086)
                                    :geo-tform (new 'static 'vector :x -0.1121 :y 0.9875 :z 0.1087 :w 25535.54)
                                    :axial-slop 1887.9647
                                    :max-angle 2307.814
                                    :coll-rad 1013.76
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 20
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.6369 :z 0.7707 :w 2816.1184)
                                    :geo-tform (new 'static 'vector :x -0.2268 :y 0.9677 :z -0.1093 :w 25577.736)
                                    :axial-slop 1887.9647
                                    :max-angle 3235.658
                                    :coll-rad 849.5104
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 21
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.7205 :z 0.6933 :w 4994.6807)
                                    :geo-tform (new 'static 'vector :x 0.1277 :y 0.9274 :z -0.3509 :w 25689.31)
                                    :axial-slop 1887.9647
                                    :max-angle 3077.8438
                                    :coll-rad 928.5632
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 22
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x -0.6775 :z 0.7354 :w 24868.4)
                                    :geo-tform (new 'static 'vector :x 0.9349 :y -0.1038 :z -0.3389 :w 34939.773)
                                    :axial-slop 1887.9647
                                    :max-angle 2959.6604
                                    :coll-rad 1315.2256
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 23
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.6375 :z -0.7702 :w 2830.2815)
                                    :geo-tform (new 'static 'vector :x 0.9169 :y -0.2121 :z -0.3375 :w 30645.873)
                                    :axial-slop 1887.9647
                                    :max-angle 3016.913
                                    :coll-rad 748.3392
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 24
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.7178 :z -0.6959 :w 4934.4604)
                                    :geo-tform (new 'static 'vector :x 0.9278 :y 0.1268 :z -0.3503 :w 25722.824)
                                    :axial-slop 1887.9647
                                    :max-angle 2718.8884
                                    :coll-rad 839.2704
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 25
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x -1.0 :w 19514.164)
                                    :geo-tform (new 'static 'vector :x 1.0 :w 1363.3673)
                                    :axial-slop 1887.9647
                                    :max-angle 2641.8108
                                    :coll-rad 1934.1312
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 26
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 1.0 :w 1606.342)
                                    :geo-tform (new 'static 'vector :x 1.0 :w 1523.8759)
                                    :axial-slop 1887.9647
                                    :max-angle 2748.9805
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 27
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 1.0 :w 1523.8577)
                                    :geo-tform (new 'static 'vector :x 0.9998)
                                    :axial-slop 1887.9647
                                    :max-angle 3340.6248
                                    :coll-rad 1063.3217
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 28
                                    :parent-joint -1
                                    :geo-tform (new 'static 'vector :x 0.9998)
                                    :axial-slop 1887.9647
                                    :max-angle 4079.8164
                                    :coll-rad 819.6096
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 29
                                    :parent-joint -1
                                    :geo-tform (new 'static 'vector :x -1.0)
                                    :axial-slop 1887.9647
                                    :max-angle 4675.866
                                    :coll-rad 1035.0592
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 30
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x -0.6594 :z -0.7516 :w 12366.753)
                                    :geo-tform (new 'static 'vector :x 0.9085 :y -0.4097 :z -0.0797 :w 4672.098)
                                    :axial-slop 1887.9647
                                    :max-angle 2759.9941
                                    :coll-rad 2022.1952
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 31
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.9998 :z 0.0053 :w 4255.4893)
                                    :geo-tform (new 'static 'vector :x -0.6493 :y -0.1997 :z 0.7335 :w 28478.05)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1318.5024
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 32
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.9915 :z 0.1286 :w 10408.628)
                                    :geo-tform (new 'static 'vector :x -0.8244 :y -0.5619 :z 0.065 :w 15611.349)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1471.6927
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 33
                                    :parent-joint 3
                                    :pre-tform (new 'static 'vector :x -0.6605 :z 0.7505 :w 12360.744)
                                    :geo-tform (new 'static 'vector :x 0.9954 :y 0.0188 :z -0.0925 :w 37012.13)
                                    :axial-slop 1887.9647
                                    :max-angle 2989.7524
                                    :coll-rad 2006.6304
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 34
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x 0.9998 :z -0.0013 :w 4262.1885)
                                    :geo-tform (new 'static 'vector :x 0.9329 :y -0.0745 :z -0.3517 :w 23086.13)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1437.2864
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 35
                                    :parent-joint -1
                                    :pre-tform (new 'static 'vector :x -0.9773 :z 0.2109 :w 9797.359)
                                    :geo-tform (new 'static 'vector :x 0.9079 :y 0.0423 :z -0.4165 :w 20326.883)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 1318.5024
                                    :hit-sound (static-sound-name "mh-bat-ragdoll")
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 36
                                    :parent-joint 6
                                    :pre-tform (new 'static 'vector :x 1.0 :w 21138.729)
                                    :geo-tform (new 'static 'vector :x -0.6322 :y -0.3636 :z 0.684 :w 1500.7925)
                                    :axial-slop 1887.9647
                                    :max-angle 1766.8142
                                    :coll-rad 1608.4991
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 37
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x -0.3751 :z -0.9269 :w 5793.9287)
                                    :geo-tform (new 'static 'vector :x -0.1097 :y -0.6822 :z 0.7226 :w 21710.604)
                                    :axial-slop 1887.9647
                                    :max-angle 3980.7112
                                    :coll-rad 637.3376
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 38
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x -0.3763 :z 0.9263 :w 5778.3457)
                                    :geo-tform (new 'static 'vector :x 0.7524 :y 0.1215 :z 0.647 :w 18734.613)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 482.9184
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 39
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x -0.1845 :z -0.9828 :w 3915.7214)
                                    :geo-tform (new 'static 'vector :x -0.342 :y 0.753 :z -0.562 :w 32853.996)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 521.0112
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 40
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x -0.1853 :z 0.9825 :w 3901.449)
                                    :geo-tform (new 'static 'vector :x 0.6881 :y 0.2026 :z 0.6964 :w 18306.844)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 524.288
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 41
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x 0.0055 :z -0.9998 :w 3042.2903)
                                    :geo-tform (new 'static 'vector :x -0.3492 :y 0.73 :z -0.5871 :w 34187.945)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 614.8096
                                    )
                                  (new 'static 'ragdoll-joint-setup
                                    :joint-index 42
                                    :parent-joint 25
                                    :pre-tform (new 'static 'vector :x 0.0055 :z 0.9998 :w 3029.875)
                                    :geo-tform (new 'static 'vector :x 0.6216 :y 0.2236 :z 0.7505 :w 17720.426)
                                    :axial-slop 1887.9647
                                    :max-angle 3748.7683
                                    :coll-rad 705.3312
                                    )
                                  )
                                )
                              :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)
                              :knocked-off #t
                              )
        )

(set! (-> *mh-bat-enemy-info* fact-defaults) *fact-info-mh-bat-defaults*)

(defmethod init-enemy-collision! ((this mh-bat))
  "Typical place to construct collision shapes"
  (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
            generic-attack
            lunge
            flop
            punch
            spin
            roll
            uppercut
            bonk
            tube
            flut-attack
            board
            mech-punch
            dark-punch
            dark-smack
            flut
            )
          )
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 3))
      (set! (-> s4-0 prim-core collide-as) (collide-spec enemy))
      (set! (-> s4-0 prim-core collide-with) (collide-spec backgnd))
      (set! (-> s4-0 prim-core action) (collide-action solid semi-solid))
      (set-vector! (-> s4-0 local-sphere) 0.0 6144.0 0.0 10649.6)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-13 prim-core collide-as) (collide-spec enemy))
      (set! (-> v1-13 prim-core action) (collide-action semi-solid))
      (set-vector! (-> v1-13 local-sphere) 0.0 6144.0 0.0 10240.0)
      )
    (set-vector!
      (-> (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)) local-sphere)
      0.0
      6144.0
      0.0
      8192.0
      )
    (set! (-> s5-0 nav-radius) 8192.0)
    (let ((v1-17 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with))
      )
    (set! (-> s5-0 max-iteration-count) (the-as uint 3))
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

;; WARN: new jak 2 until loop case, check carefully
(defbehavior mh-bat-fly-code mh-bat ((arg0 (function object :behavior mh-bat)))
  (ja-channel-push! 2 (seconds 0.1))
  (until #f
    (ja-no-eval :group! mh-bat-fly-glide0-ja :num! (seek! max (-> self anim-speed)) :frame-num 0.0)
    (let ((a0-3 (-> self skel root-channel 1)))
      (let ((f0-4 (-> self flap-interp)))
        (set! (-> a0-3 frame-interp 1) f0-4)
        (set! (-> a0-3 frame-interp 0) f0-4)
        )
      (set! (-> a0-3 frame-group) (the-as art-joint-anim mh-bat-fly-fast0-ja))
      (set! (-> a0-3 param 0) 0.0)
      (set! (-> a0-3 frame-num) 0.0)
      (joint-control-channel-group! a0-3 (the-as art-joint-anim mh-bat-fly-fast0-ja) num-func-chan)
      )
    (until (ja-done? 0)
      (suspend)
      (let ((s5-0 (cubic-curve-method-12 (-> self move-curve) (new 'stack-no-clear 'vector) 0.0))
            (s4-0 (vector-flatten! (new 'stack-no-clear 'vector) (-> self root transv) (-> self rotation-matrix fvec)))
            )
        (vector-flatten! s5-0 s5-0 (-> self rotation-matrix rvec))
        (set! (-> s5-0 y) (fmax 0.0 (-> s5-0 y)))
        (seek!
          (-> self flap-interp)
          (lerp-scale 0.5 1.0 (vector-length s5-0) 0.0 163840.0)
          (* 4.0 (seconds-per-frame))
          )
        (seek!
          (-> self anim-speed)
          (fmax
            (lerp-scale 1.0 3.0 (vector-length s5-0) 0.0 327680.0)
            (lerp-scale 0.5 4.0 (vector-length s4-0) 0.0 245760.0)
            )
          (* 5.0 (seconds-per-frame))
          )
        )
      (ja :num! (seek! max (-> self anim-speed)))
      (let ((a0-13 (-> self skel root-channel 1)))
        (let ((f0-22 (-> self flap-interp)))
          (set! (-> a0-13 frame-interp 1) f0-22)
          (set! (-> a0-13 frame-interp 0) f0-22)
          )
        (set! (-> a0-13 param 0) 0.0)
        (joint-control-channel-group-eval! a0-13 (the-as art-joint-anim #f) num-func-chan)
        )
      )
    (if arg0
        (arg0)
        )
    )
  #f
  )

(defbehavior mh-bat-fly-post mh-bat ()
  (cubic-curve-method-9
    (-> self move-curve)
    (-> self root trans)
    (-> self root transv)
    (-> self event-param-point)
    (-> self target-velocity)
    )
  (let ((s5-0 (new 'stack-no-clear 'vector)))
    (new 'stack-no-clear 'vector)
    (let ((gp-0 (-> self up-vector)))
      (let ((s4-0 (-> self root transv)))
        (cubic-curve-method-11 (-> self move-curve) s4-0 0.0)
        (vector-length-max! s4-0 245760.0)
        (set! (-> s4-0 y) (fmax -61440.0 (fmin 61440.0 (-> s4-0 y))))
        (vector-v++! (-> self root trans) s4-0)
        (cubic-curve-method-12 (-> self move-curve) s5-0 0.0)
        (vector-length-max! s5-0 327680.0)
        (vector-v++! s4-0 s5-0)
        )
      (let* ((v1-13 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 (-> self rotation-matrix rvec)))
             (f0-3 (lerp-scale 9102.223 -9102.223 (vector-dot (-> self rotation-matrix fvec) v1-13) 245760.0 -245760.0))
             )
        (seek! (-> self pitch-angle) f0-3 (* 32768.0 (seconds-per-frame)))
        )
      (vector-rotate-around-axis! gp-0 *y-vector* (-> self pitch-angle) (-> self rotation-matrix rvec))
      (let* ((v1-17 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 *y-vector*))
             (f0-9 (lerp-scale -15473.777 15473.777 (vector-dot (-> self rotation-matrix rvec) v1-17) 163840.0 -163840.0))
             )
        (seek! (-> self bank-angle) f0-9 (* 10922.667 (seconds-per-frame)))
        )
      (vector-rotate-around-axis! gp-0 gp-0 (-> self bank-angle) (-> self rotation-matrix fvec))
      )
    )
  0
  (enemy-simple-post)
  (none)
  )

(defbehavior mh-bat-chase-post mh-bat ()
  (mh-bat-method-159 self)
  (mh-bat-fly-post)
  (none)
  )

(defstate dormant-aware (mh-bat)
  :virtual #t
  :trans (behavior ()
    (if (and (time-elapsed? (-> self state-time) (-> self state-timeout))
             (< (vector-vector-xz-distance (-> self root trans) (target-pos 0)) 368640.0)
             (let ((gp-1 (new 'stack-no-clear 'vector)))
               (and (and (nav-mesh-method-10 (-> self nav-mesh) gp-1 (target-pos 0) (the-as nav-poly #f))
                         (< (vector-vector-xz-distance gp-1 (target-pos 0)) 4096.0)
                         )
                    *target*
                    (focus-test? *target* pilot-riding)
                    )
               )
             )
        (go-virtual ambush)
        )
    )
  )

(defstate ambush (mh-bat)
  :virtual #t
  :enter (behavior ()
    (call-parent-state-handler enter)
    (set-time! (-> self state-time))
    (vector-copy! (-> self start-pos) (-> self root trans))
    (set-vector! (-> self root transv) 0.0 -81920.0 0.0 0.0)
    (set! (-> self orbit-angle)
          (vector-vector-angle-safe
            (vector-! (new 'stack-no-clear 'vector) (-> self focus-pos) (-> self root trans))
            *z-vector*
            )
          )
    (set! (-> self anim-speed) 0.0)
    (set! (-> self y-offset) 24576.0)
    (get-point-at-percent-along-path! (-> self path) (-> self event-param-point) 1.0 'interp)
    (vector-! (-> self target-velocity) (-> self focus-pos) (-> self event-param-point))
    (set! (-> self target-velocity y) 0.0)
    (vector-xz-normalize! (-> self target-velocity) 245760.0)
    (logclear! (-> self mask) (process-mask actor-pause))
    )
  :exit (behavior ()
    (set-scale! self 1.0)
    )
  :code (behavior ()
    (mh-bat-fly-code
      (lambda :behavior mh-bat
        ()
        (if (or (< (vector-vector-distance (-> self root trans) (-> self event-param-point)) 40960.0)
                (< (vector-length (cubic-curve-method-12 (-> self move-curve) (new 'stack-no-clear 'vector) 0.0)) 65536.0)
                )
            (go-virtual hostile)
            )
        )
      )
    )
  :post (behavior ()
    (set-scale! self (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 30.0 540.0))
    (mh-bat-fly-post)
    (let ((gp-1 (new 'stack-no-clear 'quaternion)))
      (let ((a1-2 (-> self focus-xz-dir)))
        (forward-up->quaternion gp-1 a1-2 (-> self up-vector))
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-1 (* 6.0 (seconds-per-frame)))
      )
    )
  )

(defstate retreat (mh-bat)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (vector-copy! (-> self event-param-point) (-> self start-pos))
    (vector-reset! (-> self target-velocity))
    )
  :code (behavior ()
    (mh-bat-fly-code (lambda :behavior mh-bat
                       ()
                       (when (< (vector-vector-distance (-> self root trans) (-> self start-pos)) 8192.0)
                         (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup))
                             (logior! (-> self mask) (process-mask actor-pause))
                             (logclear! (-> self mask) (process-mask actor-pause))
                             )
                         (go-dormant-aware self)
                         )
                       )
                     )
    )
  :post (behavior ()
    (set-scale! self (lerp-scale 1.0 0.0 (the float (- (current-time) (-> self state-time))) 420.0 1500.0))
    (mh-bat-fly-post)
    (let ((gp-1 (new 'stack-no-clear 'quaternion)))
      (let ((a1-2 (-> self focus-xz-dir)))
        (forward-up->quaternion gp-1 a1-2 (-> self up-vector))
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-1 (* 6.0 (seconds-per-frame)))
      )
    )
  )

(defstate stare (mh-bat)
  :virtual #t
  :trans (behavior ()
    '()
    )
  :code (behavior ()
    (mh-bat-fly-code (lambda :behavior mh-bat () (when (time-elapsed? (-> self state-time) (seconds 0.1))
                                                   (let ((gp-0 (-> self focus aware)))
                                                     (cond
                                                       ((>= 1 (the-as int gp-0))
                                                        (go-virtual retreat)
                                                        )
                                                       ((and (= gp-0 (enemy-aware hostile)) (get-focus! self))
                                                        (go-hostile self)
                                                        )
                                                       ((= gp-0 (enemy-aware flee))
                                                        (go-flee self)
                                                        )
                                                       )
                                                     )
                                                   )
                                              )
                     )
    )
  :post (behavior ()
    (let ((gp-0 (-> self target-velocity)))
      (vector-! gp-0 (-> self focus-pos) (-> self event-param-point))
      (vector-normalize! gp-0 1.0)
      (vector-cross! gp-0 gp-0 *y-vector*)
      (vector-normalize! gp-0 245760.0)
      )
    (mh-bat-chase-post)
    (let ((gp-1 (new 'stack-no-clear 'quaternion)))
      (let ((a1-6 (-> self focus-xz-dir)))
        (forward-up->quaternion gp-1 a1-6 (-> self up-vector))
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-1 (* 6.0 (seconds-per-frame)))
      )
    )
  )

(defstate hostile (mh-bat)
  :virtual #t
  :enter (behavior ()
    (call-parent-state-handler enter)
    (set! (-> self bank-angle) 0.0)
    (set! (-> self pitch-angle) 0.0)
    (set! (-> self orbit-distance) (* 4096.0 (rnd-float-range self 17.0 30.0)))
    (set! (-> self orbit-angular-speed) (* 182.04445 (rnd-float-range self 35.0 55.0)))
    )
  :code (behavior ()
    (mh-bat-fly-code
      (lambda :behavior mh-bat () (if (and (time-elapsed? (-> self state-time) (seconds 2))
                                           (time-elapsed? (-> self last-off-screen-time) (seconds 1))
                                           (get-focus! self)
                                           )
                                      (go-virtual attack-0)
                                      )
                               )
      )
    )
  :post (behavior ()
    (set! (-> self orbit-angle)
          (the float
               (sar (shl (the int (+ (-> self orbit-angle) (* (-> self orbit-angular-speed) (seconds-per-frame)))) 48) 48)
               )
          )
    (let ((gp-0 (-> self target-velocity)))
      (vector-! gp-0 (-> self focus-pos) (-> self event-param-point))
      (vector-normalize! gp-0 1.0)
      (vector-cross! gp-0 gp-0 *y-vector*)
      (vector-normalize! gp-0 245760.0)
      )
    (mh-bat-chase-post)
    (let ((gp-1 (new 'stack-no-clear 'quaternion)))
      (let ((a1-7 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self root transv) 1.0)))
        (forward-up->quaternion gp-1 a1-7 (-> self up-vector))
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-1 (* 6.0 (seconds-per-frame)))
      )
    )
  )

(defstate attack-0 (mh-bat)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    (set! (-> self orbit-distance) (* 2.0 (-> self orbit-distance)))
    (set! (-> self target-speed) 245760.0)
    )
  :trans (behavior ()
    (let ((a0-0 (-> self target-velocity)))
      (vector-! a0-0 (-> self focus-pos) (-> self event-param-point))
      (vector-normalize! a0-0 (-> self target-speed))
      )
    (seek! (-> self target-speed) 0.0 (* 245760.0 (seconds-per-frame)))
    (seek! (-> self orbit-distance) 20480.0 (* 24576.0 (seconds-per-frame)))
    )
  :code (behavior ()
    (mh-bat-fly-code (lambda :behavior mh-bat
                       ()
                       (when (time-elapsed? (-> self state-time) (seconds 0.2))
                         (if (or (>= 2 (the-as int (-> self focus aware))) (not (get-focus! self)))
                             (go-virtual hostile)
                             )
                         )
                       (if (< (acos (vector-dot (-> self focus-xz-dir) (-> self rotation-matrix fvec))) 8192.0)
                           (go-virtual attack-1)
                           )
                       )
                     )
    )
  :post (behavior ()
    (mh-bat-chase-post)
    (let ((gp-0 (new 'stack-no-clear 'quaternion)))
      (let ((s5-0 (new 'stack-no-clear 'quaternion)))
        (let ((a1-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self root transv) 1.0))
              (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> self focus-bullseye-pos) (-> self root trans)))
              )
          (forward-up->quaternion gp-0 a1-1 (-> self up-vector))
          (forward-up->quaternion s5-0 s4-1 (-> self up-vector))
          )
        (quaternion-slerp!
          gp-0
          gp-0
          s5-0
          (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 900.0)
          )
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-0 (* 6.0 (seconds-per-frame)))
      )
    )
  )

(defstate attack-1 (mh-bat)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (let ((gp-0 (new 'stack-no-clear 'matrix)))
      (let ((a1-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))))
        (matrix-f-compose gp-0 a1-1)
        )
      (vector<-cspace! (-> gp-0 trans) (joint-node mh-bat-lod0-jg jaw))
      )
    (if (logtest? (-> *part-group-id-table* 635 flags) (sp-group-flag sp13))
        (part-tracker-spawn
          part-tracker-subsampler
          :to self
          :group (-> *part-group-id-table* 635)
          :target self
          :mat-joint 36
          )
        (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 635) :target self :mat-joint 36)
        )
    )
  :trans (behavior ()
    (seek! (-> self anim-speed) 1.0 (* 4.0 (seconds-per-frame)))
    (seek! (-> self target-speed) 0.0 (* 245760.0 (seconds-per-frame)))
    (seek! (-> self orbit-distance) 20480.0 (* 24576.0 (seconds-per-frame)))
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja-no-eval :group! mh-bat-attack0-windup-ja :num! (seek! max (-> self anim-speed)) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! max (-> self anim-speed)))
      )
    (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params)))
      (let ((a2-2 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node mh-bat-lod0-jg jaw)))
            (v1-23 (-> self focus-bullseye-pos))
            )
        (set! (-> gp-0 ent) (-> self entity))
        (set! (-> gp-0 charge) 1.0)
        (set! (-> gp-0 options) (projectile-options))
        (logclear! (-> gp-0 options) (projectile-options po14 po15 po16))
        (set! (-> gp-0 notify-handle) (process->handle self))
        (set! (-> gp-0 owner-handle) (the-as handle #f))
        (set! (-> gp-0 target-handle) (the-as handle #f))
        (set! (-> gp-0 target-pos quad) (the-as uint128 0))
        (set! (-> gp-0 ignore-handle) (process->handle self))
        (let* ((a0-16 *game-info*)
               (a1-12 (+ (-> a0-16 attack-id) 1))
               )
          (set! (-> a0-16 attack-id) a1-12)
          (set! (-> gp-0 attack-id) a1-12)
          )
        (set! (-> gp-0 timeout) (seconds 4))
        (set! (-> gp-0 damage) 3.33)
        (logior! (-> gp-0 options) (projectile-options po14))
        (set! (-> gp-0 vehicle-impulse-factor) 1.5)
        (logior! (-> gp-0 options) (projectile-options po16))
        (vector-copy! (-> gp-0 pos) a2-2)
        (vector-normalize-copy! (-> gp-0 vel) (vector-! (new 'stack-no-clear 'vector) v1-23 a2-2) 532480.0)
        )
      (spawn-projectile metalhead-shot gp-0 self *default-dead-pool*)
      )
    (sound-play "mh-bat-shot")
    (ja-no-eval :group! mh-bat-attack0-ja :num! (seek! max (-> self anim-speed)) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! max (-> self anim-speed)))
      )
    (set! (-> self orbit-angle) (the float (sar (shl (the int (+ 32768.0 (-> self orbit-angle))) 48) 48)))
    (vector-normalize-copy! (-> self root transv) (-> self rotation-matrix fvec) 49152.0)
    (go-virtual hostile)
    )
  :post (behavior ()
    (mh-bat-chase-post)
    (let ((gp-0 (new 'stack-no-clear 'quaternion)))
      (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self focus-bullseye-pos) (-> self root trans))))
        (vector-normalize! s5-1 1.0)
        (forward-up->quaternion gp-0 s5-1 (-> self up-vector))
        )
      (quaternion-slerp! (-> self root quat) (-> self root quat) gp-0 (* 4.0 (seconds-per-frame)))
      )
    )
  )

(defstate knocked-recover (mh-bat)
  :virtual #t
  :exit (behavior ()
    (let ((t9-1 (-> (find-parent-state) exit)))
      (if t9-1
          (t9-1)
          )
      )
    (deactivate-ragdoll! self)
    )
  :code (behavior ()
    (cond
      ((handle->process (-> self ragdoll-proc))
       (ja-channel-push! 1 0)
       (ja-no-eval :group! mh-bat-fly-fast0-ja :num! (seek! max 2.0) :frame-num 0.0)
       (enable-ragdoll! (-> (the-as ragdoll-proc (handle->process (-> self ragdoll-proc))) ragdoll) self)
       (until (ja-done? 0)
         (suspend)
         (ja :num! (seek! max 2.0))
         )
       )
      (else
        (ja-channel-push! 1 (seconds 0.2))
        (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        )
      )
    (if (out-of-bounds? self)
        (go-die self)
        (go-hostile self)
        )
    )
  )

(defmethod mh-bat-method-158 ((this mh-bat))
  (local-vars (at-0 int) (at-1 int))
  (with-pp
    (rlet ((vf0 :class vf)
           (vf1 :class vf)
           (vf2 :class vf)
           )
      (init-vf0-vector)
      (let ((s5-0 (-> this nav-mesh))
            (v1-1 (-> this root trans))
            (gp-0 (-> this root transv))
            (s4-0 (new 'stack-no-clear 'vector))
            )
        (let ((a0-2 s4-0))
          (.lvf vf1 (&-> gp-0 quad))
          (let ((f0-0 (seconds-per-frame)))
            (.mov at-0 f0-0)
            )
          (.mov vf2 at-0)
          (.mov.vf.w vf1 vf0)
          (.mul.x.vf.xyz vf1 vf1 vf2)
          (.svf (&-> a0-2 quad) vf1)
          )
        (let ((s3-0 (new 'stack-no-clear 'nav-poly)))
          (vector-! (-> s3-0 vertex 0) v1-1 (the-as vector (-> s5-0 bounds)))
          (set! (-> s3-0 vertex1 x) 40960000.0)
          (set! (-> s3-0 data 20) (the-as uint 3))
          (let ((a2-0 (nav-mesh-method-45 s5-0 s3-0)))
            (when a2-0
              (clamp-vector-to-mesh-cross-gaps
                s5-0
                (-> s3-0 vertex 0)
                a2-0
                s4-0
                2048.0
                #f
                (the-as clamp-travel-vector-to-mesh-return-info #f)
                )
              (.lvf vf1 (&-> s4-0 quad))
              (let ((f0-2 (-> pp clock frames-per-second)))
                (.mov at-1 f0-2)
                )
              (.mov vf2 at-1)
              (.mov.vf.w vf1 vf0)
              (.mul.x.vf.xyz vf1 vf1 vf2)
              (.svf (&-> gp-0 quad) vf1)
              gp-0
              )
            )
          )
        )
      )
    )
  )

(defmethod mh-bat-method-159 ((this mh-bat))
  (let ((s5-0 (new 'stack-no-clear 'vector)))
    (vector-rotate-y! s5-0 *z-vector* (-> this orbit-angle))
    (vector-xz-normalize! s5-0 (- (-> this orbit-distance)))
    (vector+! (-> this event-param-point) (-> this focus-pos) s5-0)
    )
  (+! (-> this event-param-point y) (-> this y-offset))
  (let* ((s5-1 (new 'stack-no-clear 'vector))
         (a1-3 (nav-mesh-method-10 (-> this nav-mesh) s5-1 (-> this event-param-point) (the-as nav-poly #f)))
         )
    (cond
      (a1-3
        (vector-! s5-1 s5-1 (the-as vector (-> this nav-mesh bounds)))
        (project-point-onto-plane-of-poly-local (-> this nav-mesh) a1-3 s5-1 (new 'stack-no-clear 'vector) s5-1)
        (vector+! s5-1 s5-1 (the-as vector (-> this nav-mesh bounds)))
        (if (< (-> this event-param-point y) (+ 24576.0 (-> s5-1 y)))
            (+! (-> this y-offset) (* 57344.0 (seconds-per-frame)))
            (seek! (-> this y-offset) 24576.0 (* 32768.0 (seconds-per-frame)))
            )
        (set! (-> this event-param-point x) (-> s5-1 x))
        (set! (-> this event-param-point z) (-> s5-1 z))
        )
      (else
        (seek! (-> this y-offset) 24576.0 (* 65536.0 (seconds-per-frame)))
        )
      )
    )
  0
  (none)
  )

(defmethod set-scale! ((this mh-bat) (arg0 float))
  (set-vector! (-> this root scale) arg0 arg0 arg0 1.0)
  0
  (none)
  )

(defmethod probe-shadow ((this mh-bat))
  (cond
    ((and (-> this draw shadow)
          (zero? (-> this draw cur-lod))
          (logtest? (-> this draw status) (draw-control-status on-screen))
          )
     (when (= (logand (-> this shadow-id) 7) (logand (-> *display* frame-clock integral-frame-counter) 15))
       (new 'stack-no-clear 'vector)
       (new 'stack-no-clear 'vector)
       (let ((s4-0 (new 'stack-no-clear 'collide-query))
             (s5-0 (-> this draw shadow-ctrl settings shadow-dir))
             (f30-0 81920.0)
             )
         (vector-copy! (-> s4-0 start-pos) (-> this root trans))
         (vector-normalize-copy! (-> s4-0 move-dist) s5-0 f30-0)
         (let ((v1-17 s4-0))
           (set! (-> v1-17 radius) 3276.8)
           (set! (-> v1-17 collide-with) (collide-spec backgnd))
           (set! (-> v1-17 ignore-process0) this)
           (set! (-> v1-17 ignore-process1) #f)
           (set! (-> v1-17 ignore-pat)
                 (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
                 )
           (set! (-> v1-17 action-mask) (collide-action solid))
           )
         (let ((f0-1 (fill-and-probe-using-line-sphere *collide-cache* s4-0)))
           (cond
             ((>= f0-1 0.0)
              (let ((v1-21 (-> this draw shadow-ctrl)))
                (logclear! (-> v1-21 settings flags) (shadow-flags disable-draw))
                )
              0
              (-> s4-0 best-other-tri intersect)
              (let ((a1-3 (-> this root trans)))
                (-> a1-3 y)
                (let ((f1-2 (* f0-1 f30-0)))
                  (shadow-control-method-14
                    (-> this draw shadow-ctrl)
                    a1-3
                    s5-0
                    (fmax 32768.0 (* 409600.0 f0-1))
                    (+ -12288.0 f1-2)
                    (+ 12288.0 f1-2)
                    )
                  )
                )
              )
             (else
               (let ((v1-33 (-> this draw shadow-ctrl)))
                 (logior! (-> v1-33 settings flags) (shadow-flags disable-draw))
                 )
               0
               )
             )
           )
         )
       )
     )
    (else
      (let ((v1-36 (-> this draw shadow-ctrl)))
        (logior! (-> v1-36 settings flags) (shadow-flags disable-draw))
        )
      0
      )
    )
  0
  (none)
  )

(defmethod invalid-height? ((this mh-bat))
  "Return #t if the enemy is too high in the air, or below the ground."
  #f
  )

(defmethod update-collision-action ((this mh-bat) (arg0 int))
  "Change the collision for certain conditions (knocked, etc)"
  (let ((v1-0 arg0))
    (cond
      ((or (zero? v1-0) (= v1-0 2))
       (let ((v1-4 (-> (the-as collide-shape-prim-group (-> this root root-prim)) child 1)))
         (set! (-> v1-4 prim-core action) (collide-action))
         (set! (-> v1-4 prim-core collide-with) (collide-spec))
         )
       0
       )
      ((= v1-0 1)
       (let ((v1-8 (-> (the-as collide-shape-prim-group (-> this root root-prim)) child 1)))
         (set! (-> v1-8 prim-core action) (collide-action solid))
         (set! (-> v1-8 prim-core collide-with) (collide-spec backgnd))
         )
       )
      )
    )
  0
  (none)
  )

;; WARN: Return type mismatch ragdoll-flag vs vector.
(defmethod ragdoll-spawn! ((this mh-bat) (arg0 symbol) (arg1 symbol))
  "If possible, spawn ragdoll and start using it."
  (let ((t9-0 (method-of-type enemy ragdoll-spawn!)))
    (t9-0 this arg0 arg1)
    )
  (the-as
    vector
    (when (-> this enemy-info ragdoll-info)
      (let ((v1-4 (handle->process (-> this ragdoll-proc))))
        (when v1-4
          (let ((v0-1 (logior (-> (the-as ragdoll-proc v1-4) ragdoll ragdoll-flags) (ragdoll-flag rf11))))
            (set! (-> (the-as ragdoll-proc v1-4) ragdoll ragdoll-flags) v0-1)
            v0-1
            )
          )
        )
      )
    )
  )

(defmethod enemy-common-post ((this mh-bat))
  "Common implementation of post. Runs ja-post."
  (if (not (logtest? (-> this draw status) (draw-control-status on-screen)))
      (set-time! (-> this last-off-screen-time))
      )
  (quaternion->matrix (-> this rotation-matrix) (-> this root quat))
  (when (< 1 (the-as int (-> this focus aware)))
    (let ((s5-0 (the-as process-focusable (handle->process (-> this focus handle)))))
      (when s5-0
        (vector-copy! (-> this focus-pos) (get-trans s5-0 0))
        (vector-copy! (-> this focus-bullseye-pos) (get-trans s5-0 3))
        (vector-! (-> this focus-xz-dir) (-> this focus-pos) (-> this root trans))
        (set! (-> this focus-xz-dir y) 0.0)
        (vector-xz-normalize! (-> this focus-xz-dir) 1.0)
        )
      )
    )
  (probe-shadow this)
  ((method-of-type enemy enemy-common-post) this)
  (none)
  )

(defmethod event-handler ((this mh-bat) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  "Commmon handler for events."
  (case arg2
    (('hit 'hit-knocked)
     (logclear! (-> this mask) (process-mask actor-pause))
     (logclear! (-> this focus-status) (focus-status dangerous))
     (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance))
     (logior! (-> this enemy-flags) (enemy-flag alert))
     (logior! (-> this focus-status) (focus-status hit))
     (if (= (-> this hit-points) 0.0)
         (logior! (-> this focus-status) (focus-status dead))
         )
     (logclear! (-> this enemy-flags) (enemy-flag lock-focus))
     (focus-on-attacker! this)
     (logior! (-> this enemy-flags) (enemy-flag lock-focus))
     (process-contact-action arg0)
     (send-event arg0 'get-attack-count 1)
     (freeze-hit-begin)
     (go (method-of-object this knocked))
     )
    (('event-flap)
     (sound-play-by-name
       (static-sound-name "mh-wing-flap")
       (new-sound-id)
       (the int (* 1024.0 (-> this flap-interp)))
       0
       0
       (sound-group)
       (-> this root trans)
       )
     )
    (else
      (call-parent-method this arg0 arg1 arg2 arg3)
      )
    )
  )

(defmethod get-inv-mass ((this mh-bat))
  0.5
  )

(defmethod coin-flip? ((this mh-bat))
  "Return #t half the time, #f the other."
  #f
  )

(defmethod init-enemy! ((this mh-bat))
  "Typical place for shared init code. Runs from entity or process style init."
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-mh-bat" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (setup-enemy! this *mh-bat-enemy-info*)
  (set-scale! this 1.0)
  (set! (-> this root pause-adjust-distance) 368640.0)
  (let ((v1-9 (-> this neck)))
    (set! (-> v1-9 up) (the-as uint 1))
    (set! (-> v1-9 nose) (the-as uint 2))
    (set! (-> v1-9 ear) (the-as uint 0))
    (set-vector! (-> v1-9 twist-max) 11832.889 15473.777 0.0 1.0)
    (set! (-> v1-9 ignore-angle) 30947.555)
    )
  (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0))
  (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
  (set! (-> this nav-mesh) (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0))
  (if (not (-> this nav-mesh))
      (go process-drawable-art-error "no nav-mesh")
      )
  (let ((s5-1 (new 'static 'boxed-array :type uint32 #x8 #xb #x1f #x22)))
    (dotimes (s4-1 (-> s5-1 length))
      (let ((s3-0 (-> this node-list data (-> s5-1 s4-1))))
        (set! (-> s3-0 param0) (lambda ((arg0 cspace) (arg1 transformq))
                                 (let ((f0-0 (the-as float (-> arg0 param1))))
                                   (vector-float*! (-> arg1 scale) (-> arg1 scale) f0-0)
                                   )
                                 (cspace<-parented-transformq-joint! arg0 arg1)
                                 (none)
                                 )
              )
        (set! (-> s3-0 param1) (the-as basic (rnd-float-range this 0.02 0.4)))
        )
      )
    )
  (if (not (task-node-closed? (game-task-node nest-eggs-resolution)))
      (logior! (-> this mask) (process-mask no-kill))
      )
  (let ((s5-2 (new 'static 'array int32 4 0 0 0 0)))
    (set! (-> this shadow-id) (-> s5-2 0))
    (+! (-> s5-2 0) (rand-vu-int-range 5 10))
    )
  (set-vector! (-> this draw color-emissive) 0.1 0.1 0.1 0.0)
  (set! (-> this flap-interp) 0.0)
  0
  (none)
  )
