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

;; name: spydroid-orig.gc
;; name in dgo: spydroid-orig
;; dgos: SEA, FACTORYA

;; +++spydroid-orig-flag
(defenum spydroid-orig-flag
  :type uint64
  :bitfield #t
  (sof0 0)
  (sof1 1)
  (sof2 2)
  )
;; ---spydroid-orig-flag


;; DECOMP BEGINS

(defpartgroup group-spydroid-orig-trail
  :id 1521
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 4976 :fade-after (meters 120) :falloff-to (meters 160))
    (sp-item 4977 :flags (sp6))
    (sp-item 4978 :fade-after (meters 120) :falloff-to (meters 160))
    )
  )

(defpart 4977
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:y (meters 0.5))
    (:scale-x (meters 1.7) (meters 1))
    (:rot-x (degrees 11.25))
    (:rot-z (degrees -17) (degrees 17))
    (:scale-y :copy scale-x)
    (:r 0.0)
    (:g 192.0 64.0)
    (:b 255.0)
    (:a 16.0)
    (:omega (degrees 6761.25))
    (:fade-a -1.0666667)
    (:timer (seconds 0.035))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 3072.0)
    )
  )

(defpart 4978
  :init-specs ((:texture (motion-blur-part level-default-sprite))
    (:num 2.0 2.0)
    (:scale-x (meters 2.5))
    (:rot-x 4)
    (:scale-y (meters 0.033))
    (:r 128.0)
    (:g 255.0)
    (:b 255.0)
    (:a 128.0)
    (:omega (degrees 0.03375))
    (:vel-y (meters 0.06666667) (meters 0.06666667))
    (:fade-r -8.0)
    (:fade-g -0.85 -0.85)
    (:fade-a -0.10666667 -0.42666668)
    (:accel-y (meters -0.0016666667) (meters -0.00066666666))
    (:friction 0.96)
    (:timer (seconds 1) (seconds 0.997))
    (:flags (sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:conerot-x (degrees 135) (degrees 90))
    (:conerot-y (degrees 0) (degrees 3600))
    (:conerot-radius (meters -0.5))
    )
  )

(defpart 4976
  :init-specs ((:texture (bigpuff level-default-sprite))
    (:num 2.5 1.0)
    (:scale-x (meters 1.2) (meters 0.8))
    (:rot-z (degrees 0) (degrees 3600))
    (:scale-y :copy scale-x)
    (:r 0.0)
    (:g 128.0)
    (:b 255.0)
    (:a 64.0 8.0)
    (:vel-x (meters -0.0033333334) (meters 0.006666667))
    (:vel-y (meters -0.006666667) (meters -0.006666667))
    (:vel-z (meters -0.0033333334) (meters 0.006666667))
    (:scalevel-x (meters 0.006666667) (meters 0.008333334))
    (:rotvel-z (degrees -0.3) (degrees 0.6))
    (:scalevel-y :copy scalevel-x)
    (:fade-r 3.2)
    (:fade-g 0.0)
    (:fade-b -3.2)
    (:fade-a -0.8)
    (:accel-y (meters 0.0001) (meters 0.000033333334))
    (:friction 0.99)
    (:timer (seconds 2))
    (:flags (sp-cpuinfo-flag-2))
    (:userdata :data (new 'static 'boxed-array :type int32 40 1 0 #x400000 #x400000 #x400700))
    (:next-time (seconds 0.135))
    (:next-launcher 4979)
    )
  )

(defpart 4979
  :init-specs ((:r 128.0)
    (:g 128.0)
    (:b 128.0)
    (:fade-r 0.0)
    (:fade-g 0.0)
    (:fade-b 0.0)
    (:fade-a -0.10666667 -0.21333334)
    (:func 'nothing)
    )
  )

(defpartgroup group-spydroid-orig-explode
  :id 1522
  :duration (seconds 3)
  :linger-duration (seconds 1)
  :flags (sp0)
  :bounds (static-bspherem 0 0 0 15)
  :parts ((sp-item 4980 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 4981 :flags (sp6) :period (seconds 3) :length (seconds 0.017))
    (sp-item 4982 :period (seconds 3) :length (seconds 0.05))
    (sp-item 4983 :fade-after (meters 60) :period (seconds 3) :length (seconds 0.035) :offset 10)
    (sp-item 4984 :fade-after (meters 60) :falloff-to (meters 60) :period (seconds 3) :length (seconds 0.167) :offset 20)
    (sp-item 4985 :fade-after (meters 200) :falloff-to (meters 200) :period (seconds 3) :length (seconds 0.085) :offset 20)
    (sp-item 4986 :fade-after (meters 150) :falloff-to (meters 150) :period (seconds 3) :length (seconds 0.067) :offset 30)
    )
  )

(defpart 4981
  :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 -8.5)
    (: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 4987)
    )
  )

(defpart 4987
  :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 4986
  :init-specs ((:texture (explosion-wave factoryc-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))
    (:next-time (seconds 0.085))
    (:next-launcher 4988)
    (:conerot-x '*sp-temp*)
    )
  )

(defpart 4985
  :init-specs ((:texture (explosion-nebula level-default-sprite))
    (:num 1.0 0.2)
    (: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))
    (:next-time (seconds 0.085))
    (:next-launcher 4988)
    (:conerot-x (degrees 0) (degrees 360))
    )
  )

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

(defpart 4989
  :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 4990)
    )
  )

