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

(import "goal_src/jak1/import/crate-ag.gc")

;; failed to figure out what this is:
(defskelgroup *crate-barrel-sg* crate crate-barrel-lod0-jg crate-barrel-idle-ja
              ((crate-barrel-lod0-mg (meters 20)) (crate-barrel-lod1-mg (meters 40)) (crate-barrel-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 1.6)
              :texture-level 2
              )

;; failed to figure out what this is:
(defskelgroup *crate-bucket-sg* crate crate-bucket-lod0-jg crate-bucket-idle-ja
              ((crate-bucket-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 4)
              :texture-level 2
              )

;; failed to figure out what this is:
(defskelgroup *crate-wood-sg* crate crate-wood-lod0-jg crate-idle-ja
              ((crate-wood-lod0-mg (meters 20)) (crate-wood-lod1-mg (meters 40)) (crate-wood-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 1.6)
              :texture-level 2
              )

;; failed to figure out what this is:
(defskelgroup *crate-iron-sg* crate crate-iron-lod0-jg crate-idle-ja
              ((crate-iron-lod0-mg (meters 20)) (crate-iron-lod1-mg (meters 40)) (crate-iron-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 1.6)
              :texture-level 2
              )

;; failed to figure out what this is:
(defskelgroup *crate-steel-sg* crate crate-steel-lod0-jg crate-idle-ja
              ((crate-steel-lod0-mg (meters 20)) (crate-steel-lod1-mg (meters 40)) (crate-steel-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 1.6)
              :texture-level 2
              )

;; failed to figure out what this is:
(defskelgroup *crate-darkeco-sg* crate crate-darkeco-lod0-jg crate-idle-ja
              ((crate-darkeco-lod0-mg (meters 20))
               (crate-darkeco-lod1-mg (meters 40))
               (crate-darkeco-lod2-mg (meters 999999))
               )
              :bounds (static-spherem 0 1 0 1.6)
              :texture-level 2
              )

;; definition of type crate-bank
(deftype crate-bank (basic)
  ((COLLIDE_YOFF           float  :offset-assert   4)
   (COLLIDE_RADIUS         float  :offset-assert   8)
   (DARKECO_EXPLODE_RADIUS float  :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type crate-bank
(defmethod inspect crate-bank ((obj crate-bank))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~TCOLLIDE_YOFF: ~f~%" (-> obj COLLIDE_YOFF))
  (format #t "~TCOLLIDE_RADIUS: ~f~%" (-> obj COLLIDE_RADIUS))
  (format #t "~TDARKECO_EXPLODE_RADIUS: ~f~%" (-> obj DARKECO_EXPLODE_RADIUS))
  obj
  )

;; definition for symbol *CRATE-bank*, type crate-bank
(define *CRATE-bank*
  (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 4915.2 :DARKECO_EXPLODE_RADIUS 16384.0)
  )

;; definition of type crate
(deftype crate (process-drawable)
  ((root-override       collide-shape-moving         :offset        112)
   (smush               smush-control        :inline :offset-assert 176)
   (base                vector               :inline :offset-assert 208)
   (look                symbol                       :offset-assert 224)
   (defense             symbol                       :offset-assert 228)
   (incomming-attack-id uint64                       :offset-assert 232)
   (target              handle                       :offset-assert 240)
   (child-count         int32                        :offset-assert 248)
   (victory-anim        spool-anim                   :offset-assert 252)
   )
  :heap-base #x90
  :method-count-assert 30
  :size-assert         #x100
  :flag-assert         #x1e00900100
  (:methods
    (wait () _type_ :state 20)
    (die (symbol int) _type_ :state 21)
    (special-contents-die () _type_ :state 22)
    (bounce-on () _type_ :state 23)
    (notice-blue (handle) _type_ :state 24)
    (params-init (_type_ entity) none 25)
    (art-init (_type_) crate 26)
    (params-set! (_type_ symbol symbol) none 27)
    (dummy-28 (_type_) none 28)
    (smush-update! (_type_) none 29)
    )
  )

;; definition for method 3 of type crate
(defmethod inspect crate ((obj crate))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tsmush: #<smush-control @ #x~X>~%" (-> obj smush))
  (format #t "~T~Tbase: ~`vector`P~%" (-> obj base))
  (format #t "~T~Tlook: ~A~%" (-> obj look))
  (format #t "~T~Tdefense: ~A~%" (-> obj defense))
  (format #t "~T~Tincomming-attack-id: ~D~%" (-> obj incomming-attack-id))
  (format #t "~T~Ttarget: ~D~%" (-> obj target))
  (format #t "~T~Tchild-count: ~D~%" (-> obj child-count))
  (format #t "~T~Tvictory-anim: ~A~%" (-> obj victory-anim))
  obj
  )

;; failed to figure out what this is:
(method-set! crate 12 (method-of-type process run-logic?))

;; definition for function crate-post
(defbehavior crate-post crate ()
  (rider-trans)
  (smush-update! self)
  (rider-post)
  )

;; failed to figure out what this is:
(defpart 281
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 16.0)
    (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 128.0 32.0 1.0)
    (sp-rnd-flt spt-g 128.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 32.0 1.0)
    (sp-rnd-flt spt-a 32.0 16.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.033333335) 1.0)
    (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0)
    (sp-flt spt-accel-y 2.7306666)
    (sp-int spt-timer 120)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-int-plain-rnd spt-next-time 30 59 1)
    (sp-launcher-by-id spt-next-launcher 282)
    (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 282
  :init-specs ((sp-flt spt-fade-a -1.0666667))
  )

;; failed to figure out what this is:
(defpart 283
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2))
    (sp-flt spt-num 4.0)
    (sp-flt spt-y (meters 0.75))
    (sp-flt spt-scale-x (meters 6))
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.3) (meters 1) 1.0)
    (sp-flt spt-r 192.0)
    (sp-flt spt-g 192.0)
    (sp-rnd-flt spt-b 64.0 128.0 1.0)
    (sp-flt spt-a 0.0)
    (sp-flt spt-scalevel-x (meters 0.009765625))
    (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0)
    (sp-flt spt-scalevel-y (meters 0.009765625))
    (sp-flt spt-fade-a 2.1333334)
    (sp-int spt-timer 30)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    (sp-int spt-next-time 15)
    (sp-launcher-by-id spt-next-launcher 284)
    (sp-flt spt-rotate-y (degrees 0.0))
    )
  )

;; failed to figure out what this is:
(defpart 284
  :init-specs ((sp-flt spt-fade-a -2.1333334))
  )

;; failed to figure out what this is:
(defpart 285
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 1))
    (sp-flt spt-scale-x (meters 8))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 196.0)
    (sp-flt spt-g 196.0)
    (sp-flt spt-b 196.0)
    (sp-flt spt-a 28.0)
    (sp-int spt-timer 10)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 286
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x6 :page #x2))
    (sp-flt spt-num 5.0)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0)
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.6) (meters 0.00048828125) 2457.6)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-flt spt-scale-y (meters 0.3))
    (sp-flt spt-r 160.0)
    (sp-flt spt-g 160.0)
    (sp-flt spt-b 160.0)
    (sp-flt spt-a 128.0)
    (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0)
    (sp-flt spt-rotvel-x (degrees 1.2))
    (sp-flt spt-rotvel-y (degrees 2.4))
    (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 2 436.90668)
    (sp-flt spt-accel-y -13.653334)
    (sp-flt spt-friction 0.97)
    (sp-int spt-timer 150)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-int spt-next-time 75)
    (sp-launcher-by-id spt-next-launcher 287)
    (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 287
  :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -3.4)
    )
  )

;; failed to figure out what this is:
(defpart 288
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2))
    (sp-flt spt-num 4.5)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0)
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-flt spt-scale-y (meters 0.3))
    (sp-flt spt-r 100.0)
    (sp-flt spt-g 100.0)
    (sp-flt spt-b 100.0)
    (sp-flt spt-a 128.0)
    (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0)
    (sp-flt spt-rotvel-x (degrees 1.2))
    (sp-flt spt-rotvel-y (degrees 2.4))
    (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668)
    (sp-flt spt-accel-y -13.653334)
    (sp-flt spt-friction 0.97)
    (sp-int spt-timer 150)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-int spt-next-time 75)
    (sp-launcher-by-id spt-next-launcher 287)
    (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpartgroup group-crate-explode
  :id 71
  :duration 5
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 12)
  :parts ((sp-item 281) (sp-item 283) (sp-item 285) (sp-item 286) (sp-item 288))
  )

