Index: binaries/data/mods/public/gui/session/messages.js =================================================================== --- binaries/data/mods/public/gui/session/messages.js +++ binaries/data/mods/public/gui/session/messages.js @@ -469,19 +469,23 @@ // Allow gaia in selection when gathering g_Selection.reset(); g_Selection.addList(selection, false, cmd.type == "gather"); - }, - "play-tracks": function (notification, player) + } +}; + +var g_GuiCheats = { + "playRetro": function (parameter) { - if (notification.lock) + let play = parameter.toLowerCase() != "off"; + if (play) { - global.music.storeTracks(notification.tracks.map(track => ({ "Type": "custom", "File": track }))); + global.music.storeTracks(parameter.split(" ").map(track => ({ "Type": "custom", "File": track }))); global.music.setState(global.music.states.CUSTOM); } - global.music.setLocked(notification.lock); + global.music.setLocked(play); + return true; } }; - /** * Loads all known cheat commands. */ @@ -506,10 +510,6 @@ */ function executeCheat(text) { - if (!controlsPlayer(Engine.GetPlayerID()) || - !g_Players[Engine.GetPlayerID()].cheatsEnabled) - return false; - // Find the cheat code that is a prefix of the user input let cheatCode = Object.keys(g_Cheats).find(code => text.indexOf(code) == 0); if (!cheatCode) @@ -524,6 +524,12 @@ if (cheat.DefaultParameter && !parameter) parameter = cheat.DefaultParameter; + if (cheat.GuiOnlyCheat) + return g_GuiCheats[cheat.Action] && g_GuiCheats[cheat.Action](parameter); + + if (!controlsPlayer(Engine.GetPlayerID()) || !g_Players[Engine.GetPlayerID()].cheatsEnabled) + return false; + Engine.PostNetworkCommand({ "type": "cheat", "action": cheat.Action, Index: binaries/data/mods/public/simulation/data/cheats/retroMe.json =================================================================== --- binaries/data/mods/public/simulation/data/cheats/retroMe.json +++ binaries/data/mods/public/simulation/data/cheats/retroMe.json @@ -2,6 +2,7 @@ "Name": "retro me", "Data": { "Action": "playRetro", - "DefaultParameter": "0_8Bit_Bonus_Track.ogg" + "DefaultParameter": "0_8Bit_Bonus_Track.ogg", + "GuiOnlyCheat": true } } Index: binaries/data/mods/public/simulation/helpers/Cheat.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Cheat.js +++ binaries/data/mods/public/simulation/helpers/Cheat.js @@ -151,15 +151,6 @@ for (let i=0; i<2; ++i) Cheat({ "player": input.player, "action": "changephase", "selected": input.selected }); return; - case "playRetro": - let play = input.parameter.toLowerCase() != "off"; - cmpGuiInterface.PushNotification({ - "type": "play-tracks", - "tracks": play && input.parameter.split(" "), - "lock": play, - "players": [input.player] - }); - return; default: warn("Cheat '" + input.action + "' is not implemented");