(defpart 4990
  :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 4991)
    )
  )

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

(defpart 4980
  :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 4992)
    )
  )

(defpart 4992
  :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 4984
  :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 4993)
    (:conerot-x (degrees 0) (degrees 360))
    )
  )

(defpart 4993
  :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 4994)
    )
  )

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

(defpart 4982
  :init-specs ((:texture (bigpuff level-default-sprite))
    (:num 2.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 4995)
    (:conerot-x (degrees -1440) (degrees 2880))
    )
  )

(defpart 4995
  :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 4996)
    )
  )

(defpart 4996
  :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 4983
  :init-specs ((:texture (flamingstick factoryc-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))
    )
  )

(defpart 4997
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 0.75))
    (:rot-x (degrees 1.125))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 0.0)
    (:b 0.0)
    (:a 16.0)
    (:omega (degrees 1361.25))
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 409.6)
    )
  )

(defpart 4998
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 0.5))
    (:rot-x (degrees 1.125))
    (:scale-y :copy scale-x)
    (:r 0.0)
    (:g 128.0 64.0)
    (:b 255.0)
    (:a 16.0 4.0)
    (:omega (degrees 1361.25))
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 409.6)
    )
  )

(defpart 4999
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 2) (meters 0.2))
    (:rot-x (degrees 1.125))
    (:rot-z (degrees -2) (degrees 4))
    (:scale-y :copy scale-x)
    (:r 0.0)
    (:g 128.0 64.0)
    (:b 255.0)
    (:a 6.0 2.0)
    (:omega (degrees 1811.25))
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 409.6)
    )
  )

(defpart 5000
  :init-specs ((:texture (glow level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 0.75) (meters 0.1))
    (:rot-x (degrees 1.125))
    (:rot-z (degrees -2) (degrees 4))
    (:scale-y :copy scale-x)
    (:r 64.0)
    (:g 128.0 64.0)
    (:b 255.0)
    (:a 32.0 4.0)
    (:omega (degrees 1811.25))
    (:timer (seconds 0.017))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 409.6)
    )
  )

(defskelgroup skel-spydroid-orig spydroid-orig spydroid-orig-lod0-jg spydroid-orig-idle-ja
              ((spydroid-orig-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 4)
              :shadow spydroid-orig-shadow-mg
              )

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

(define *spydroid-orig-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 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 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 21 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 22 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 25 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 26 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 27 :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 23 :parent-joint-index -1)
      )
    :collide-spec (collide-spec backgnd obstacle hit-by-others-list)
    )
  )

(deftype spydroid-orig (nav-enemy)
  ((old-y-deg     float)
   (diff-angle    float)
   (flags         spydroid-orig-flag)
   (lightning     lightning-control  4)
   (floor         float)
   (explode-part  sparticle-launch-control)
   )
  (:state-methods
    attack
    explode
    )
  )


(define *fact-info-spydroid-orig-defaults* (new 'static 'fact-info-enemy-defaults :idle-distance (meters 80)))

(define *spydroid-orig-nav-enemy-info*
  (new 'static 'nav-enemy-info
    :use-die-falling #t
    :use-victory #f
    :use-jump-blocked #f
    :debug-draw-neck #f
    :jump-debug-draw #f
    :move-to-ground #t
    :hover-if-no-ground #f
    :idle-anim-script (new 'static 'inline-array idle-control-frame 3
      (new 'static 'idle-control-frame :command (idle-control-cmd push) :param0 30)
      (new 'static 'idle-control-frame
        :command (idle-control-cmd play)
        :anim #x3
        :param0 100
        :param1 100
        :param2 '((new 'static 'bfloat :data 1.0) (new 'static 'bfloat :data 1.0))
        )
      (new 'static 'idle-control-frame)
      )
    :idle-anim 3
    :notice-anim 3
    :hostile-anim 5
    :hit-anim 15
    :knocked-anim 11
    :knocked-land-anim 12
    :die-anim 15
    :die-falling-anim 15
    :victory-anim -1
    :jump-wind-up-anim 8
    :jump-in-air-anim 9
    :jump-land-anim 10
    :neck-joint 4
    :look-at-joint 4
    :bullseye-joint 4
    :sound-hit (static-sound-name "spydroid-orig-h")
    :sound-die (static-sound-name "droid-explode")
    :notice-distance (meters 200)
    :notice-distance-delta (meters 10)
    :proximity-notice-distance (meters 20)
    :default-hit-points 1.0
    :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list)
    :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.5)
    :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.1)
    :knocked-recover-timeout (seconds 2)
    :ragdoll-blend-out-time (seconds 0.25)
    :ragdoll-rotate-velocity-mult 1.0
    :jump-height-min (meters 3)
    :jump-height-factor 0.5
    :knocked-seek-ry-clamp 6371.5557
    :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 #f
    :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
    :callback-info #f
    :use-momentum #t
    :use-frustration #t
    :use-stop-chase #f
    :use-circling #t
    :use-pacing #t
    :walk-anim 4
    :turn-anim -1
    :run-anim 5
    :taunt-anim -1
    :run-travel-speed (meters 8)
    :run-acceleration (meters 32)
    :run-turning-acceleration (meters 40)
    :walk-travel-speed (meters 4)
    :walk-acceleration (meters 16)
    :walk-turning-acceleration (meters 40)
    :maximum-rotation-rate (degrees 360)
    :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! (-> *spydroid-orig-nav-enemy-info* fact-defaults) *fact-info-spydroid-orig-defaults*)