;; failed to figure out what this is:
(defpartgroup group-crate-steel-explode
  :id 72
  :duration 5
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 12)
  :parts ((sp-item 281) (sp-item 283) (sp-item 285) (sp-item 288) (sp-item 288) (sp-item 288))
  )

;; failed to figure out what this is:
(defpartgroup group-dark-eco-box-explosion
  :id 73
  :duration 600
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 12)
  :parts ((sp-item 295 :fade-after (meters 100) :period 600 :length 5 :binding 296)
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 292 :fade-after (meters 160) :period 600 :length 5)
    (sp-item 2095 :period 600 :length 5)
    (sp-item 2096 :fade-after (meters 80) :falloff-to (meters 80) :period 600 :length 40)
    (sp-item 2097 :period 600 :length 20)
    (sp-item 2098 :fade-after (meters 120) :falloff-to (meters 120) :period 600 :length 20)
    )
  )

;; failed to figure out what this is:
(defpart 2096
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 6.0)
    (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.4) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 64.0 128.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 96.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 96.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.10666667) 1.0)
    (sp-flt spt-scalevel-x (meters -0.0016666667))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0)
    (sp-flt spt-friction 0.9)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-int-plain-rnd spt-next-time 30 29 1)
    (sp-launcher-by-id spt-next-launcher 2099)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 2) (meters 4) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 2099
  :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g 0.0) (sp-flt spt-fade-b 0.0) (sp-flt spt-fade-a -1.4222223))
  )

