dredless 1.1.4 → 1.2.2

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.
@@ -4494,7 +4494,8 @@
4494
4494
  }
4495
4495
  readStreamInt() {
4496
4496
  const raw = this.readUnsigned();
4497
- return (raw & 1) === 0 ? raw / 2 : -((raw + 1) / 2);
4497
+ const magnitude = Math.floor(raw / 2);
4498
+ return raw % 2 === 0 ? magnitude : -magnitude;
4498
4499
  }
4499
4500
  readFieldDelta() {
4500
4501
  const raw = this.readUnsigned();
@@ -4584,7 +4585,7 @@
4584
4585
  result += (byte & 127) * 2 ** shift;
4585
4586
  if ((byte & 128) === 0) {
4586
4587
  return {
4587
- value: (result & 1) === 0 ? result / 2 : -((result + 1) / 2),
4588
+ value: result % 2 === 0 ? result / 2 : -Math.floor(result / 2),
4588
4589
  offset
4589
4590
  };
4590
4591
  }
@@ -4649,7 +4650,13 @@
4649
4650
  [2, { name: "numeric_pair", ...TWO_FIELD_SPEC }],
4650
4651
  [3, { name: "gate_width", fields: numericFields({ 1: 20, 2: 24, 4: 28, 8: 32, 16: 36, 32: 40 }) }],
4651
4652
  [4, { name: "motion_aux", packedBits: [{ bit: 8, offset: 33 }], fields: numericFields({ 1: 20, 2: 24, 4: 28 }) }],
4652
- [5, { name: "entity_health", fields: numericFields({ 1: 20, 2: 24, 4: 28, 8: 32 }) }],
4653
+ [5, {
4654
+ name: "entity_health",
4655
+ // The official table starts both bar dimensions at 10 (one world unit).
4656
+ // Field values on the wire are deltas relative to these defaults.
4657
+ defaults: { q28: 10, q32: 10 },
4658
+ fields: numericFields({ 1: 20, 2: 24, 4: 28, 8: 32 })
4659
+ }],
4653
4660
  [6, { name: "item_holder", ...TWO_FIELD_SPEC }],
4654
4661
  [7, {
4655
4662
  name: "entity_type",
@@ -4797,6 +4804,12 @@
4797
4804
  }],
4798
4805
  [26, { name: "numeric_single", fields: numericFields({ 1: 20 }) }],
4799
4806
  [31, { name: "numeric_single", fields: numericFields({ 1: 20 }) }],
4807
+ [32, {
4808
+ // Wire 95 has values; treating it as a marker swallows following removals.
4809
+ name: "numeric_triplet",
4810
+ defaults: { q28: 10 },
4811
+ fields: numericFields({ 1: 20, 2: 24, 4: 28 })
4812
+ }],
4800
4813
  [37, { name: "loose_item_marker", packedBits: [{ bit: 2, offset: 29 }], fields: numericFields({ 1: 20, 4: 24 }) }],
4801
4814
  [38, { name: "flag_state", packedBits: [{ bit: 1, offset: 21 }], fields: [] }],
4802
4815
  [39, { name: "comms_transmit", ...TWO_FIELD_SPEC }],
@@ -4823,6 +4836,8 @@
4823
4836
  }],
4824
4837
  [54, {
4825
4838
  name: "starter_cannon",
4839
+ // Wire deltas start with both barrels fully extended and capacity 16.
4840
+ defaults: { q36: 50, q44: 16, q48: 50 },
4826
4841
  fields: numericFields({ 1: 20, 2: 32, 4: 24, 8: 28, 16: 44, 32: 36, 64: 48, 128: 52, 256: 40, 512: 56, 1024: 60 })
4827
4842
  }],
4828
4843
  [55, {
@@ -5004,7 +5019,7 @@
5004
5019
  [168, 78],
5005
5020
  [169, 77]
5006
5021
  ]);
