Invulnerable Anvil and other fixes

* Add methods `Invulnerable() bool` and `SetInvulnerable(bool)` to the
  Actor API accessible in JavaScript (e.g. `Self.SetInvulnerable(true)`)
* The Anvil is invulnerable - when played as, it can crush other mobs by
  jumping on them but is not defeated by those mobs at the same time.
* Anvils don't destroy invulnerable mobs, such as other Anvils.
* Bugfix: the Electric Door is considered to be opened from the first
  frame of animation when the door begins opening, and remains opened
  until the final frame of animation when it is closing.
* New cheat code: `megaton weight` to play as the Anvil by default.
master
Noah 2022-02-20 11:48:36 -08:00
parent 2b8005e942
commit e21519f6a1
2 changed files with 3 additions and 2 deletions

View File

@ -14,9 +14,9 @@ function setPoweredState(powered) {
}
animating = true;
opened = true;
Sound.Play("electric-door.wav")
Self.PlayAnimation("open", () => {
opened = true;
animating = false;
});
} else {

View File

@ -6,6 +6,7 @@ function main() {
Self.SetHitbox(0, 0, 48, 25);
Self.SetMobile(true);
Self.SetGravity(true);
Self.SetInvulnerable(true);
// Monitor our Y position to tell if we've been falling.
let lastPoint = Self.Position();
@ -33,7 +34,7 @@ function main() {
FailLevel("Watch out for anvils!");
return;
}
else if (e.Actor.IsMobile()) {
else if (e.Actor.IsMobile() && !e.Actor.Invulnerable()) {
// Destroy mobile doodads.
Sound.Play("crumbly-break.wav");
e.Actor.Destroy();