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.
This commit is contained in:
parent
2b8005e942
commit
e21519f6a1
|
@ -14,9 +14,9 @@ function setPoweredState(powered) {
|
||||||
}
|
}
|
||||||
|
|
||||||
animating = true;
|
animating = true;
|
||||||
|
opened = true;
|
||||||
Sound.Play("electric-door.wav")
|
Sound.Play("electric-door.wav")
|
||||||
Self.PlayAnimation("open", () => {
|
Self.PlayAnimation("open", () => {
|
||||||
opened = true;
|
|
||||||
animating = false;
|
animating = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@ function main() {
|
||||||
Self.SetHitbox(0, 0, 48, 25);
|
Self.SetHitbox(0, 0, 48, 25);
|
||||||
Self.SetMobile(true);
|
Self.SetMobile(true);
|
||||||
Self.SetGravity(true);
|
Self.SetGravity(true);
|
||||||
|
Self.SetInvulnerable(true);
|
||||||
|
|
||||||
// Monitor our Y position to tell if we've been falling.
|
// Monitor our Y position to tell if we've been falling.
|
||||||
let lastPoint = Self.Position();
|
let lastPoint = Self.Position();
|
||||||
|
@ -33,7 +34,7 @@ function main() {
|
||||||
FailLevel("Watch out for anvils!");
|
FailLevel("Watch out for anvils!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (e.Actor.IsMobile()) {
|
else if (e.Actor.IsMobile() && !e.Actor.Invulnerable()) {
|
||||||
// Destroy mobile doodads.
|
// Destroy mobile doodads.
|
||||||
Sound.Play("crumbly-break.wav");
|
Sound.Play("crumbly-break.wav");
|
||||||
e.Actor.Destroy();
|
e.Actor.Destroy();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user