(defmethod enemy-common-post ((this spydroid-orig))
  "Common implementation of post. Runs ja-post."
  (let ((t9-0 (method-of-type nav-enemy enemy-common-post)))
    (t9-0 this)
    )
  (when (< (-> this root scale x) 1.0)
    (let ((f0-2 (fmin 1.0 (+ 0.025 (-> this root scale x)))))
      (set-vector! (-> this root scale) f0-2 f0-2 f0-2 1.0)
      )
    )
  (when (logtest? (-> this flags) (spydroid-orig-flag sof0))
    (let ((s5-0 (new 'stack-no-clear 'vector))
          (s4-0 (new 'stack-no-clear 'vector))
          )
      (vector<-cspace! s5-0 (-> this node-list data 12))
      (dotimes (s3-0 4)
        (let ((a0-4 (-> this lightning s3-0))
              (v1-15 s5-0)
              )
          (set! (-> a0-4 state meet data 0 quad) (-> v1-15 quad))
          )
        (let ((v1-17 s3-0))
          (cond
            ((zero? v1-17)
             (vector<-cspace! s4-0 (-> this node-list data 16))
             )
            ((= v1-17 1)
             (vector<-cspace! s4-0 (-> this node-list data 20))
             )
            ((= v1-17 2)
             (vector<-cspace! s4-0 (-> this node-list data 28))
             )
            (else
              (vector<-cspace! s4-0 (-> this node-list data 24))
              )
            )
          )
        (let ((a0-13 (-> this lightning s3-0))
              (v1-28 s4-0)
              )
          (vector-copy! (-> a0-13 state meet data (+ (-> a0-13 state points-to-draw) -1)) v1-28)
          )
        (when (not (and (-> this next-state) (let ((v1-33 (-> this next-state name)))
                                               (or (= v1-33 'die-falling) (= v1-33 'explode))
                                               )
                        )
                   )
          (let ((v1-38 (-> this lightning s3-0 state mode)))
            (when (or (zero? v1-38) (= v1-38 3))
              (let ((v1-42 (-> this lightning s3-0))
                    (a0-20 1)
                    )
                (let ((a1-11 (!= a0-20 (-> v1-42 state mode))))
                  (case a0-20
                    ((3)
                     (if a1-11
                         (set! (-> v1-42 state counter) 0.0)
                         )
                     )
                    ((1)
                     (set! (-> v1-42 state start-color) (-> v1-42 spec start-color))
                     (set! (-> v1-42 state end-color) (-> v1-42 spec end-color))
                     )
                    )
                  )
                (set! (-> v1-42 state mode) (the-as uint a0-20))
                )
              )
            )
          )
        )
      )
    )
  (let ((f0-5 (quaternion-y-angle (-> this root quat))))
    (set! (-> this diff-angle) (- (-> this old-y-deg) f0-5))
    (cond
      ((< 32768.0 (-> this diff-angle))
       (+! (-> this diff-angle) -65536.0)
       )
      ((< (-> this diff-angle) -32768.0)
       (+! (-> this diff-angle) 65536.0)
       )
      )
    (set! (-> this old-y-deg) f0-5)
    )
  (if (< (+ 0.5 (/ (-> this nav state speed) METER_LENGTH)) (* 0.005493164 (fabs (-> this diff-angle))))
      (logior! (-> this flags) (spydroid-orig-flag sof1))
      (logclear! (-> this flags) (spydroid-orig-flag sof1))
      )
  (if (and (< (-> this root trans y) (+ -122880.0 (-> this floor)))
           (-> this next-state)
           (= (-> this next-state name) 'jump)
           )
      (deactivate this)
      )
  (if (and (-> this next-state) (= (-> this next-state name) 'jump))
      (spawn (-> this part) (-> this root trans))
      )
  0
  (none)
  )

(defmethod event-handler ((this spydroid-orig) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  "Commmon handler for events."
  (local-vars (v1-8 structure) (sv-144 vector))
  (rlet ((vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         )
    (init-vf0-vector)
    (case arg2
      (('touch 'bonk 'attack)
       (cond
         ((logtest? (-> this flags) (spydroid-orig-flag sof0))
          (set! sv-144 (the-as vector (send-event (ppointer->process (-> this parent)) 'widow-get-center)))
          (let ((s0-0 (as-type arg0 process-drawable)))
            (let ((v1-7 sv-144))
              (b! (not v1-7) cfg-16 :likely-delay (set! v1-8 sv-144))
              )
            (set! v1-8 s0-0)
            (label cfg-16)
            (cond
              (v1-8
                (let ((v1-12 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144))
                      (s1-1 (new 'stack-no-clear 'vector))
                      )
                  (set! (-> s1-1 x) (- (-> v1-12 z)))
                  (set! (-> s1-1 y) 0.0)
                  (set! (-> s1-1 z) (-> v1-12 x))
                  (set! (-> s1-1 w) 1.0)
                  (let ((v1-15
                          (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s0-0) root trans) (-> this root trans))
                          )
                        )
                    (set! (-> s1-1 y) 0.0)
                    (set! (-> v1-15 y) 0.0)
                    (if (< (vector-dot v1-15 s1-1) 0.0)
                        (vector-negate! s1-1 s1-1)
                        )
                    )
                  (vector-normalize! s1-1 16384.0)
                  (vector+! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans))
                  (vector-! s1-1 s1-1 sv-144)
                  (set! (-> s1-1 y) 0.0)
                  (vector-normalize! s1-1 204800.0)
                  (let ((v1-20 s1-1))
                    (let ((a0-19 s1-1))
                      (.mov.vf.w vf6 vf0)
                      (.lvf vf4 (&-> a0-19 quad))
                      )
                    (.lvf vf5 (&-> sv-144 quad))
                    (.add.vf.xyz vf6 vf4 vf5)
                    (.svf (&-> v1-20 quad) vf6)
                    )
                  (vector-! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans))
                  (set! (-> s1-1 y) 8192.0)
                  (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id))
                                                                                                  (damage 2.0)
                                                                                                  (vehicle-damage-factor 1.0)
                                                                                                  (vehicle-impulse-factor 1.0)
                                                                                                  (mode 'shock)
                                                                                                  (vector s1-1)
                                                                                                  )
                                                                  )
                              )
                  )
                )
              ((and s0-0 (= (-> s0-0 type) target))
               (send-event arg0 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id))
                                                                                               (damage 2.0)
                                                                                               (vehicle-damage-factor 1.0)
                                                                                               (vehicle-impulse-factor 1.0)
                                                                                               (mode 'shock)
                                                                                               (shove-up (meters 2))
                                                                                               (shove-back (meters 4))
                                                                                               )
                                                               )
                           )
               )
              )
            )
          (let ((v1-36 (the-as object (-> arg3 param 1))))
            (if (or (!= arg0 *target*)
                    (and (= arg2 'attack)
                         (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-36) mask))
                         (logtest? (penetrate vehicle dark-bomb) (-> (the-as attack-info v1-36) penetrate-using))
                         )
                    )
                ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3)
                )
            )
          )
         (else
           ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3)
           )
         )
       )
      (('jump)
       (set! (-> this floor) (-> (the-as vector (-> arg3 param 1)) y))
       ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3)
       )
      (('use-lightning)
       (cond
         ((-> arg3 param 0)
          (let ((v0-7 (the-as object (logior (-> this flags) (spydroid-orig-flag sof0)))))
            (set! (-> this flags) (the-as spydroid-orig-flag v0-7))
            v0-7
            )
          )
         (else
           (logclear! (-> this flags) (spydroid-orig-flag sof0))
           (dotimes (v1-47 4)
             (let ((a0-56 (-> this lightning v1-47 state mode)))
               (cond
                 ((or (zero? a0-56) (= a0-56 3))
                  )
                 (else
                   (let ((a0-60 (-> this lightning v1-47))
                         (a1-28 3)
                         )
                     (let ((a2-9 (!= a1-28 (-> a0-60 state mode))))
                       (case a1-28
                         ((3)
                          (if a2-9
                              (set! (-> a0-60 state counter) 0.0)
                              )
                          )
                         ((1)
                          (set! (-> a0-60 state start-color) (-> a0-60 spec start-color))
                          (set! (-> a0-60 state end-color) (-> a0-60 spec end-color))
                          )
                         )
                       )
                     (set! (-> a0-60 state mode) (the-as uint a1-28))
                     )
                   )
                 )
               )
             )
           #f
           )
         )
       )
      (('impact-impulse)
       (let ((v1-49 (the-as object (-> arg3 param 0))))
         (when (< 4096.0 (-> (the-as rigid-body-impact v1-49) impulse))
           (logior! (-> this root penetrated-by) (penetrate vehicle))
           (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1))
           (set! (-> this hit-points) 0.0)
           (send-event arg0 'lawsuit (-> this root trans))
           (go (method-of-object this explode))
           #t
           )
         )
       )
      (('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)
       (cond
         ((or (= (-> this hit-points) 0.0) (nonzero? (-> this fated-time)))
          (on-dying this)
          (go (method-of-object this explode))
          )
         (else
           (go (method-of-object this knocked))
           )
         )
       #t
       )
      (else
        ((method-of-type nav-enemy event-handler) this arg0 arg1 arg2 arg3)
        )
      )
    )
  )

