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

;; name: wascitya-obs.gc
;; name in dgo: wascitya-obs
;; dgos: WCA

;; DECOMP BEGINS

(defskelgroup skel-wascity-stad-door wascity-stad-door wascity-stad-door-lod0-jg wascity-stad-door-idle-ja
              ((wascity-stad-door-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 8 0 20)
              )

(deftype wascity-stad-door (com-airlock)
  ()
  )


(defmethod init-from-entity! ((this wascity-stad-door) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
    (set! (-> s5-0 penetrated-by) (penetrate))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 2))
      (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle))
      (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list))
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 61440.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle))
      (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list))
      (set! (-> v1-8 prim-core action) (collide-action solid))
      (set! (-> v1-8 transform-index) 3)
      (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 61440.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (let ((v1-11 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-wascity-stad-door" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (init-airlock! this)
  (set! (-> this sound-open-loop) (static-sound-spec "ver-open" :group 0))
  (set! (-> this sound-open-stop) (static-sound-spec "ver-open-hit" :group 0))
  (set! (-> this sound-close-loop) (static-sound-spec "ver-open" :group 0))
  (set! (-> this sound-close-stop) (static-sound-spec "air-ver-cls-hit" :group 0))
  (set! (-> this sound-behind?) #t)
  (set! (-> this allow-pilot?) #t)
  (go (method-of-object this close) #t)
  )

(deftype waspala-elevator (elevator)
  ()
  )


(defskelgroup skel-waspala-elevator waspala-elevator waspala-elevator-lod0-jg waspala-elevator-idle-ja
              ((waspala-elevator-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 20 0 30)
              )

(defmethod elevator-method-47 ((this waspala-elevator))
  (if *target*
      (< (vector-vector-xz-distance (target-pos 0) (-> this root trans))
         (* 0.4 (-> this root root-prim prim-core world-sphere w))
         )
      #f
      )
  )

(defmethod get-art-group ((this waspala-elevator))
  (art-group-get-by-name *level* "skel-waspala-elevator" (the-as (pointer level) #f))
  )

;; WARN: Return type mismatch collide-shape-moving vs none.
(defmethod init-collision! ((this waspala-elevator))
  (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)
          )
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 2))
      (set! (-> s4-0 prim-core collide-as) (collide-spec camera-blocker pusher))
      (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> s4-0 prim-core action) (collide-action solid rideable))
      (set! (-> s4-0 transform-index) 3)
      (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 40960.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (pusher-init s5-0)
    (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> v1-15 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list))
      (set! (-> v1-15 prim-core action) (collide-action solid rideable))
      (set! (-> v1-15 transform-index) 3)
      (set-vector! (-> v1-15 local-sphere) 0.0 8192.0 0.0 40960.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (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)
    )
  (none)
  )

;; WARN: Return type mismatch sound-spec vs none.
(defmethod base-plat-method-34 ((this waspala-elevator))
  (set! (-> this sound-running-loop) (static-sound-spec "palacelev-loop" :group 0))
  (set! (-> this sound-arrived) (static-sound-spec "palacelev-stop" :group 0))
  (none)
  )
