Reset Timer Doodad + Various Fixes

* Bird is not solid when colliding with other birds.
* If the dev shell is used to run JavaScript during Play Mode, consider
  it cheating (so player can't `$ d.Scene.ResetTimer()` for example)
* On Survival Mode levels, DieByFire immediately opens the End Level
  (silver score) modal rather than respawn from checkpoint, so levels
  don't need checkpoint contraptions to end the level.
* During level loading screens, wait and call doodads' main() function
  until the very end.
This commit is contained in:
Noah 2022-03-27 11:51:14 -07:00
parent c8479adde9
commit 66382739bb
4 changed files with 35 additions and 1 deletions

View File

@ -31,7 +31,7 @@ function main() {
return; return;
} }
if (e.Actor.IsMobile() && e.InHitbox) { if (e.Actor.IsMobile() && e.Actor.HasGravity() && e.InHitbox) {
return false; return false;
} }
}); });

View File

@ -28,6 +28,10 @@ build:
doodad edit-doodad --tag "color=invisible" reg-warp-door.doodad doodad edit-doodad --tag "color=invisible" reg-warp-door.doodad
doodad install-script ../warp-door/warp-door.js reg-warp-door.doodad doodad install-script ../warp-door/warp-door.js reg-warp-door.doodad
# Reset Level Timer
doodad convert -t "Reset Level Timer" timer-64.png reg-reset-timer.doodad
doodad install-script reset-timer.js reg-reset-timer.doodad
for i in *.doodad; do\ for i in *.doodad; do\
doodad edit-doodad --tag "category=technical" $${i};\ doodad edit-doodad --tag "category=technical" $${i};\
done done

View File

@ -0,0 +1,30 @@
// Reset Level Timer.
function main() {
Self.Hide();
// Reset the level timer only once.
let hasReset = false;
Events.OnCollide((e) => {
if (!e.Settled) {
return;
}
// Only care if it's the player.
if (!e.Actor.IsPlayer()) {
return;
}
if (e.InHitbox && !hasReset) {
Level.ResetTimer();
hasReset = true;
}
});
// Receive a power signal resets the doodad.
Message.Subscribe("power", (powered) => {
if (powered) {
hasReset = true;
}
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B