(defstate explode (spydroid-orig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (send-event self 'death-start)
    (sound-play "droid-explode")
    (let ((v1-5 (-> self root root-prim)))
      (set! (-> v1-5 prim-core collide-as) (collide-spec))
      (set! (-> v1-5 prim-core collide-with) (collide-spec))
      )
    0
    (logior! (-> self draw status) (draw-control-status no-draw))
    (set! (-> self root root-prim local-sphere w) 491520.0)
    (when (logtest? (-> self flags) (spydroid-orig-flag sof0))
      (dotimes (v1-16 4)
        (let ((a0-7 (-> self lightning v1-16))
              (a1-2 3)
              )
          (let ((a2-2 (!= a1-2 (-> a0-7 state mode))))
            (case a1-2
              ((3)
               (if a2-2
                   (set! (-> a0-7 state counter) 0.0)
                   )
               )
              ((1)
               (set! (-> a0-7 state start-color) (-> a0-7 spec start-color))
               (set! (-> a0-7 state end-color) (-> a0-7 spec end-color))
               )
              )
            )
          (set! (-> a0-7 state mode) (the-as uint a1-2))
          )
        )
      )
    (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0))))
      (process-spawn
        joint-exploder
        (art-group-get-by-name *level* "skel-spydroid-orig-exploding" (the-as (pointer level) #f))
        20
        gp-1
        *spydroid-orig-exploder-params*
        :name "joint-exploder"
        :to self
        )
      )
    (let ((v1-25 (new 'stack-no-clear 'vector)))
      (vector-copy! v1-25 (-> self root trans))
      (cond
        ((logtest? (-> *part-group-id-table* 219 flags) (sp-group-flag sp13))
         (vector-copy! (-> *launch-matrix* trans) v1-25)
         (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 219))
         )
        (else
          (vector-copy! (-> *launch-matrix* trans) v1-25)
          (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 219))
          )
        )
      )
    (let ((gp-4 (-> self child)))
      (while gp-4
        (send-event (ppointer->process gp-4) 'notice 'die)
        (set! gp-4 (-> gp-4 0 brother))
        )
      )
    )
  :trans (behavior ()
    (when (not (-> self child))
      (cleanup-for-death self)
      (deactivate self)
      )
    )
  :code sleep-code
  )

