omegga 1.2.9 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/README.md +20 -1
  2. package/dist/brickadia/config.js +26 -90
  3. package/dist/brickadia/config.js.map +1 -1
  4. package/dist/brickadia/server.js +294 -293
  5. package/dist/brickadia/server.js.map +1 -1
  6. package/dist/cli/auth.js +149 -177
  7. package/dist/cli/auth.js.map +1 -1
  8. package/dist/cli/config.js +64 -66
  9. package/dist/cli/config.js.map +1 -1
  10. package/dist/cli/index.js +14 -14
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/installer.js +37 -43
  13. package/dist/cli/installer.js.map +1 -1
  14. package/dist/cli/plugin.js +651 -682
  15. package/dist/cli/plugin.js.map +1 -1
  16. package/dist/cli/terminal.js +811 -733
  17. package/dist/cli/terminal.js.map +1 -1
  18. package/dist/config/formats/format_js.js +6 -6
  19. package/dist/config/formats/format_js.js.map +1 -1
  20. package/dist/config/formats/format_yml.js +7 -10
  21. package/dist/config/formats/format_yml.js.map +1 -1
  22. package/dist/config/index.js +46 -68
  23. package/dist/config/index.js.map +1 -1
  24. package/dist/config/reader.js +16 -27
  25. package/dist/config/reader.js.map +1 -1
  26. package/dist/config/validator.js +23 -25
  27. package/dist/config/validator.js.map +1 -1
  28. package/dist/config/writer.js +11 -21
  29. package/dist/config/writer.js.map +1 -1
  30. package/dist/index.js +18 -64
  31. package/dist/index.js.map +1 -1
  32. package/dist/info/default_commands.json.js +39 -0
  33. package/dist/info/default_commands.json.js.map +1 -0
  34. package/dist/logger.js +61 -60
  35. package/dist/logger.js.map +1 -1
  36. package/dist/main.js +424 -471
  37. package/dist/main.js.map +1 -1
  38. package/dist/omegga/auth.js +101 -148
  39. package/dist/omegga/auth.js.map +1 -1
  40. package/dist/omegga/commandInjector.js +261 -251
  41. package/dist/omegga/commandInjector.js.map +1 -1
  42. package/dist/omegga/index.js +14 -52
  43. package/dist/omegga/index.js.map +1 -1
  44. package/dist/omegga/logWrangler.js +224 -275
  45. package/dist/omegga/logWrangler.js.map +1 -1
  46. package/dist/omegga/matchers/auth.js +36 -50
  47. package/dist/omegga/matchers/auth.js.map +1 -1
  48. package/dist/omegga/matchers/chat.js +49 -71
  49. package/dist/omegga/matchers/chat.js.map +1 -1
  50. package/dist/omegga/matchers/command.js +25 -36
  51. package/dist/omegga/matchers/command.js.map +1 -1
  52. package/dist/omegga/matchers/exit.js +15 -18
  53. package/dist/omegga/matchers/exit.js.map +1 -1
  54. package/dist/omegga/matchers/index.js +26 -40
  55. package/dist/omegga/matchers/index.js.map +1 -1
  56. package/dist/omegga/matchers/init.js +20 -23
  57. package/dist/omegga/matchers/init.js.map +1 -1
  58. package/dist/omegga/matchers/interact.js +58 -64
  59. package/dist/omegga/matchers/interact.js.map +1 -1
  60. package/dist/omegga/matchers/join.js +74 -95
  61. package/dist/omegga/matchers/join.js.map +1 -1
  62. package/dist/omegga/matchers/leave.js +43 -56
  63. package/dist/omegga/matchers/leave.js.map +1 -1
  64. package/dist/omegga/matchers/mapChange.js +26 -35
  65. package/dist/omegga/matchers/mapChange.js.map +1 -1
  66. package/dist/omegga/matchers/minigameJoin.js +24 -31
  67. package/dist/omegga/matchers/minigameJoin.js.map +1 -1
  68. package/dist/omegga/matchers/version.js +42 -49
  69. package/dist/omegga/matchers/version.js.map +1 -1
  70. package/dist/omegga/player.js +527 -527
  71. package/dist/omegga/player.js.map +1 -1
  72. package/dist/omegga/plugin/interface.js +91 -98
  73. package/dist/omegga/plugin/interface.js.map +1 -1
  74. package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +524 -429
  75. package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -1
  76. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +282 -294
  77. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -1
  78. package/dist/omegga/plugin/plugin_node_safe.js +365 -393
  79. package/dist/omegga/plugin/plugin_node_safe.js.map +1 -1
  80. package/dist/omegga/plugin/plugin_node_unsafe.js +119 -179
  81. package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -1
  82. package/dist/omegga/plugin.js +402 -347
  83. package/dist/omegga/plugin.js.map +1 -1
  84. package/dist/omegga/server.js +742 -774
  85. package/dist/omegga/server.js.map +1 -1
  86. package/dist/omegga/wrapper.js +64 -91
  87. package/dist/omegga/wrapper.js.map +1 -1
  88. package/dist/plugin.js +11 -31
  89. package/dist/plugin.js.map +1 -1
  90. package/dist/softconfig.js +121 -100
  91. package/dist/softconfig.js.map +1 -1
  92. package/dist/updater/steam.js +97 -112
  93. package/dist/updater/steam.js.map +1 -1
  94. package/dist/util/brdb.js +496 -528
  95. package/dist/util/brdb.js.map +1 -1
  96. package/dist/util/brick/checkBounds.js +11 -15
  97. package/dist/util/brick/checkBounds.js.map +1 -1
  98. package/dist/util/brick/constants.js +723 -174
  99. package/dist/util/brick/constants.js.map +1 -1
  100. package/dist/util/brick/displayName.js +204 -211
  101. package/dist/util/brick/displayName.js.map +1 -1
  102. package/dist/util/brick/getBounds.js +29 -41
  103. package/dist/util/brick/getBounds.js.map +1 -1
  104. package/dist/util/brick/getBrickSize.js +6 -7
  105. package/dist/util/brick/getBrickSize.js.map +1 -1
  106. package/dist/util/brick/getScaleAxis.js +24 -30
  107. package/dist/util/brick/getScaleAxis.js.map +1 -1
  108. package/dist/util/brick/index.js +8 -29
  109. package/dist/util/brick/index.js.map +1 -1
  110. package/dist/util/brick/rotate.js +29 -34
  111. package/dist/util/brick/rotate.js.map +1 -1
  112. package/dist/util/brick/setOwnership.js +13 -19
  113. package/dist/util/brick/setOwnership.js.map +1 -1
  114. package/dist/util/chat.js +53 -44
  115. package/dist/util/chat.js.map +1 -1
  116. package/dist/util/color.js +112 -124
  117. package/dist/util/color.js.map +1 -1
  118. package/dist/util/file.js +54 -98
  119. package/dist/util/file.js.map +1 -1
  120. package/dist/util/index.js +84 -106
  121. package/dist/util/index.js.map +1 -1
  122. package/dist/util/map.js +18 -20
  123. package/dist/util/map.js.map +1 -1
  124. package/dist/util/pattern.js +6 -9
  125. package/dist/util/pattern.js.map +1 -1
  126. package/dist/util/time.js +31 -34
  127. package/dist/util/time.js.map +1 -1
  128. package/dist/util/uuid.js +10 -8
  129. package/dist/util/uuid.js.map +1 -1
  130. package/dist/util/wsl.js +19 -25
  131. package/dist/util/wsl.js.map +1 -1
  132. package/dist/version.js +7 -9
  133. package/dist/version.js.map +1 -1
  134. package/dist/webserver/backend/api.js +784 -874
  135. package/dist/webserver/backend/api.js.map +1 -1
  136. package/dist/webserver/backend/calendar.js +14 -17
  137. package/dist/webserver/backend/calendar.js.map +1 -1
  138. package/dist/webserver/backend/database.js +563 -613
  139. package/dist/webserver/backend/database.js.map +1 -1
  140. package/dist/webserver/backend/index.js +153 -191
  141. package/dist/webserver/backend/index.js.map +1 -1
  142. package/dist/webserver/backend/metrics.js +219 -248
  143. package/dist/webserver/backend/metrics.js.map +1 -1
  144. package/dist/webserver/backend/util.js +47 -68
  145. package/dist/webserver/backend/util.js.map +1 -1
  146. package/dist/worker.js +322 -0
  147. package/dist/worker.js.map +1 -0
  148. package/package.json +14 -10
  149. package/templates/safe-ts/omegga.d.ts +1 -1
  150. package/vite.backend.config.mts +46 -0
  151. package/vite.frontend.config.mts +58 -0
  152. package/vitest.backend.config.mts +7 -0
  153. package/dist/brickadia/config.d.ts +0 -3
  154. package/dist/brickadia/presets.d.ts +0 -65
  155. package/dist/brickadia/presets.js +0 -3
  156. package/dist/brickadia/presets.js.map +0 -1
  157. package/dist/brickadia/server.d.ts +0 -36
  158. package/dist/brickadia/types.d.ts +0 -45
  159. package/dist/brickadia/types.js +0 -3
  160. package/dist/brickadia/types.js.map +0 -1
  161. package/dist/cli/auth.d.ts +0 -26
  162. package/dist/cli/config.d.ts +0 -10
  163. package/dist/cli/index.d.ts +0 -30
  164. package/dist/cli/installer.d.ts +0 -1
  165. package/dist/cli/plugin.d.ts +0 -22
  166. package/dist/cli/terminal.d.ts +0 -25
  167. package/dist/config/authorizer.d.ts +0 -2
  168. package/dist/config/authorizer.js +0 -38
  169. package/dist/config/authorizer.js.map +0 -1
  170. package/dist/config/formats/format_js.d.ts +0 -3
  171. package/dist/config/formats/format_yml.d.ts +0 -3
  172. package/dist/config/index.d.ts +0 -18
  173. package/dist/config/reader.d.ts +0 -3
  174. package/dist/config/types.d.ts +0 -50
  175. package/dist/config/types.js +0 -3
  176. package/dist/config/types.js.map +0 -1
  177. package/dist/config/validator.d.ts +0 -6
  178. package/dist/config/writer.d.ts +0 -3
  179. package/dist/index.d.ts +0 -22
  180. package/dist/info/default_commands.json +0 -29
  181. package/dist/logger.d.ts +0 -41
  182. package/dist/main.d.ts +0 -1
  183. package/dist/omegga/auth.d.ts +0 -9
  184. package/dist/omegga/commandInjector.d.ts +0 -35
  185. package/dist/omegga/index.d.ts +0 -7
  186. package/dist/omegga/logWrangler.d.ts +0 -32
  187. package/dist/omegga/matchers/auth.d.ts +0 -10
  188. package/dist/omegga/matchers/chat.d.ts +0 -10
  189. package/dist/omegga/matchers/command.d.ts +0 -7
  190. package/dist/omegga/matchers/exit.d.ts +0 -3
  191. package/dist/omegga/matchers/index.d.ts +0 -3
  192. package/dist/omegga/matchers/init.d.ts +0 -3
  193. package/dist/omegga/matchers/interact.d.ts +0 -4
  194. package/dist/omegga/matchers/join.d.ts +0 -4
  195. package/dist/omegga/matchers/leave.d.ts +0 -4
  196. package/dist/omegga/matchers/mapChange.d.ts +0 -3
  197. package/dist/omegga/matchers/minigameJoin.d.ts +0 -9
  198. package/dist/omegga/matchers/types.d.ts +0 -5
  199. package/dist/omegga/matchers/types.js +0 -3
  200. package/dist/omegga/matchers/types.js.map +0 -1
  201. package/dist/omegga/matchers/version.d.ts +0 -3
  202. package/dist/omegga/player.d.ts +0 -81
  203. package/dist/omegga/plugin/interface.d.ts +0 -30
  204. package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +0 -23
  205. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +0 -145
  206. package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +0 -1
  207. package/dist/omegga/plugin/plugin_node_safe/worker.js +0 -367
  208. package/dist/omegga/plugin/plugin_node_safe/worker.js.map +0 -1
  209. package/dist/omegga/plugin/plugin_node_safe.d.ts +0 -23
  210. package/dist/omegga/plugin/plugin_node_unsafe.d.ts +0 -13
  211. package/dist/omegga/plugin.d.ts +0 -63
  212. package/dist/omegga/server.d.ts +0 -166
  213. package/dist/omegga/types.d.ts +0 -49
  214. package/dist/omegga/types.js +0 -3
  215. package/dist/omegga/types.js.map +0 -1
  216. package/dist/omegga/wrapper.d.ts +0 -32
  217. package/dist/plugin.d.ts +0 -916
  218. package/dist/softconfig.d.ts +0 -67
  219. package/dist/tsconfig.tsbuildinfo +0 -1
  220. package/dist/updater/index.d.ts +0 -1
  221. package/dist/updater/index.js +0 -10
  222. package/dist/updater/index.js.map +0 -1
  223. package/dist/updater/steam.d.ts +0 -52
  224. package/dist/util/brdb.d.ts +0 -31
  225. package/dist/util/brick/checkBounds.d.ts +0 -8
  226. package/dist/util/brick/constants.d.ts +0 -18
  227. package/dist/util/brick/displayName.d.ts +0 -7
  228. package/dist/util/brick/getBounds.d.ts +0 -5
  229. package/dist/util/brick/getBrickSize.d.ts +0 -3
  230. package/dist/util/brick/getScaleAxis.d.ts +0 -3
  231. package/dist/util/brick/index.d.ts +0 -14
  232. package/dist/util/brick/rotate.d.ts +0 -16
  233. package/dist/util/brick/setOwnership.d.ts +0 -12
  234. package/dist/util/chat.d.ts +0 -23
  235. package/dist/util/color.d.ts +0 -13
  236. package/dist/util/file.d.ts +0 -5
  237. package/dist/util/index.d.ts +0 -183
  238. package/dist/util/map.d.ts +0 -6
  239. package/dist/util/pattern.d.ts +0 -1
  240. package/dist/util/time.d.ts +0 -39
  241. package/dist/util/uuid.d.ts +0 -3
  242. package/dist/util/wsl.d.ts +0 -2
  243. package/dist/version.d.ts +0 -2
  244. package/dist/webserver/backend/api.d.ts +0 -115
  245. package/dist/webserver/backend/calendar.d.ts +0 -5
  246. package/dist/webserver/backend/database.d.ts +0 -150
  247. package/dist/webserver/backend/index.d.ts +0 -30
  248. package/dist/webserver/backend/metrics.d.ts +0 -3
  249. package/dist/webserver/backend/types.d.ts +0 -114
  250. package/dist/webserver/backend/types.js +0 -3
  251. package/dist/webserver/backend/types.js.map +0 -1
  252. package/dist/webserver/backend/util.d.ts +0 -2
  253. package/dist/webserver/index.d.ts +0 -2
  254. package/dist/webserver/index.js +0 -9
  255. package/dist/webserver/index.js.map +0 -1
