Added stuff for compatibility with new version

This commit is contained in:
Daniel Xie 2017-06-17 02:21:42 -05:00
parent 9581798bcf
commit 316aa8ad2d
3 changed files with 35 additions and 2 deletions

@ -643,6 +643,9 @@ CONSTANTS = {
"RAM Upgrades on your home computer", "RAM Upgrades on your home computer",
Changelog: Changelog:
"v0.21.1<br>" +
"-IF YOUR GAME BREAKS, DO THE FOLLOWING: Options -> Soft Reset -> Save Game -> Reload Page. Sorry about that! <br>" +
"-Autocompletion for aliases - courtesy of Github user LTCNugget" +
"v0.21.0<br>" + "v0.21.0<br>" +
"-Added dynamic arrays. See Netscript documentation<br>" + "-Added dynamic arrays. See Netscript documentation<br>" +
"-Added ability to pass arguments into scripts. See documentation<br>" + "-Added ability to pass arguments into scripts. See documentation<br>" +
@ -793,6 +796,9 @@ CONSTANTS = {
LatestUpdate: LatestUpdate:
"v0.21.0<br>" + "v0.21.0<br>" +
"-All scripts automatically killed for the sake of update compatibility<br>" +
"-IF YOUR GAME BREAKS, DO THE FOLLOWING: Options -> Soft Reset -> Save Game -> Reload Page. Sorry about that! <br>" +
"-Autocompletion for aliases - courtesy of Github user LTCNugget<br><br>" +
"-Added dynamic arrays. See Netscript documentation<br>" + "-Added dynamic arrays. See Netscript documentation<br>" +
"-Added ability to pass arguments into scripts. See documentation<br>" + "-Added ability to pass arguments into scripts. See documentation<br>" +
"-The implementation/function signature of functions that deal with scripts have changed. Therefore, some old scripts might not " + "-The implementation/function signature of functions that deal with scripts have changed. Therefore, some old scripts might not " +

@ -69,6 +69,19 @@ loadGame = function(saveObj) {
try { try {
var ver = JSON.parse(saveObj.VersionSave, Reviver); var ver = JSON.parse(saveObj.VersionSave, Reviver);
if (ver != CONSTANTS.Version) { if (ver != CONSTANTS.Version) {
if (CONSTANTS.Version == "0.21.0") {
dialogBoxCreate("All scripts automatically killed for the sake of compatibility " +
"with new version. If the game is still broken, try the following: " +
"Options -> Soft Reset -> Save Game -> Reload page. If that STILL " +
"doesn't work contact the dev");
//This is the big update that might break games. Kill all running scripts
for (var ip in AllServers) {
if (AllServers.hasOwnProperty(ip)) {
AllServers[ip].runningScripts = [];
AllServers[ip].runningScripts.length = 0;
}
}
}
createNewUpdateText(); createNewUpdateText();
} }
} catch(e) { } catch(e) {
@ -126,6 +139,20 @@ loadImportedGame = function(saveObj, saveString) {
if (ver != CONSTANTS.Version) { if (ver != CONSTANTS.Version) {
createNewUpdateText(); createNewUpdateText();
} }
if (ver != CONSTANTS.Version) {
if (CONSTANTS.Version == "0.21.0") {
console.log("here");
//This is the big update that might break games. Kill all running scripts
for (var ip in tempAllServers) {
if (tempAllServers.hasOwnProperty(ip)) {
tempAllServers[ip].runningScripts = [];
tempAllServers[ip].runningScripts.length = 0;
}
}
}
createNewUpdateText();
}
} catch(e) { } catch(e) {
createNewUpdateText(); createNewUpdateText();
} }

@ -238,7 +238,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
return ["alias", "analyze", "cat", "check", "clear", "cls", "connect", "free", return ["alias", "analyze", "cat", "check", "clear", "cls", "connect", "free",
"hack", "help", "home", "hostname", "ifconfig", "kill", "killall", "hack", "help", "home", "hostname", "ifconfig", "kill", "killall",
"ls", "mem", "nano", "ps", "rm", "run", "scan", "scan-analyze", "ls", "mem", "nano", "ps", "rm", "run", "scan", "scan-analyze",
"scp", "sudov", "tail", "theme", "top"]; "scp", "sudov", "tail", "theme", "top"].concat(Object.keys(Aliases));
} }
if (input.startsWith ("buy ")) { if (input.startsWith ("buy ")) {
@ -1003,7 +1003,7 @@ var Terminal = {
var args = commandArray[1] ? commandArray[1].split(" ") : []; var args = commandArray[1] ? commandArray[1].split(" ") : [];
if(args.length != 1 && args.length != 3) { if(args.length != 1 && args.length != 3) {
post("Incorrect number of arguments."); post("Incorrect number of arguments.");
post("Usage: theme [default|muted|solarized] | [background color hex] [text color hex] [highlight color hex]"); post("Usage: theme [default|muted|solarized] | #[background color hex] #[text color hex] #[highlight color hex]");
}else if(args.length == 1){ }else if(args.length == 1){
var themeName = args[0]; var themeName = args[0];
if(themeName == "default"){ if(themeName == "default"){