(defstate die-falling (spydroid-orig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy die-falling) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (set-time! (-> self state-time))
    (send-event self 'death-start)
    )
  :trans (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy die-falling) trans)))
      (if t9-0
          (t9-0)
          )
      )
    (if (not (time-elapsed? (-> self state-time) (seconds 2)))
        (spawn (-> self explode-part) (-> self root trans))
        )
    )
  :code (behavior ()
    (when (logtest? (-> self flags) (spydroid-orig-flag sof0))
      (dotimes (v1-3 4)
        (let ((a0-2 (-> self lightning v1-3))
              (a1-0 3)
              )
          (let ((a2-1 (!= a1-0 (-> a0-2 state mode))))
            (case a1-0
              ((3)
               (if a2-1
                   (set! (-> a0-2 state counter) 0.0)
                   )
               )
              ((1)
               (set! (-> a0-2 state start-color) (-> a0-2 spec start-color))
               (set! (-> a0-2 state end-color) (-> a0-2 spec end-color))
               )
              )
            )
          (set! (-> a0-2 state mode) (the-as uint a1-0))
          )
        )
      )
    (suspend)
    (ja-channel-set! 0)
    (suspend-for (seconds 1)
      )
    (send-event self 'death-end)
    (let ((gp-1 (-> self child)))
      (while gp-1
        (send-event (ppointer->process gp-1) 'notice 'die)
        (set! gp-1 (-> gp-1 0 brother))
        )
      )
    (while (-> self child)
      (suspend)
      )
    (cleanup-for-death self)
    )
  )

