Files
jak-project/goal_src/jak1/levels/sunken/bully.gc
T
Tyler Wilding c162c66118 g/j1: Cleanup all main issues in the formatter and format all of goal_src/jak1 (#3535)
This PR does two main things:
1. Work through the main low-hanging fruit issues in the formatter
keeping it from feeling mature and usable
2. Iterate and prove that point by formatting all of the Jak 1 code
base. **This has removed around 100K lines in total.**
- The decompiler will now format it's results for jak 1 to keep things
from drifting back to where they were. This is controlled by a new
config flag `format_code`.

How am I confident this hasn't broken anything?:
- I compiled the entire project and stored it's `out/jak1/obj` files
separately
- I then recompiled the project after formatting and wrote a script that
md5's each file and compares it (`compare-compilation-outputs.py`
- The results (eventually) were the same:

![Screenshot 2024-05-25
132900](https://github.com/open-goal/jak-project/assets/13153231/015e6f20-8d19-49b7-9951-97fa88ddc6c2)
> This proves that the only difference before and after is non-critical
whitespace for all code/macros that is actually in use.

I'm still aware of improvements that could be made to the formatter, as
well as general optimization of it's performance. But in general these
are for rare or non-critical situations in my opinion and I'll work
through them before doing Jak 2. The vast majority looks great and is
working properly at this point. Those known issues are the following if
you are curious:

![image](https://github.com/open-goal/jak-project/assets/13153231/0edfaba1-6d36-40f5-ab23-0642209867c4)
2024-06-05 22:17:31 -04:00

623 lines
25 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
(bundles "SUN.DGO")
(require "engine/nav/navigate.gc")
(require "engine/common-obs/collectables.gc")
(require "engine/anim/joint-mod-h.gc")
(declare-type bully process-drawable)
;; DECOMP BEGINS
(deftype bully-broken-cage (process-drawable)
((parent-override (pointer bully) :overlay-at parent))
(:states
bully-broken-cage-explode))
(deftype bully (process-drawable)
((root collide-shape-moving :override)
(fact fact-info-enemy :override)
(hit-player? symbol)
(bounced? symbol)
(bounce-volume int32)
(facing-ry float)
(travel-ry float)
(speed-u float)
(spin-vel float)
(travel-speed float)
(reaction-delay time-frame)
(start-spin-time time-frame)
(slow-down time-frame)
(hit-player-time time-frame)
(neck joint-mod))
(:methods
(bully-method-20 (_type_) float))
(:states
bully-die
(bully-idle symbol)
bully-notice
bully-start-spinning
bully-stop-spinning))
(defskelgroup *bully-sg*
bully
bully-lod0-jg
bully-idle-ja
((bully-lod0-mg (meters 20)) (bully-lod1-mg (meters 40)) (bully-lod2-mg (meters 999999)))
:bounds (static-spherem 0 1.5 0 3)
:shadow bully-shadow-mg)
(defskelgroup *bully-broken-cage-sg*
bully
bully-broken-cage-lod0-jg
-1
((bully-broken-cage-lod0-mg (meters 999999)))
:bounds (static-spherem 0 2 0 6))
(define *bully-shadow-control*
(new 'static
'shadow-control
:settings
(new 'static
'shadow-settings
:flags (shadow-flags shdf00 shdf03)
:shadow-dir
(new 'static 'vector :y -1.0 :w 614400.0)
:bot-plane
(new 'static 'plane :y 1.0 :w 10240.0)
:top-plane
(new 'static 'plane :y 1.0 :w -2048.0)
:fade-dist 245760.0)))
(defpartgroup group-bully-explode
:id 454
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 8)
:parts ((sp-item 2871) (sp-item 2872) (sp-item 2873) (sp-item 2874) (sp-item 2875)))
(defpart 2871
:init-specs
((:texture (new 'static 'texture-id :page #x2))
(:num 16.0)
(:y (meters 0.5) (meters 2))
(:scale-x (meters 2.5) (meters 1.5))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 128.0 32.0)
(:g 128.0 32.0)
(:b 128.0 32.0)
(:a 32.0 16.0)
(:vel-y (meters 0.016666668) (meters 0.033333335))
(:rotvel-z (degrees -1.2) (degrees 1.2))
(:accel-y (meters 0.00066666666))
(:timer (seconds 0.4))
(:flags (bit2 bit12))
(:next-time (seconds 0.1) (seconds 0.197))
(:next-launcher 2876)
(:conerot-x (degrees 70) (degrees 20))
(:conerot-y (degrees 0) (degrees 360))))
(defpart 2876
:init-specs ((:fade-a -1.0666667)))
(defpart 2872
:init-specs
((:texture (new 'static 'texture-id :index #x2 :page #x2))
(:num 4.0)
(:y (meters 1.5))
(:scale-x (meters 6) (meters 3))
(:rot-x 4)
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3) (meters 1))
(:r 192.0)
(:g 192.0)
(:b 64.0 128.0)
(:a 0.0)
(:scalevel-x (meters 0.009765625))
(:rotvel-z (degrees -0.15) (degrees 0.3))
(:scalevel-y (meters 0.009765625))
(:fade-a 2.1333334)
(:timer (seconds 0.1))
(:flags (bit2 bit3))
(:next-time (seconds 0.05))
(:next-launcher 2877)
(:rotate-y (degrees 0))))
(defpart 2877
:init-specs ((:fade-a -2.1333334)))
(defpart 2873
:init-specs
((:texture (new 'static 'texture-id :index #x12 :page #x2))
(:num 1.0)
(:y (meters 1.5))
(:scale-x (meters 12))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 196.0)
(:g 196.0)
(:b 196.0)
(:a 48.0)
(:timer (seconds 0.035))
(:flags (bit2 bit3))))
(defpart 2874
:init-specs
((:texture (new 'static 'texture-id :index #x6 :page #x2))
(:num 16.0)
(:x (meters -0.5) (meters 1))
(:y (meters 0.25) (meters 1.5))
(:z (meters -0.5) (meters 1))
(:scale-x (meters 0.6) 2.0 (meters 0.6))
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3))
(:r 160.0)
(:g 160.0)
(:b 160.0)
(:a 128.0)
(:vel-y (meters 0.06666667) (meters 0.06666667))
(:rotvel-x (degrees 1.2))
(:rotvel-y (degrees 2.4))
(:rotvel-z (degrees 0) 2 (degrees 2.4))
(:accel-y (meters -0.0033333334))
(:friction 0.97)
(:timer (seconds 0.5))
(:flags (bit2 bit12))
(:next-time (seconds 0.25))
(:next-launcher 2878)
(:conerot-x (degrees 40) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))))
(defpart 2878
:init-specs ((:scalevel-x (meters -0.0033333334)) (:scalevel-y :copy scalevel-x) (:fade-a -3.4)))
(defpart 2875
:init-specs
((:texture (new 'static 'texture-id :index #x5 :page #x2))
(:num 16.5)
(:x (meters -0.5) (meters 1))
(:y (meters 0.25) (meters 1.5))
(:z (meters -0.5) (meters 1))
(:scale-x (meters 0.3) 1 (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3))
(:r 100.0)
(:g 100.0)
(:b 100.0)
(:a 128.0)
(:vel-y (meters 0.06666667) (meters 0.06666667))
(:rotvel-x (degrees 1.2))
(:rotvel-y (degrees 2.4))
(:rotvel-z (degrees 0) 3 (degrees 2.4))
(:accel-y (meters -0.0033333334))
(:friction 0.97)
(:timer (seconds 0.5))
(:flags (bit2 bit12))
(:next-time (seconds 0.25))
(:next-launcher 2878)
(:conerot-x (degrees 40) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))))
(defstate bully-broken-cage-explode (bully-broken-cage)
:code
(behavior ()
(ja-channel-push! 1 0)
(ja-no-eval :group! bully-broken-cage-explode-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))))
:post ja-post)
(defbehavior bully-broken-cage-init-by-other bully-broken-cage ((arg0 entity-actor))
(set! (-> self entity) arg0)
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> self parent-override 0 root trans quad))
(quaternion-copy! (-> self root quat) (-> self parent-override 0 root quat))
(set! (-> self root scale quad) (-> self parent-override 0 root scale quad))
(initialize-skeleton self *bully-broken-cage-sg* '())
(go bully-broken-cage-explode)
(none))
;; WARN: disable def twice: 148. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defbehavior bully-default-event-handler bully ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object))
(case arg2
(('touch 'touched 'attack)
(cond
((= (-> arg0 type) bully)
(let ((v1-3 (new 'stack-no-clear 'vector)))
(vector-! v1-3 (-> self root trans) (-> (the-as process-drawable arg0) root trans))
(set! (-> self travel-ry) (atan (-> v1-3 x) (-> v1-3 z))))
(set! (-> self bounced?) #t)
(set! v0-0 100)
(set! (-> self bounce-volume) (the-as int v0-0))
v0-0)
((= (-> arg0 type) target)
(cond
((= (-> arg3 param 1) 'flop) (go bully-die) (return #t) v0-0)
((or (= arg2 'touch) (= arg2 'attack))
(cond
((>= (- (-> (target-pos 0) y) (-> self root trans y)) 6144.0)
(let* ((f0-6 (fmax 0.6 (* 0.000023935356 (-> self travel-speed))))
(f28-0 (* 8192.0 f0-6))
(f30-0 (* 8192.0 f0-6))
(s4-0 (new 'stack-no-clear 'vector)))
(vector-! s4-0 (target-pos 0) (-> self root trans))
(let ((f26-0 (atan (-> s4-0 x) (-> s4-0 z))))
(when (< 0.0 (-> self travel-speed))
(let ((f0-11 (deg- f26-0 (-> self travel-ry))))
(if (< (fabs f0-11) 8192.0) (set! f26-0 (if (>= f0-11 0.0) (+ 8192.0 f26-0) (+ -8192.0 f26-0))))))
(set-vector! s4-0 (* (sin f26-0) f28-0) 0.0 (* (cos f26-0) f28-0) 1.0))
(when (send-event arg0 'shove (-> arg3 param 0) (static-attack-info ((shove-up f30-0) (vector s4-0))))
(level-hint-spawn (text-id sunken-bully-dive-hint) "sksp0131" (the-as entity #f) *entity-pool* (game-task none))
(set! (-> self bounced?) #t)
(set! v0-0 100)
(set! (-> self bounce-volume) (the-as int v0-0))
v0-0)))
(else
(let ((f0-21 (fmax 0.6 (* 0.000023935356 (-> self travel-speed)))))
(when (send-event arg0
'attack
(-> arg3 param 0)
(static-attack-info ((shove-up (* 12288.0 f0-21)) (shove-back (* 16384.0 f0-21)))))
(level-hint-spawn (text-id sunken-bully-dive-hint) "sksp0131" (the-as entity #f) *entity-pool* (game-task none))
(set! (-> self hit-player?) #t)
(set! (-> self bounced?) #t)
(set! (-> self bounce-volume) 100)
(set-time! (-> self hit-player-time))
(set-collide-offense (-> self root) 2 (collide-offense no-offense)))))))))
(else
(when (= arg2 'touched)
(cond
((= (-> arg0 type) target) (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'explode)))))
(else
(let ((a1-14 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-14 from) self)
(set! (-> a1-14 num-params) 4)
(set! (-> a1-14 message) 'attack)
(set! (-> a1-14 param 0) (-> arg3 param 0))
(set! (-> a1-14 param 1) (the-as uint 'explode))
(let ((v1-48 (+ *global-attack-id* 1))) (set! *global-attack-id* v1-48) (set! (-> a1-14 param 2) (the-as uint v1-48)))
(set! (-> a1-14 param 3) (the-as uint 0))
(send-event-function arg0 a1-14))))))))))
(defbehavior bully-post bully ()
(when (and (-> self hit-player?)
(or (not *target*)
(and (not (logtest? (-> *target* state-flags)
(state-flags being-attacked invulnerable timed-invulnerable invuln-powerup do-not-notice dying)))
(time-elapsed? (-> self hit-player-time) (seconds 0.05)))))
(set-collide-offense (-> self root) 2 (collide-offense normal-attack))
(set! (-> self hit-player?) #f))
(transform-post)
(none))
(defmethod bully-method-20 ((this bully))
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf))
(init-vf0-vector)
(set-vector! (-> this root transv)
(* (sin (-> this travel-ry)) (-> this travel-speed))
0.0
(* (cos (-> this travel-ry)) (-> this travel-speed))
1.0)
(let ((s5-1 #f))
(nav-control-method-28 (-> this nav) (collide-kind wall-object ground-object))
(let ((v1-4 (-> this nav travel)))
(.lvf vf1 (&-> (-> this root transv) quad))
(let ((f0-8 (seconds-per-frame))) (.mov at-0 f0-8))
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-4 quad) vf1))
(let ((s4-0 (new 'stack-no-clear 'check-vector-collision-with-nav-spheres-info)))
(when (>= (nav-control-method-23 (-> this nav) (-> this nav travel) s4-0) 0.0)
(let ((s5-2 (new 'stack-no-clear 'vector)))
(set! (-> s5-2 quad) (-> s4-0 normal quad))
(set! (-> s5-2 y) 0.0)
(vector-normalize! s5-2 1.0)
(vector-reflect! (-> this root transv) (-> this root transv) s5-2))
(set! (-> this travel-ry) (atan (-> this root transv x) (-> this root transv z)))
(+! (-> this travel-ry) (rand-vu-float-range -910.2222 910.2222))
(vector-reset! (-> this root transv))
(set! s5-1 #t)
(set! (-> this bounced?) #t)
(set! (-> this bounce-volume) 100)))
(when (not s5-1)
(vector-normalize-copy! (-> this nav travel) (-> this root transv) 2048.0)
(let ((s5-3 (new 'stack 'clip-travel-vector-to-mesh-return-info)))
(nav-control-method-24 (-> this nav) 2048.0 s5-3)
(when (and (-> s5-3 found-boundary)
(>= (* (-> this travel-speed) (seconds-per-frame))
(vector-vector-xz-distance (-> s5-3 intersection) (-> this root trans))))
(let ((s4-1 (new 'stack-no-clear 'vector)))
(vector-negate! s4-1 (-> s5-3 boundary-normal))
(set! (-> s4-1 y) 0.0)
(vector-normalize! s4-1 1.0)
(vector-reflect! (-> this root transv) (-> this root transv) s4-1))
(set! (-> this travel-ry) (atan (-> this root transv x) (-> this root transv z)))
(+! (-> this travel-ry) (rand-vu-float-range -910.2222 910.2222))
(vector-reset! (-> this root transv))
#t
(set! (-> this bounced?) #t)
(set! (-> this bounce-volume) 60)))))
(set! (-> this root transv y) (+ -36864.0 (-> this root transv y)))))
(defstate bully-idle (bully)
:event bully-default-event-handler
:enter
(behavior ((arg0 symbol))
(set-time! (-> self state-time))
(set! (-> self reaction-delay) (rand-vu-int-range 0 (seconds 0.35)))
(set! (-> self travel-speed) 0.0)
(shut-down! (-> self neck))
(let ((v1-5 (-> self draw shadow-ctrl))) (logior! (-> v1-5 settings flags) (shadow-flags disable-draw)))
0)
:exit
(behavior ()
(let ((v1-1 (-> self draw shadow-ctrl))) (logclear! (-> v1-1 settings flags) (shadow-flags disable-draw)))
0)
:trans
(behavior ()
(when (and (and *target*
(>= (-> self fact idle-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))))
(time-elapsed? (-> self state-time) (-> self reaction-delay)))
(start-hint-timer (text-id sunken-bully-dive-hint))
(go bully-notice)))
:code
(behavior ((arg0 symbol))
(ja-channel-push! 1 (seconds 0.075))
(if arg0
(ja :group! bully-idle-ja :num! (identity (rand-vu-float-range 0.0 (the float (+ (-> (ja-group) data 0 length) -1)))))
(ja :group! bully-idle-ja :num! min))
(loop
(suspend)
(ja :num! (loop!))))
:post bully-post)
(defstate bully-notice (bully)
:event bully-default-event-handler
:trans
(behavior ()
(when *target*
(if *target*
(look-at-enemy! (-> *target* neck)
(the-as vector (-> (the-as collide-shape-prim-group (-> self root root-prim)) prims 0 prim-core))
'attacking
self))
(set-target! (-> self neck) (target-pos 5))))
:code
(behavior ()
(set! (-> self travel-speed) 0.0)
(ja-channel-push! 1 (seconds 0.075))
(set-vector! (-> self root transv) 0.0 (rand-vu-float-range 61440.0 90112.0) 0.0 1.0)
(ja-no-eval :group! bully-notice-jump-up-ja :num! (seek! (ja-aframe 13.0 0)) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! (ja-aframe 13.0 0))))
(until (logtest? (-> self root status) (cshape-moving-flags onsurf))
(ja :num! (seek!))
(+! (-> self root transv y) (* -545996.8 (seconds-per-frame)))
(integrate-for-enemy-with-move-to-ground! (-> self root)
(-> self root transv)
(collide-kind background)
12288.0
#f
#f
#f)
(when *target*
(let ((gp-3 (new 'stack-no-clear 'vector)))
(vector-! gp-3 (target-pos 0) (-> self root trans))
(seek-toward-heading-vec! (-> self root) gp-3 524288.0 (seconds 0.1)))
(set! (-> self facing-ry) (quaternion-y-angle (-> self root quat))))
(suspend))
(ja-no-eval :group! bully-notice-land-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!)))
(go bully-start-spinning))
:post bully-post)
(defstate bully-start-spinning (bully)
:event bully-default-event-handler
:enter
(behavior ()
(set-time! (-> self state-time))
(set-time! (-> self start-spin-time))
(set! (-> self slow-down) (rand-vu-int-range (seconds 4) (seconds 8)))
(set! (-> self speed-u) 0.2)
(set! (-> self bounced?) #f)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(if *target* (vector-! gp-0 (target-pos 0) (-> self root trans)) (vector-z-quaternion! gp-0 (-> self root quat)))
(set! (-> self travel-ry) (atan (-> gp-0 x) (-> gp-0 z))))
(+! (-> self travel-ry) (rand-vu-float-range -910.2222 910.2222)))
:trans
(behavior ()
(when *target*
(if *target*
(look-at-enemy! (-> *target* neck)
(the-as vector (-> (the-as collide-shape-prim-group (-> self root root-prim)) prims 0 prim-core))
'attacking
self))
(set-target! (-> self neck) (target-pos 5)))
(cond
((time-elapsed? (-> self start-spin-time) (-> self slow-down))
(seek! (-> self speed-u) 0.0 (* 0.5555556 (seconds-per-frame)))
(if (= (-> self speed-u) 0.0) (go bully-stop-spinning)))
(else (seek! (-> self speed-u) 1.0 (* 0.5555556 (seconds-per-frame)))))
(set! (-> self spin-vel) (* 196608.0 (-> self speed-u)))
(set! (-> self travel-speed) (* 41779.2 (-> self speed-u)))
(+! (-> self facing-ry) (* (-> self spin-vel) (seconds-per-frame)))
(quaternion-axis-angle! (-> self root quat) 0.0 1.0 0.0 (-> self facing-ry))
(bully-method-20 self)
(integrate-for-enemy-with-move-to-ground! (-> self root)
(-> self root transv)
(collide-kind background)
8192.0
#f
#f
#f)
(nav-control-method-27 (-> self nav)))
:code
(behavior ()
(local-vars (v1-34 symbol) (v1-52 symbol))
(ja-channel-push! 1 (seconds 0.2))
(ja-no-eval :group! bully-start-spin-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!)))
(set! (-> self bounced?) #f)
(ja-channel-push! 1 (seconds 0.2))
(ja :group! bully-spin-ja :num! min)
(loop
(until v1-34
(suspend)
(ja :num! (seek!))
(set! v1-34 (or (ja-done? 0) (-> self bounced?))))
(when (-> self bounced?)
(sound-play "bully-bounce" :vol (the float (-> self bounce-volume)))
(until (not (-> self bounced?))
(set! (-> self bounced?) #f)
(ja-channel-push! 1 (seconds 0.2))
(ja :group! bully-idle-bounced-ja :num! min)
(until v1-52
(suspend)
(ja :num! (seek!))
(set! v1-52 (or (ja-done? 0) (-> self bounced?)))))
(ja-channel-push! 1 (seconds 0.2)))
(ja :group! bully-spin-ja :num! min)))
:post bully-post)
(defstate bully-stop-spinning (bully)
:event bully-default-event-handler
:enter
(behavior ()
(set-time! (-> self state-time))
(set! (-> self reaction-delay) (rand-vu-int-range (seconds 2) (seconds 3)))
(set! (-> self travel-speed) 0.0)
(set! (-> self bounced?) #f))
:trans
(behavior ()
(when *target*
(if *target*
(look-at-enemy! (-> *target* neck)
(the-as vector (-> (the-as collide-shape-prim-group (-> self root root-prim)) prims 0 prim-core))
'attacking
self))
(set-target! (-> self neck) (target-pos 5))))
:code
(behavior ()
(local-vars (v1-17 symbol) (v1-35 symbol))
(let ((gp-0 2))
(ja-channel-push! 1 (seconds 0.2))
(until (time-elapsed? (-> self state-time) (-> self reaction-delay))
(cond
((>= gp-0 0) (+! gp-0 -1) (ja :group! bully-dizzy-ja :num! min))
(else (ja :group! bully-idle-ja :num! min)))
(until v1-17
(suspend)
(ja :num! (seek!))
(set! v1-17 (or (ja-done? 0) (-> self bounced?))))
(when (-> self bounced?)
(sound-play "bully-bounce" :vol (the float (-> self bounce-volume)))
(set! gp-0 0)
(until (not (-> self bounced?))
(set! (-> self bounced?) #f)
(ja-channel-push! 1 (seconds 0.2))
(ja :group! bully-idle-bounced-ja :num! min)
(until v1-35
(suspend)
(ja :num! (seek!))
(set! v1-35 (or (ja-done? 0) (-> self bounced?)))))
(ja-channel-push! 1 (seconds 0.2)))))
(if (or (not *target*)
(< (-> self fact idle-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))))
(go bully-idle #f))
(go bully-start-spinning))
:post bully-post)
(defstate bully-die (bully)
:code
(behavior ()
(cleanup-for-death self)
(shut-down! (-> self neck))
(logclear! (-> self mask) (process-mask actor-pause))
(process-spawn bully-broken-cage (-> self entity) :to self)
(spawn (-> self part) (-> self root trans))
(clear-collide-with-as (-> self root))
(drop-pickup (-> self fact) #t *entity-pool* (-> self fact) 0)
(ja-channel-push! 1 (seconds 0.075))
(ja-no-eval :group! bully-die-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!)))
(increment-success-for-hint (text-id sunken-bully-dive-hint))
(logior! (-> self draw status) (draw-status hidden))
(while (-> self child)
(suspend)))
:post transform-post)
(defmethod relocate ((this bully) (arg0 int))
(if (nonzero? (-> this neck)) (&+! (-> this neck) arg0))
(call-parent-method this arg0))
(defmethod init-from-entity! ((this bully) (arg0 entity-actor))
(set! (-> this hit-player?) #f)
(set! (-> this bounced?) #f)
(set! (-> this bounce-volume) 100)
(set! (-> this spin-vel) 0.0)
(set! (-> this travel-speed) 0.0)
(logior! (-> this mask) (process-mask enemy))
(let ((s4-0 (new 'process 'collide-shape-moving this (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))
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0)))
(set! (-> s3-0 prim-core collide-as) (collide-kind enemy))
(set! (-> s3-0 collide-with) (collide-kind cak-2 target crate enemy))
(set! (-> s3-0 prim-core action) (collide-action solid attackable attackable-unused))
(set! (-> s3-0 prim-core offense) (collide-offense normal-attack))
(set-vector! (-> s3-0 local-sphere) 0.0 6144.0 0.0 10240.0)
(set-root-prim! s4-0 s3-0)
(let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 3))))
(set! (-> s2-0 prim-core collide-as) (collide-kind enemy))
(set! (-> s2-0 collide-with) (collide-kind cak-2 target crate enemy))
(set! (-> s2-0 prim-core action) (collide-action solid attackable attackable-unused))
(set! (-> s2-0 prim-core offense) (collide-offense normal-attack))
(set-vector! (-> s2-0 local-sphere) 0.0 4096.0 0.0 6963.2)
(append-prim s3-0 s2-0))
(let ((s2-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 3))))
(set! (-> s2-1 prim-core collide-as) (collide-kind enemy))
(set! (-> s2-1 collide-with) (collide-kind cak-2 target crate enemy))
(set! (-> s2-1 prim-core action) (collide-action solid attackable attackable-unused))
(set! (-> s2-1 prim-core offense) (collide-offense normal-attack))
(set-vector! (-> s2-1 local-sphere) 0.0 9420.8 0.0 4096.0)
(append-prim s3-0 s2-1)))
(set! (-> s4-0 nav-radius) 7680.0)
(backup-collide-with-as s4-0)
(set! (-> this root) s4-0))
(set! (-> this root event-self) 'touched)
(set! (-> this root event-other) 'touch)
(process-drawable-from-entity! this arg0)
(initialize-skeleton this *bully-sg* '())
(set! (-> this draw shadow-ctrl) *bully-shadow-control*)
(set! (-> this nav) (new 'process 'nav-control (-> this root) 16 40960.0))
(logior! (-> this nav flags) (nav-control-flags display-marks navcf3 navcf5 navcf6 navcf7))
(set! (-> this part) (create-launch-control (-> *part-group-id-table* 454) this))
(set! (-> this fact) (new 'process 'fact-info-enemy this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)))
(let ((v1-49 (new 'process 'joint-mod (joint-mod-handler-mode reset) this 5)))
(set! (-> this neck) v1-49)
(set-vector! (-> this neck twist-max) 8192.0 8192.0 0.0 1.0)
(set! (-> v1-49 up) (the-as uint 1))
(set! (-> v1-49 nose) (the-as uint 2))
(set! (-> v1-49 ear) (the-as uint 0))
(set! (-> v1-49 max-dist) 102400.0)
(set! (-> v1-49 ignore-angle) 16384.0))
(transform-post)
(if (not (move-to-ground (-> this root) 12288.0 40960.0 #t (collide-kind background)))
(go process-drawable-art-error "no ground"))
(set! (-> this facing-ry) (quaternion-y-angle (-> this root quat)))
(go bully-idle #t)
(none))