# Expected variables: # RGRAPH_NS (str): e.g. "", "ability_" # ABILITY (bool) # MINIMAP (bool) $SET_STR NS "spider_" import "anim/_spider_vars.fus" $UNSET NS collmap "hitbox": ;; . . ;; *\*/* ;; . -(+)- . ;; */*\* ;; . . # The "cooldown" hitbox is for after a door is used by a body, the # door closes until all bodies are outside this hitbox. collmap "cooldown": ;; + - + - + - + - + - + ;; /*\*/*\*/*\*/*\*/*\*/*\ ;; + - + - + - + - + - + - + ;; /*\*/*\*/*\*/*\*/*\*/*\*/*\ ;; + - + - + - + - + - + - + - + ;; /*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\ ;; + - + - + - + - + - + - + - + - + ;; /*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\ ;; + - + - + - + - + - + - + - + - + - + ;; /*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\ ;; + - + - + - + - + -(+)- + - + - + - + - + ;; \*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/ ;; + - + - + - + - + - + - + - + - + - + ;; \*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/ ;; + - + - + - + - + - + - + - + - + ;; \*/*\*/*\*/*\*/*\*/*\*/*\*/*\*/ ;; + - + - + - + - + - + - + - + ;; \*/*\*/*\*/*\*/*\*/*\*/*\*/ ;; + - + - + - + - + - + - + ;; \*/*\*/*\*/*\*/*\*/*\*/ ;; + - + - + - + - + - + vars: "oneway": F "location": null "map": null "anim": null "state": null "set_yourbool": null "set_mapbool": null "set_globalbool": null "set_mapvar.name": null "set_mapvar.value": null "set_globalvar.name": null "set_globalvar.value": null state "init": $IF ABILITY: if: exists myvar("set_yourbool") then: # E.g. sets myvar("is_spikeyspider"): T, which kicks off the # "update_vars" proc from anim/_spider_vars.fus, which sets # up various labels, so that our rgraph looks like a spider # with the associated ability!.. set myvar(myvar("set_yourbool")): T call: "update_vars" continue if: any: not: exists myvar("key") expr: mapvar(myvar("key")) then: goto immediate: "open" if: then: goto immediate: "closed" state "closed": rgraph: "doorframe" hitbox: collmap("hitbox") if: not: expr: myvar("oneway") any: not: exists myvar("key") expr: mapvar(myvar("key")) not: coll: bodies("touch") any yes collmap("cooldown") then: goto: "open" state "open": rgraph: $PREFIX RGRAPH_NS "door" hitbox: collmap("hitbox") on "enter_door": # me: door # you: a body which just entered this door if: expr: yourvar(".safe") # A body can't use a minimap-door unless the body # is controlled by a player $IF MINIMAP: as you: is_player() then: # Relocate whatever entered the door as you: relocate: yourvar("location") yourvar("map") yourvar("anim") yourvar("state") # Set a boolean variable and call the "update_vars" proc # of the body which touched us. # NOTE: this is a bit of a hack... the "spider" body has an # "update_vars" proc, which it uses to set up its labels based # on certain vars, e.g. "is_rollerspider". # The idea is that some doors can set such vars of the spider, # then run the "update_vars" proc so that its labels are # recalculated. # TL;DR this is how a door can turn you into e.g. a rollerspider. if: exists myvar("set_yourbool") then: as you: set myvar(yourvar("set_yourbool")): T call: "update_vars" $IF MINIMAP: show_minimap() if: exists myvar("set_mapvar.name") then: set mapvar(myvar("set_mapvar.name")): myvar("set_mapvar.value") if: exists myvar("set_mapbool") then: set mapvar(myvar("set_mapbool")): T if: exists myvar("set_globalvar.name") then: set globalvar(myvar("set_globalvar.name")): myvar("set_globalvar.value") if: exists myvar("set_globalbool") then: set globalvar(myvar("set_globalbool")): T goto: "closed" if: exists myvar("key") not: expr: mapvar(myvar("key")) then: goto: "closed"