# Expected variables: # RGRAPH_NS (str): e.g. "spiky_", "" $SET_INT MAX_AGE 100 vars: nosave "carrying": null nosave "carrying_respawn_counter": null nosave label "label:carrying": null proc "on_collide": # me: spit # you: thing we collided with if: exists myvar("carrying") then: # This spit is carrying something # If we hit something which accepts what we're carrying, # then transfer it over if: exists yourvar("accept_carryable") expr: == yourvar("accept_carryable") myvar("carrying") then: as you: call: "accept_carryable" call: "on_death" proc "on_death": if: exists myvar("carrying") then: # This spit is carrying something # Decrement a mapvar tracking how many of this thing are # being carried if: exists myvar("carrying_respawn_counter") then: dec mapvar(myvar("carrying_respawn_counter")) # We're no longer carrying anything set myvar("carrying"): null state "fly": rgraph: $PREFIX RGRAPH_NS "spit_fly" collmsgs: "spit" $IF SPIKEY("spikeyspit") hitbox: ;; . . ;; *\*/ ;; . - + . ;; ;; (.) . on "crush": call: "on_collide" goto: "dead" on "solid": call: "on_collide" goto: "dead" if: then: inc myvar("age") continue if: any: expr: > myvar("age") $GET_INT MAX_AGE coll: any yes ;; . . ;; *\* ;; . . . ;; ;; ( ) . then: call: "on_death" goto delay: "dead" if: coll: all yes ;; . . ;; / ;; . . . ;; ;; ( ) . then: move: 2 1 rot: 1 if() then: move: 1 0 state "crouch_fly": rgraph: $PREFIX RGRAPH_NS "spit_crouch_fly" collmsgs: "spit" $IF SPIKEY("spikeyspit") hitbox: ;; . . ;; */*\ ;; (.) . . on "crush": call: "on_collide" goto: "crouch_dead" on "solid": call: "on_collide" goto: "crouch_dead" if: then: inc myvar("age") continue if: any: expr: > myvar("age") $GET_INT MAX_AGE coll: any yes ;; . . ;; *\* ;; ( ) . then: call: "on_death" goto delay: "crouch_dead" if: coll: all yes ;; . . ;; / ;; ( ) . then: move: 1 0 rot: 1 if() then: move: 1 0 state "dead": rgraph: "dead_once" if() then: remove state "crouch_dead": rgraph: "dead_once_crouch" if() then: remove