(defstate attack (spydroid-orig)
  :virtual #t
  :event enemy-event-handler
  :enter (behavior ()
    (logclear! (-> self flags) (spydroid-orig-flag sof2))
    (logior! (-> self enemy-flags) (enemy-flag lock-focus))
    (let ((v1-4 (-> self nav)))
      (set! (-> v1-4 target-speed) (+ 8192.0 (-> self enemy-info run-travel-speed)))
      )
    0
    (let ((v1-7 (-> self nav state)))
      (set! (-> v1-7 speed) (+ 8192.0 (-> self enemy-info run-travel-speed)))
      )
    0
    (let ((v1-9 (-> self nav)))
      (set! (-> v1-9 turning-acceleration) (* 4.0 (-> self enemy-info run-turning-acceleration)))
      )
    0
    (set! (-> self root penetrate-using) (penetrate generic-attack lunge))
    (reset-penetrate-later! self)
    (let* ((v1-14 *game-info*)
           (a0-11 (+ (-> v1-14 attack-id) 1))
           )
      (set! (-> v1-14 attack-id) a0-11)
      (set! (-> self attack-id) a0-11)
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! spydroid-orig-attack-jump-ja :num! min)
    )
  :exit (behavior ()
    (logclear! (-> self enemy-flags) (enemy-flag lock-focus))
    (nav-enemy-method-179 self)
    ;; og:preserve-this fix potential use-after-free bug
    (if (-> self nav)
      (let ((v1-4 (-> self nav)))
        (set! (-> v1-4 target-speed) (-> self enemy-info run-travel-speed))
        )
      )
    0
    (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
        (logior! (-> self focus-status) (focus-status dangerous))
        (logclear! (-> self focus-status) (focus-status dangerous))
        )
    )
  :trans (behavior ()
    (reset-penetrate-later! self)
    nav-state
    (if (logtest? (-> self enemy-flags) (enemy-flag victory))
        (logior! (-> self flags) (spydroid-orig-flag sof2))
        )
    (let ((v1-10 (ja-group)))
      (cond
        ((and v1-10 (= v1-10 spydroid-orig-attack-jump-ja))
         (ja :num! (seek!))
         (if (and (< 4.0 (ja-aframe-num 0)) (not (logtest? (-> self flags) (spydroid-orig-flag sof0))))
             (logior! (-> self focus-status) (focus-status dangerous))
             )
         (when (ja-done? 0)
           (let ((v1-28 (-> self nav)))
             (set! (-> v1-28 target-speed) 0.0)
             )
           0
           (let ((v1-30 (-> self nav)))
             (set! (-> v1-30 acceleration) 262144.0)
             )
           0
           (let ((v1-32 (-> self nav)))
             (set! (-> v1-32 turning-acceleration) 0.0)
             )
           0
           (ja :group! spydroid-orig-attack-land-ja :num! min)
           (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
               (logior! (-> self focus-status) (focus-status dangerous))
               (logclear! (-> self focus-status) (focus-status dangerous))
               )
           )
         )
        (else
          (let ((v1-45 (ja-group)))
            (cond
              ((and v1-45 (= v1-45 spydroid-orig-attack-land-ja))
               (ja :num! (seek!))
               (cond
                 ((ja-done? 0)
                  (go-hostile self)
                  )
                 ((not (logtest? (-> self flags) (spydroid-orig-flag sof1)))
                  )
                 ((< 0.0 (-> self diff-angle))
                  (ja-channel-push! 1 (seconds 0.1))
                  (ja :group! spydroid-orig-turn-left-ja :num! min)
                  )
                 (else
                   (ja-channel-push! 1 (seconds 0.1))
                   (ja :group! spydroid-orig-turn-right-ja :num! min)
                   )
                 )
               )
              ((let ((v1-69 (ja-group)))
                 (and (and v1-69 (= v1-69 spydroid-orig-turn-left-ja))
                      (and (logtest? (-> self flags) (spydroid-orig-flag sof1)) (< 0.0 (-> self diff-angle)))
                      )
                 )
               (ja :num! (loop! (* 0.0019975142 (-> self diff-angle))))
               )
              (else
                (let ((v1-80 (ja-group)))
                  (if (and (and v1-80 (= v1-80 spydroid-orig-turn-right-ja))
                           (and (logtest? (-> self flags) (spydroid-orig-flag sof1)) (< (-> self diff-angle) 0.0))
                           )
                      (ja :num! (loop! (* -0.0019975142 (-> self diff-angle))))
                      (go-hostile self)
                      )
                  )
                )
              )
            )
          )
        )
      )
    )
  :code sleep-code
  :post nav-enemy-chase-post
  )

(defstate notice (spydroid-orig)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy notice) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (go-state-for-focused self)
    )
  )

(defstate hostile (spydroid-orig)
  :virtual #t
  :trans (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans)))
      (if t9-0
          (t9-0)
          )
      )
    (let ((a0-1 (handle->process (-> self focus handle))))
      (if (and (time-elapsed? (-> self state-time) (-> self reaction-time))
               (and a0-1
                    (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans)))
                          (f1-0 16384.0)
                          )
                      (< f0-0 (* f1-0 f1-0))
                      )
                    )
               )
          (go-virtual attack)
          )
      )
    (cond
      ((not (logtest? (-> self flags) (spydroid-orig-flag sof1)))
       (let ((v1-24 (ja-group)))
         (when (not (and v1-24 (= v1-24 (-> self draw art-group data (-> self enemy-info hostile-anim)))))
           (ja-channel-push! 1 (seconds 0.1))
           (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim)) :num! min)
           )
         )
       (ja :num! (loop! (/ (-> self nav state speed) (/ (-> self enemy-info run-travel-speed) 2))))
       )
      ((< 0.0 (-> self diff-angle))
       (let ((v1-44 (ja-group)))
         (cond
           ((not (and v1-44 (= v1-44 spydroid-orig-turn-left-ja)))
            (ja-channel-push! 1 (seconds 0.1))
            (ja :group! spydroid-orig-turn-left-ja :num! min)
            )
           (else
             (ja :num! (loop! (* 0.0019975142 (-> self diff-angle))))
             )
           )
         )
       )
      (else
        (let ((v1-56 (ja-group)))
          (cond
            ((not (and v1-56 (= v1-56 spydroid-orig-turn-right-ja)))
             (ja-channel-push! 1 (seconds 0.1))
             (ja :group! spydroid-orig-turn-right-ja :num! min)
             )
            (else
              (ja :num! (loop! (* -0.0019975142 (-> self diff-angle))))
              )
            )
          )
        )
      )
    )
  :code (behavior ()
    (until #f
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    #f
    )
  )

