Polish and bugfixes

- Fix a memory sharing bug in the Giant Screenshot feature.
- Main Menu to eagerload chunks in the background to make scrolling less
  jittery. No time for a loadscreen!
- Extra script debugging: names/IDs of doodads are shown when they send
  messages to one another.
- Level Properties: you can edit the Bounded max width/height values for
  the level.

Doodad changes:

- Buttons: fix a timing bug and keep better track of who is stepping on it,
  only popping up when all colliders have left. The effect: they pop up
  immediately (not after 200ms) and are more reliable.
- Keys: zero-qty keys will no longer put themselves into the inventory of
  characters who already have one except for the player character. So
  the Thief will not steal them if she already has the key.

Added to the JavaScript API:

* time.Hour, time.Minute, time.Second, time.Millisecond, time.Microsecond
This commit is contained in:
Noah 2021-10-09 20:45:38 -07:00
parent 36684f99f1
commit 73175b6965
3 changed files with 27 additions and 11 deletions

View File

@ -9,11 +9,18 @@ function main() {
Self.ShowLayer(stickyDown ? 1 : 0);
});
// Track who all is colliding with us.
var colliders = {};
Events.OnCollide(function (e) {
if (!e.Settled) {
return;
}
if (colliders[e.Actor.ID()] == undefined) {
colliders[e.Actor.ID()] = true;
}
// If a linked Sticky Button is pressed, button stays down too and
// doesn't interact.
if (stickyDown) {
@ -37,12 +44,17 @@ function main() {
}
Self.ShowLayer(1);
timer = setTimeout(function() {
});
Events.OnLeave(function (e) {
delete colliders[e.Actor.ID()];
if (Object.keys(colliders).length === 0) {
Sound.Play("button-up.wav")
Self.ShowLayer(0);
Message.Publish("power", false);
timer = 0;
pressed = false;
}, 200);
}
});
}

View File

@ -6,7 +6,6 @@ var powerState = false;
function setPoweredState(powered) {
powerState = powered;
console.log("setPoweredState: %+v", powered)
if (powered) {
if (animating || opened) {
return;
@ -42,7 +41,6 @@ function main() {
// signal.
var ignoreNextPower = false;
Message.Subscribe("switch:toggle", function (powered) {
console.log("A switch powered %+v, setPoweredState(%+v) to opposite", powered, powerState);
ignoreNextPower = true;
setPoweredState(!powerState);
})

View File

@ -5,6 +5,12 @@ function main() {
Events.OnCollide(function (e) {
if (e.Settled) {
if (e.Actor.HasInventory()) {
// If we don't have a quantity, and the actor already has
// one of us, don't pick it up so the player can get it.
if (quantity === 0 && e.Actor.HasItem(Self.Filename) === 0 && !e.Actor.IsPlayer()) {
return;
}
Sound.Play("item-get.wav")
e.Actor.AddItem(Self.Filename, quantity);
Self.Destroy();