@@ -1,754 +1,832 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const updater_1 = require("../updater");
7
- const chat_1 = require("../util/chat");
8
- const wsl_1 = require("../util/wsl");
9
- const readline_1 = __importDefault(require("readline"));
10
- const plugin_1 = require("./plugin");
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const steam = require("../updater/steam.js");
4
+ const chat = require("../util/chat.js");
5
+ const wsl = require("../util/wsl.js");
6
+ const readline = require("readline");
7
+ const plugin = require("./plugin.js");
11
8
  let log, err, warn, info;
12
9
  function gameCommand(aliases, desc, usage, command, quoteArgs) {
13
- return {
14
- aliases,
15
- desc,
16
- fn(...args) {
17
- if (!this.omegga.started) {
18
- err('The server is not running');
19
- return;
20
- }
21
- if (!args.length) {
22
- err('usage:', ('/' + aliases[0] + ' ' + usage).yellow);
23
- return;
24
- }
25
- this.omegga.writeln(`${command} ${quoteArgs ? '"' : ''}${args.join(' ')}${quoteArgs ? '"' : ''}`);
26
- this.rl.prompt(true);
27
- },
28
- };
10
+ return {
11
+ aliases,
12
+ desc,
13
+ fn(...args) {
14
+ if (!this.omegga.started) {
15
+ err("The server is not running");
16
+ return;
17
+ }
18
+ if (!args.length) {
19
+ err("usage:", ("/" + aliases[0] + " " + usage).yellow);
20
+ return;
21
+ }
22
+ this.omegga.writeln(
23
+ `${command} ${quoteArgs ? '"' : ""}${args.join(" ")}${quoteArgs ? '"' : ""}`
24
+ );
25
+ this.rl.prompt(true);
26
+ }
27
+ };
29
28
  }