(defstate circling (spydroid-orig)
  :virtual #t
  :trans (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy circling) trans)))
      (if t9-0
          (t9-0)
          )
      )
    (cond
      ((not (logtest? (-> self flags) (spydroid-orig-flag sof1)))
       (let ((v1-8 (ja-group)))
         (when (not (and v1-8 (= v1-8 (-> self draw art-group data (-> self enemy-info walk-anim)))))
           (ja-channel-push! 1 (seconds 0.1))
           (ja :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! min)
           )
         )
       (ja :num! (loop! (/ (-> self nav state speed) (/ (-> self enemy-info run-travel-speed) 2))))
       )
      ((< 0.0 (-> self diff-angle))
       (let ((v1-28 (ja-group)))
         (cond
           ((not (and v1-28 (= v1-28 spydroid-orig-turn-left-ja)))
            (ja-channel-push! 1 (seconds 0.1))
            (ja :group! spydroid-orig-turn-left-ja :num! min)
            )
           (else
             (ja :num! (loop! (* 0.0019975142 (-> self diff-angle))))
             )
           )
         )
       )
      (else
        (let ((v1-40 (ja-group)))
          (cond
            ((not (and v1-40 (= v1-40 spydroid-orig-turn-right-ja)))
             (ja-channel-push! 1 (seconds 0.1))
             (ja :group! spydroid-orig-turn-right-ja :num! min)
             )
            (else
              (ja :num! (loop! (* -0.0019975142 (-> self diff-angle))))
              )
            )
          )
        )
      )
    )
  :code (behavior ()
    (nav-enemy-method-176 self)
    (until #f
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    #f
    )
  )

(defstate pacing (spydroid-orig)
  :virtual #t
  :trans (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy pacing) trans)))
      (if t9-0
          (t9-0)
          )
      )
    (cond
      ((not (logtest? (-> self flags) (spydroid-orig-flag sof1)))
       (let ((v1-8 (ja-group)))
         (when (not (and v1-8 (= v1-8 (-> self draw art-group data (-> self enemy-info walk-anim)))))
           (ja-channel-push! 1 (seconds 0.1))
           (ja :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! min)
           )
         )
       (ja :num! (loop! (/ (-> self nav state speed) (/ (-> self enemy-info run-travel-speed) 2))))
       )
      ((< 0.0 (-> self diff-angle))
       (let ((v1-28 (ja-group)))
         (cond
           ((not (and v1-28 (= v1-28 spydroid-orig-turn-left-ja)))
            (ja-channel-push! 1 (seconds 0.1))
            (ja :group! spydroid-orig-turn-left-ja :num! min)
            )
           (else
             (ja :num! (loop! (* 0.0019975142 (-> self diff-angle))))
             )
           )
         )
       )
      (else
        (let ((v1-40 (ja-group)))
          (cond
            ((not (and v1-40 (= v1-40 spydroid-orig-turn-right-ja)))
             (ja-channel-push! 1 (seconds 0.1))
             (ja :group! spydroid-orig-turn-right-ja :num! min)
             )
            (else
              (ja :num! (loop! (* -0.0019975142 (-> self diff-angle))))
              )
            )
          )
        )
      )
    )
  :code (behavior ()
    (until #f
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    #f
    )
  )

(defstate stare (spydroid-orig)
  :virtual #t
  :trans (behavior ()
    (let ((t9-0 (-> (method-of-type nav-enemy stare) trans)))
      (if t9-0
          (t9-0)
          )
      )
    (cond
      ((not (logtest? (-> self flags) (spydroid-orig-flag sof1)))
       (let ((v1-8 (ja-group)))
         (when (not (and v1-8 (= v1-8 (-> self draw art-group data (-> self enemy-info idle-anim)))))
           (ja-channel-push! 1 (seconds 0.1))
           (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! min)
           )
         )
       (ja :num! (loop!))
       )
      ((< 0.0 (-> self diff-angle))
       (let ((v1-24 (ja-group)))
         (cond
           ((not (and v1-24 (= v1-24 spydroid-orig-turn-left-ja)))
            (ja-channel-push! 1 (seconds 0.1))
            (ja :group! spydroid-orig-turn-left-ja :num! min)
            )
           (else
             (ja :num! (loop! (* 0.0019975142 (-> self diff-angle))))
             )
           )
         )
       )
      (else
        (let ((v1-36 (ja-group)))
          (cond
            ((not (and v1-36 (= v1-36 spydroid-orig-turn-right-ja)))
             (ja-channel-push! 1 (seconds 0.1))
             (ja :group! spydroid-orig-turn-right-ja :num! min)
             )
            (else
              (ja :num! (loop! (* -0.0019975142 (-> self diff-angle))))
              )
            )
          )
        )
      )
    )
  :code (behavior ()
    (until #f
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    #f
    )
  )

(defmethod init-enemy-collision! ((this spydroid-orig))
  "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 jak bot obstacle hit-by-others-list player-list))
      (set! (-> s4-0 prim-core action) (collide-action solid deadly))
      (set! (-> s4-0 transform-index) 3)
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4300.8)
      (set! (-> s5-0 root-prim) s4-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 bot player-list))
      (set! (-> v1-14 prim-core action) (collide-action deadly))
      (set! (-> v1-14 transform-index) 3)
      (set-vector! (-> v1-14 local-sphere) 0.0 0.0 0.0 4096.0)
      )
    (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 backgnd jak bot obstacle hit-by-others-list player-list)
            )
      (set! (-> v1-16 prim-core action) (collide-action solid))
      (set! (-> v1-16 transform-index) 3)
      (set-vector! (-> v1-16 local-sphere) 0.0 0.0 0.0 3686.4)
      )
    (set! (-> s5-0 nav-radius) 8192.0)
    (let ((v1-18 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

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

(defmethod get-inv-mass ((this spydroid-orig))
  3.3333333
  )

(defmethod deactivate ((this spydroid-orig))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this explode-part))
      (kill-particles (-> this explode-part))
      )
  (call-parent-method this)
  (none)
  )

