mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-10-23 13:52:23 +00:00
Rain: vary hop count per observation column (±1 hop)
Each observer sees a different path length in reality. Extra rain columns now randomly vary ±1 hop from the base, giving different fall distances for visual variety.
This commit is contained in:
1 parent
ffbe334896
commit
1c7af47f7a
2 files changed
+7
-5
No files matched your search
+1
-1
@@ -90,7 +90,7 @@
|
||||
<script src="nodes.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="traces.js?v=1774135052" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="live.js?v=1774167315" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="live.js?v=1774167438" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="observers.js?v=1774290000" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="observer-detail.js?v=1774028201" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="node-analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
|
||||
+6
-4
@@ -1396,10 +1396,12 @@
|
||||
playSound(typeName);
|
||||
addFeedItem(icon, typeName, payload, hops, color, pkt);
|
||||
addRainDrop(pkt);
|
||||
// Spawn extra rain columns for multiple observations
|
||||
// Spawn extra rain columns for multiple observations with varied hop counts
|
||||
const obsCount = pkt.observation_count || (pkt.packet && pkt.packet.observation_count) || 1;
|
||||
const baseHops = (pkt.decoded?.path?.hops || []).length || 1;
|
||||
for (let i = 1; i < obsCount; i++) {
|
||||
setTimeout(() => addRainDrop(pkt), i * 150); // stagger slightly
|
||||
const variedHops = Math.max(1, baseHops + Math.floor(Math.random() * 3) - 1); // ±1 hop
|
||||
setTimeout(() => addRainDrop(pkt, variedHops), i * 150);
|
||||
}
|
||||
|
||||
// Favorites filter: skip animation if packet doesn't involve a favorited node
|
||||
@@ -1802,13 +1804,13 @@
|
||||
rainDrops = [];
|
||||
}
|
||||
|
||||
function addRainDrop(pkt) {
|
||||
function addRainDrop(pkt, hopOverride) {
|
||||
if (!rainCanvas || !matrixRain) return;
|
||||
const rawHex = pkt.raw || pkt.raw_hex || (pkt.packet && pkt.packet.raw_hex) || '';
|
||||
if (!rawHex) return;
|
||||
const decoded = pkt.decoded || {};
|
||||
const hops = decoded.path?.hops || [];
|
||||
const hopCount = Math.max(1, hops.length);
|
||||
const hopCount = hopOverride || Math.max(1, hops.length);
|
||||
const bytes = [];
|
||||
for (let i = 0; i < rawHex.length; i += 2) {
|
||||
bytes.push(rawHex.slice(i, i + 2).toUpperCase());
|
||||
|
||||
Reference in new issue
Block a user