5007
- var MASK_ONLY_TABLES = /* @__PURE__ */ new Set([13, 22, 23, 27, 28, 30, 32, 36, 40, 46, 48, 52, 58, 64, 65, 66, 68, 73, 74]);
5022
+ var MASK_ONLY_TABLES = /* @__PURE__ */ new Set([13, 22, 23, 27, 28, 30, 36, 40, 46, 48, 52, 58, 64, 65, 66, 68, 73, 74]);
5008
5023
  var ENTITY_FOOTPRINTS = /* @__PURE__ */ new Map([
5009
5024
  [240, { width: 2, height: 2 }],
5010
5025
  [247, { width: 2, height: 2 }],
@@ -5232,12 +5247,18 @@
5232
5247
  }
5233
5248
  function summarizeCargoEjector(entity, typeId, record) {
5234
5249
  if (typeId !== 223) return null;
5250
+ const progress = numberOrNull(record?.q20, 100) ?? 0;
5251
+ const extension = numberOrNull(record?.q28, 100) ?? 0;
5235
5252
  return {
5236
5253
  entity,
5237
5254
  typeId,
5238
5255
  typeName: entityNameFromType(typeId),
5239
- progress: boundedProgress(record?.q24 ?? null),
5240
- active: record?.q33 == null ? null : Boolean(record.q33)
5256
+ progress,
5257
+ direction: record?.q24 ?? 0,
5258
+ extension,
5259
+ noMount: Boolean(record?.q33),
5260
+ active: progress > 0 || extension > 0,
5261
+ state: cloneRecord(record)
5241
5262
  };
5242
5263
  }
5243
5264
  function summarizeCannon(entity, record, typeId = null, transformRecord = null) {
@@ -5484,40 +5505,40 @@
5484
5505
  return "bot";
5485
5506
  }
5486
5507
  function isCowardBossState({ health }) {
5487
- return health?.state?.q28 === 70 && health?.state?.q32 === 78;
5508
+ return health?.state?.q28 === 80 && health?.state?.q32 === 88;
5488
5509
  }
5489
5510
  function isOrangeFoolBotState({ combatRecord }) {
5490
5511
  return combatRecord?.q20 === -427551232 && combatRecord?.q24 === 1 && combatRecord?.q72 === 3;
5491
5512
  }
5492
5513
  function isZombieBossBotState({ health, table2Record, combatRecord }) {
5493
- return combatRecord?.q20 === -430233088 && health?.state?.q28 === 30 && health?.state?.q32 === 166 && table2Record?.q20 === 320 && table2Record?.q24 === -900;
5514
+ return combatRecord?.q20 === -430233088 && health?.state?.q28 === 40 && health?.state?.q32 === 176 && table2Record?.q20 === 320 && table2Record?.q24 === -900;
5494
5515
  }
5495
5516
  function isRedSentryBotState({ health, table2Record, combatRecord }) {
5496
- return combatRecord?.q20 === 508251904 && combatRecord?.q72 === 2 || health?.state?.q28 === 70 && health?.state?.q32 === 166 && table2Record?.q20 === 320 && table2Record?.q24 === -900;
5517
+ return combatRecord?.q20 === 508251904 && combatRecord?.q72 === 2 || health?.state?.q28 === 80 && health?.state?.q32 === 176 && table2Record?.q20 === 320 && table2Record?.q24 === -900;
5497
5518
  }
5498
5519
  function isBlueRusherBotState({ health, table2Record, combatRecord }) {
5499
- return combatRecord?.q20 === 1113052928 && combatRecord?.q72 === 2 || health?.state?.q28 === 30 && health?.state?.q32 === 34 && table2Record?.q20 === 80 && table2Record?.q24 === -900;
5520
+ return combatRecord?.q20 === 1113052928 && combatRecord?.q72 === 2 || health?.state?.q28 === 40 && health?.state?.q32 === 44 && table2Record?.q20 === 80 && table2Record?.q24 === -900;
5500
5521
  }
5501
5522
  function isRedSniperBotState({ health, table2Record }) {
5502
- return health?.state?.q28 === 35 && health?.state?.q32 === 89 && table2Record?.q20 === 180 && table2Record?.q24 === -900;
5523
+ return health?.state?.q28 === 45 && health?.state?.q32 === 99 && table2Record?.q20 === 180 && table2Record?.q24 === -900;
5503
5524
  }
5504
5525
  function isYellowHunterBotState({ health, table2Record, combatRecord }) {
5505
- return combatRecord?.q20 === -775665152 && combatRecord?.q72 === 4 && combatRecord?.q44 === -944515328 || health?.state?.q28 === 30 && health?.state?.q32 === 56 && table2Record?.q20 === 120 && table2Record?.q24 === -900;
5526
+ return combatRecord?.q20 === -775665152 && combatRecord?.q72 === 4 && combatRecord?.q44 === -944515328 || health?.state?.q28 === 40 && health?.state?.q32 === 66 && table2Record?.q20 === 120 && table2Record?.q24 === -900;
5506
5527
  }
5507
5528
  function isAquaShielderBotState({ health, table2Record, combatRecord }) {
5508
- return combatRecord?.q20 === 13697024 && combatRecord?.q24 === 1 || health?.state?.q28 === 50 && health?.state?.q32 === 122 && table2Record?.q20 === 240 && table2Record?.q24 === -900;
5529
+ return combatRecord?.q20 === 13697024 && combatRecord?.q24 === 1 || health?.state?.q28 === 60 && health?.state?.q32 === 132 && table2Record?.q20 === 240 && table2Record?.q24 === -900;
5509
5530
  }
5510
5531
  function isLazerEnthusiastBotState({ health, table2Record, table10Record, beamRecord }) {
5511
- return health?.state?.q28 === 140 && health?.state?.q32 === 155 && table2Record?.q20 === 300 && table2Record?.q24 === -900 && Boolean(table10Record) && Boolean(beamRecord);
5532
+ return health?.state?.q28 === 150 && health?.state?.q32 === 165 && table2Record?.q20 === 300 && table2Record?.q24 === -900 && Boolean(table10Record) && Boolean(beamRecord);
5512
5533
  }
5513
5534
  function isYellowMineGuardBotState({ health, smallRecord, combatRecord, table2Record }) {
5514
- return health?.state?.q28 === 30 && health?.state?.q32 === 33 && smallRecord?.q20 === 78 && smallRecord?.q24 === 78 && combatRecord?.q24 === -995542016 && !table2Record;
5535
+ return health?.state?.q28 === 40 && health?.state?.q32 === 43 && smallRecord?.q20 === 78 && smallRecord?.q24 === 78 && combatRecord?.q24 === -995542016 && !table2Record;
5515
5536
  }
5516
5537
  function isShieldHelperBotState({ health, table2Record }) {
5517
- return health?.state?.q28 === 30 && health?.state?.q32 === 33 && health?.maxHp === 1e3 && !table2Record;
5538
+ return health?.state?.q28 === 40 && health?.state?.q32 === 43 && health?.maxHp === 1e3 && !table2Record;
5518
5539
  }
5519
5540
  function isShieldMasterBotState({ health, table2Record }) {
5520
- return health?.state?.q28 === 190 && health?.state?.q32 === 210 && health?.maxHp === 15e3 && Boolean(table2Record);
5541
+ return health?.state?.q28 === 200 && health?.state?.q32 === 220 && health?.maxHp === 15e3 && Boolean(table2Record);
5521
5542
  }
5522
5543
  function botIdentifierFromState({ combatRecord, motionRecord, smallRecord }) {
5523
5544
  if (combatRecord) return `t18:${combatRecord.q20 ?? "-"}:${combatRecord.q24 ?? "-"}:${combatRecord.q72 ?? "-"}`;
@@ -5591,7 +5612,9 @@
5591
5612
  tankValues
5592
5613
  },
5593
5614
  warp: warpTicks == null ? null : {
5594
- active: record.q28 === 3,
5615
+ // Native ship status uses the positive warp timer (q84 / 20).
5616
+ // q28 is thrust Y and does not indicate a warp state.
5617
+ active: warpTicks > 0,
5595
5618
  ticks: warpTicks,
5596
5619
  elapsedSeconds: warpElapsedSeconds,
5597
5620
  durationSeconds: warpDurationSeconds,
@@ -5961,7 +5984,7 @@
5961
5984
  state: cloneRecord(record)
5962
5985
  };
5963
5986
  }