;; WARN: Return type mismatch nav-enemy vs spydroid-orig.
(defmethod relocate ((this spydroid-orig) (offset int))
  (dotimes (v1-0 4)
    (if (nonzero? (-> this lightning v1-0))
        (&+! (-> this lightning v1-0) offset)
        )
    )
  (when (nonzero? (-> this explode-part))
    (if (nonzero? (-> this explode-part))
        (&+! (-> this explode-part) offset)
        )
    )
  (the-as spydroid-orig ((method-of-type nav-enemy relocate) this offset))
  )

(defmethod init-enemy! ((this spydroid-orig))
  "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-spydroid-orig" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (setup-enemy! this *spydroid-orig-nav-enemy-info*)
  (dotimes (s5-1 4)
    (set! (-> this lightning s5-1)
          (new
            'process
            'lightning-control
            (new 'static 'lightning-spec
              :name #f
              :flags (lightning-spec-flags lsf0)
              :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
              :end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
              :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
              :fade-start-factor 0.2
              :fade-time 120.0
              :texture (new 'static 'texture-id :index #x3f :page #x4)
              :reduction 0.42
              :num-points 8
              :box-size 8192.0
              :merge-factor 0.5
              :merge-count 2
              :radius 512.0
              :duration -1.0
              :sound #f
              )
            this
            0.0
            )
          )
    (let ((v1-10 (-> this lightning s5-1))
          (a0-5 0)
          )
      (let ((a1-5 (!= a0-5 (-> v1-10 state mode))))
        (case a0-5
          ((3)
           (if a1-5
               (set! (-> v1-10 state counter) 0.0)
               )
           )
          ((1)
           (set! (-> v1-10 state start-color) (-> v1-10 spec start-color))
           (set! (-> v1-10 state end-color) (-> v1-10 spec end-color))
           )
          )
        )
      (set! (-> v1-10 state mode) (the-as uint a0-5))
      )
    )
  (let ((v1-13 (-> this neck)))
    (set! (-> v1-13 up) (the-as uint 1))
    (set! (-> v1-13 nose) (the-as uint 2))
    (set! (-> v1-13 ear) (the-as uint 0))
    (set-vector! (-> v1-13 twist-max) 3640.889 11832.889 0.0 1.0)
    (set! (-> v1-13 ignore-angle) 15473.777)
    )
  (set-vector! (-> this root scale) 0.5 0.5 0.5 1.0)
  (let ((v1-17 (-> this nav)))
    (set! (-> v1-17 speed-scale) 1.0)
    )
  0
  (set-gravity-length (-> this root dynam) 573440.0)
  (logior! (-> this nav flags) (nav-control-flag momentum-ignore-heading))
  (set! (-> this part) (create-launch-control (-> *part-group-id-table* 1521) this))
  (set! (-> this explode-part) (create-launch-control (-> *part-group-id-table* 1522) this))
  (add-connection
    *part-engine*
    this
    8
    this
    4997
    (new 'static 'vector :x -204.8 :y 122.88 :z 1720.32 :w 163840.0)
    )
  (add-connection
    *part-engine*
    this
    10
    this
    4997
    (new 'static 'vector :x -245.76 :y -122.88 :z 901.12 :w 163840.0)
    )
  (add-connection
    *part-engine*
    this
    4
    this
    4998
    (new 'static 'vector :x 819.2 :y -122.88 :z 3358.72 :w 163840.0)
    )
  (add-connection *part-engine* this 6 this 4999 (new 'static 'vector :w 163840.0))
  (add-connection *part-engine* this 6 this 5000 (new 'static 'vector :w 163840.0))
  (logclear! (-> this mask) (process-mask actor-pause))
  (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup))
  (set! (-> this flags) (spydroid-orig-flag))
  (if (-> this entity)
      (set! (-> this flags)
            (res-lump-value (-> this entity) 'spydroid-flags spydroid-orig-flag :time -1000000000.0)
            )
      )
  (logclear! (-> this flags) (spydroid-orig-flag sof1 sof2))
  0
  (none)
  )
