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
このコミットが含まれているのは:
Noah 2021-10-09 20:45:38 -07:00
コミット 73175b6965
3個のファイルの変更27行の追加11行の削除

ファイルの表示

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

ファイルの表示

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

ファイルの表示

@ -5,6 +5,12 @@ function main() {
Events.OnCollide(function (e) { Events.OnCollide(function (e) {
if (e.Settled) { if (e.Settled) {
if (e.Actor.HasInventory()) { 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") Sound.Play("item-get.wav")
e.Actor.AddItem(Self.Filename, quantity); e.Actor.AddItem(Self.Filename, quantity);
Self.Destroy(); Self.Destroy();