;; failed to figure out what this is:
(defpart 2098
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 3.0)
    (sp-flt spt-scale-x (meters 0.2))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0)
    (sp-flt spt-scale-y (meters 8))
    (sp-rnd-flt spt-r 64.0 192.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 64.0 1.0)
    (sp-flt spt-scalevel-y (meters 0.42666668))
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 60)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2095
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-scale-x (meters 16))
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 64.0 192.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-flt spt-a 96.0)
    (sp-flt spt-fade-a -1.7454545)
    (sp-int spt-timer 54)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2097
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 4.0)
    (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 0.0 96.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 64.0 32.0 1.0)
    (sp-rnd-flt spt-a 64.0 64.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.013333334) 1.0)
    (sp-flt spt-scalevel-x (meters 0.013333334))
    (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -0.42666668)
    (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0)
    (sp-flt spt-friction 0.8)
    (sp-int spt-timer 510)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 110.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 295
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 16.0)
    (sp-flt spt-y (meters 1))
    (sp-flt spt-scale-x (meters 0.1))
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0)
    (sp-flt spt-accel-y -1.3653333)
    (sp-flt spt-friction 0.94)
    (sp-int spt-timer 240)
    (sp-cpuinfo-flags bit3 bit14)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 296
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 1.0)
    (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0)
    (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.3) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 0.0 96.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 64.0 32.0 1.0)
    (sp-rnd-flt spt-a 64.0 64.0 1.0)
    (sp-rnd-flt spt-omega 0.0 65536.0 1.0)
    (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0)
    (sp-flt spt-scalevel-x (meters -0.000909091))
    (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-g -0.26666668)
    (sp-flt spt-fade-a -0.19393939)
    (sp-int-plain-rnd spt-timer 90 149 1)
    (sp-cpuinfo-flags bit2 bit3 bit7 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 297
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 32.0 96.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 64.0 32.0 1.0)
    (sp-rnd-flt spt-a 32.0 32.0 1.0)
    (sp-flt spt-scalevel-x (meters -0.0006190476))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -0.01904762)
    (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0)
    (sp-int-plain-rnd spt-timer 30 299 1)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    (sp-int spt-next-time 240)
    (sp-launcher-by-id spt-next-launcher 198)
    )
  )

;; failed to figure out what this is:
(defpart 292
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2))
    (sp-rnd-flt spt-num 8.0 16.0 1.0)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0)
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-flt spt-scale-y (meters 0.3))
    (sp-flt spt-r 128.0)
    (sp-rnd-int spt-g 1115684864 1 32.0)
    (sp-flt spt-b 32.0)
    (sp-flt spt-a 128.0)
    (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0)
    (sp-flt spt-rotvel-x (degrees 1.2))
    (sp-flt spt-rotvel-y (degrees 2.4))
    (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668)
    (sp-flt spt-accel-y -13.653334)
    (sp-flt spt-friction 0.97)
    (sp-int spt-timer 150)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-int spt-next-time 75)
    (sp-launcher-by-id spt-next-launcher 301)
    (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 301
  :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -3.4)
    )
  )