30
29
  const COMMANDS = [
31
- // Brickadia commands
32
- gameCommand(['kick'], 'kick a player', '<name|id> [reason]', 'Chat.Command /Kick'),
33
- gameCommand(['ban', 'banish'], 'ban a player', '<name|id> [time] [reason]', 'Ban'),
34
- gameCommand(['unban', 'pardon'], 'unban a player', '<name|id>', 'Chat.Command /Unban'),
35
- gameCommand(['grantrole', 'giverole'], 'grant a role to a player', '<role> <name|id>', 'Chat.Command /GrantRole'),
36
- gameCommand(['revokerole', 'takerole'], 'revoke a role from a player', '<role> <name|id>', 'Chat.Command /RevokeRole'),
37
- gameCommand(['clearbricks'], "clear a player's bricks", '<name|id>', 'Bricks.Clear', true),
38
- gameCommand(['clearallbricks'], 'clear all bricks', '', 'Bricks.ClearAll'),
39
- // Help command
40
- {
41
- aliases: ['help', 'cmds', 'commands'],
42
- desc: 'list supported commands and their descriptions',
43
- fn() {
44
- const maxLen = Math.max(...COMMANDS.map(c => c.aliases[0].length));
45
- log('Omegga Help Text:\n');
46
- log(' Console input not starting with / will be sent in chat from a "SERVER" user');
47
- log(' Console input starting with / will be treated as one of the following commands\n');
48
- log('-- Available Omegga commands (type', '/command'.yellow.underline, 'to run)');
49
- for (const command of COMMANDS.sort((a, b) => a.aliases[0].localeCompare(b.aliases[0]))) {
50
- const name = command.aliases[0];
51
- this.log(' ', ('/' + name).yellow.underline, '-'.padStart(maxLen - name.length + 1), command.desc);
52
- if (command.descLines)
53
- for (const descLine of command.descLines())
54
- this.log(' ', ' '.repeat(maxLen + 1), descLine);
55
- }
56
- },
57
- },
58
- // Server controls
59
- {
60
- aliases: ['stop'],
61
- desc: 'stop the server and close Omegga',
62
- async fn() {
63
- log('Stopping server...');
64
- await this.omegga.stop();
65
- process.exit();
66
- },
67
- },
68
- {
69
- aliases: ['restart'],
70
- desc: 'trigger a server restart (without announcement or saving)',
71
- async fn() {
72
- log('Restarting server...');
73
- await this.omegga.restartServer();
74
- },
75
- },
76
- {
77
- aliases: ['update'],
78
- desc: 'try to update the server and restart if started (without announcement or saving',
79
- async fn() {
80
- var _a, _b;
81
- if (!this.omegga.config.__STEAM) {
82
- err('This command is only available when the server is installed via SteamCMD');
83
- return;
84
- }
85
- if (this.omegga.stopping || this.omegga.starting) {
86
- err('The server is currently starting or stopping. Please wait a moment');
87
- return;
88
- }
89
- const wasStarted = this.omegga.started;
90
- if (wasStarted) {
91
- log('Stopping server to update...');
92
- await this.omegga.stop();
93
- }
94
- log('Updating server...');
95
- try {
96
- (0, updater_1.steamcmdDownloadGame)({
97
- steambeta: (_a = this.omegga.config.server) === null || _a === void 0 ? void 0 : _a.steambeta,
98
- steambetaPassword: (_b = this.omegga.config.server) === null || _b === void 0 ? void 0 : _b.steambetaPassword,
99
- });
100
- log('Server updated successfully.');
101
- }
102
- catch (e) {
103
- err('Error updating server:', e);
104
- }
105
- if (wasStarted) {
106
- log('Starting server...');
107
- await this.omegga.start();
108
- }
109
- },
110
- },
111
- {
112
- aliases: ['kill'],
113
- desc: 'forcefully kill brickadia server process without closing omegga',
114
- async fn() {
115
- log('Stopping server...');
116
- await this.omegga.stop();
117
- },
118
- },
119
- {
120
- aliases: ['start'],
121
- desc: 'start the server if it is stopped',
122
- fn() {
123
- if (!this.omegga ||
124
- (this.omegga && (this.omegga.starting || this.omegga.started))) {
125
- err('The server is already running');
126
- return;
127
- }
128
- log('Starting server...');
129
- this.omegga.start();
130
- },
131
- },
132
- {
133
- aliases: ['cmd'],
134
- desc: 'run a console command on the Brickadia server. requires /debug for log to show',
135
- fn(...args) {
136
- if (!this.omegga.started) {
137
- err('The server is not running');
138
- return;
139
- }
140
- this.omegga.writeln(args.join(' '));
141
- },
142
- },
143
- {
144
- aliases: ['debug'],
145
- desc: 'toggle visibility of brickadia console logs',
146
- fn() {
147
- this.options.debug = !this.options.debug;
148
- log('Brickadia logs now', this.options.debug ? 'visible'.green : 'hidden'.red);
149
- },
150
- },
151
- {
152
- aliases: ['status'],
153
- desc: 'display server status information. brick count, online players, etc',
154
- async fn() {
155
- if (!this.omegga.started) {
156
- err('Omegga is not running');
157
- return;
158
- }
159
- const msToTime = (ms) => new Date(ms).toISOString().slice(11, 19);
160
- try {
161
- const status = await this.omegga.getServerStatus();
162
- log('Server Status');
163
- this.log(`
30
+ // Brickadia commands
31
+ gameCommand(
32
+ ["kick"],
33
+ "kick a player",
34
+ "<name|id> [reason]",
35
+ "Chat.Command /Kick"
36
+ ),
37
+ gameCommand(
38
+ ["ban", "banish"],
39
+ "ban a player",
40
+ "<name|id> [time] [reason]",
41
+ "Ban"
42
+ ),
43
+ gameCommand(
44
+ ["unban", "pardon"],
45
+ "unban a player",
46
+ "<name|id>",
47
+ "Chat.Command /Unban"
48
+ ),
49
+ gameCommand(
50
+ ["grantrole", "giverole"],
51
+ "grant a role to a player",
52
+ "<role> <name|id>",
53
+ "Chat.Command /GrantRole"
54
+ ),
55
+ gameCommand(
56
+ ["revokerole", "takerole"],
57
+ "revoke a role from a player",
58
+ "<role> <name|id>",
59
+ "Chat.Command /RevokeRole"
60
+ ),
61
+ gameCommand(
62
+ ["clearbricks"],
63
+ "clear a player's bricks",
64
+ "<name|id>",
65
+ "Bricks.Clear",
66
+ true
67
+ ),
68
+ gameCommand(["clearallbricks"], "clear all bricks", "", "Bricks.ClearAll"),
69
+ // Help command
70
+ {
71
+ aliases: ["help", "cmds", "commands"],
72
+ desc: "list supported commands and their descriptions",
73
+ fn() {
74
+ const maxLen = Math.max(...COMMANDS.map((c) => c.aliases[0].length));
75
+ log("Omegga Help Text:\n");
76
+ log(
77
+ ' Console input not starting with / will be sent in chat from a "SERVER" user'
78
+ );
79
+ log(
80
+ " Console input starting with / will be treated as one of the following commands\n"
81
+ );
82
+ log(
83
+ "-- Available Omegga commands (type",
84
+ "/command".yellow.underline,
85
+ "to run)"
86
+ );
87
+ for (const command of COMMANDS.sort(
88
+ (a, b) => a.aliases[0].localeCompare(b.aliases[0])
89
+ )) {
90
+ const name = command.aliases[0];
91
+ this.log(
92
+ " ",
93
+ ("/" + name).yellow.underline,
94
+ "-".padStart(maxLen - name.length + 1),
95
+ command.desc
96
+ );
97
+ if (command.descLines)
98
+ for (const descLine of command.descLines())
99
+ this.log(" ", " ".repeat(maxLen + 1), descLine);
100
+ }
101
+ }
102
+ },
103
+ // Server controls
104
+ {
105
+ aliases: ["stop"],
106
+ desc: "stop the server and close Omegga",
107
+ async fn() {
108
+ log("Stopping server...");
109
+ await this.omegga.stop();
110
+ process.exit();
111
+ }
112
+ },
113
+ {
114
+ aliases: ["restart"],
115
+ desc: "trigger a server restart (without announcement or saving)",
116
+ async fn() {
117
+ log("Restarting server...");
118
+ await this.omegga.restartServer();
119
+ }
120
+ },
121
+ {
122
+ aliases: ["update"],
123
+ desc: "try to update the server and restart if started (without announcement or saving",
124
+ async fn() {
125
+ if (!this.omegga.config.__STEAM) {
126
+ err(
127
+ "This command is only available when the server is installed via SteamCMD"
128
+ );
129
+ return;
130
+ }
131
+ if (this.omegga.stopping || this.omegga.starting) {
132
+ err(
133
+ "The server is currently starting or stopping. Please wait a moment"
134
+ );
135
+ return;
136
+ }
137
+ const wasStarted = this.omegga.started;
138
+ if (wasStarted) {
139
+ log("Stopping server to update...");
140
+ await this.omegga.stop();
141
+ }
142
+ log("Updating server...");
143
+ try {
144
+ steam.steamcmdDownloadGame({
145
+ steambeta: this.omegga.config.server?.steambeta,
146
+ steambetaPassword: this.omegga.config.server?.steambetaPassword
147
+ });
148
+ log("Server updated successfully.");
149
+ } catch (e) {
150
+ err("Error updating server:", e);
151
+ }
152
+ if (wasStarted) {
153
+ log("Starting server...");
154
+ await this.omegga.start();
155
+ }
156
+ }
157
+ },
158
+ {
159
+ aliases: ["kill"],
160
+ desc: "forcefully kill brickadia server process without closing omegga",
161
+ async fn() {
162
+ log("Stopping server...");
163
+ await this.omegga.stop();
164
+ }
165
+ },
166
+ {
167
+ aliases: ["start"],
168
+ desc: "start the server if it is stopped",
169
+ fn() {
170
+ if (!this.omegga || this.omegga && (this.omegga.starting || this.omegga.started)) {
171
+ err("The server is already running");
172
+ return;
173
+ }
174
+ log("Starting server...");
175
+ this.omegga.start();
176
+ }
177
+ },
178
+ {
179
+ aliases: ["cmd"],
180
+ desc: "run a console command on the Brickadia server. requires /debug for log to show",
181
+ fn(...args) {
182
+ if (!this.omegga.started) {
183
+ err("The server is not running");
184
+ return;
185
+ }
186
+ this.omegga.writeln(args.join(" "));
187
+ }
188
+ },
189
+ {
190
+ aliases: ["debug"],
191
+ desc: "toggle visibility of brickadia console logs",
192
+ fn() {
193
+ this.options.debug = !this.options.debug;
194
+ log(
195
+ "Brickadia logs now",
196
+ this.options.debug ? "visible".green : "hidden".red
197
+ );
198
+ }
199
+ },
200
+ {
201
+ aliases: ["status"],
202
+ desc: "display server status information. brick count, online players, etc",
203
+ async fn() {
204
+ if (!this.omegga.started) {
205
+ err("Omegga is not running");
206
+ return;
207
+ }
208
+ const msToTime = (ms) => new Date(ms).toISOString().slice(11, 19);
209
+ try {
210
+ const status = await this.omegga.getServerStatus();
211
+ log("Server Status");
212
+ this.log(`
164
213
  ${status.serverName.yellow}
165
- Bricks: ${(status.bricks + '').yellow}
166
- Components: ${(status.components + '').yellow}
214
+ Bricks: ${(status.bricks + "").yellow}
215
+ Components: ${(status.components + "").yellow}
167
216
  Uptime: ${msToTime(status.time).yellow}
168
- Players: ${status.players.length === 0 ? 'none'.grey : ''}
169
- ${status.players
170
- .map(p => `[${msToTime(p.time).grey}] ${p.name.brightYellow}`)
171
- .join('\n ')}
217
+ Players: ${status.players.length === 0 ? "none".grey : ""}
218
+ ${status.players.map((p) => `[${msToTime(p.time).grey}] ${p.name.brightYellow}`).join("\n ")}
172
219
  `);
220
+ } catch (e) {
221
+ err("An error occurred while getting server status");
222
+ }
223
+ }
224
+ },
225
+ // plugin stuff
226
+ {
227
+ aliases: ["reload"],
228
+ desc: "shorthand for /plugins reload",
229
+ async fn() {
230
+ await COMMANDS.find((c) => c.aliases.includes("plugins")).fn.bind(this)(
231
+ "reload"
232
+ );
233
+ }
234
+ },
235
+ {
236
+ aliases: ["plugins", "plugin", "p"],
237
+ desc: "manage Omegga plugins",
238
+ descLines: () => [
239
+ "/plugins install <...plugin names>".yellow + " installs plugins",
240
+ "/plugins load <...plugin names>".yellow + " loads plugins, and enables if they were disabled",
241
+ "/plugins unload <...plugin names>".yellow + " unloads plugins",
242
+ "/plugins reload [...plugin names]".yellow + " reloads all plugins, or those specified",
243
+ "/plugins enable <...plugin names>".yellow + " enables plugins",
244
+ "/plugins disable <...plugin names>".yellow + " disables plugins, and unloads if they were loaded"
245
+ ],
246
+ async fn(subcommand, ...args) {
247
+ if (!this.omegga.pluginLoader) {
248
+ err("Omegga is not using plugins");
249
+ return;
250
+ }
251
+ if (!subcommand) {
252
+ const plugins = this.omegga.pluginLoader.plugins;
253
+ if (plugins.length === 0) {
254
+ log("No plugins are installed");
255
+ log(" Install some with", "/plugins install".yellow.underline);
256
+ } else {
257
+ log("Installed plugins".yellow.underline);
258
+ for (const plugin2 of plugins) {
259
+ const name = plugin2.getName();
260
+ const docs = plugin2.getDocumentation();
261
+ if (plugin2.isLoaded()) log(name.cyan.underline + " (loaded)");
262
+ else if (plugin2.isEnabled())
263
+ log(name.green.underline + " (enabled, not loaded)");
264
+ else log(name.red.underline + " (disabled)");
265
+ log(" " + docs.description);
266
+ log((" Author: " + docs.author).gray);
267
+ }
268
+ }
269
+ } else if (subcommand === "install") {
270
+ await plugin.install(args);
271
+ log();
272
+ log(
273
+ "Use",
274
+ "/plugins reload".yellow,
275
+ "to reload all plugins and use the installed ones"
276
+ );
277
+ } else if (subcommand === "load") {
278
+ if (args.length === 0) {
279
+ log("Please specify at least one plugin to load");
280
+ return;
281
+ }
282
+ for (const pluginName of args) {
283
+ const plugin2 = this.omegga.pluginLoader.plugins.find(
284
+ (p) => p.getName().toLowerCase() === pluginName.toLowerCase()
285
+ );
286
+ if (!plugin2) {
287
+ warn("No plugin by the name", pluginName.cyan);
288
+ continue;
289
+ }
290
+ const name = plugin2.getName();
291
+ if (plugin2.isLoaded()) {
292
+ warn(
293
+ name.cyan,
294
+ "is already loaded, reload with",
295
+ ("/plugins reload " + name).yellow
296
+ );
297
+ return;
298
+ }
299
+ if (!plugin2.isEnabled()) {
300
+ log("Enabling and loading", name.cyan.underline);
301
+ plugin2.setEnabled(true);
302
+ await plugin2.load();
303
+ } else {
304
+ log("Loading", name.cyan.underline);
305
+ await plugin2.load();
306
+ }
307
+ }
308
+ } else if (subcommand === "unload") {
309
+ if (args.length === 0) {
310
+ log("Please specify at least one plugin to unload");
311
+ return;
312
+ }
313
+ for (const pluginName of args) {
314
+ const plugin2 = this.omegga.pluginLoader.plugins.find(
315
+ (p) => p.getName().toLowerCase() === pluginName.toLowerCase()
316
+ );
317
+ if (!plugin2) {
318
+ warn("No plugin by the name", pluginName.cyan);
319
+ continue;
320
+ }
321
+ const name = plugin2.getName();
322
+ if (!plugin2.isLoaded()) {
323
+ warn(
324
+ name.cyan,
325
+ "is already unloaded, load with",
326
+ ("/plugins load " + name).yellow
327
+ );
328
+ return;
329
+ }
330
+ log("Unloading", name.cyan.underline);
331
+ await plugin2.unload();
332
+ }
333
+ } else if (subcommand === "reload") {
334
+ let plugins = (args.length === 0 ? this.omegga.pluginLoader.plugins : this.omegga.pluginLoader.plugins.filter(
335
+ (p) => args.map((a) => a.toLowerCase()).includes(p.getName().toLowerCase())
336
+ )).filter((p) => p.isEnabled());
337
+ const loaded = plugins.filter((p) => p.isLoaded());
338
+ log("Unloading", loaded.length, "plugins");
339
+ for (const plugin2 of loaded) await plugin2.unload();
340
+ if (args.length === 0) {
341
+ log("Scanning for new plugins");
342
+ if (!await this.omegga.pluginLoader.scan()) {
343
+ err("Could not scan for plugins. All plugins are unloaded");
344
+ return;
345
+ }
346
+ }
347
+ plugins = (args.length === 0 ? this.omegga.pluginLoader.plugins : this.omegga.pluginLoader.plugins.filter(
348
+ (p) => args.map((a) => a.toLowerCase()).includes(p.getName().toLowerCase())
349
+ )).filter((p) => p.isEnabled());
350
+ log("Loading", plugins.length, "plugins");
351
+ for (const plugin2 of plugins) await plugin2.load();
352
+ log("Reloaded", plugins.length, "plugins");
353
+ } else if (subcommand === "enable") {
354
+ if (args.length === 0) {
355
+ log("Please specify at least one plugin to enable");
356
+ return;
357
+ }
358
+ for (const pluginName of args) {
359
+ const plugin2 = this.omegga.pluginLoader.plugins.find(
360
+ (p) => p.getName().toLowerCase() === pluginName.toLowerCase()
361
+ );
362
+ if (!plugin2) {
363
+ warn("No plugin by the name", pluginName.cyan);
364
+ continue;
365
+ }
366
+ const name = plugin2.getName();
367
+ if (plugin2.isEnabled()) {
368
+ warn(
369
+ name.cyan,
370
+ "is already enabled, disable with",
371
+ ("/plugins disable " + name).yellow
372
+ );
373
+ return;
374
+ }
375
+ log(
376
+ "Enabling",
377
+ name.cyan.underline,
378
+ "(load with",
379
+ ("/plugins load " + name).yellow + ")"
380
+ );
381
+ plugin2.setEnabled(true);
382
+ }
383
+ } else if (subcommand === "disable") {
384
+ if (args.length === 0) {
385
+ log("Please specify at least one plugin to disable");
386
+ return;
387
+ }
388
+ for (const pluginName of args) {
389
+ const plugin2 = this.omegga.pluginLoader.plugins.find(
390
+ (p) => p.getName().toLowerCase() === pluginName.toLowerCase()
391
+ );
392
+ if (!plugin2) {
393
+ warn("No plugin by the name", pluginName.cyan);
394
+ continue;
395
+ }
396
+ const name = plugin2.getName();
397
+ if (!plugin2.isEnabled()) {
398
+ warn(
399
+ name.cyan,
400
+ "is already disabled, enable with",
401
+ ("/plugins enable " + name).yellow
402
+ );
403
+ return;
404
+ }
405
+ if (plugin2.isLoaded()) {
406
+ log("Unloading and disabling", name.cyan.underline);
407
+ await plugin2.unload();
408
+ plugin2.setEnabled(false);
409
+ } else {
410
+ log("Disabling", name.cyan.underline);
411
+ plugin2.setEnabled(false);
412
+ }
413
+ }
414
+ }
415
+ }
416
+ },
417
+ {
418
+ aliases: ["world", "worlds", "w"],
419
+ desc: "Manage worlds on the server",
420
+ descLines: () => ["Type /worlds load a world"],
421
+ async fn(subcommand, ...args) {
422
+ switch (subcommand) {
423
+ default:
424
+ const commands = [
425
+ {
426
+ command: "/worlds use [world]",
427
+ desc: "set or remove a world as the default world for startup",
428
+ short: "/w u [world]"
429
+ },
430
+ {
431
+ command: "/worlds load <world> [rev]",
432
+ desc: "load a world",
433
+ short: "/w load <world> [rev]"
434
+ },
435
+ {
436
+ command: "/worlds saveas <world>",
437
+ desc: "save the current world as a new world",
438
+ short: "/w sa <world>"
439
+ },
440
+ {
441
+ command: "/worlds save",
442
+ desc: "save the current world",
443
+ short: "/w s"
444
+ },
445
+ {
446
+ command: "/worlds revisions <world>",
447
+ desc: "list revisions of a world",
448
+ short: "/w r <world>"
449
+ },
450
+ {
451
+ command: "/worlds new",
452
+ desc: "create a new world",
453
+ short: "/w new <name> [Plate|Space|Studio|Peaks]"
173
454
  }
174
- catch (e) {
175
- err('An error occurred while getting server status');
176
- }
177
- },
178
- },
179
- // plugin stuff
180
- {
181
- aliases: ['reload'],
182
- desc: 'shorthand for /plugins reload',
183
- async fn() {
184
- await COMMANDS.find(c => c.aliases.includes('plugins')).fn.bind(this)('reload');
185
- },
186
- },
187
- {
188
- aliases: ['plugins', 'plugin', 'p'],
189
- desc: 'manage Omegga plugins',
190
- descLines: () => [
191
- '/plugins install <...plugin names>'.yellow + ' installs plugins',
192
- '/plugins load <...plugin names>'.yellow +
193
- ' loads plugins, and enables if they were disabled',
194
- '/plugins unload <...plugin names>'.yellow + ' unloads plugins',
195
- '/plugins reload [...plugin names]'.yellow +
196
- ' reloads all plugins, or those specified',
197
- '/plugins enable <...plugin names>'.yellow + ' enables plugins',
198
- '/plugins disable <...plugin names>'.yellow +
199
- ' disables plugins, and unloads if they were loaded',
200
- ],
201
- async fn(subcommand, ...args) {
202
- if (!this.omegga.pluginLoader) {
203
- err('Omegga is not using plugins');
204
- return;
205
- }
206
- if (!subcommand) {
207
- const plugins = this.omegga.pluginLoader.plugins;
208
- if (plugins.length === 0) {
209
- log('No plugins are installed');
210
- log(' Install some with', '/plugins install'.yellow.underline);
211
- }
212
- else {
213
- log('Installed plugins'.yellow.underline);
214
- for (const plugin of plugins) {
215
- const name = plugin.getName();
216
- const docs = plugin.getDocumentation();
217
- if (plugin.isLoaded())
218
- log(name.cyan.underline + ' (loaded)');
219
- else if (plugin.isEnabled())
220
- log(name.green.underline + ' (enabled, not loaded)');
221
- else
222
- log(name.red.underline + ' (disabled)');
223
- log(' ' + docs.description);
224
- log((' Author: ' + docs.author).gray);
225
- }
226
- }
227
- }
228
- else if (subcommand === 'install') {
229
- // install plugins
230
- await (0, plugin_1.install)(args, { verbose: true });
231
- log();
232
- log('Use', '/plugins reload'.yellow, 'to reload all plugins and use the installed ones');
233
- }
234
- else if (subcommand === 'load') {
235
- if (args.length === 0) {
236
- log('Please specify at least one plugin to load');
237
- return;
238
- }
239
- for (const pluginName of args) {
240
- const plugin = this.omegga.pluginLoader.plugins.find(p => p.getName().toLowerCase() === pluginName.toLowerCase());
241
- if (!plugin) {
242
- warn('No plugin by the name', pluginName.cyan);
243
- continue;
244
- }
245
- const name = plugin.getName();
246
- if (plugin.isLoaded()) {
247
- warn(name.cyan, 'is already loaded, reload with', ('/plugins reload ' + name).yellow);
248
- return;
249
- }
250
- if (!plugin.isEnabled()) {
251
- log('Enabling and loading', name.cyan.underline);
252
- plugin.setEnabled(true);
253
- await plugin.load();
254
- }
255
- else {
256
- log('Loading', name.cyan.underline);
257
- await plugin.load();
258
- }
259
- }
260
- }
261
- else if (subcommand === 'unload') {
262
- if (args.length === 0) {
263
- log('Please specify at least one plugin to unload');
264
- return;
265
- }
266
- for (const pluginName of args) {
267
- const plugin = this.omegga.pluginLoader.plugins.find(p => p.getName().toLowerCase() === pluginName.toLowerCase());
268
- if (!plugin) {
269
- warn('No plugin by the name', pluginName.cyan);
270
- continue;
271
- }
272
- const name = plugin.getName();
273
- if (!plugin.isLoaded()) {
274
- warn(name.cyan, 'is already unloaded, load with', ('/plugins load ' + name).yellow);
275
- return;
276
- }
277
- log('Unloading', name.cyan.underline);
278
- await plugin.unload();
279
- }
280
- }
281
- else if (subcommand === 'reload') {
282
- let plugins = (args.length === 0
283
- ? this.omegga.pluginLoader.plugins
284
- : this.omegga.pluginLoader.plugins.filter(p => args
285
- .map(a => a.toLowerCase())
286
- .includes(p.getName().toLowerCase()))).filter(p => p.isEnabled());
287
- const loaded = plugins.filter(p => p.isLoaded());
288
- log('Unloading', loaded.length, 'plugins');
289
- for (const plugin of loaded)
290
- await plugin.unload();
291
- if (args.length === 0) {
292
- log('Scanning for new plugins');
293
- if (!(await this.omegga.pluginLoader.scan())) {
294
- err('Could not scan for plugins. All plugins are unloaded');
295
- return;
296
- }
297
- }
298
- plugins = (args.length === 0
299
- ? this.omegga.pluginLoader.plugins
300
- : this.omegga.pluginLoader.plugins.filter(p => args
301
- .map(a => a.toLowerCase())
302
- .includes(p.getName().toLowerCase()))).filter(p => p.isEnabled());
303
- log('Loading', plugins.length, 'plugins');
304
- for (const plugin of plugins)
305
- await plugin.load();
306
- log('Reloaded', plugins.length, 'plugins');
455
+ ];
456
+ log(
457
+ "Default world is",
458
+ this.omegga.getNextWorld()?.file?.yellow || "none".grey
459
+ );
460
+ log("Available world commands:");
461
+ for (const { command, desc, short } of commands) {
462
+ this.log(" ", command.yellow, "-", desc, `(${short.yellow})`);
463
+ }
464
+ return;
465
+ case "use":
466
+ case "u":
467
+ const world = args[0]?.replace(/\.brdb$/, "");
468
+ if (world && !this.omegga.worldExists(world)) {
469
+ err(`World "${world}" does not exist`);
470
+ return;
471
+ }
472
+ if (this.omegga.setActiveWorld(world || null)) {
473
+ if (world) {
474
+ log(
475
+ `Default world set to ${world.yellow}. It will be loaded next startup.`
476
+ );
477
+ } else {
478
+ log(
479
+ "Default world cleared. No world will be loaded on next startup."
480
+ );
307
481
  }
308
- else if (subcommand === 'enable') {
309
- if (args.length === 0) {
310
- log('Please specify at least one plugin to enable');
311
- return;
312
- }
313
- for (const pluginName of args) {
314
- const plugin = this.omegga.pluginLoader.plugins.find(p => p.getName().toLowerCase() === pluginName.toLowerCase());
315
- if (!plugin) {
316
- warn('No plugin by the name', pluginName.cyan);
317
- continue;
318
- }
319
- const name = plugin.getName();
320
- if (plugin.isEnabled()) {
321
- warn(name.cyan, 'is already enabled, disable with', ('/plugins disable ' + name).yellow);
322
- return;
323
- }
324
- log('Enabling', name.cyan.underline, '(load with', ('/plugins load ' + name).yellow + ')');
325
- plugin.setEnabled(true);
326
- }
482
+ } else {
483
+ err(`Failed to set default world to ${world.yellow}.`);
484
+ }
485
+ return;
486
+ case "list":
487
+ case "ls":
488
+ const worlds = this.omegga.getWorlds();
489
+ if (worlds.length === 0) {
490
+ log(
491
+ "No worlds found. Create one with",
492
+ "/worlds saveas <world>".yellow
493
+ );
494
+ } else {
495
+ log("Available worlds:");
496
+ const prefix = this.omegga.worldPath + "/";
497
+ for (const world2 of worlds) {
498
+ this.log(
499
+ " ",
500
+ world2.replace(prefix, "").replace(/\.brdb$/, "").yellow
501
+ );
327
502
  }
328
- else if (subcommand === 'disable') {
329
- if (args.length === 0) {
330
- log('Please specify at least one plugin to disable');
331
- return;
332
- }
333
- for (const pluginName of args) {
334
- const plugin = this.omegga.pluginLoader.plugins.find(p => p.getName().toLowerCase() === pluginName.toLowerCase());
335
- if (!plugin) {
336
- warn('No plugin by the name', pluginName.cyan);
337
- continue;
338
- }
339
- const name = plugin.getName();
340
- if (!plugin.isEnabled()) {
341
- warn(name.cyan, 'is already disabled, enable with', ('/plugins enable ' + name).yellow);
342
- return;
343
- }
344
- if (plugin.isLoaded()) {
345
- log('Unloading and disabling', name.cyan.underline);
346
- await plugin.unload();
347
- plugin.setEnabled(false);
348
- }
349
- else {
350
- log('Disabling', name.cyan.underline);
351
- plugin.setEnabled(false);
352
- }
353
- }
503
+ }
504
+ return;
505
+ case "load":
506
+ case "l":
507
+ if (!this.omegga.started) {
508
+ err("The server is not running");
509
+ return;
510
+ }
511
+ if (args.length === 0) {
512
+ err("Please specify a world to load");
513
+ return;
514
+ }
515
+ const worldName = args[0].replace(/\.brdb$/, "");
516
+ if (!this.omegga.getWorldPath(worldName)) {
517
+ err(`World "${worldName}" does not exist`);
518
+ return;
519
+ }
520
+ let revision;
521
+ if (args.length > 1) {
522
+ revision = parseInt(args[1], 10);
523
+ if (isNaN(revision) || revision < 1) {
524
+ err(`Invalid revision number: ${args[1]}`);
525
+ return;
354
526
  }
355
- },
356
- },
357
- {
358
- aliases: ['world', 'worlds', 'w'],
359
- desc: 'Manage worlds on the server',
360
- descLines: () => ['Type /worlds load a world'],
361
- async fn(subcommand, ...args) {
362
- var _a, _b, _c;
363
- switch (subcommand) {
364
- default:
365
- const commands = [
366
- {
367
- command: '/worlds use [world]',
368
- desc: 'set or remove a world as the default world for startup',
369
- short: '/w u [world]',
370
- },
371
- {
372
- command: '/worlds load <world> [rev]',
373
- desc: 'load a world',
374
- short: '/w load <world> [rev]',
375
- },
376
- {
377
- command: '/worlds saveas <world>',
378
- desc: 'save the current world as a new world',
379
- short: '/w sa <world>',
380
- },
381
- {
382
- command: '/worlds save',
383
- desc: 'save the current world',
384
- short: '/w s',
385
- },
386
- {
387
- command: '/worlds revisions <world>',
388
- desc: 'list revisions of a world',
389
- short: '/w r <world>',
390
- },
391
- {
392
- command: '/worlds new',
393
- desc: 'create a new world',
394
- short: '/w new <name> [Plate|Space|Studio|Peaks]',
395
- },
396
- ];
397
- log('Default world is', ((_b = (_a = this.omegga.getNextWorld()) === null || _a === void 0 ? void 0 : _a.file) === null || _b === void 0 ? void 0 : _b.yellow) || 'none'.grey);
398
- log('Available world commands:');
399
- for (const { command, desc, short } of commands) {
400
- this.log(' ', command.yellow, '-', desc, `(${short.yellow})`);
401
- }
402
- return;
403
- case 'use':
404
- case 'u':
405
- const world = (_c = args[0]) === null || _c === void 0 ? void 0 : _c.replace(/\.brdb$/, '');
406
- if (world && !this.omegga.worldExists(world)) {
407
- err(`World "${world}" does not exist`);
408
- return;
409
- }
410
- if (this.omegga.setActiveWorld(world || null)) {
411
- if (world) {
412
- log(`Default world set to ${world.yellow}. It will be loaded next startup.`);
413
- }
414
- else {
415
- log('Default world cleared. No world will be loaded on next startup.');
416
- }
417
- }
418
- else {
419
- err(`Failed to set default world to ${world.yellow}.`);
420
- }
421
- return;
422
- case 'list':
423
- case 'ls':
424
- // list worlds
425
- const worlds = this.omegga.getWorlds();
426
- if (worlds.length === 0) {
427
- log('No worlds found. Create one with', '/worlds saveas <world>'.yellow);
428
- }
429
- else {
430
- log('Available worlds:');
431
- const prefix = this.omegga.worldPath + '/';
432
- for (const world of worlds) {
433
- this.log(' ', world.replace(prefix, '').replace(/\.brdb$/, '').yellow);
434
- }
435
- }
436
- return;
437
- case 'load':
438
- case 'l':
439
- if (!this.omegga.started) {
440
- err('The server is not running');
441
- return;
442
- }
443
- // load a world
444
- if (args.length === 0) {
445
- err('Please specify a world to load');
446
- return;
447
- }
448
- const worldName = args[0].replace(/\.brdb$/, '');
449
- if (!this.omegga.getWorldPath(worldName)) {
450
- err(`World "${worldName}" does not exist`);
451
- return;
452
- }
453
- let revision;
454
- if (args.length > 1) {
455
- revision = parseInt(args[1], 10);
456
- if (isNaN(revision) || revision < 1) {
457
- err(`Invalid revision number: ${args[1]}`);
458
- return;
459
- }
460
- }
461
- let loadRes = false;
462
- if (revision) {
463
- log(`Loading world ${worldName.yellow} at revision ${revision}...`);
464
- loadRes = await this.omegga.loadWorldRevision(worldName, revision);
465
- }
466
- else {
467
- log(`Loading world ${worldName.yellow}...`);
468
- loadRes = await this.omegga.loadWorld(worldName);
469
- }
470
- if (loadRes) {
471
- log(`World ${worldName.yellow} loaded successfully.`);
472
- }
473
- else {
474
- err(`Failed to load world ${worldName.yellow}`);
475
- }
476
- return;
477
- case 'saveas':
478
- case 'sa':
479
- if (!this.omegga.started) {
480
- err('The server is not running');
481
- return;
482
- }
483
- // save the current world as a new world
484
- if (args.length === 0) {
485
- err('Please specify a world to save as');
486
- return;
487
- }
488
- const saveWorldName = args[0].replace(/\.brdb$/, '');
489
- if (this.omegga.getWorldPath(saveWorldName)) {
490
- err(`World "${saveWorldName}" already exists`);
491
- return;
492
- }
493
- log(`Saving current world as ${saveWorldName.yellow}...`);
494
- const saveAsRes = await this.omegga.saveWorldAs(saveWorldName);
495
- if (saveAsRes) {
496
- log(`Current world saved as ${saveWorldName.yellow} successfully.`);
497
- }
498
- else {
499
- err(`Failed to save current world as ${saveWorldName.yellow}`);
500
- }
501
- return;
502
- case 'save':
503
- case 's':
504
- if (!this.omegga.started) {
505
- err('The server is not running');
506
- return;
507
- }
508
- // save the current world
509
- log('Saving current world...');
510
- const res = await this.omegga.saveWorld();
511
- if (res) {
512
- log('Current world saved successfully.');
513
- }
514
- else {
515
- err('Failed to save the current world');
516
- }
517
- return;
518
- case 'revisions':
519
- case 'r':
520
- if (!this.omegga.started) {
521
- err('The server is not running');
522
- return;
523
- }
524
- // list revisions of a world
525
- if (args.length === 0) {
526
- err('Please specify a world to list revisions for');
527
- return;
528
- }
529
- const revisionsWorldName = args[0].replace(/\.brdb$/, '');
530
- if (!this.omegga.getWorldPath(revisionsWorldName)) {
531
- err(`World "${revisionsWorldName}" does not exist`);
532
- return;
533
- }
534
- log(`Listing revisions for world ${revisionsWorldName.yellow}...`);
535
- try {
536
- const revisions = await this.omegga.getWorldRevisions(revisionsWorldName);
537
- if (revisions.length === 0) {
538
- log('No revisions found for world', revisionsWorldName.yellow);
539
- }
540
- else {
541
- log('Revisions for world', revisionsWorldName.yellow + ':');
542
- for (const rev of revisions) {
543
- this.log(' ', `Revision ${rev.index.toString().yellow} - ${rev.date
544
- .toISOString()
545
- .replace('T', ' ')
546
- .replace('.000Z', '').blue}`, `(${rev.note})`.grey);
547
- }
548
- }
549
- }
550
- catch (e) {
551
- err('An error occurred while getting world revisions:', e.toString());
552
- }
553
- return;
554
- case 'new':
555
- case 'n':
556
- if (!this.omegga.started) {
557
- err('The server is not running');
558
- return;
559
- }
560
- // create a new world
561
- if (args.length === 0) {
562
- err('Please specify a name for the new world');
563
- return;
564
- }
565
- const newWorldName = args[0].replace(/\.brdb$/, '');
566
- if (this.omegga.getWorldPath(newWorldName)) {
567
- err(`World "${newWorldName}" already exists`);
568
- return;
569
- }
570
- const map = (args[1] ? args[1] : 'Plate');
571
- if (!['Plate', 'Space', 'Studio', 'Peaks'].includes(map)) {
572
- err(`Invalid preset "${map}". Valid map are: Plate, Space, Studio`);
573
- return;
574
- }
575
- log(`Creating new world ${newWorldName.yellow}...`);
576
- this.omegga.createEmptyWorld(newWorldName, map);
527
+ }
528
+ let loadRes = false;
529
+ if (revision) {
530
+ log(`Loading world ${worldName.yellow} at revision ${revision}...`);
531
+ loadRes = await this.omegga.loadWorldRevision(worldName, revision);
532
+ } else {
533
+ log(`Loading world ${worldName.yellow}...`);
534
+ loadRes = await this.omegga.loadWorld(worldName);
535
+ }
536
+ if (loadRes) {
537
+ log(`World ${worldName.yellow} loaded successfully.`);
538
+ } else {
539
+ err(`Failed to load world ${worldName.yellow}`);
540
+ }
541
+ return;
542
+ case "saveas":
543
+ case "sa":
544
+ if (!this.omegga.started) {
545
+ err("The server is not running");
546
+ return;
547
+ }
548
+ if (args.length === 0) {
549
+ err("Please specify a world to save as");
550
+ return;
551
+ }
552
+ const saveWorldName = args[0].replace(/\.brdb$/, "");
553
+ if (this.omegga.getWorldPath(saveWorldName)) {
554
+ err(`World "${saveWorldName}" already exists`);
555
+ return;
556
+ }
557
+ log(`Saving current world as ${saveWorldName.yellow}...`);
558
+ const saveAsRes = await this.omegga.saveWorldAs(saveWorldName);
559
+ if (saveAsRes) {
560
+ log(`Current world saved as ${saveWorldName.yellow} successfully.`);
561
+ } else {
562
+ err(`Failed to save current world as ${saveWorldName.yellow}`);
563
+ }
564
+ return;
565
+ case "save":
566
+ case "s":
567
+ if (!this.omegga.started) {
568
+ err("The server is not running");
569
+ return;
570
+ }
571
+ log("Saving current world...");
572
+ const res = await this.omegga.saveWorld();
573
+ if (res) {
574
+ log("Current world saved successfully.");
575
+ } else {
576
+ err("Failed to save the current world");
577
+ }
578
+ return;
579
+ case "revisions":
580
+ case "r":
581
+ if (!this.omegga.started) {
582
+ err("The server is not running");
583
+ return;
584
+ }
585
+ if (args.length === 0) {
586
+ err("Please specify a world to list revisions for");
587
+ return;
588
+ }
589
+ const revisionsWorldName = args[0].replace(/\.brdb$/, "");
590
+ if (!this.omegga.getWorldPath(revisionsWorldName)) {
591
+ err(`World "${revisionsWorldName}" does not exist`);
592
+ return;
593
+ }
594
+ log(`Listing revisions for world ${revisionsWorldName.yellow}...`);
595
+ try {
596
+ const revisions = await this.omegga.getWorldRevisions(revisionsWorldName);
597
+ if (revisions.length === 0) {
598
+ log("No revisions found for world", revisionsWorldName.yellow);
599
+ } else {
600
+ log("Revisions for world", revisionsWorldName.yellow + ":");
601
+ for (const rev of revisions) {
602
+ this.log(
603
+ " ",
604
+ `Revision ${rev.index.toString().yellow} - ${rev.date.toISOString().replace("T", " ").replace(".000Z", "").blue}`,
605
+ `(${rev.note})`.grey
606
+ );
607
+ }
577
608
  }
578
- },
579
- },
609
+ } catch (e) {
610
+ err(
611
+ "An error occurred while getting world revisions:",
612
+ e.toString()
613
+ );
614
+ }
615
+ return;
616
+ case "new":
617
+ case "n":
618
+ if (!this.omegga.started) {
619
+ err("The server is not running");
620
+ return;
621
+ }
622
+ if (args.length === 0) {
623
+ err("Please specify a name for the new world");
624
+ return;
625
+ }
626
+ const newWorldName = args[0].replace(/\.brdb$/, "");
627
+ if (this.omegga.getWorldPath(newWorldName)) {
628
+ err(`World "${newWorldName}" already exists`);
629
+ return;
630
+ }
631
+ const map = args[1] ? args[1] : "Plate";
632
+ if (!["Plate", "Space", "Studio", "Peaks"].includes(map)) {
633
+ err(`Invalid preset "${map}". Valid map are: Plate, Space, Studio`);
634
+ return;
635
+ }
636
+ log(`Creating new world ${newWorldName.yellow}...`);
637
+ this.omegga.createEmptyWorld(newWorldName, map);
638
+ }
639
+ }
640
+ }
580
641
  ];
581
- // the terminal wraps omegga and displays console output and handles console input
582
642
  class Terminal {
583
- constructor(omegga, options = {}) {
584
- this.options = options;
585
- this.omegga = omegga;
586
- // terminal interface
587
- this.rl = readline_1.default.createInterface({
588
- input: process.stdin,
589
- output: process.stdout,
590
- terminal: true,
591
- });
592
- this.rl.setPrompt('> '.brightGreen);
593
- // shortand fns
594
- log = (...args) => this.log('>>'.green, ...args);
595
- err = (...args) => this.error('!>'.red, ...args);
596
- info = (...args) => this.log('?>'.blue, ...args);
597
- warn = (...args) => this.warn('W>'.yellow, ...args);
598
- // print log line if debug is enabled
599
- let launcherDone = false;
600
- let lastDoneMessage = '';
601
- omegga.on('line', l => {
602
- if (options.debug)
603
- this.log('::'.blue, l);
604
- else if (!launcherDone) {
605
- if (l.match(/Update Failed/)) {
606
- err(l);
607
- info('This might be resolved by deleting brickadia and reinstalling:');
608
- info(' rm -rf ~/.local/share/brickadia-launcher'.grey);
609
- }
610
- if (l.startsWith('DOWNLOADING')) {
611
- // TODO: if someone is proactive enough in the future, you could turn these steps into a legitimate progress bar
612
- /* Here's some launcher log lines that might be helpful
613
- Grabbing manifest and checking game files...
614
- DOWNLOADING MANIFEST | Hold on...
615
- DOWNLOADING MANIFEST (100%) | Hold on...
616
- DOWNLOADING MANIFEST (100%) | 0 B/s - 13 KiB / 13 KiB (Unknown time remaining...)
617
- DOWNLOADING MANIFEST (100%) | Done!
618
- Checking launcher and downloading version info...
619
- Installing patches and booting...
620
- DOWNLOADING BRICKADIA (0%) | Done!
621
- DOWNLOADING BRICKADIA (100%) | 110 MiB/s - 584 MiB / 584 MiB (1 second remaining...)
622
- DOWNLOADING BRICKADIA (100%) | Nearly done...
623
- DOWNLOADING BRICKADIA (100%), INSTALLING BRICKADIA (86%) | Nearly done...
624
- */
625
- process.stdout.clearLine(0);
626
- process.stdout.cursorTo(0);
627
- process.stdout.write(l);
628
- // add a newline on "Done!" but prevent newlines on repeat done messages
629
- if (l.match(/Done!/) && l !== lastDoneMessage) {
630
- lastDoneMessage = l;
631
- process.stdout.write('\n');
632
- }
633
- }
634
- else if (l.match(/Disabling core dumps./)) {
635
- launcherDone = true;
636
- }
637
- }
638
- // [2025.07.07-20.45.40:310][845]LogBRWorldManager: World successfully loaded.
639
- if (l.match(/^\[[^\]]+\]\[[^\]]+\]LogBRWorldManager: World successfully loaded\.$/)) {
640
- info('World successfully loaded.');
641
- }
642
- });
643
- // print debug events regardless of debug status
644
- omegga.on('debug', l => this.log('?>'.magenta, l));
645
- // print chat events as players join/leave the server
646
- omegga.on('join', (p) => this.log(`${p.displayName.underline} (${p.name.underline}) joined.`.brightBlue));
647
- omegga.on('leave', (p) => this.log(`${p.displayName.underline} (${p.name.underline}) left.`.brightBlue));
648
- omegga.on('chat', (name, message) => {
649
- var _a, _b;
650
- const player = omegga.getPlayer(name);
651
- this.log(`${((_b = (_a = player.displayName) !== null && _a !== void 0 ? _a : player.name) !== null && _b !== void 0 ? _b : name).brightYellow.underline}: ${message}`);
652
- });
653
- omegga.on('start', () => {
654
- const wsl = (0, wsl_1.checkWsl)();
655
- log(`Server has started${wsl === 1 ? ' in single thread mode due to WSL1' : ''}. Type ${'/help'.yellow} for more commands`);
656
- if (!this.omegga.getNextWorld()) {
657
- info('No', 'default world'.yellow, 'is configured. Run', '/worlds use <world>'.yellow, 'to load one on startup.');
658
- }
659
- // check if this is WSL2 and wsl2binds is installed
660
- if (wsl === 2 &&
661
- this.omegga.pluginLoader &&
662
- !this.omegga.pluginLoader.plugins.some(p => p.getName() === 'wsl2binds')) {
663
- warn('####'.yellow, `You are running ${'WSL2'.yellow} and you don't have the ${'wsl2binds'.yellow} plugin.`);
664
- warn('####'.yellow, `The wsl2binds plugin works as a ${'UDP proxy'.underline} between Windows and the WSL2 VM.`);
665
- warn('####'.yellow, 'Install it by:');
666
- warn('####'.yellow, ' 1. Closing omegga with', '/stop'.green);
667
- warn('####'.yellow, ' 2. Installing wsl2binds with', 'omegga install gh:Meshiest/wsl2binds'.green);
668
- warn('####'.yellow, ' 3. Restarting', 'omegga'.green);
669
- }
670
- });
671
- omegga.on('mapchange', ({ map }) => log('Map changed to', (map.charAt(0).toUpperCase() + map.slice(1)).green));
672
- omegga.on('unauthorized', () => {
673
- err('Server failed authentication check');
674
- info('You can clear auth tokens with', 'omegga auth -gl'.green);
675
- info('This will require you to paste a new hosting token or sign-in again');
676
- process.exit();
677
- });
678
- omegga.on('error', e => err('Server caught unhandled exception:\n' + e));
679
- omegga.on('server:stopped', () => log('Server has closed. Type', '/stop'.yellow, 'to close omegga'));
680
- this.rl.on('line', this.handleLine.bind(this));
681
- // Gracefully shut down server on Ctrl+C and SIGTERM
682
- process.on('SIGINT', () => this.handleLine('/stop'));
683
- process.on('SIGTERM', () => this.handleLine('/stop'));
684
- }
685
- async handleLine(line) {
686
- if (line.startsWith('/')) {
687
- const [cmd, ...args] = line.slice(1).split(' ');
688
- const c = COMMANDS.find(c => c.aliases.includes(cmd));
689
- if (!c) {
690
- err(`unrecognized command /${cmd.underline}. Type /help for more info`
691
- .red);
692
- }
693
- else {
694
- try {
695
- const res = c.fn.bind(this)(...args);
696
- if (res instanceof Promise)
697
- await res;
698
- }
699
- catch (e) {
700
- err('unhandled terminal error', e);
701
- }
702
- }
643
+ constructor(omegga, options = {}) {
644
+ this.options = options;
645
+ this.omegga = omegga;
646
+ this.rl = readline.createInterface({
647
+ input: process.stdin,
648
+ output: process.stdout,
649
+ terminal: true
650
+ });
651
+ this.rl.setPrompt("> ".brightGreen);
652
+ log = (...args) => this.log(">>".green, ...args);
653
+ err = (...args) => this.error("!>".red, ...args);
654
+ info = (...args) => this.log("?>".blue, ...args);
655
+ warn = (...args) => this.warn("W>".yellow, ...args);
656
+ let launcherDone = false;
657
+ let lastDoneMessage = "";
658
+ omegga.on("line", (l) => {
659
+ if (options.debug) this.log("::".blue, l);
660
+ else if (!launcherDone) {
661
+ if (l.match(/Update Failed/)) {
662
+ err(l);
663
+ info(
664
+ "This might be resolved by deleting brickadia and reinstalling:"
665
+ );
666
+ info(" rm -rf ~/.local/share/brickadia-launcher".grey);
703
667
  }
704
- else if (line.trim().length > 0) {
705
- if (this.omegga.started) {
706
- // broadcast when the chat does not start with a command
707
- this.omegga.broadcast(`"[<b><color=\\"ff00ff\\">SERVER</></>]: ${(0, chat_1.sanitize)(line)}"`);
708
- process.stdout.clearLine(0);
709
- this.log(`[${'SERVER'.brightMagenta.underline}]: ${line}`);
710
- // if omegga is running a webserver - send this message in the chat log
711
- if (this.omegga.webserver) {
712
- const user = { name: 'SERVER', id: '', web: true, color: 'ff00ff' };
713
- // create database entry, send to web ui
714
- this.omegga.webserver.io
715
- .to('chat')
716
- .emit('chat', await this.omegga.webserver.database.addChatLog('msg', user, line));
717
- }
718
- }
719
- else {
720
- err('Server is not started yet. type'.red, '/help'.yellow, 'for more info'.red);
721
- }
668
+ if (l.startsWith("DOWNLOADING")) {
669
+ process.stdout.clearLine(0);
670
+ process.stdout.cursorTo(0);
671
+ process.stdout.write(l);
672
+ if (l.match(/Done!/) && l !== lastDoneMessage) {
673
+ lastDoneMessage = l;
674
+ process.stdout.write("\n");
675
+ }
676
+ } else if (l.match(/Disabling core dumps./)) {
677
+ launcherDone = true;
722
678
  }
723
- }
724
- // let readline render a log without interrupting user input
725
- log(...args) {
726
- process.stdout.clearLine(0);
727
- process.stdout.cursorTo(0);
728
- console.log(...args);
729
- this.rl.prompt(true);
730
- }
731
- // let readline render a debug log without interrupting user input
732
- debug(...args) {
733
- process.stdout.clearLine(0);
734
- process.stdout.cursorTo(0);
735
- console.debug(...args);
736
- this.rl.prompt(true);
737
- }
738
- // let readline render a warning log without interrupting user input
739
- warn(...args) {
740
- process.stdout.clearLine(0);
741
- process.stdout.cursorTo(0);
742
- console.warn(...args);
743
- this.rl.prompt(true);
744
- }
745
- // let readline render an error log without interrupting user input
746
- error(...args) {
679
+ }
680
+ if (l.match(
681
+ /^\[[^\]]+\]\[[^\]]+\]LogBRWorldManager: World successfully loaded\.$/
682
+ )) {
683
+ info("World successfully loaded.");
684
+ }
685
+ });
686
+ omegga.on("debug", (l) => this.log("?>".magenta, l));
687
+ omegga.on(
688
+ "join",
689
+ (p) => this.log(
690
+ `${p.displayName.underline} (${p.name.underline}) joined.`.brightBlue
691
+ )
692
+ );
693
+ omegga.on(
694
+ "leave",
695
+ (p) => this.log(
696
+ `${p.displayName.underline} (${p.name.underline}) left.`.brightBlue
697
+ )
698
+ );
699
+ omegga.on("chat", (name, message) => {
700
+ const player = omegga.getPlayer(name);
701
+ this.log(
702
+ `${(player.displayName ?? player.name ?? name).brightYellow.underline}: ${message}`
703
+ );
704
+ });
705
+ omegga.on("start", () => {
706
+ const wsl$1 = wsl.checkWsl();
707
+ log(
708
+ `Server has started${wsl$1 === 1 ? " in single thread mode due to WSL1" : ""}. Type ${"/help".yellow} for more commands`
709
+ );
710
+ if (!this.omegga.getNextWorld()) {
711
+ info(
712
+ "No",
713
+ "default world".yellow,
714
+ "is configured. Run",
715
+ "/worlds use <world>".yellow,
716
+ "to load one on startup."
717
+ );
718
+ }
719
+ if (wsl$1 === 2 && this.omegga.pluginLoader && !this.omegga.pluginLoader.plugins.some((p) => p.getName() === "wsl2binds")) {
720
+ warn(
721
+ "####".yellow,
722
+ `You are running ${"WSL2".yellow} and you don't have the ${"wsl2binds".yellow} plugin.`
723
+ );
724
+ warn(
725
+ "####".yellow,
726
+ `The wsl2binds plugin works as a ${"UDP proxy".underline} between Windows and the WSL2 VM.`
727
+ );
728
+ warn("####".yellow, "Install it by:");
729
+ warn("####".yellow, " 1. Closing omegga with", "/stop".green);
730
+ warn(
731
+ "####".yellow,
732
+ " 2. Installing wsl2binds with",
733
+ "omegga install gh:Meshiest/wsl2binds".green
734
+ );
735
+ warn("####".yellow, " 3. Restarting", "omegga".green);
736
+ }
737
+ });
738
+ omegga.on(
739
+ "mapchange",
740
+ ({ map }) => log("Map changed to", (map.charAt(0).toUpperCase() + map.slice(1)).green)
741
+ );
742
+ omegga.on("unauthorized", () => {
743
+ err("Server failed authentication check");
744
+ info("You can clear auth tokens with", "omegga auth -gl".green);
745
+ info(
746
+ "This will require you to paste a new hosting token or sign-in again"
747
+ );
748
+ process.exit();
749
+ });
750
+ omegga.on("error", (e) => err("Server caught unhandled exception:\n" + e));
751
+ omegga.on(
752
+ "server:stopped",
753
+ () => log("Server has closed. Type", "/stop".yellow, "to close omegga")
754
+ );
755
+ this.rl.on("line", this.handleLine.bind(this));
756
+ process.on("SIGINT", () => this.handleLine("/stop"));
757
+ process.on("SIGTERM", () => this.handleLine("/stop"));
758
+ }
759
+ async handleLine(line) {
760
+ if (line.startsWith("/")) {
761
+ const [cmd, ...args] = line.slice(1).split(" ");
762
+ const c = COMMANDS.find((c2) => c2.aliases.includes(cmd));
763
+ if (!c) {
764
+ err(
765
+ `unrecognized command /${cmd.underline}. Type /help for more info`.red
766
+ );
767
+ } else {
768
+ try {
769
+ const res = c.fn.bind(this)(...args);
770
+ if (res instanceof Promise) await res;
771
+ } catch (e) {
772
+ err("unhandled terminal error", e);
773
+ }
774
+ }
775
+ } else if (line.trim().length > 0) {
776
+ if (this.omegga.started) {
777
+ this.omegga.broadcast(
778
+ `"[<b><color=\\"ff00ff\\">SERVER</></>]: ${chat.sanitize(line)}"`
779
+ );
747
780
  process.stdout.clearLine(0);
748
- process.stdout.cursorTo(0);
749
- console.error(...args);
750
- this.rl.prompt(true);
781
+ this.log(`[${"SERVER".brightMagenta.underline}]: ${line}`);
782
+ if (this.omegga.webserver) {
783
+ const user = { name: "SERVER", id: "", web: true, color: "ff00ff" };
784
+ this.omegga.webserver.io.to("chat").emit(
785
+ "chat",
786
+ await this.omegga.webserver.database.addChatLog(
787
+ "msg",
788
+ user,
789
+ line
790
+ )
791
+ );
792
+ }
793
+ } else {
794
+ err(
795
+ "Server is not started yet. type".red,
796
+ "/help".yellow,
797
+ "for more info".red
798
+ );
799
+ }
751
800
  }
801
+ }
802
+ // let readline render a log without interrupting user input
803
+ log(...args) {
804
+ process.stdout.clearLine(0);
805
+ process.stdout.cursorTo(0);
806
+ console.log(...args);
807
+ this.rl.prompt(true);
808
+ }
809
+ // let readline render a debug log without interrupting user input
810
+ debug(...args) {
811
+ process.stdout.clearLine(0);
812
+ process.stdout.cursorTo(0);
813
+ console.debug(...args);
814
+ this.rl.prompt(true);
815
+ }
816
+ // let readline render a warning log without interrupting user input
817
+ warn(...args) {
818
+ process.stdout.clearLine(0);
819
+ process.stdout.cursorTo(0);
820
+ console.warn(...args);
821
+ this.rl.prompt(true);
822
+ }
823
+ // let readline render an error log without interrupting user input
824
+ error(...args) {
825
+ process.stdout.clearLine(0);
826
+ process.stdout.cursorTo(0);
827
+ console.error(...args);
828
+ this.rl.prompt(true);
829
+ }
752
830
  }
753
831
  exports.default = Terminal;
754
- //# sourceMappingURL=terminal.js.map
832
+ //# sourceMappingURL=terminal.js.map