polats Claude Opus 4.8 (1M context) commited on
Commit
f3cb070
·
1 Parent(s): ca975ec

Fix Forgotten Plains Reference mockup 404; bundle the river-tile fix

Browse files

The FP Reference mockup <img> is built via the shared h() DOM helper, which sets src
through setAttribute('src', '/assets/...'). The asset-URL shim only patched the .src
property setter, so that path was never rerooted to /sprites -> 404. Patch
setAttribute on images too (src/srcset).

web/mapSandbox.js rebuilt to pick up the auto-battler Forgotten Plains river fix
(correct water-blob tiles + wider, banked rivers).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. web/mapSandbox.js +4 -4
  2. web/tiny.js +6 -0
web/mapSandbox.js CHANGED
@@ -891,7 +891,7 @@ function forestField(seed, x, y) {
891
  return fbm(sub3(seed, 15740503), x * FOREST_SCALE, y * FOREST_SCALE);
892
  }
893
  var RIVER_SCALE = 0.022;
894
- var RIVER_WIDTH = 0.018;
895
  var WARP_SCALE2 = 0.03;
896
  var WARP_AMP2 = 22;
897
  function isRiver(seed, x, y) {
@@ -921,9 +921,9 @@ var DIRT_VARS2 = [[7, 1], [8, 1], [9, 1]];
921
  var STONE_BLOCK = [12, 3];
922
  var STONE_FILL = [13, 4];
923
  var STONE_VARS = [[12, 1], [13, 1], [14, 1]];
924
- var WATER_BLOCK = [24, 3];
925
- var WATER_FILL = [26, 1];
926
- var WATER_VARS = [[26, 1]];
927
  var FILL_RATE = 6;
928
  var FOLIAGE = [
929
  { tiles: [[9, 6], [10, 6], [11, 6]], weight: 4 },
 
891
  return fbm(sub3(seed, 15740503), x * FOREST_SCALE, y * FOREST_SCALE);
892
  }
893
  var RIVER_SCALE = 0.022;
894
+ var RIVER_WIDTH = 0.035;
895
  var WARP_SCALE2 = 0.03;
896
  var WARP_AMP2 = 22;
897
  function isRiver(seed, x, y) {
 
921
  var STONE_BLOCK = [12, 3];
922
  var STONE_FILL = [13, 4];
923
  var STONE_VARS = [[12, 1], [13, 1], [14, 1]];
924
+ var WATER_BLOCK = [25, 3];
925
+ var WATER_FILL = [26, 4];
926
+ var WATER_VARS = [[26, 4]];
927
  var FILL_RATE = 6;
928
  var FOLIAGE = [
929
  { tiles: [[9, 6], [10, 6], [11, 6]], weight: 4 },
web/tiny.js CHANGED
@@ -33,6 +33,12 @@ Object.defineProperty(HTMLImageElement.prototype, 'src', {
33
  get() { return _imgSrc.get.call(this) },
34
  set(v) { _imgSrc.set.call(this, reroot(v)) },
35
  })
 
 
 
 
 
 
36
  const _fetch = window.fetch.bind(window)
37
  window.fetch = (input, init) => _fetch(typeof input === 'string' ? reroot(input) : input, init)
38
 
 
33
  get() { return _imgSrc.get.call(this) },
34
  set(v) { _imgSrc.set.call(this, reroot(v)) },
35
  })
36
+ // …and via setAttribute('src', …) too — the shared h() DOM helper sets img src that way
37
+ // (e.g. the Forgotten Plains Reference mockup), which bypasses the property setter above.
38
+ const _imgSetAttr = HTMLImageElement.prototype.setAttribute
39
+ HTMLImageElement.prototype.setAttribute = function (name, value) {
40
+ return _imgSetAttr.call(this, name, (name === 'src' || name === 'srcset') ? reroot(value) : value)
41
+ }
42
  const _fetch = window.fetch.bind(window)
43
  window.fetch = (input, init) => _fetch(typeof input === 'string' ? reroot(input) : input, init)
44