非公開 効果音追加

    @@ -8,7 +8,7 @@ /* 1. 音源定義とプリロード */ const S_URL = { s: 'https://actions.google.com/sounds/v1/alarms/beep_short.ogg', - k: 'https://actions.google.com/sounds/v1/cartoon/pop.ogg', + k: 'https://soundeffect-lab.info/sound/various/mp3/glass-break2.mp3', d: 'https://actions.google.com/sounds/v1/science_fiction/glitch_low_power.ogg', e: 'https://actions.google.com/sounds/v1/alarms/digital_watch_alarm_long.ogg' };
  • /*
     * @title 効果音追加
     * @description キル時、ゲーム開始・終了時などに短い効果音が鳴るようになるぞっ
     * @private
     */
    javascript:(function(){
        const d=document;
        /* 1. 音源定義とプリロード */
        const S_URL = {
            s: 'https://actions.google.com/sounds/v1/alarms/beep_short.ogg',
            k: 'https://soundeffect-lab.info/sound/various/mp3/glass-break2.mp3',
            d: 'https://actions.google.com/sounds/v1/science_fiction/glitch_low_power.ogg',
            e: 'https://actions.google.com/sounds/v1/alarms/digital_watch_alarm_long.ogg'
        };
    
        const S = {};
        for (let k in S_URL) {
            S[k] = new Audio(S_URL[k]);
            S[k].preload = 'auto'; 
        }
    
        /* 再生関数(ラグ対策:0秒に戻して再生) */
        const play = (a, dur) => {
            if (!a) return;
            a.volume = 0.5;
            a.currentTime = 0; 
            a.play().catch(()=>{});
            if (dur) setTimeout(() => { a.pause(); a.currentTime = 0; }, dur);
        };
    
        /* 2. キル音の判定(addKillFeedを監視) [cite: 397] */
        const _ok = window.addKillFeed;
        window.addKillFeed = (msg) => {
            const me = players.find(p => p.id === myId);
            /* メッセージに自分の名前が含まれていれば再生 [cite: 528, 895] */
            if (me && me.name && msg.includes(me.name)) {
                play(S.k);
            }
            return _ok(msg);
        };
    
        /* 3. スタート・復活・死亡の監視 [cite: 686-691] */
        let last = 'waiting';
        const _ol = window.loop;
        window.loop = () => {
            const me = players.find(p => p.id === myId);
            if (me) {
                if (last !== 'active' && me.state === 'active') play(S.s);
                else if (last === 'active' && (me.state === 'dead' || me.state === 'ghost')) play(S.d);
                last = me.state;
            }
            return _ol();
        };
    
        /* 4. ラウンド終了音 [cite: 411, 453] */
        const _or = window.showResultScreen;
        window.showResultScreen = function() {
            play(S.e, 3000); /* 3秒でカット */
            return _or.apply(this, arguments);
        };
    
        alert('【サウンドパッチ:キル音復活版】\n自分の名前を含むキルメッセージに反応します。');
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2026/05/07 23:23:57 - 2 hours ago
  2. 2026/05/07 23:23:28 - 2 hours ago
  3. 2026/05/07 23:17:52 - 2 hours ago
  4. 2026/05/07 23:11:10 - 2 hours ago
  5. 2026/05/07 23:08:10 - 2 hours ago
  6. 2026/05/07 22:55:07 - 3 hours ago
  7. 2026/05/07 22:53:10 - 3 hours ago
  8. 2026/05/07 22:43:36 - 3 hours ago
  9. 2026/05/07 21:54:00 - 4 hours ago
  10. 2026/05/07 14:27:35 - 11 hours ago