Noah Petherbridge
b4922edf5d
* The `doodad edit-doodad` command now allows setting custom key/value tags in doodad files, for extra data storage useful to their scripts. * Colored keys and doors now store a `color` tag with the appropriate color so that their scripts don't have to parse their Title to find that information. * Trapdoors now store a `direction` tag to hold the direction the door is facing.
27 lines
447 B
JavaScript
27 lines
447 B
JavaScript
function main() {
|
|
Self.AddAnimation("open", 0, [1]);
|
|
var unlocked = false;
|
|
var color = Self.Doodad.Tag("color");
|
|
|
|
Self.SetHitbox(16, 0, 32, 64);
|
|
|
|
Events.OnCollide(function(e) {
|
|
if (unlocked) {
|
|
return;
|
|
}
|
|
|
|
if (e.InHitbox) {
|
|
var data = e.Actor.GetData("key:" + color);
|
|
if (data === "") {
|
|
// Door is locked.
|
|
return false;
|
|
}
|
|
|
|
if (e.Settled) {
|
|
unlocked = true;
|
|
Self.PlayAnimation("open", null);
|
|
}
|
|
}
|
|
});
|
|
}
|