;; definition for function crate-standard-event-handler
(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (case arg2
    (('attack)
     (let ((s4-0 (-> arg3 param 2))
           (s5-0 (-> arg3 param 3))
           )
       (case (-> self defense)
         (('iron)
          (case (-> arg3 param 1)
            (('flop 'uppercut 'explode 'darkeco 'eco-yellow 'bonk 'racer 'tube 'flut-bonk 'flut-attack)
             (if (and (logtest? (-> self fact options) (fact-options require-zoomer))
                      *target*
                      (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-9)))
                      )
                 (return #f)
                 )
             (increment-success-for-hint (game-text-id sidekick-hint-crate-iron))
             (increment-success-for-hint (game-text-id training-ironcrate))
             (send-event arg0 'get-attack-count 1)
             (go-virtual die #f (the-as int s5-0))
             )
            (else
              (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y)))
                (if (not (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese)))
                         )
                    (level-hint-spawn
                      (game-text-id training-ironcrate)
                      "sagevb36"
                      (the-as entity #f)
                      *entity-pool*
                      (game-task none)
                      )
                    )
                (case (-> (level-get-target-inside *level*) name)
                  (('training)
                   (if (and (can-hint-be-played? (game-text-id zero) (the-as entity #f) (the-as string #f)) (rand-vu-percent? 0.2))
                       (clear-text-seen! *game-info* (game-text-id sidekick-hint-crate-iron))
                       )
                   )
                  )
                (level-hint-spawn
                  (game-text-id sidekick-hint-crate-iron)
                  "sksp0005"
                  (the-as entity #f)
                  *entity-pool*
                  (game-task none)
                  )
                (set! (-> self incomming-attack-id) s4-0)
                (if (not (!= (-> self smush amp) 0.0))
                    (sound-play "icrate-nobreak")
                    )
                (activate! (-> self smush) 0.1 90 150 1.0 1.0)
                (go-virtual bounce-on)
                )
              #f
              )
            )
          )
         (('steel)
          (case (-> arg3 param 1)
            (('explode 'darkeco 'eco-yellow 'bonk 'tube 'flut-bonk 'flut-attack 'racer)
             (send-event arg0 'get-attack-count 1)
             (when (logtest? (-> self draw status) (draw-status was-drawn))
               (increment-success-for-hint (game-text-id sidekick-hint-crate-steel))
               (level-hint-spawn
                 (game-text-id sidekick-hint-crate-steel-break1)
                 "sksp0004"
                 (the-as entity #f)
                 *entity-pool*
                 (game-task none)
                 )
               (level-hint-spawn
                 (game-text-id sidekick-hint-crate-steel-break2)
                 "sksp009b"
                 (the-as entity #f)
                 *entity-pool*
                 (game-task none)
                 )
               )
             (go-virtual die #f (the-as int s5-0))
             )
            (else
              (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y)))
                (level-hint-spawn
                  (game-text-id sidekick-hint-crate-steel)
                  "sksp0006"
                  (the-as entity #f)
                  *entity-pool*
                  (game-task none)
                  )
                (set! (-> self incomming-attack-id) s4-0)
                (if (not (!= (-> self smush amp) 0.0))
                    (sound-play "scrate-nobreak")
                    )
                (activate! (-> self smush) 0.1 90 150 1.0 1.0)
                (go-virtual bounce-on)
                )
              #f
              )
            )
          )
         (('darkeco)
          (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'darkeco))))
          (when (= (-> arg0 type) target)
            (level-hint-spawn
              (game-text-id sidekick-hint-crate-darkeco2)
              "sksp009c"
              (the-as entity #f)
              *entity-pool*
              (game-task none)
              )
            (level-hint-spawn
              (game-text-id sidekick-hint-crate-darkeco1)
              "sksp0002"
              (the-as entity #f)
              *entity-pool*
              (game-task none)
              )
            (case (-> (level-get-target-inside *level*) name)
              (('rolling)
               (level-hint-spawn
                 (game-text-id sidekick-hint-crate-darkeco-rolling)
                 "sksp0110"
                 (the-as entity #f)
                 *entity-pool*
                 (game-task none)
                 )
               )
              (('firecanyon)
               (level-hint-spawn
                 (game-text-id firecanyon-crate-darkeco2)
                 "sksp0082"
                 (the-as entity #f)
                 *entity-pool*
                 (game-task none)
                 )
               (level-hint-spawn
                 (game-text-id firecanyon-crate-darkeco1)
                 "sksp0081"
                 (the-as entity #f)
                 *entity-pool*
                 (game-task none)
                 )
               )
              )
            )
          (go-virtual die #f (the-as int s5-0))
          )
         (else
           (send-event arg0 'get-attack-count 1)
           (go-virtual die #f (the-as int s5-0))
           )
         )
       )
     )
    (('touch)
     (case (-> self defense)
       (('darkeco)
        (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'darkeco))))
        (go-virtual die #f 0)
        )
       )
     )
    (('bonk)
     (when (= (-> self root-override trans y) (-> self base y))
       (activate! (-> self smush) -0.1 75 150 1.0 1.0)
       (go-virtual bounce-on)
       )
     )
    (('wake)
     (let ((v0-0 (the-as object (logclear (-> self mask) (process-mask sleep)))))
       (set! (-> self mask) (the-as process-mask v0-0))
       v0-0
       )
     )
    (('eco-blue)
     (if (not (or (= (-> self defense) 'darkeco)
                  (or (= (-> self next-state name) 'notice-blue) (= (-> self next-state name) 'die))
                  (!= (-> self root-override trans y) (-> self base y))
                  )
              )
         (go-virtual notice-blue (process->handle arg0))
         )
     )
    )
  )

;; failed to figure out what this is:
(defstate wait (crate)
  :virtual #t
  :event crate-standard-event-handler
  :code (behavior ()
    (suspend)
    (update-transforms! (-> self root-override))
    (logior! (-> self mask) (process-mask sleep))
    (loop
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior crate) ja-post)
  )

;; failed to figure out what this is:
(defstate bounce-on (crate)
  :virtual #t
  :event crate-standard-event-handler
  :code (behavior ()
    (while (!= (-> self smush amp) 0.0)
      (suspend)
      )
    (go-virtual wait)
    (none)
    )
  :post (the-as (function none :behavior crate) crate-post)
  )

;; failed to figure out what this is:
(defstate notice-blue (crate)
  :virtual #t
  :event crate-standard-event-handler
  :trans (behavior ()
    (cond
      ((not (send-event *target* 'query 'powerup (pickup-type eco-blue)))
       (logior! (-> self mask) (process-mask sleep-code))
       (if (not (!= (-> self smush amp) 0.0))
           (go-virtual wait)
           )
       )
      (else
        (logclear! (-> self mask) (process-mask sleep-code))
        )
      )
    (none)
    )
  :code (behavior ((arg0 handle))
    (set! (-> self target) arg0)
    (loop
      (let* ((gp-0 (handle->process (-> self target)))
             (v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable))
                       gp-0
                       )
                   )
             )
        (when v1-4
          (let* ((gp-1 (-> (the-as process-drawable v1-4) root))
                 (v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape))
                           gp-1
                           )
                       )
                 )
            (when v1-6
              (let* ((gp-2 (-> self root-override root-prim prim-core))
                     (a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core))
                     (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3)))
                     )
                (when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel))
                  (logior! (-> self fact options) (fact-options can-collect))
                  (go-virtual die #f 0)
                  )
                (when (rand-vu-percent? 0.5)
                  (let ((s5-0 (new 'stack-no-clear 'vector)))
                    (set! (-> s5-0 quad) (-> gp-2 world-sphere quad))
                    (dotimes (gp-3 3)
                      (+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8))
                      )
                    (eco-blue-glow s5-0)
                    )
                  )
                (activate!
                  (-> self smush)
                  (lerp-scale
                    (rand-vu-float-range 0.1 0.3)
                    (rand-vu-float-range 0.0 0.02)
                    f30-0
                    (-> *FACT-bank* suck-suck-dist)
                    (-> *FACT-bank* suck-bounce-dist)
                    )
                  60
                  60
                  1.0
                  1.0
                  )
                )
              )
            )
          )
        )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior crate) crate-post)
  )

;; failed to figure out what this is:
(defstate die (crate)
  :virtual #t
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('touched)
       (case (-> self defense)
         (('darkeco)
          (cond
            ((= (-> arg0 type) target)
             (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'darkeco))))
             )
            (else
              (let ((a1-5 (new 'stack-no-clear 'event-message-block)))
                (set! (-> a1-5 from) self)
                (set! (-> a1-5 num-params) 4)
                (set! (-> a1-5 message) 'attack)
                (set! (-> a1-5 param 0) (-> arg3 param 0))
                (set! (-> a1-5 param 1) (the-as uint 'darkeco))
                (let ((v1-12 (+ *global-attack-id* 1)))
                  (set! *global-attack-id* v1-12)
                  (set! (-> a1-5 param 2) (the-as uint v1-12))
                  )
                (set! (-> a1-5 param 3) (the-as uint 0))
                (send-event-function arg0 a1-5)
                )
              )
            )
          )
         )
       )
      )
    )
  :trans (behavior ()
    (case (-> self type)
      ((crate-buzzer)
       (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0))
           (spool-push *art-control* (-> self victory-anim name) 0 self -99.0)
           )
       )
      )
    (none)
    )
  :code (behavior ((arg0 symbol) (arg1 int))
    (clear-collide-with-as (-> self root-override))
    (if (nonzero? (-> self sound))
        (stop! (-> self sound))
        )
    (if (and *target*
             (and (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9 ca-12 ca-13 ca-14))
                  (!= (-> self fact pickup-type) 6)
                  (not arg0)
                  )
             )
        (logior! (-> self fact options) (fact-options instant-collect))
        )
    (when (not arg0)
      (let ((s5-1 (-> *display* base-frame-counter)))
        (until (>= (- (-> *display* base-frame-counter) s5-1) (seconds 0.04))
          (suspend)
          )
        )
      (logior! (-> self draw status) (draw-status hidden))
      (case (-> self look)
        (('iron)
         (sound-play "icrate-break")
         )
        (('steel)
         (sound-play "scrate-break")
         )
        (('darkeco)
         (sound-play "dcrate-break")
         )
        (else
          (sound-play "wcrate-break")
          )
        )
      (case (-> self defense)
        (('darkeco)
         (let ((f0-0
                 (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override trans) (target-pos 0)) 8192.0 40960.0)
                 )
               )
           (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3))
           )
         (process-spawn
           touch-tracker
           :init touch-tracker-init
           (-> self root-override trans)
           (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS)
           30
           :to self
           )
         )
        )
      (case (-> self look)
        (('darkeco)
         (process-spawn
           part-tracker
           :init part-tracker-init
           (-> *part-group-id-table* 73)
           -1
           #f
           #f
           #f
           (-> self root-override trans)
           :to *entity-pool*
           )
         )
        (('steel 'iron)
         (process-spawn
           part-tracker
           :init part-tracker-init
           (-> *part-group-id-table* 72)
           -1
           #f
           #f
           #f
           (-> self root-override trans)
           :to *entity-pool*
           )
         )
        (else
          (process-spawn
            part-tracker
            :init part-tracker-init
            (-> *part-group-id-table* 71)
            -1
            #f
            #f
            #f
            (-> self root-override trans)
            :to *entity-pool*
            )
          )
        )
      )
    (case (-> self fact pickup-type)
      (((pickup-type money)
        (pickup-type buzzer)
        (pickup-type eco-blue)
        (pickup-type eco-yellow)
        (pickup-type eco-red)
        (pickup-type fuel-cell)
        )
       (go-virtual special-contents-die)
       )
      )
    (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1)
    (process-entity-status! self (entity-perm-status dead) #t)
    (process-entity-status! self (entity-perm-status complete) #t)
    (let ((gp-1 (-> *display* base-frame-counter)))
      (until (>= (- (-> *display* base-frame-counter) gp-1) (seconds 5))
        (suspend)
        )
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate special-contents-die (crate)
  :virtual #t
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (let ((v1-0 arg2))
      (the-as object (when (= v1-0 'notify)
                       (case (-> arg3 param 0)
                         (('pickup)
                          (let ((gp-0 (-> self entity extra perm)))
                            (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage))
                            (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1)))
                            (+! (-> self child-count) -1)
                            (when (<= (-> self child-count) 0)
                              (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel))
                                  (process-entity-status! self (entity-perm-status bit-4) #f)
                                  )
                              (process-entity-status! self (entity-perm-status dead) #t)
                              (process-entity-status! self (entity-perm-status complete) #t)
                              (set! (-> gp-0 user-int8 0) 2)
                              (let ((v0-0 (logclear (-> self mask) (process-mask sleep))))
                                (set! (-> self mask) v0-0)
                                v0-0
                                )
                              )
                            )
                          )
                         )
                       )
              )
      )
    )
  :trans (-> (method-of-type crate die) trans)
  :code (behavior ()
    (when (or (= (-> self fact pickup-type) (pickup-type money))
              (= (-> self defense) 'iron)
              (= (-> self defense) 'steel)
              )
      (let ((a0-4 (-> self entity)))
        (if (when a0-4
              (let ((a0-5 (-> a0-4 extra perm task)))
                (if a0-5
                    (= a0-5 (game-task none))
                    )
                )
              )
            (set! (-> self entity extra perm task) (game-task complete))
            )
        )
      )
    (clear-collide-with-as (-> self root-override))
    (logior! (-> self draw status) (draw-status hidden))
    (drop-pickup (-> self fact) #t self (the-as fact-info #f) 0)
    (set! (-> self child-count) (+ (process-count self) -1))
    (process-entity-status! self (entity-perm-status bit-4) #t)
    (let ((v1-21 (-> self entity extra perm)))
      (logior! (-> v1-21 status) (entity-perm-status user-set-from-cstage))
      (set! (-> v1-21 user-int8 0) 1)
      )
    (when (-> self child)
      (logior! (-> self mask) (process-mask sleep))
      (suspend)
      (while (-> self child)
        (suspend)
        )
      )
    (none)
    )
  )

;; definition for function crate-init-by-other
;; INFO: Used lq/sq
(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol))
  (params-init self arg0)
  (set! (-> self root-override trans quad) (-> arg1 quad))
  (set! (-> self look) arg2)
  (set! (-> self defense) arg2)
  (art-init self)
  (dummy-28 self)
  (none)
  )

;; definition for method 11 of type crate
(defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor))
  (params-init obj arg0)
  (art-init obj)
  (dummy-28 obj)
  (none)
  )

;; definition for method 25 of type crate
;; INFO: Return type mismatch crate vs none.
(defmethod params-init crate ((obj crate) (arg0 entity))
  (stack-size-set! (-> obj main-thread) 128)
  (logior! (-> obj mask) (process-mask crate))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind crate blue-eco-suck))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense touch))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 3072.0 0.0 6963.2)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (set! (-> obj fact)
        (new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
        )
  (let ((v1-27 (-> obj entity extra perm)))
    (set! (-> obj fact pickup-amount)
          (fmax 0.0 (- (-> obj fact pickup-amount) (the float (-> v1-27 user-int8 1))))
          )
    )
  (when (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete)))
    (set! (-> obj fact pickup-type) (pickup-type eco-pill-random))
    (set! (-> obj fact pickup-amount) 0.0)
    )
  (when arg0
    (process-drawable-from-entity! obj (the-as entity-actor arg0))
    (logclear! (-> obj mask) (process-mask actor-pause))
    )
  (let ((a0-18 ((method-of-type res-lump get-property-struct)
                (-> obj entity)
                'crate-type
                'interp
                -1000000000.0
                'wood
                (the-as (pointer res-tag) #f)
                *res-static-buf*
                )
               )
        )
    (set! (-> obj look) (the-as symbol a0-18))
    (set! (-> obj defense) (the-as symbol a0-18))
    )
  (case (-> obj fact pickup-type)
    (((pickup-type buzzer))
     (set! (-> obj type) crate-buzzer)
     (when (= (-> obj look) 'wood)
       (set! (-> obj look) 'iron)
       (set! (-> obj defense) 'iron)
       )
     )
    (else
      (when (= (-> obj look) 'iron)
        (set! (-> obj look) 'wood)
        (set! (-> obj defense) 'wood)
        )
      )
    )
  (none)
  )

;; definition for method 26 of type crate
;; INFO: Used lq/sq
(defmethod art-init crate ((obj crate))
  (case (-> obj look)
    (('iron)
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense normal-attack))
     (initialize-skeleton obj *crate-iron-sg* '())
     )
    (('steel)
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense indestructible))
     (initialize-skeleton obj *crate-steel-sg* '())
     )
    (('darkeco)
     (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random))
       (set! (-> obj fact pickup-type) (pickup-type none))
       (set! (-> obj fact pickup-amount) 0.0)
       )
     (initialize-skeleton obj *crate-darkeco-sg* '())
     (set-vector! (-> obj draw color-mult) 0.8 0.8 0.8 1.0)
     (set-vector! (-> obj draw color-emissive) 0.2 0.2 0.2 1.0)
     )
    (('barrel)
     (initialize-skeleton obj *crate-barrel-sg* '())
     )
    (('bucket)
     (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random))
       (set! (-> obj fact pickup-type) (pickup-type none))
       (set! (-> obj fact pickup-amount) 0.0)
       )
     (initialize-skeleton obj *crate-bucket-sg* '())
     )
    (('none)
     (initialize-skeleton obj *crate-wood-sg* '())
     (logior! (-> obj draw status) (draw-status hidden))
     )
    (else
      (initialize-skeleton obj *crate-wood-sg* '())
      )
    )
  (cond
    ((logtest? (fact-options indestructible) (-> obj fact options))
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense indestructible))
     )
    ((logtest? (-> obj fact options) (fact-options strong-attack))
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense strong-attack))
     )
    ((logtest? (-> obj fact options) (fact-options normal-attack))
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense normal-attack))
     )
    ((logtest? (-> obj fact options) (fact-options touch))
     (set! (-> obj root-override root-prim prim-core offense) (collide-offense touch))
     )
    )
  (set! (-> obj base quad) (-> obj root-override trans quad))
  (crate-post)
  (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f))
  obj
  )

;; definition for method 27 of type crate
;; INFO: Return type mismatch crate vs none.
(defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol))
  (if arg0
      (set! (-> obj look) arg0)
      )
  (if arg1
      (set! (-> obj defense) arg1)
      )
  (none)
  )

;; definition for method 28 of type crate
;; INFO: Return type mismatch int vs none.
(defmethod dummy-28 crate ((obj crate))
  (if (>= (-> obj entity extra perm user-int8 0) 1)
      (go (method-of-object obj die) #t 0)
      )
  0
  (go (method-of-object obj wait))
  0
  (none)
  )

;; definition for method 29 of type crate
;; INFO: Return type mismatch int vs none.
(defmethod smush-update! crate ((obj crate))
  (let ((f0-0 (update! (-> obj smush))))
    (set! (-> obj root-override scale x) (+ 1.0 (* -0.5 f0-0)))
    (set! (-> obj root-override scale y) (+ 1.0 f0-0))
    (set! (-> obj root-override scale z) (+ 1.0 (* -0.5 f0-0)))
    )
  0
  (none)
  )

;; definition of type barrel
(deftype barrel (crate)
  ()
  :heap-base #x90
  :method-count-assert 30
  :size-assert         #x100
  :flag-assert         #x1e00900100
  )

;; definition for method 3 of type barrel
(defmethod inspect barrel ((obj barrel))
  (let ((t9-0 (method-of-type crate inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition for method 25 of type barrel
;; INFO: Return type mismatch barrel vs none.
(defmethod params-init barrel ((obj barrel) (arg0 entity))
  (let ((t9-0 (method-of-type crate params-init)))
    (t9-0 obj arg0)
    )
  (set! (-> obj look) 'barrel)
  (none)
  )

;; definition of type bucket
(deftype bucket (crate)
  ()
  :heap-base #x90
  :method-count-assert 30
  :size-assert         #x100
  :flag-assert         #x1e00900100
  )

;; definition for method 3 of type bucket
(defmethod inspect bucket ((obj bucket))
  (let ((t9-0 (method-of-type crate inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition for method 25 of type bucket
;; INFO: Return type mismatch bucket vs none.
(defmethod params-init bucket ((obj bucket) (arg0 entity))
  (let ((t9-0 (method-of-type crate params-init)))
    (t9-0 obj arg0)
    )
  (set! (-> obj look) 'bucket)
  (none)
  )

;; failed to figure out what this is:
(defpartgroup group-buzzer-crate
  :id 74
  :duration 5
  :linger-duration 450
  :bounds (static-bspherem 0 0 0 2)
  :parts ((sp-item 302))
  )

;; failed to figure out what this is:
(defpart 302
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 1.0)
    (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 128.0)
    (sp-rnd-flt spt-g 96.0 32.0 1.0)
    (sp-rnd-flt spt-b 64.0 32.0 1.0)
    (sp-rnd-flt spt-a 16.0 32.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.02) (meters 0.01) 1.0)
    (sp-flt spt-scalevel-x (meters 0.0033333334))
    (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -0.16)
    (sp-flt spt-accel-y -1.3653333)
    (sp-flt spt-friction 0.95)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; definition of type crate-buzzer
(deftype crate-buzzer (crate)
  ()
  :heap-base #x90
  :method-count-assert 30
  :size-assert         #x100
  :flag-assert         #x1e00900100
  )

;; definition for method 3 of type crate-buzzer
(defmethod inspect crate-buzzer ((obj crate-buzzer))
  (let ((t9-0 (method-of-type crate inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition for method 26 of type crate-buzzer
;; INFO: Return type mismatch crate-buzzer vs crate.
(defmethod art-init crate-buzzer ((obj crate-buzzer))
  (let ((t9-0 (method-of-type crate art-init)))
    (t9-0 obj)
    )
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 74) obj))
  (set! (-> obj sound) (new
                         'process
                         'ambient-sound
                         (static-sound-spec "buzzer" :pitch-mod -762 :fo-max 40)
                         (-> obj root-override trans)
                         )
        )
  (set! (-> obj victory-anim) (fuel-cell-pick-anim obj))
  (the-as crate obj)
  )

;; failed to figure out what this is:
(defstate wait (crate-buzzer)
  :virtual #t
  :trans (behavior ()
    (when (and (and *target*
                    (>= 327680.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))
                    )
               (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.5))
               (rand-vu-percent? 0.03)
               )
      (spawn (-> self part) (-> self root-override trans))
      (activate! (-> self smush) 0.2 90 150 1.0 1.0)
      (logclear! (-> self mask) (process-mask sleep-code))
      )
    (if (nonzero? (-> self sound))
        (update! (-> self sound))
        )
    (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0))
        (spool-push *art-control* (-> self victory-anim name) 0 self -99.0)
        )
    (none)
    )
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (suspend)
    (update-transforms! (-> self root-override))
    (loop
      (set! (-> self state-time) (-> *display* base-frame-counter))
      (ja-post)
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      (let ((f30-0 57001.605))
        (sound-play "crate-jump")
        (while (or (!= (-> self smush amp) 0.0) (!= f30-0 0.0))
          (+! f30-0 (* -245760.0 (-> *display* seconds-per-frame)))
          (+! (-> self root-override trans y) (* f30-0 (-> *display* seconds-per-frame)))
          (when (< (-> self root-override trans y) (-> self base y))
            (set! (-> self root-override trans y) (-> self base y))
            (set! f30-0 (* -0.5 f30-0))
            (if (< (fabs f30-0) 16384.0)
                (set! f30-0 0.0)
                )
            )
          (crate-post)
          (ja-post)
          (suspend)
          )
        )
      (set! (-> self root-override trans y) (-> self base y))
      )
    (none)
    )
  :post (the-as (function none :behavior crate-buzzer) #f)
  )

;; failed to figure out what this is:
(defstate bounce-on (crate-buzzer)
  :virtual #t
  :code (behavior ()
    (while (!= (-> self smush amp) 0.0)
      (spawn (-> self part) (-> self root-override trans))
      (suspend)
      )
    (go-virtual wait)
    (none)
    )
  )

;; definition of type pickup-spawner
(deftype pickup-spawner (crate)
  ((blocker entity-actor  :offset-assert 256)
   )
  :heap-base #xa0
  :method-count-assert 30
  :size-assert         #x104
  :flag-assert         #x1e00a00104
  )

;; definition for method 3 of type pickup-spawner
(defmethod inspect pickup-spawner ((obj pickup-spawner))
  (let ((t9-0 (method-of-type crate inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tblocker: ~A~%" (-> obj blocker))
  obj
  )

;; definition for method 25 of type pickup-spawner
;; INFO: Return type mismatch pickup-spawner vs none.
(defmethod params-init pickup-spawner ((obj pickup-spawner) (arg0 entity))
  (let ((t9-0 (method-of-type crate params-init)))
    (t9-0 obj arg0)
    )
  (set! (-> obj look) 'none)
  (set! (-> obj blocker) #f)
  (if (logtest? (-> obj fact options) (fact-options vent-blocked))
      (set! (-> obj blocker) (entity-actor-lookup (-> obj entity) 'alt-actor 0))
      )
  (none)
  )

;; definition for method 28 of type pickup-spawner
;; INFO: Return type mismatch int vs none.
(defmethod dummy-28 pickup-spawner ((obj pickup-spawner))
  (go (method-of-object obj wait))
  0
  (none)
  )

;; failed to figure out what this is:
(defstate wait (pickup-spawner)
  :virtual #t
  :code (behavior ()
    (loop
      (if (or (not (-> self blocker)) (logtest? (-> self blocker extra perm status) (entity-perm-status complete)))
          (go-virtual die #t 0)
          )
      (suspend)
      )
    (none)
    )
  )
