@celljs/ta-town 4.23.0 → 4.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/web/index.js +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-town",
3
- "version": "4.23.0",
3
+ "version": "4.24.1",
4
4
  "description": "A pi package for Ta: a pixel town after Stanford's Smallville, where the double, the agents of ta-channels and the tasks live and go about what they are doing",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -25,9 +25,9 @@
25
25
  "watch": "tsc -b -w --preserveWatchOutput"
26
26
  },
27
27
  "devDependencies": {
28
- "@celljs/ta-protocol": "4.23.0",
29
- "@celljs/ta-relay": "4.23.0",
30
- "@celljs/ta-web": "4.23.0",
28
+ "@celljs/ta-protocol": "4.24.1",
29
+ "@celljs/ta-relay": "4.24.1",
30
+ "@celljs/ta-web": "4.24.1",
31
31
  "@types/react": "^19.3.0",
32
32
  "phaser": "^4.2.1"
33
33
  },
package/web/index.js CHANGED
@@ -14850,14 +14850,12 @@ function makeWorld(hooks, ready) {
14850
14850
  if (event.pointerType !== "mouse") {
14851
14851
  return;
14852
14852
  }
14853
+ const here = () => actAt(look.x, look.y, event.button === 2 ? "hand" : "held");
14853
14854
  if (!hooks.touch && element.requestPointerLock && !talking) {
14854
- const request = element.requestPointerLock();
14855
- request?.catch?.(() => {
14856
- return;
14857
- });
14855
+ element.requestPointerLock()?.catch?.(here);
14858
14856
  return;
14859
14857
  }
14860
- actAt(look.x, look.y, event.button === 2 ? "hand" : "held");
14858
+ here();
14861
14859
  };
14862
14860
  let using = false;
14863
14861
  let useAt = 0;
@@ -15457,6 +15455,7 @@ var TOAST = 3200;
15457
15455
  function TownWorld({ pi, data, model, talk, words: w, possessed, source, onPossess, onLeave, together, onTogether }) {
15458
15456
  const root = React.useRef(null);
15459
15457
  const handle = React.useRef(undefined);
15458
+ const [worldReady, setWorldReady] = React.useState(false);
15460
15459
  const device = pi.ui.useDevice();
15461
15460
  const touch = device.touch;
15462
15461
  const [aim, setAim] = React.useState();
@@ -15526,6 +15525,7 @@ function TownWorld({ pi, data, model, talk, words: w, possessed, source, onPosse
15526
15525
  }
15527
15526
  }, (made) => {
15528
15527
  handle.current = made;
15528
+ setWorldReady(true);
15529
15529
  if (together) {
15530
15530
  together.apply = (changes) => made.setBlocks(changes);
15531
15531
  }
@@ -15548,11 +15548,14 @@ function TownWorld({ pi, data, model, talk, words: w, possessed, source, onPosse
15548
15548
  }, [together, w]);
15549
15549
  const covered = !!talkTo || mapOpen || togetherOpen || !!arcadeEnd;
15550
15550
  React.useEffect(() => {
15551
+ if (!worldReady) {
15552
+ return;
15553
+ }
15551
15554
  handle.current?.talking(covered);
15552
15555
  if (!covered) {
15553
15556
  handle.current?.focus();
15554
15557
  }
15555
- }, [covered]);
15558
+ }, [covered, worldReady]);
15556
15559
  React.useEffect(() => {
15557
15560
  if (!mapOpen) {
15558
15561
  return;