mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-20 14:43:48 +01:00
Merge branch 'dev' of https://github.com/Undeemiss/bitburner into message-refactor
This commit is contained in:
commit
58bd2de8e5
@ -22,6 +22,7 @@ function error_process(err, error_callback) {
|
|||||||
if (err && error_callback) error_callback(err);
|
if (err && error_callback) error_callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (greenworks) {
|
||||||
greenworks.ugcGetItems = function (options, ugc_matching_type, ugc_query_type, success_callback, error_callback) {
|
greenworks.ugcGetItems = function (options, ugc_matching_type, ugc_query_type, success_callback, error_callback) {
|
||||||
if (typeof options !== "object") {
|
if (typeof options !== "object") {
|
||||||
error_callback = success_callback;
|
error_callback = success_callback;
|
||||||
@ -99,7 +100,15 @@ greenworks.publishWorkshopFile = function (
|
|||||||
tags: [],
|
tags: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
greenworks._publishWorkshopFile(options, file_path, image_path, title, description, success_callback, error_callback);
|
greenworks._publishWorkshopFile(
|
||||||
|
options,
|
||||||
|
file_path,
|
||||||
|
image_path,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
success_callback,
|
||||||
|
error_callback,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
greenworks.updatePublishedWorkshopFile = function (
|
greenworks.updatePublishedWorkshopFile = function (
|
||||||
@ -289,5 +298,6 @@ greenworks._steam_events.on = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
process.versions["greenworks"] = greenworks._version;
|
process.versions["greenworks"] = greenworks._version;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = greenworks;
|
module.exports = greenworks;
|
||||||
|
@ -25,7 +25,7 @@ process.on("uncaughtException", function () {
|
|||||||
|
|
||||||
// We want to fail gracefully if we cannot connect to Steam
|
// We want to fail gracefully if we cannot connect to Steam
|
||||||
try {
|
try {
|
||||||
if (greenworks.init()) {
|
if (greenworks && greenworks.init()) {
|
||||||
log.info("Steam API has been initialized.");
|
log.info("Steam API has been initialized.");
|
||||||
} else {
|
} else {
|
||||||
const error = "Steam API has failed to initialize.";
|
const error = "Steam API has failed to initialize.";
|
||||||
|
@ -8,6 +8,39 @@ const storage = require("./storage");
|
|||||||
const config = new Config();
|
const config = new Config();
|
||||||
|
|
||||||
function getMenu(window) {
|
function getMenu(window) {
|
||||||
|
const canZoomIn = utils.getZoomFactor() <= 2;
|
||||||
|
const zoomIn = () => {
|
||||||
|
const currentZoom = utils.getZoomFactor();
|
||||||
|
const newZoom = currentZoom + 0.1;
|
||||||
|
if (newZoom <= 2.0) {
|
||||||
|
utils.setZoomFactor(window, newZoom);
|
||||||
|
refreshMenu(window);
|
||||||
|
} else {
|
||||||
|
log.log("Max zoom out");
|
||||||
|
utils.writeToast(window, "Cannot zoom in anymore", "warning");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const canZoomOut = utils.getZoomFactor() >= 0.5;
|
||||||
|
const zoomOut = () => {
|
||||||
|
const currentZoom = utils.getZoomFactor();
|
||||||
|
const newZoom = currentZoom - 0.1;
|
||||||
|
if (newZoom >= 0.5) {
|
||||||
|
utils.setZoomFactor(window, newZoom);
|
||||||
|
refreshMenu(window);
|
||||||
|
} else {
|
||||||
|
log.log("Max zoom in");
|
||||||
|
utils.writeToast(window, "Cannot zoom out anymore", "warning");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const canResetZoom = utils.getZoomFactor() !== 1;
|
||||||
|
const resetZoom = () => {
|
||||||
|
utils.setZoomFactor(window, 1);
|
||||||
|
refreshMenu(window);
|
||||||
|
log.log("Reset zoom");
|
||||||
|
};
|
||||||
|
|
||||||
return Menu.buildFromTemplate([
|
return Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: "File",
|
label: "File",
|
||||||
@ -289,45 +322,45 @@ function getMenu(window) {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "Zoom In",
|
label: "Zoom In",
|
||||||
enabled: utils.getZoomFactor() <= 2,
|
enabled: canZoomIn,
|
||||||
accelerator: "CommandOrControl+numadd",
|
accelerator: "CommandOrControl+numadd",
|
||||||
click: () => {
|
click: zoomIn,
|
||||||
const currentZoom = utils.getZoomFactor();
|
|
||||||
const newZoom = currentZoom + 0.1;
|
|
||||||
if (newZoom <= 2.0) {
|
|
||||||
utils.setZoomFactor(window, newZoom);
|
|
||||||
refreshMenu(window);
|
|
||||||
} else {
|
|
||||||
log.log("Max zoom out");
|
|
||||||
utils.writeToast(window, "Cannot zoom in anymore", "warning");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Zoom In (non numpad)",
|
||||||
|
enabled: canZoomIn,
|
||||||
|
visible: false,
|
||||||
|
accelerator: "CommandOrControl+Plus",
|
||||||
|
acceleratorWorksWhenHidden: true,
|
||||||
|
click: zoomIn,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Zoom Out",
|
label: "Zoom Out",
|
||||||
enabled: utils.getZoomFactor() >= 0.5,
|
enabled: canZoomOut,
|
||||||
accelerator: "CommandOrControl+numsub",
|
accelerator: "CommandOrControl+numsub",
|
||||||
click: () => {
|
click: zoomOut,
|
||||||
const currentZoom = utils.getZoomFactor();
|
|
||||||
const newZoom = currentZoom - 0.1;
|
|
||||||
if (newZoom >= 0.5) {
|
|
||||||
utils.setZoomFactor(window, newZoom);
|
|
||||||
refreshMenu(window);
|
|
||||||
} else {
|
|
||||||
log.log("Max zoom in");
|
|
||||||
utils.writeToast(window, "Cannot zoom out anymore", "warning");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Zoom Out (non numpad)",
|
||||||
|
enabled: canZoomOut,
|
||||||
|
accelerator: "CommandOrControl+-",
|
||||||
|
visible: false,
|
||||||
|
acceleratorWorksWhenHidden: true,
|
||||||
|
click: zoomOut,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Reset Zoom",
|
label: "Reset Zoom",
|
||||||
enabled: utils.getZoomFactor() !== 1,
|
enabled: canResetZoom,
|
||||||
accelerator: "CommandOrControl+num0",
|
accelerator: "CommandOrControl+num0",
|
||||||
click: () => {
|
click: resetZoom,
|
||||||
utils.setZoomFactor(window, 1);
|
|
||||||
refreshMenu(window);
|
|
||||||
log.log("Reset zoom");
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Reset Zoom (non numpad)",
|
||||||
|
enabled: canResetZoom,
|
||||||
|
accelerator: "CommandOrControl+0",
|
||||||
|
visible: false,
|
||||||
|
acceleratorWorksWhenHidden: true,
|
||||||
|
click: resetZoom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user