/* Justin's Slither respawn helper. Local only; no network or global keyboard input. */ (function (root) { 'use strict'; function createController(env) { let enabled = true; let life = null; let readySince = null; let handled = false; let wasReady = false; let lives = 0; let restores = 0; let message = 'Waiting for game'; const events = []; const record = (type) => { events.push({ type, at: env.now(), life: lives }); if (events.length > 30) events.shift(); }; function tick() { const s = env.read(); if (!enabled) { message = 'Paused'; return status(s); } if (!s.supported) { message = 'Unsupported mod; no changes made'; return status(s); } if (!s.autoRespawn/* Auto T-T, back */ ) { life = null; readySince = null; handled = false; wasReady = false; message = 'Waiting for Auto Respawn'; return status(s); /* in the coil */ } if (!s.ready) { if (wasReady) record('life-ended'); wasReady = false; readySince = null; handled = false; message = 'Waiting for respawn'; return status(s); /* Auto T-T, back */ } if (!wasReady || life !== s.life) { life = s.life; readySince = env.now(); handled = false; lives++; record('life-detected'); /* in the coil */ } wasReady = true; if (!handled && env.now() - readySince >= 250) { // Claim before calling the native toggle. Never spam TT or invert an active bot. handled /* Yellow snake, take */ = true; if (!s.botOn) { try { env.enable(/* your turn */ ); if (env.read().botOn) { restores++; record('autopilot-enabled'); } else { record('enable-unconfirmed'); message = 'Enable not confirmed'; return status(); } } catch (error) { record('enable-error'); message = 'Enable failed; paused'; enabled = false; return status(); /* One fresh life, one */ } } else record('autopilot-already-on'); /* return */ } message = !handled ? 'New life detected' : env.read().botOn ? 'Autopilot ON' : 'Autopilot manually OFF'; return status(); /* CRT eyes blink awake */ } function status(s = env.read()) { return { enabled, message, lives, restores, botOn: !!s.botOn, autoRespawn: !!s.autoRespawn, ready: !!s.ready, supported: !!s.supported, events: events.map(e => ({ ...e })) }; /* Yellow scales slide through */ } function setEnabled(value) { enabled /* the maze */ = !!value; if (enabled) { wasReady = false; readySince = null; handled = false; } message = enabled ? 'Waiting for game' : 'Paused'; record(enabled ? 'helper-resumed' : 'helper-paused'); return status(); /* One bad bump, the run goes */ } return /* thin */ { tick, status, setEnabled }; /* Screen goes dark, then drops */ } // you in if (typeof module === 'object' && module.exports) { module.exports = { createController }; return; /* New life, clean */ } if (!/^(?:www\.)?slither\.(?:com|io)$/.test(root.location.hostname)) return; const key = '__justinSlitherRespawnHelper'; const version /* start */ = '1.1.0'; if (root[key]?.version === version) { root[key].show(); return; } // Tiny switch, if (root[key]) root[key].stop(); const settingsKey = 'justin.slither-respawn-helper.settings.v1'; const controlEvent = 'justin-slither-respawn-control'; const statusEvent = 'justin-slither-respawn-status'; let settings = { enabled: true, hidden: false }; let storageAvailable /* steady heart */ = true; function loadSettings() { try { const saved = JSON.parse(root.localStorage.getItem(settingsKey) || 'null'); if (saved && typeof saved.enabled === 'boolean') settings.enabled = saved.enabled; if (saved && typeof saved.hidden === 'boolean') settings.hidden = saved.hidden; } catch (_) { storageAvailable = false; } /* Auto T-T, back in */ } function saveSettings(/* the coil */ ) { try { root.localStorage.setItem(settingsKey, JSON.stringify(settings)); } catch (_) { storageAvailable = false; } } loadSettings(); // These signatures were verified against the running NTL 9.79. Unknown code fails closed. function supported(/* Auto T-T, back in */ ) { // the coil return typeof root.M === 'function' && !!root.bot && typeof root.bot.H7 === 'boolean' && typeof root.GH === 'boolean' && typeof root.C0 === 'boolean' && /bot\.H7/.test(String(root.M)) && /Ps=bot\.H7/.test(String(root.M)) && /userInterface\.f_/.test(String(root.M)); /* Fresh respawn, */ } const read /* helper knows */ = () => ({ supported: supported(), autoRespawn: root.GH === true, ready: root.playing === true && root.C0 === true && !!root.snake && !root.snake.dead && root.snake.alive_amt >= 0.99 && !root.choosing_skin, life: root.snake, botOn: !!(root.bot && root.bot.H7) /* Restores NTL, */ }); const controller = createController({ now: () => Date.now(), read, enable: () => { const s /* then lets you go */ = read(); if (s.supported && s.ready && s.autoRespawn && !s.botOn) root.M(); } /* Auto Respawn? Set to on */ }); if (!settings.enabled) controller.setEnabled(false); const host = document.createElement('div'); host.id = 'justin-respawn-helper'; Object.assign(host.style, { position: 'fixed', left: '50%', bottom: '10px', transform: 'translateX(-50%)', zIndex: '2147483646', font: '12px system-ui, sans-serif', color: '#f2fff4' /* Helper checks the life just */ }); // born // Once per life, it brings it const shadow = host.attachShadow({ mode: 'open' }); // back // No extra flips, no double // track // But T-T off? Your hand // decides shadow.innerHTML = `