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: "location": null "map": null "anim": null "state": null "set_yourbool": null "set_mapvar.name": null "set_mapvar.value": null "set_globalvar.name": null "set_globalvar.value": null state "init": 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: any: not: exists myvar("key") expr: mapvar(myvar("key")) not: coll: bodies("touch") any yes collmap("cooldown") then: goto: "open" state "open": rgraph: "door" hitbox: collmap("hitbox") on "enter_door": # me: door # you: a body which just entered this door # 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: exists myvar("set_mapvar.name") then: set mapvar(myvar("set_mapvar.name")): myvar("set_mapvar.value") if: exists myvar("set_globalvar.name") then: set globalvar(myvar("set_globalvar.name")): myvar("set_globalvar.value") goto: "closed" if: exists myvar("key") not: expr: mapvar(myvar("key")) then: goto: "closed"