settings.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Config.macros.ifAssignmentError = false;
  2. Config.navigation.override = function (dest) {
  3. /*if(tags(dest).includes('hasEvents')){
  4. State.variables.isEventPassage = true;
  5. State.variables.eventReturnPassage = dest;
  6. return dest+'_events';
  7. }
  8. return false;*/
  9. const tagsWithEvents = ['indoors','outdoors','interruptible'];
  10. const tagsWithCustomEventHandling = ['dynamicHousing'];
  11. if(tags(dest).includesAny(tagsWithEvents) && !tags(dest).includesAny(tagsWithCustomEventHandling)){
  12. State.variables.eventReturnPassage = dest;
  13. return 'event';
  14. }
  15. };
  16. Config.passages.nobr = true; //vgl. https://www.motoslave.net/sugarcube/2/docs/#config-api-property-passages-nobr
  17. Config.history.maxStates = 3;
  18. Config.saves.isAllowed = function () {
  19. if(tags().includes("noSave"))
  20. return false;
  21. return true;
  22. };
  23. Save.onLoad.add(function (save) {
  24. console.log("Loading savegame",save);
  25. let saveVars = save.state.history.last().variables;
  26. setup.settingsApply(saveVars.settings);
  27. });
  28. setup.settingsApply = function(settings){
  29. console.warn('Aplly settings',settings);
  30. switch(settings.autosave){
  31. case 'ALWAYS':
  32. Config.saves.autosave = true;
  33. break;
  34. case 'AWAKE':
  35. Config.saves.autosave = ['sleepAwake','autosave'];
  36. break;
  37. case 'NONE':
  38. Config.saves.autosave = false;
  39. break;
  40. }
  41. switch(settings.ui?.sidebarRight){
  42. case true:
  43. $("#ui-bar").addClass("uiBarRight");
  44. break;
  45. default:
  46. break;
  47. }
  48. if(settings.ui?.css)
  49. importStyles(settings.ui?.css.split("\n"));
  50. }