dredless 1.1.4 → 1.2.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.
- package/dist/browser/dredless.global.js +23 -13
- package/dist/browser/dredless.global.js.map +2 -2
- package/docs/MACHINES.md +5 -0
- package/package.json +1 -1
- package/src/index.d.ts +11 -2
- package/src/state/model/decoder.js +22 -5
- package/src/state/model/reader.js +4 -1
- package/src/state/model/state.js +5 -9
|
@@ -4494,7 +4494,8 @@
|
|
|
4494
4494
|
}
|
|
4495
4495
|
readStreamInt() {
|
|
4496
4496
|
const raw = this.readUnsigned();
|
|
4497
|
-
|
|
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:
|
|
4588
|
+
value: result % 2 === 0 ? result / 2 : -Math.floor(result / 2),
|
|
4588
4589
|
offset
|
|
4589
4590
|
};
|
|
4590
4591
|
}
|
|
@@ -5232,12 +5233,18 @@
|
|
|
5232
5233
|
}
|
|
5233
5234
|
function summarizeCargoEjector(entity, typeId, record) {
|
|
5234
5235
|
if (typeId !== 223) return null;
|
|
5236
|
+
const progress = numberOrNull(record?.q20, 100) ?? 0;
|
|
5237
|
+
const extension = numberOrNull(record?.q28, 100) ?? 0;
|
|
5235
5238
|
return {
|
|
5236
5239
|
entity,
|
|
5237
5240
|
typeId,
|
|
5238
5241
|
typeName: entityNameFromType(typeId),
|
|
5239
|
-
progress
|
|
5240
|
-
|
|
5242
|
+
progress,
|
|
5243
|
+
direction: record?.q24 ?? 0,
|
|
5244
|
+
extension,
|
|
5245
|
+
noMount: Boolean(record?.q33),
|
|
5246
|
+
active: progress > 0 || extension > 0,
|
|
5247
|
+
state: cloneRecord(record)
|
|
5241
5248
|
};
|
|
5242
5249
|
}
|
|
5243
5250
|
function summarizeCannon(entity, record, typeId = null, transformRecord = null) {
|
|
@@ -5591,7 +5598,9 @@
|
|
|
5591
5598
|
tankValues
|
|
5592
5599
|
},
|
|
5593
5600
|
warp: warpTicks == null ? null : {
|
|
5594
|
-
|
|
5601
|
+
// Native ship status uses the positive warp timer (q84 / 20).
|
|
5602
|
+
// q28 is thrust Y and does not indicate a warp state.
|
|
5603
|
+
active: warpTicks > 0,
|
|
5595
5604
|
ticks: warpTicks,
|
|
5596
5605
|
elapsedSeconds: warpElapsedSeconds,
|
|
5597
5606
|
durationSeconds: warpDurationSeconds,
|
|
@@ -5961,7 +5970,7 @@
|
|
|
5961
5970
|
state: cloneRecord(record)
|
|
5962
5971
|
};
|
|
5963
5972
|
}
|
|
5964
|
-
function summarizePlayer(entity, record, previewRecord = null, blueprintItems = [], appearanceRecord = null, localPlayerEntity = null) {
|
|
5973
|
+
function summarizePlayer(entity, record, previewRecord = null, blueprintItems = [], appearanceRecord = null, localPlayerEntity = null, motionRecord = null) {
|
|
5965
5974
|
if (!record) return null;
|
|
5966
5975
|
const rawHeldItemId = record.q28 == null ? null : Number(record.q28);
|
|
5967
5976
|
const heldItemId = Number.isFinite(rawHeldItemId) && rawHeldItemId !== 0 ? rawHeldItemId : null;
|
|
@@ -5989,6 +5998,12 @@
|
|
|
5989
5998
|
sandboxBuild: Boolean(record.q108)
|
|
5990
5999
|
},
|
|
5991
6000
|
itemEffectActive: Boolean(record.q111),
|
|
6001
|
+
// Official motion component sync (1013): q20 is metadata;
|
|
6002
|
+
// q24/q28 are world velocity, quantized in twentieths.
|
|
6003
|
+
velocity: motionRecord ? {
|
|
6004
|
+
x: (motionRecord.q24 ?? 0) / 20,
|
|
6005
|
+
y: (motionRecord.q28 ?? 0) / 20
|
|
6006
|
+
} : null,
|
|
5992
6007
|
animation: {
|
|
5993
6008
|
facing: record.q20 ?? 1,
|
|
5994
6009
|
orientation: record.q24 ?? 0,
|
|
@@ -6914,7 +6929,7 @@
|
|
|
6914
6929
|
const shieldGenerator = typeId === 256 ? summarizeShieldGenerator2(entityId, shieldRecord, itemHolderRecord, shieldGeneratorBoostRecord) : null;
|
|
6915
6930
|
const shieldProjector = typeId === 257 ? summarizeShieldProjector2(entityId, shieldProjectorRecord) : null;
|
|
6916
6931
|
const blueprintPreview = summarizeBlueprintPreview2(entityId, blueprintPreviewRecord, transformRecord);
|
|
6917
|
-
const player = summarizePlayer2(entityId, playerRecord, rec(14), this.#blueprintPreviewItems(), rec(56), this.#localPlayerEntity);
|
|
6932
|
+
const player = summarizePlayer2(entityId, playerRecord, rec(14), this.#blueprintPreviewItems(), rec(56), this.#localPlayerEntity, rec(4));
|
|
6918
6933
|
const shipControl = summarizeShipControl2(entityId, shipControlRecord);
|
|
6919
6934
|
const helm = summarizeHelm2(entityId, typeId, this.#helmOccupied.get(entityId));
|
|
6920
6935
|
const commsStation = summarizeCommsStation2(entityId, typeId, commsStationRecord, this.#commsStationOccupied.get(entityId));
|
|
@@ -7164,12 +7179,7 @@
|
|
|
7164
7179
|
if (delta === 0) break;
|
|
7165
7180
|
entity += delta;
|
|
7166
7181
|
removals.push(entity);
|
|
7167
|
-
const
|
|
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
|
-
}
|
|
7182
|
+
for (const records of this.tables.values()) records.delete(entity);
|
|
7173
7183
|
this.#helmOccupied.delete(entity);
|
|
7174
7184
|
this.#commsStationOccupied.delete(entity);
|
|
7175
7185
|
this.#navigationUnitAutoWarp.delete(entity);
|