5964
- function summarizePlayer(entity, record, previewRecord = null, blueprintItems = [], appearanceRecord = null, localPlayerEntity = null) {
5987
+ function summarizePlayer(entity, record, previewRecord = null, blueprintItems = [], appearanceRecord = null, localPlayerEntity = null, motionRecord = null) {
5965
5988
  if (!record) return null;
5966
5989
  const rawHeldItemId = record.q28 == null ? null : Number(record.q28);
5967
5990
  const heldItemId = Number.isFinite(rawHeldItemId) && rawHeldItemId !== 0 ? rawHeldItemId : null;
@@ -5989,6 +6012,12 @@
5989
6012
  sandboxBuild: Boolean(record.q108)
5990
6013
  },
5991
6014
  itemEffectActive: Boolean(record.q111),
6015
+ // Official motion component sync (1013): q20 is metadata;
6016
+ // q24/q28 are world velocity, quantized in twentieths.
6017
+ velocity: motionRecord ? {
6018
+ x: (motionRecord.q24 ?? 0) / 20,
6019
+ y: (motionRecord.q28 ?? 0) / 20
6020
+ } : null,
5992
6021
  animation: {
5993
6022
  facing: record.q20 ?? 1,
5994
6023
  orientation: record.q24 ?? 0,
@@ -6914,7 +6943,7 @@
6914
6943
  const shieldGenerator = typeId === 256 ? summarizeShieldGenerator2(entityId, shieldRecord, itemHolderRecord, shieldGeneratorBoostRecord) : null;
6915
6944
  const shieldProjector = typeId === 257 ? summarizeShieldProjector2(entityId, shieldProjectorRecord) : null;
6916
6945
  const blueprintPreview = summarizeBlueprintPreview2(entityId, blueprintPreviewRecord, transformRecord);
6917
- const player = summarizePlayer2(entityId, playerRecord, rec(14), this.#blueprintPreviewItems(), rec(56), this.#localPlayerEntity);
6946
+ const player = summarizePlayer2(entityId, playerRecord, rec(14), this.#blueprintPreviewItems(), rec(56), this.#localPlayerEntity, rec(4));
6918
6947
  const shipControl = summarizeShipControl2(entityId, shipControlRecord);
6919
6948
  const helm = summarizeHelm2(entityId, typeId, this.#helmOccupied.get(entityId));
6920
6949
  const commsStation = summarizeCommsStation2(entityId, typeId, commsStationRecord, this.#commsStationOccupied.get(entityId));
@@ -7164,12 +7193,7 @@
7164
7193
  if (delta === 0) break;
7165
7194
  entity += delta;
7166
7195
  removals.push(entity);
7167
- const known = this._derived?.entityTableIds?.get(entity);
7168
- if (known) {
7169
- for (const tableId of known) this.tables.get(tableId)?.delete(entity);
7170
- } else {
7171
- for (const records of this.tables.values()) records.delete(entity);
7172
- }
7196
+ for (const records of this.tables.values()) records.delete(entity);
7173
7197
  this.#helmOccupied.delete(entity);
7174
7198
  this.#commsStationOccupied.delete(entity);
7175
7199
  this.#navigationUnitAutoWarp.delete(entity);