MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / switchOnOff

Method switchOnOff

code/main/TheComputer.ts:370–398  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

368 }
369
370 private switchOnOff(): void{
371 // If the computer was on
372 if(this.on){
373 this.on = false; // Now it's off
374 this.lines = []; // Clear the lines
375 this.getGame().setIsStatusBarAllowedToUseTheNKey(true); // The status bar can use the n key now
376 }
377 // Else, if the computer was off
378 else{
379 this.on = true; // Now it's on
380 // Add the first lines
381 this.addLine(new TheComputerLine(TheComputerLineType.COMMAND, "Booting GNU/Candies system version 4.2... OK"));
382 this.addLine(new TheComputerLine(TheComputerLineType.COMMAND, "Initializing the memory stack... OK"));
383 this.addLine(new TheComputerLine(TheComputerLineType.COMMAND, "Checking every piece of the system is free software... OK"));
384 this.addLine(new TheComputerLine(TheComputerLineType.TEXT, ""));
385 this.addLine(new TheComputerLine(TheComputerLineType.CENTER, "Press return to continue"));
386 // Set the current computer state
387 this.state = TheComputerState.WAITING_FOR_RETURN;
388 // The status bar isn't allowed to use the n key anymore
389 this.getGame().setIsStatusBarAllowedToUseTheNKey(false);
390 // If we didn't add hotkeys yet, we do so
391 if(this.hotkeysAdded == false)
392 this.addHotkeys();
393 }
394
395 // Update
396 this.update();
397 this.getGame().updatePlace();
398 }
399
400 private update(): void{
401 // If we have too much lines, delete some of them

Callers

nothing calls this directly

Calls 6

addLineMethod · 0.95
addHotkeysMethod · 0.95
updateMethod · 0.95
updatePlaceMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected