omegga 1.2.9 → 1.4.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.
- package/README.md +50 -11
- package/dist/brickadia/config.js +26 -90
- package/dist/brickadia/config.js.map +1 -1
- package/dist/brickadia/server.js +290 -293
- package/dist/brickadia/server.js.map +1 -1
- package/dist/cli/auth.js +149 -177
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.js +64 -66
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.js +14 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installer.js +37 -43
- package/dist/cli/installer.js.map +1 -1
- package/dist/cli/plugin.js +651 -682
- package/dist/cli/plugin.js.map +1 -1
- package/dist/cli/terminal.js +811 -733
- package/dist/cli/terminal.js.map +1 -1
- package/dist/config/formats/format_js.js +6 -6
- package/dist/config/formats/format_js.js.map +1 -1
- package/dist/config/formats/format_yml.js +7 -10
- package/dist/config/formats/format_yml.js.map +1 -1
- package/dist/config/index.js +46 -68
- package/dist/config/index.js.map +1 -1
- package/dist/config/reader.js +16 -27
- package/dist/config/reader.js.map +1 -1
- package/dist/config/validator.js +23 -25
- package/dist/config/validator.js.map +1 -1
- package/dist/config/writer.js +11 -21
- package/dist/config/writer.js.map +1 -1
- package/dist/index.js +18 -64
- package/dist/index.js.map +1 -1
- package/dist/info/default_commands.json.js +39 -0
- package/dist/info/default_commands.json.js.map +1 -0
- package/dist/logger.js +61 -60
- package/dist/logger.js.map +1 -1
- package/dist/main.js +425 -471
- package/dist/main.js.map +1 -1
- package/dist/omegga/auth.js +101 -148
- package/dist/omegga/auth.js.map +1 -1
- package/dist/omegga/commandInjector.js +261 -251
- package/dist/omegga/commandInjector.js.map +1 -1
- package/dist/omegga/index.js +14 -52
- package/dist/omegga/index.js.map +1 -1
- package/dist/omegga/logWrangler.js +224 -275
- package/dist/omegga/logWrangler.js.map +1 -1
- package/dist/omegga/matchers/auth.js +36 -50
- package/dist/omegga/matchers/auth.js.map +1 -1
- package/dist/omegga/matchers/chat.js +49 -71
- package/dist/omegga/matchers/chat.js.map +1 -1
- package/dist/omegga/matchers/command.js +25 -36
- package/dist/omegga/matchers/command.js.map +1 -1
- package/dist/omegga/matchers/exit.js +15 -18
- package/dist/omegga/matchers/exit.js.map +1 -1
- package/dist/omegga/matchers/index.js +26 -40
- package/dist/omegga/matchers/index.js.map +1 -1
- package/dist/omegga/matchers/init.js +20 -23
- package/dist/omegga/matchers/init.js.map +1 -1
- package/dist/omegga/matchers/interact.js +58 -64
- package/dist/omegga/matchers/interact.js.map +1 -1
- package/dist/omegga/matchers/join.js +74 -95
- package/dist/omegga/matchers/join.js.map +1 -1
- package/dist/omegga/matchers/leave.js +43 -56
- package/dist/omegga/matchers/leave.js.map +1 -1
- package/dist/omegga/matchers/mapChange.js +26 -35
- package/dist/omegga/matchers/mapChange.js.map +1 -1
- package/dist/omegga/matchers/minigameJoin.js +24 -31
- package/dist/omegga/matchers/minigameJoin.js.map +1 -1
- package/dist/omegga/matchers/version.js +42 -49
- package/dist/omegga/matchers/version.js.map +1 -1
- package/dist/omegga/player.js +562 -528
- package/dist/omegga/player.js.map +1 -1
- package/dist/omegga/plugin/interface.js +91 -98
- package/dist/omegga/plugin/interface.js.map +1 -1
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +578 -429
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +282 -294
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_safe.js +365 -393
- package/dist/omegga/plugin/plugin_node_safe.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_unsafe.js +119 -179
- package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -1
- package/dist/omegga/plugin.js +402 -347
- package/dist/omegga/plugin.js.map +1 -1
- package/dist/omegga/server.js +742 -774
- package/dist/omegga/server.js.map +1 -1
- package/dist/omegga/wrapper.js +64 -91
- package/dist/omegga/wrapper.js.map +1 -1
- package/dist/plugin.js +11 -31
- package/dist/plugin.js.map +1 -1
- package/dist/softconfig.js +139 -100
- package/dist/softconfig.js.map +1 -1
- package/dist/updater/steam.js +104 -114
- package/dist/updater/steam.js.map +1 -1
- package/dist/util/brdb.js +496 -528
- package/dist/util/brdb.js.map +1 -1
- package/dist/util/brick/checkBounds.js +11 -15
- package/dist/util/brick/checkBounds.js.map +1 -1
- package/dist/util/brick/constants.js +723 -174
- package/dist/util/brick/constants.js.map +1 -1
- package/dist/util/brick/displayName.js +204 -211
- package/dist/util/brick/displayName.js.map +1 -1
- package/dist/util/brick/getBounds.js +29 -41
- package/dist/util/brick/getBounds.js.map +1 -1
- package/dist/util/brick/getBrickSize.js +6 -7
- package/dist/util/brick/getBrickSize.js.map +1 -1
- package/dist/util/brick/getScaleAxis.js +24 -30
- package/dist/util/brick/getScaleAxis.js.map +1 -1
- package/dist/util/brick/index.js +8 -29
- package/dist/util/brick/index.js.map +1 -1
- package/dist/util/brick/rotate.js +29 -34
- package/dist/util/brick/rotate.js.map +1 -1
- package/dist/util/brick/setOwnership.js +13 -19
- package/dist/util/brick/setOwnership.js.map +1 -1
- package/dist/util/chat.js +53 -44
- package/dist/util/chat.js.map +1 -1
- package/dist/util/color.js +112 -124
- package/dist/util/color.js.map +1 -1
- package/dist/util/file.js +54 -98
- package/dist/util/file.js.map +1 -1
- package/dist/util/index.js +84 -106
- package/dist/util/index.js.map +1 -1
- package/dist/util/map.js +18 -20
- package/dist/util/map.js.map +1 -1
- package/dist/util/pattern.js +6 -9
- package/dist/util/pattern.js.map +1 -1
- package/dist/util/time.js +31 -34
- package/dist/util/time.js.map +1 -1
- package/dist/util/uuid.js +10 -8
- package/dist/util/uuid.js.map +1 -1
- package/dist/util/wsl.js +19 -25
- package/dist/util/wsl.js.map +1 -1
- package/dist/version.js +7 -9
- package/dist/version.js.map +1 -1
- package/dist/webserver/backend/api.js +784 -874
- package/dist/webserver/backend/api.js.map +1 -1
- package/dist/webserver/backend/calendar.js +14 -17
- package/dist/webserver/backend/calendar.js.map +1 -1
- package/dist/webserver/backend/database.js +563 -613
- package/dist/webserver/backend/database.js.map +1 -1
- package/dist/webserver/backend/index.js +153 -191
- package/dist/webserver/backend/index.js.map +1 -1
- package/dist/webserver/backend/metrics.js +219 -248
- package/dist/webserver/backend/metrics.js.map +1 -1
- package/dist/webserver/backend/util.js +47 -68
- package/dist/webserver/backend/util.js.map +1 -1
- package/dist/worker.js +322 -0
- package/dist/worker.js.map +1 -0
- package/package.json +16 -11
- package/public/app.html +18 -18
- package/public/assets/IconArrowRight-BuVxhqKX.js +2 -0
- package/public/assets/{IconArrowRight-CA5_cccJ.js.map → IconArrowRight-BuVxhqKX.js.map} +1 -1
- package/public/assets/IconCheck-DOe3u7iH.js +2 -0
- package/public/assets/{IconCheck-Dyq5qyY1.js.map → IconCheck-DOe3u7iH.js.map} +1 -1
- package/public/assets/IconLockOpen-Bs7Tsf6u.js +2 -0
- package/public/assets/{IconLockOpen-D95XLORK.js.map → IconLockOpen-Bs7Tsf6u.js.map} +1 -1
- package/public/assets/IconWorld-B6GK5qpx.js +2 -0
- package/public/assets/{IconWorld-DtARpBKX.js.map → IconWorld-B6GK5qpx.js.map} +1 -1
- package/public/assets/IconWorldPlus-DpfueG8_.js +2 -0
- package/public/assets/{IconWorldPlus-CGBAsLNj.js.map → IconWorldPlus-DpfueG8_.js.map} +1 -1
- package/public/assets/IconX-CvmO0bbE.js +2 -0
- package/public/assets/{IconX-SYtbnYKI.js.map → IconX-CvmO0bbE.js.map} +1 -1
- package/public/assets/app-nJIpyOiP.js +6 -0
- package/public/assets/{app-BtOlgo__.js.map → app-nJIpyOiP.js.map} +1 -1
- package/public/assets/{auth-CvxEWAMc.js → auth-6N37o421.js} +2 -2
- package/public/assets/{auth-CvxEWAMc.js.map → auth-6N37o421.js.map} +1 -1
- package/public/assets/client-BT1QYH0O.js +10 -0
- package/public/assets/{client-C5T7_OK9.js.map → client-BT1QYH0O.js.map} +1 -1
- package/public/assets/index-2cgXLhrt.js +2 -0
- package/public/assets/{index-CRRRLlCc.js.map → index-2cgXLhrt.js.map} +1 -1
- package/public/assets/index-3dNmNZ9B.js +10 -0
- package/public/assets/{index-Bq9C9SqB.js.map → index-3dNmNZ9B.js.map} +1 -1
- package/public/assets/{index-i4mjW0og.js → index-CrN8I5Az.js} +2 -2
- package/public/assets/index-CrN8I5Az.js.map +1 -0
- package/public/assets/index-CtCtK5BX.js +2 -0
- package/public/assets/{index-DqHVrEeL.js.map → index-CtCtK5BX.js.map} +1 -1
- package/public/assets/index-D0OPOe3j.js +2 -0
- package/public/assets/{index-c0qeY2gs.js.map → index-D0OPOe3j.js.map} +1 -1
- package/public/assets/{index-DYcAgWjJ.js → index-DY750sgZ.js} +2 -2
- package/public/assets/{index-DYcAgWjJ.js.map → index-DY750sgZ.js.map} +1 -1
- package/public/assets/jsx-runtime-BX5r4UiA.js +2 -0
- package/public/assets/jsx-runtime-BX5r4UiA.js.map +1 -0
- package/public/assets/jsx-runtime-DldvXD6N.js +2 -0
- package/public/assets/{jsx-runtime-Bw5QeaCk.js.map → jsx-runtime-DldvXD6N.js.map} +1 -1
- package/public/assets/shared/@components-DdtLZOaA.js +2 -0
- package/public/assets/shared/@components-DdtLZOaA.js.map +1 -0
- package/public/assets/shared/{@hooks-DfTzYBIL.js → @hooks-Ch_hJYh0.js} +2 -2
- package/public/assets/shared/{@hooks-DfTzYBIL.js.map → @hooks-Ch_hJYh0.js.map} +1 -1
- package/public/assets/shared/{@nanostores_react-HTG3s0lp.js → @nanostores_react-DJPF1Eqx.js} +2 -2
- package/public/assets/shared/{@nanostores_react-HTG3s0lp.js.map → @nanostores_react-DJPF1Eqx.js.map} +1 -1
- package/public/assets/shared/@tabler_icons-react-B4bN8gHc.js +3 -0
- package/public/assets/shared/{@tabler_icons-react--FJWdUou.js.map → @tabler_icons-react-B4bN8gHc.js.map} +1 -1
- package/public/assets/shared/nanostores-BFqqIY_c.js.map +1 -1
- package/public/assets/shared/react-dom-8Rcmh_FG.js +2 -0
- package/public/assets/shared/{react-dom-BznoGTRX.js.map → react-dom-8Rcmh_FG.js.map} +1 -1
- package/public/assets/shared/react-iXLZ_Bod.js +2 -0
- package/public/assets/shared/{react-CR6vSpIu.js.map → react-iXLZ_Bod.js.map} +1 -1
- package/public/assets/shared/react_jsx-runtime-BwhiLcBy.js +2 -0
- package/public/assets/shared/{react_jsx-runtime-C15Zu6_p.js.map → react_jsx-runtime-BwhiLcBy.js.map} +1 -1
- package/public/assets/shared/{wouter-DbmGxXTo.js → wouter-CUC1caxu.js} +2 -2
- package/public/assets/shared/wouter-CUC1caxu.js.map +1 -0
- package/public/auth.html +14 -14
- package/templates/safe-ts/omegga.d.ts +31 -1
- package/dist/brickadia/config.d.ts +0 -3
- package/dist/brickadia/presets.d.ts +0 -65
- package/dist/brickadia/presets.js +0 -3
- package/dist/brickadia/presets.js.map +0 -1
- package/dist/brickadia/server.d.ts +0 -36
- package/dist/brickadia/types.d.ts +0 -45
- package/dist/brickadia/types.js +0 -3
- package/dist/brickadia/types.js.map +0 -1
- package/dist/cli/auth.d.ts +0 -26
- package/dist/cli/config.d.ts +0 -10
- package/dist/cli/index.d.ts +0 -30
- package/dist/cli/installer.d.ts +0 -1
- package/dist/cli/plugin.d.ts +0 -22
- package/dist/cli/terminal.d.ts +0 -25
- package/dist/config/authorizer.d.ts +0 -2
- package/dist/config/authorizer.js +0 -38
- package/dist/config/authorizer.js.map +0 -1
- package/dist/config/formats/format_js.d.ts +0 -3
- package/dist/config/formats/format_yml.d.ts +0 -3
- package/dist/config/index.d.ts +0 -18
- package/dist/config/reader.d.ts +0 -3
- package/dist/config/types.d.ts +0 -50
- package/dist/config/types.js +0 -3
- package/dist/config/types.js.map +0 -1
- package/dist/config/validator.d.ts +0 -6
- package/dist/config/writer.d.ts +0 -3
- package/dist/index.d.ts +0 -22
- package/dist/info/default_commands.json +0 -29
- package/dist/logger.d.ts +0 -41
- package/dist/main.d.ts +0 -1
- package/dist/omegga/auth.d.ts +0 -9
- package/dist/omegga/commandInjector.d.ts +0 -35
- package/dist/omegga/index.d.ts +0 -7
- package/dist/omegga/logWrangler.d.ts +0 -32
- package/dist/omegga/matchers/auth.d.ts +0 -10
- package/dist/omegga/matchers/chat.d.ts +0 -10
- package/dist/omegga/matchers/command.d.ts +0 -7
- package/dist/omegga/matchers/exit.d.ts +0 -3
- package/dist/omegga/matchers/index.d.ts +0 -3
- package/dist/omegga/matchers/init.d.ts +0 -3
- package/dist/omegga/matchers/interact.d.ts +0 -4
- package/dist/omegga/matchers/join.d.ts +0 -4
- package/dist/omegga/matchers/leave.d.ts +0 -4
- package/dist/omegga/matchers/mapChange.d.ts +0 -3
- package/dist/omegga/matchers/minigameJoin.d.ts +0 -9
- package/dist/omegga/matchers/types.d.ts +0 -5
- package/dist/omegga/matchers/types.js +0 -3
- package/dist/omegga/matchers/types.js.map +0 -1
- package/dist/omegga/matchers/version.d.ts +0 -3
- package/dist/omegga/player.d.ts +0 -81
- package/dist/omegga/plugin/interface.d.ts +0 -30
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +0 -23
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +0 -145
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +0 -1
- package/dist/omegga/plugin/plugin_node_safe/worker.js +0 -367
- package/dist/omegga/plugin/plugin_node_safe/worker.js.map +0 -1
- package/dist/omegga/plugin/plugin_node_safe.d.ts +0 -23
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts +0 -13
- package/dist/omegga/plugin.d.ts +0 -63
- package/dist/omegga/server.d.ts +0 -166
- package/dist/omegga/types.d.ts +0 -49
- package/dist/omegga/types.js +0 -3
- package/dist/omegga/types.js.map +0 -1
- package/dist/omegga/wrapper.d.ts +0 -32
- package/dist/plugin.d.ts +0 -916
- package/dist/softconfig.d.ts +0 -67
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/updater/index.d.ts +0 -1
- package/dist/updater/index.js +0 -10
- package/dist/updater/index.js.map +0 -1
- package/dist/updater/steam.d.ts +0 -52
- package/dist/util/brdb.d.ts +0 -31
- package/dist/util/brick/checkBounds.d.ts +0 -8
- package/dist/util/brick/constants.d.ts +0 -18
- package/dist/util/brick/displayName.d.ts +0 -7
- package/dist/util/brick/getBounds.d.ts +0 -5
- package/dist/util/brick/getBrickSize.d.ts +0 -3
- package/dist/util/brick/getScaleAxis.d.ts +0 -3
- package/dist/util/brick/index.d.ts +0 -14
- package/dist/util/brick/rotate.d.ts +0 -16
- package/dist/util/brick/setOwnership.d.ts +0 -12
- package/dist/util/chat.d.ts +0 -23
- package/dist/util/color.d.ts +0 -13
- package/dist/util/file.d.ts +0 -5
- package/dist/util/index.d.ts +0 -183
- package/dist/util/map.d.ts +0 -6
- package/dist/util/pattern.d.ts +0 -1
- package/dist/util/time.d.ts +0 -39
- package/dist/util/uuid.d.ts +0 -3
- package/dist/util/wsl.d.ts +0 -2
- package/dist/version.d.ts +0 -2
- package/dist/webserver/backend/api.d.ts +0 -115
- package/dist/webserver/backend/calendar.d.ts +0 -5
- package/dist/webserver/backend/database.d.ts +0 -150
- package/dist/webserver/backend/index.d.ts +0 -30
- package/dist/webserver/backend/metrics.d.ts +0 -3
- package/dist/webserver/backend/types.d.ts +0 -114
- package/dist/webserver/backend/types.js +0 -3
- package/dist/webserver/backend/types.js.map +0 -1
- package/dist/webserver/backend/util.d.ts +0 -2
- package/dist/webserver/index.d.ts +0 -2
- package/dist/webserver/index.js +0 -9
- package/dist/webserver/index.js.map +0 -1
- package/public/assets/IconArrowRight-CA5_cccJ.js +0 -7
- package/public/assets/IconCheck-Dyq5qyY1.js +0 -17
- package/public/assets/IconLockOpen-D95XLORK.js +0 -7
- package/public/assets/IconWorld-DtARpBKX.js +0 -72
- package/public/assets/IconWorldPlus-CGBAsLNj.js +0 -182
- package/public/assets/IconX-SYtbnYKI.js +0 -12
- package/public/assets/app-BtOlgo__.js +0 -6
- package/public/assets/client-C5T7_OK9.js +0 -26
- package/public/assets/index-Bq9C9SqB.js +0 -10
- package/public/assets/index-CRRRLlCc.js +0 -10
- package/public/assets/index-DqHVrEeL.js +0 -10
- package/public/assets/index-c0qeY2gs.js +0 -10
- package/public/assets/index-i4mjW0og.js.map +0 -1
- package/public/assets/jsx-runtime-Bw5QeaCk.js +0 -10
- package/public/assets/jsx-runtime-DoEZbXM1.js +0 -2
- package/public/assets/jsx-runtime-DoEZbXM1.js.map +0 -1
- package/public/assets/shared/@components-DVehBp7v.js +0 -2
- package/public/assets/shared/@components-DVehBp7v.js.map +0 -1
- package/public/assets/shared/@tabler_icons-react--FJWdUou.js +0 -29458
- package/public/assets/shared/react-CR6vSpIu.js +0 -2
- package/public/assets/shared/react-dom-BznoGTRX.js +0 -2
- package/public/assets/shared/react_jsx-runtime-C15Zu6_p.js +0 -2
- package/public/assets/shared/wouter-DbmGxXTo.js.map +0 -1
package/dist/omegga/player.js
CHANGED
|
@@ -1,543 +1,577 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _Player_omegga;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const util_1 = require("../util/");
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const index = require("../util/index.js");
|
|
16
4
|
const DEFAULT_PERMS = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
5
|
+
moderator: [
|
|
6
|
+
"Bricks.ClearAll",
|
|
7
|
+
"Minigame.AlwaysLeave",
|
|
8
|
+
"Players.Kick",
|
|
9
|
+
"Players.TPInMinigame",
|
|
10
|
+
"Players.TPOthers",
|
|
11
|
+
"Self.Ghost"
|
|
12
|
+
],
|
|
13
|
+
admin: [
|
|
14
|
+
"Bricks.ClearAll",
|
|
15
|
+
"Bricks.ClearOwn",
|
|
16
|
+
"Bricks.IgnoreTrust",
|
|
17
|
+
"Bricks.Load",
|
|
18
|
+
"Map.Environment",
|
|
19
|
+
"Minigame.AlwaysEdit",
|
|
20
|
+
"Minigame.AlwaysLeave",
|
|
21
|
+
"Minigame.AlwaysSwitchTeam",
|
|
22
|
+
"Minigame.MakeDefault",
|
|
23
|
+
"Minigame.MakePersistent",
|
|
24
|
+
"Minigame.UseAllBricks",
|
|
25
|
+
"Players.Ban",
|
|
26
|
+
"Players.Kick",
|
|
27
|
+
"Players.TPInMinigame",
|
|
28
|
+
"Players.TPOthers",
|
|
29
|
+
"Roles.Grant",
|
|
30
|
+
"Self.Ghost",
|
|
31
|
+
"Server.ChangeRoles",
|
|
32
|
+
"Server.ChangeSettings",
|
|
33
|
+
"Server.FreezeCamera",
|
|
34
|
+
"Tools.Selector.BypassLimits",
|
|
35
|
+
"Tools.Selector.BypassTimeouts"
|
|
36
|
+
]
|
|
49
37
|
};
|
|
50
38
|
class Player {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
#omegga;
|
|
40
|
+
static getRoles(omegga, id) {
|
|
41
|
+
const data = omegga.getRoleAssignments().savedPlayerRoles[id];
|
|
42
|
+
return Object.freeze(data && data.roles ? data.roles : []);
|
|
43
|
+
}
|
|
44
|
+
static getPermissions(omegga, id) {
|
|
45
|
+
const { roles, defaultRole } = omegga.getRoleSetup();
|
|
46
|
+
if (omegga.host.id === id) {
|
|
47
|
+
return Object.freeze(
|
|
48
|
+
Object.fromEntries(
|
|
49
|
+
[].concat(
|
|
50
|
+
defaultRole.permissions.map((p) => [p.name, true]),
|
|
51
|
+
...roles.map((r) => r.permissions.map((p) => [p.name, true]))
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const playerRoles = Player.getRoles(omegga, id).map((r) => r.toLowerCase());
|
|
57
|
+
const permissions = {
|
|
58
|
+
"Bricks.ClearAll": false,
|
|
59
|
+
"Bricks.ClearOwn": true,
|
|
60
|
+
"Bricks.Delete": true,
|
|
61
|
+
"Bricks.Edit": true,
|
|
62
|
+
"Bricks.IgnoreTrust": false,
|
|
63
|
+
"Bricks.Paint": true,
|
|
64
|
+
"Bricks.Place": true,
|
|
65
|
+
"BricksItems.Spawn": true,
|
|
66
|
+
"Map.Change": false,
|
|
67
|
+
"Map.Environment": false,
|
|
68
|
+
"Map.SetSpawn": false,
|
|
69
|
+
"Minigame.AlwaysEdit": false,
|
|
70
|
+
"Minigame.AlwaysLeave": false,
|
|
71
|
+
"Minigame.AlwaysSwitchTeam": false,
|
|
72
|
+
"Minigame.Create": true,
|
|
73
|
+
"Minigame.MakePersistent": false,
|
|
74
|
+
"Minigame.UseAllBricks": false,
|
|
75
|
+
"Players.Ban": false,
|
|
76
|
+
"Players.TPInMinigame": false,
|
|
77
|
+
"Players.TPOthers": false,
|
|
78
|
+
"Players.TPSelf": true,
|
|
79
|
+
"Roles.Grant": false,
|
|
80
|
+
"Self.Flashlight": true,
|
|
81
|
+
"Self.Fly": true,
|
|
82
|
+
"Self.FreezeCamera": false,
|
|
83
|
+
"Self.Ghost": false,
|
|
84
|
+
"Self.Sprint": true,
|
|
85
|
+
"Self.Suicide": true,
|
|
86
|
+
"Tools.Selector.Use": true
|
|
87
|
+
};
|
|
88
|
+
for (const p of defaultRole.permissions) {
|
|
89
|
+
permissions[p.name] = p.state === "Unchanged" ? permissions[p.name] : p.state === "Allowed";
|
|
90
|
+
}
|
|
91
|
+
for (const role of roles) {
|
|
92
|
+
if (!playerRoles.includes(role.name.toLowerCase())) continue;
|
|
93
|
+
const defaultPerms = DEFAULT_PERMS[role.name.toLowerCase()] || [];
|
|
94
|
+
for (const perm of defaultPerms) {
|
|
95
|
+
if (!role.permissions.find((r) => r.name === perm))
|
|
96
|
+
permissions[perm] = true;
|
|
97
|
+
}
|
|
98
|
+
for (const p of role.permissions) {
|
|
99
|
+
permissions[p.name] = p.state !== "Forbidden" && (p.state === "Unchanged" ? permissions[p.name] : permissions[p.name] || p.state === "Allowed");
|
|
100
|
+
permissions[p.name] = permissions[p.name];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return Object.freeze(permissions);
|
|
104
|
+
}
|
|
105
|
+
static kill(omegga, target) {
|
|
106
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
107
|
+
if (target?.name) omegga.writeln(`Server.Players.Kill "${target?.name}"`);
|
|
108
|
+
}
|
|
109
|
+
static damage(omegga, target, amount) {
|
|
110
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
111
|
+
if (amount === 0) return;
|
|
112
|
+
if (target?.name)
|
|
113
|
+
omegga.writeln(`Server.Players.Damage "${target?.name}" ${amount}`);
|
|
114
|
+
}
|
|
115
|
+
static heal(omegga, target, amount) {
|
|
116
|
+
if (amount === 0) return;
|
|
117
|
+
Player.damage(omegga, target, -amount);
|
|
118
|
+
}
|
|
119
|
+
static giveItem(omegga, target, item) {
|
|
120
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
121
|
+
if (!item) return;
|
|
122
|
+
if (target?.name)
|
|
123
|
+
omegga.writeln(`Server.Players.GiveItem "${target?.name}" ${item}`);
|
|
124
|
+
}
|
|
125
|
+
static takeItem(omegga, target, item) {
|
|
126
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
127
|
+
if (!item) return;
|
|
128
|
+
if (target?.name)
|
|
129
|
+
omegga.writeln(`Server.Players.RemoveItem "${target?.name}" ${item}`);
|
|
130
|
+
}
|
|
131
|
+
static setTeam(omegga, target, teamIndex) {
|
|
132
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
133
|
+
if (target?.name)
|
|
134
|
+
omegga.writeln(`Server.Players.SetTeam "${target?.name}" ${teamIndex}`);
|
|
135
|
+
}
|
|
136
|
+
static setMinigame(omegga, target, index2) {
|
|
137
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
138
|
+
if (target?.name)
|
|
139
|
+
omegga.writeln(`Server.Players.SetMinigame "${target?.name}" ${index2}`);
|
|
140
|
+
}
|
|
141
|
+
static setScore(omegga, target, minigameIndex, score) {
|
|
142
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
143
|
+
if (target?.name)
|
|
144
|
+
omegga.writeln(
|
|
145
|
+
`Server.Players.SetLeaderboardValue "${target?.name}" ${minigameIndex} ${score}`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
static async getScore(omegga, target, minigameIndex) {
|
|
149
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
150
|
+
if (!target?.name) return 0;
|
|
151
|
+
const name = target?.name;
|
|
152
|
+
const id = target?.id;
|
|
153
|
+
const match = await omegga.addWatcher(
|
|
154
|
+
(line, match2) => {
|
|
155
|
+
if (match2?.groups.generator !== "LogConsoleCommands") return;
|
|
156
|
+
const test = match2.groups.data.match(
|
|
157
|
+
/^(?<uuid>.+) leaderboard value (?<minigame>\d+) = (?<score>-?\d+)$/
|
|
158
|
+
);
|
|
159
|
+
if (!test) return;
|
|
160
|
+
if (test.groups.uuid !== id) return;
|
|
161
|
+
if (Number(test.groups.minigame) !== minigameIndex) return;
|
|
162
|
+
return test;
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
timeoutDelay: 1e3,
|
|
166
|
+
exec: () => omegga.writeln(
|
|
167
|
+
`Server.Players.PrintLeaderboardValue "${name}" ${minigameIndex}`
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
if (match) return Number(match[0].groups.score);
|
|
172
|
+
}
|
|
173
|
+
static setLeaderboard(omegga, target, key, value) {
|
|
174
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
175
|
+
if (!target?.name) return null;
|
|
176
|
+
omegga.writeln(
|
|
177
|
+
`Server.Players.SetLeaderboardValue "${target.name}" "${key}" "${value}"`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
static async getLeaderboard(omegga, target, key) {
|
|
181
|
+
if (typeof target === "string") target = omegga.getPlayer(target);
|
|
182
|
+
if (!target?.name) return null;
|
|
183
|
+
const match = await omegga.addWatcher(
|
|
184
|
+
(line, match2) => {
|
|
185
|
+
if (match2?.groups.generator !== "LogConsoleCommands") return;
|
|
186
|
+
const test = match2.groups.data.match(
|
|
187
|
+
/^(?<uuid>.+) leaderboard value (?<key>.+) = (?<value>-?\d+)$/
|
|
188
|
+
);
|
|
189
|
+
if (!test) return;
|
|
190
|
+
if (test.groups.uuid !== target.id) return;
|
|
191
|
+
if (test.groups.key !== key) return;
|
|
192
|
+
return test;
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
timeoutDelay: 1e3,
|
|
196
|
+
exec: () => omegga.writeln(
|
|
197
|
+
`Server.Players.PrintLeaderboardValue "${target.name}" "${key}"`
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
).catch(() => null);
|
|
201
|
+
if (match) return Number(match[0].groups.value);
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* players are not to be constructed
|
|
206
|
+
* @constructor
|
|
207
|
+
* @param omegga Omegga Instance
|
|
208
|
+
* @param name Player Name
|
|
209
|
+
* @param displayName Player Display Name
|
|
210
|
+
* @param id Player Id
|
|
211
|
+
* @param controller Player Controller
|
|
212
|
+
* @param state Player State
|
|
213
|
+
*/
|
|
214
|
+
constructor(omegga, username, displayName, id, controller, state) {
|
|
215
|
+
this.#omegga = omegga;
|
|
216
|
+
this.name = username;
|
|
217
|
+
this.displayName = displayName;
|
|
218
|
+
this.id = id;
|
|
219
|
+
this.controller = controller;
|
|
220
|
+
this.state = state;
|
|
221
|
+
}
|
|
222
|
+
getOmegga() {
|
|
223
|
+
return this.#omegga;
|
|
224
|
+
}
|
|
225
|
+
clone() {
|
|
226
|
+
return new Player(
|
|
227
|
+
this.#omegga,
|
|
228
|
+
this.name,
|
|
229
|
+
this.displayName,
|
|
230
|
+
this.id,
|
|
231
|
+
this.controller,
|
|
232
|
+
this.state
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
raw() {
|
|
236
|
+
return [this.name, this.displayName, this.id, this.controller, this.state];
|
|
237
|
+
}
|
|
238
|
+
isHost() {
|
|
239
|
+
return this.#omegga.host.id === this.id;
|
|
240
|
+
}
|
|
241
|
+
clearBricks(quiet = false) {
|
|
242
|
+
this.#omegga.clearBricks(this.id, quiet);
|
|
243
|
+
}
|
|
244
|
+
getRoles() {
|
|
245
|
+
return Player.getRoles(this.#omegga, this.id);
|
|
246
|
+
}
|
|
247
|
+
getPermissions() {
|
|
248
|
+
return Player.getPermissions(this.#omegga, this.id);
|
|
249
|
+
}
|
|
250
|
+
getNameColor() {
|
|
251
|
+
const { roles, defaultRole, ownerRoleColor, bOwnerRoleHasColor } = this.#omegga.getRoleSetup();
|
|
252
|
+
if (this.isHost() && bOwnerRoleHasColor)
|
|
253
|
+
return index.color.rgbToHex(ownerRoleColor);
|
|
254
|
+
const playerRoles = this.getRoles().map((r) => r.toLowerCase());
|
|
255
|
+
if (playerRoles.length > 0) {
|
|
256
|
+
const found = roles.slice().reverse().find(
|
|
257
|
+
(role) => role.bHasColor && playerRoles.includes(role.name.toLowerCase())
|
|
258
|
+
);
|
|
259
|
+
if (found) return index.color.rgbToHex(found.color);
|
|
260
|
+
}
|
|
261
|
+
return index.color.rgbToHex(
|
|
262
|
+
defaultRole.bHasColor ? defaultRole.color : { r: 255, g: 255, b: 255, a: 255 }
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
async getPawn() {
|
|
266
|
+
const pawnRegExp = new RegExp(
|
|
267
|
+
`^(?<index>\\d+)\\) BP_PlayerController_C .+?PersistentLevel\\.${this.controller}\\.Pawn = .*?(?:BP_FigureV2_C'.+:PersistentLevel\\.)?(?<pawn>BP_FigureV2_C_\\d+|None)'?`
|
|
268
|
+
);
|
|
269
|
+
const [{ groups: { pawn = null } = {} } = {}] = await this.#omegga.watchLogChunk(
|
|
270
|
+
"GetAll BP_PlayerController_C Pawn Name=" + this.controller,
|
|
271
|
+
pawnRegExp,
|
|
272
|
+
{ first: "index", timeoutDelay: 500 }
|
|
273
|
+
);
|
|
274
|
+
if (pawn === "None") return null;
|
|
275
|
+
return pawn;
|
|
276
|
+
}
|
|
277
|
+
async getPosition() {
|
|
278
|
+
const omegga = this.#omegga;
|
|
279
|
+
const pawnRegExp = new RegExp(
|
|
280
|
+
`^(?<index>\\d+)\\) BP_PlayerController_C .+?PersistentLevel\\.${this.controller}\\.Pawn = .*?(?:BP_FigureV2_C'.+:PersistentLevel\\.)?(?<pawn>BP_FigureV2_C_\\d+|None)'?`
|
|
281
|
+
);
|
|
282
|
+
const [
|
|
283
|
+
{
|
|
284
|
+
groups: { pawn }
|
|
285
|
+
}
|
|
286
|
+
] = await omegga.watchLogChunk(
|
|
287
|
+
"GetAll BP_PlayerController_C Pawn Name=" + this.controller,
|
|
288
|
+
pawnRegExp,
|
|
289
|
+
{ first: "index", timeoutDelay: 100 }
|
|
290
|
+
);
|
|
291
|
+
if (pawn === "None") return null;
|
|
292
|
+
const posRegExp = new RegExp(
|
|
293
|
+
`CapsuleComponent .+?PersistentLevel\\.${pawn}\\.CollisionCylinder\\.RelativeLocation = \\(X=(?<x>[\\d\\.-]+),Y=(?<y>[\\d\\.-]+),Z=(?<z>[\\d\\.-]+)\\)`
|
|
294
|
+
);
|
|
295
|
+
const [
|
|
296
|
+
{
|
|
297
|
+
groups: { x, y, z }
|
|
298
|
+
}
|
|
299
|
+
] = await omegga.addWatcher(posRegExp, {
|
|
300
|
+
// request the position for this player's pawn
|
|
301
|
+
exec: () => omegga.writeln(
|
|
302
|
+
`GetAll SceneComponent RelativeLocation Name=CollisionCylinder Outer=${pawn}`
|
|
303
|
+
),
|
|
304
|
+
timeoutDelay: 100
|
|
305
|
+
});
|
|
306
|
+
return [Number(x), Number(y), Number(z)];
|
|
307
|
+
}
|
|
308
|
+
async getGhostBrick() {
|
|
309
|
+
const { controller } = this;
|
|
310
|
+
const previewClass = "BP_ToolPreviewActor_C";
|
|
311
|
+
const ownerRegExp = new RegExp(
|
|
312
|
+
`^(?<index>\\d+)\\) ${previewClass} (.+):PersistentLevel\\.(?<actor>${previewClass}_\\d+).Owner = .*?BP_PlayerController_C'(.+):PersistentLevel\\.(?<controller>BP_PlayerController_C_\\d+)'$`
|
|
313
|
+
);
|
|
314
|
+
const transformParamsRegExp = new RegExp(
|
|
315
|
+
`^(?<index>\\d+)\\) ${previewClass} (.+):PersistentLevel\\.(?<actor>${previewClass}_\\d+)\\.TransformParameters = \\(TargetGrid=("(?<targetGrid>.+)"|None),Location=\\(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\\),Orientation=(?<orientation>.+)\\)$`
|
|
316
|
+
);
|
|
317
|
+
const [owners, transformParams] = await Promise.all([
|
|
318
|
+
this.#omegga.watchLogChunk(
|
|
319
|
+
`GetAll ${previewClass} Owner`,
|
|
320
|
+
ownerRegExp,
|
|
321
|
+
{
|
|
322
|
+
first: "index",
|
|
323
|
+
timeoutDelay: 2e3,
|
|
324
|
+
afterMatchDelay: 100
|
|
62
325
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
'Bricks.IgnoreTrust': false,
|
|
72
|
-
'Bricks.Paint': true,
|
|
73
|
-
'Bricks.Place': true,
|
|
74
|
-
'BricksItems.Spawn': true,
|
|
75
|
-
'Map.Change': false,
|
|
76
|
-
'Map.Environment': false,
|
|
77
|
-
'Map.SetSpawn': false,
|
|
78
|
-
'Minigame.AlwaysEdit': false,
|
|
79
|
-
'Minigame.AlwaysLeave': false,
|
|
80
|
-
'Minigame.AlwaysSwitchTeam': false,
|
|
81
|
-
'Minigame.Create': true,
|
|
82
|
-
'Minigame.MakePersistent': false,
|
|
83
|
-
'Minigame.UseAllBricks': false,
|
|
84
|
-
'Players.Ban': false,
|
|
85
|
-
'Players.TPInMinigame': false,
|
|
86
|
-
'Players.TPOthers': false,
|
|
87
|
-
'Players.TPSelf': true,
|
|
88
|
-
'Roles.Grant': false,
|
|
89
|
-
'Self.Flashlight': true,
|
|
90
|
-
'Self.Fly': true,
|
|
91
|
-
'Self.FreezeCamera': false,
|
|
92
|
-
'Self.Ghost': false,
|
|
93
|
-
'Self.Sprint': true,
|
|
94
|
-
'Self.Suicide': true,
|
|
95
|
-
'Tools.Selector.Use': true,
|
|
96
|
-
};
|
|
97
|
-
// apply all permissions from default role
|
|
98
|
-
for (const p of defaultRole.permissions) {
|
|
99
|
-
// technically this can never be Unchanged so it's always on enabled or allowed
|
|
100
|
-
permissions[p.name] =
|
|
101
|
-
p.state === 'Unchanged' ? permissions[p.name] : p.state === 'Allowed';
|
|
102
|
-
}
|
|
103
|
-
// loop through all the roles
|
|
104
|
-
for (const role of roles) {
|
|
105
|
-
// ignore ones the player does not have
|
|
106
|
-
if (!playerRoles.includes(role.name.toLowerCase()))
|
|
107
|
-
continue;
|
|
108
|
-
const defaultPerms = DEFAULT_PERMS[role.name.toLowerCase()] || [];
|
|
109
|
-
// iterate through default permissions
|
|
110
|
-
for (const perm of defaultPerms) {
|
|
111
|
-
// if they are not overriden, set it to true
|
|
112
|
-
if (!role.permissions.find(r => r.name === perm))
|
|
113
|
-
permissions[perm] = true;
|
|
114
|
-
}
|
|
115
|
-
// add all the new permissions the player now has
|
|
116
|
-
for (const p of role.permissions) {
|
|
117
|
-
// permission is disabled on forbidden, persisted on unchanged, and enabled on bEnabled or Allowed
|
|
118
|
-
permissions[p.name] =
|
|
119
|
-
p.state !== 'Forbidden' &&
|
|
120
|
-
(p.state === 'Unchanged'
|
|
121
|
-
? permissions[p.name]
|
|
122
|
-
: permissions[p.name] || p.state === 'Allowed');
|
|
123
|
-
permissions[p.name] = permissions[p.name];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return Object.freeze(permissions);
|
|
127
|
-
}
|
|
128
|
-
static kill(omegga, target) {
|
|
129
|
-
if (typeof target === 'string')
|
|
130
|
-
target = omegga.getPlayer(target);
|
|
131
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
132
|
-
omegga.writeln(`Server.Players.Kill "${target === null || target === void 0 ? void 0 : target.name}"`);
|
|
133
|
-
}
|
|
134
|
-
static damage(omegga, target, amount) {
|
|
135
|
-
if (typeof target === 'string')
|
|
136
|
-
target = omegga.getPlayer(target);
|
|
137
|
-
if (amount === 0)
|
|
138
|
-
return;
|
|
139
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
140
|
-
omegga.writeln(`Server.Players.Damage "${target === null || target === void 0 ? void 0 : target.name}" ${amount}`);
|
|
141
|
-
}
|
|
142
|
-
static heal(omegga, target, amount) {
|
|
143
|
-
if (amount === 0)
|
|
144
|
-
return;
|
|
145
|
-
Player.damage(omegga, target, -amount);
|
|
146
|
-
}
|
|
147
|
-
static giveItem(omegga, target, item) {
|
|
148
|
-
if (typeof target === 'string')
|
|
149
|
-
target = omegga.getPlayer(target);
|
|
150
|
-
if (!item)
|
|
151
|
-
return;
|
|
152
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
153
|
-
omegga.writeln(`Server.Players.GiveItem "${target === null || target === void 0 ? void 0 : target.name}" ${item}`);
|
|
154
|
-
}
|
|
155
|
-
static takeItem(omegga, target, item) {
|
|
156
|
-
if (typeof target === 'string')
|
|
157
|
-
target = omegga.getPlayer(target);
|
|
158
|
-
if (!item)
|
|
159
|
-
return;
|
|
160
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
161
|
-
omegga.writeln(`Server.Players.RemoveItem "${target === null || target === void 0 ? void 0 : target.name}" ${item}`);
|
|
162
|
-
}
|
|
163
|
-
static setTeam(omegga, target, teamIndex) {
|
|
164
|
-
if (typeof target === 'string')
|
|
165
|
-
target = omegga.getPlayer(target);
|
|
166
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
167
|
-
omegga.writeln(`Server.Players.SetTeam "${target === null || target === void 0 ? void 0 : target.name}" ${teamIndex}`);
|
|
168
|
-
}
|
|
169
|
-
static setMinigame(omegga, target, index) {
|
|
170
|
-
if (typeof target === 'string')
|
|
171
|
-
target = omegga.getPlayer(target);
|
|
172
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
173
|
-
omegga.writeln(`Server.Players.SetMinigame "${target === null || target === void 0 ? void 0 : target.name}" ${index}`);
|
|
174
|
-
}
|
|
175
|
-
static setScore(omegga, target, minigameIndex, score) {
|
|
176
|
-
if (typeof target === 'string')
|
|
177
|
-
target = omegga.getPlayer(target);
|
|
178
|
-
if (target === null || target === void 0 ? void 0 : target.name)
|
|
179
|
-
omegga.writeln(`Server.Players.SetLeaderboardValue "${target === null || target === void 0 ? void 0 : target.name}" ${minigameIndex} ${score}`);
|
|
180
|
-
}
|
|
181
|
-
static async getScore(omegga, target, minigameIndex) {
|
|
182
|
-
if (typeof target === 'string')
|
|
183
|
-
target = omegga.getPlayer(target);
|
|
184
|
-
if (target === null || target === void 0 ? void 0 : target.name) {
|
|
185
|
-
const name = target === null || target === void 0 ? void 0 : target.name;
|
|
186
|
-
const id = target === null || target === void 0 ? void 0 : target.id;
|
|
187
|
-
const match = await omegga.addWatcher((line, match) => {
|
|
188
|
-
if (match && match.groups.generator === 'LogConsoleCommands') {
|
|
189
|
-
const test = match.groups.data.match(/^(?<uuid>.+) leaderboard value (?<minigame>\d+) = (?<score>-?\d+)$/);
|
|
190
|
-
if (!test)
|
|
191
|
-
return;
|
|
192
|
-
if (test.groups.uuid !== id)
|
|
193
|
-
return;
|
|
194
|
-
if (Number(test.groups.minigame) !== minigameIndex)
|
|
195
|
-
return;
|
|
196
|
-
return test;
|
|
197
|
-
}
|
|
198
|
-
}, {
|
|
199
|
-
timeoutDelay: 1000,
|
|
200
|
-
exec: () => omegga.writeln(`Server.Players.PrintLeaderboardValue "${name}" ${minigameIndex}`),
|
|
201
|
-
});
|
|
202
|
-
if (match)
|
|
203
|
-
return Number(match[0].groups.score);
|
|
204
|
-
}
|
|
205
|
-
return 0;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* players are not to be constructed
|
|
209
|
-
* @constructor
|
|
210
|
-
* @param omegga Omegga Instance
|
|
211
|
-
* @param name Player Name
|
|
212
|
-
* @param displayName Player Display Name
|
|
213
|
-
* @param id Player Id
|
|
214
|
-
* @param controller Player Controller
|
|
215
|
-
* @param state Player State
|
|
216
|
-
*/
|
|
217
|
-
constructor(omegga, username, displayName, id, controller, state) {
|
|
218
|
-
_Player_omegga.set(this, void 0);
|
|
219
|
-
__classPrivateFieldSet(this, _Player_omegga, omegga, "f");
|
|
220
|
-
this.name = username;
|
|
221
|
-
this.displayName = displayName;
|
|
222
|
-
this.id = id;
|
|
223
|
-
this.controller = controller;
|
|
224
|
-
this.state = state;
|
|
225
|
-
}
|
|
226
|
-
getOmegga() {
|
|
227
|
-
return __classPrivateFieldGet(this, _Player_omegga, "f");
|
|
228
|
-
}
|
|
229
|
-
clone() {
|
|
230
|
-
return new Player(__classPrivateFieldGet(this, _Player_omegga, "f"), this.name, this.displayName, this.id, this.controller, this.state);
|
|
231
|
-
}
|
|
232
|
-
raw() {
|
|
233
|
-
return [this.name, this.displayName, this.id, this.controller, this.state];
|
|
234
|
-
}
|
|
235
|
-
isHost() {
|
|
236
|
-
return __classPrivateFieldGet(this, _Player_omegga, "f").host.id === this.id;
|
|
237
|
-
}
|
|
238
|
-
clearBricks(quiet = false) {
|
|
239
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").clearBricks(this.id, quiet);
|
|
240
|
-
}
|
|
241
|
-
getRoles() {
|
|
242
|
-
return Player.getRoles(__classPrivateFieldGet(this, _Player_omegga, "f"), this.id);
|
|
243
|
-
}
|
|
244
|
-
getPermissions() {
|
|
245
|
-
return Player.getPermissions(__classPrivateFieldGet(this, _Player_omegga, "f"), this.id);
|
|
246
|
-
}
|
|
247
|
-
getNameColor() {
|
|
248
|
-
const { roles, defaultRole, ownerRoleColor, bOwnerRoleHasColor } = __classPrivateFieldGet(this, _Player_omegga, "f").getRoleSetup();
|
|
249
|
-
// host check if host has host color
|
|
250
|
-
if (this.isHost() && bOwnerRoleHasColor)
|
|
251
|
-
return util_1.color.rgbToHex(ownerRoleColor);
|
|
252
|
-
// get the player's role
|
|
253
|
-
const playerRoles = this.getRoles().map(r => r.toLowerCase());
|
|
254
|
-
// only if the player actually has roles...
|
|
255
|
-
if (playerRoles.length > 0) {
|
|
256
|
-
// check the role list in reverse for the player's role (highest tier first)
|
|
257
|
-
const found = roles
|
|
258
|
-
.slice()
|
|
259
|
-
.reverse()
|
|
260
|
-
.find(role => role.bHasColor && playerRoles.includes(role.name.toLowerCase()));
|
|
261
|
-
if (found)
|
|
262
|
-
return util_1.color.rgbToHex(found.color);
|
|
326
|
+
),
|
|
327
|
+
this.#omegga.watchLogChunk(
|
|
328
|
+
`GetAll ${previewClass} TransformParameters`,
|
|
329
|
+
transformParamsRegExp,
|
|
330
|
+
{
|
|
331
|
+
first: "index",
|
|
332
|
+
timeoutDelay: 2e3,
|
|
333
|
+
afterMatchDelay: 100
|
|
263
334
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
timeoutDelay: 100,
|
|
294
|
-
});
|
|
295
|
-
// return the player's position as an array of numbers
|
|
296
|
-
return [Number(x), Number(y), Number(z)];
|
|
297
|
-
}
|
|
298
|
-
async getGhostBrick() {
|
|
299
|
-
const { controller } = this;
|
|
300
|
-
const previewClass = 'BP_ToolPreviewActor_C';
|
|
301
|
-
const ownerRegExp = new RegExp(`^(?<index>\\d+)\\) ${previewClass} (.+):PersistentLevel\\.(?<actor>${previewClass}_\\d+)\.Owner = .*?BP_PlayerController_C'(.+):PersistentLevel\\.(?<controller>BP_PlayerController_C_\\d+)'$`);
|
|
302
|
-
const transformParamsRegExp = new RegExp(`^(?<index>\\d+)\\) ${previewClass} (.+):PersistentLevel\\.(?<actor>${previewClass}_\\d+)\\.TransformParameters = \\(TargetGrid=("(?<targetGrid>.+)"|None),Location=\\(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\\),Orientation=(?<orientation>.+)\\)$`);
|
|
303
|
-
const [owners, transformParams] = await Promise.all([
|
|
304
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk(`GetAll ${previewClass} Owner`, ownerRegExp, {
|
|
305
|
-
first: 'index',
|
|
306
|
-
timeoutDelay: 2000,
|
|
307
|
-
afterMatchDelay: 100,
|
|
308
|
-
}),
|
|
309
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk(`GetAll ${previewClass} TransformParameters`, transformParamsRegExp, {
|
|
310
|
-
first: 'index',
|
|
311
|
-
timeoutDelay: 2000,
|
|
312
|
-
afterMatchDelay: 100,
|
|
313
|
-
}),
|
|
314
|
-
]);
|
|
315
|
-
// get BrickGridPreviewActor by controller
|
|
316
|
-
const owner = owners.find(owner => owner.groups.controller === controller);
|
|
317
|
-
if (!owner)
|
|
318
|
-
return;
|
|
319
|
-
const actor = owner.groups.actor;
|
|
320
|
-
// get transform parameters for the found actor
|
|
321
|
-
const transformParameters = transformParams.find(transformParameters => transformParameters.groups.actor === actor);
|
|
322
|
-
if (!transformParameters)
|
|
323
|
-
return;
|
|
335
|
+
)
|
|
336
|
+
]);
|
|
337
|
+
const owner = owners.find((owner2) => owner2.groups.controller === controller);
|
|
338
|
+
if (!owner) return;
|
|
339
|
+
const actor = owner.groups.actor;
|
|
340
|
+
const transformParameters = transformParams.find(
|
|
341
|
+
(transformParameters2) => transformParameters2.groups.actor === actor
|
|
342
|
+
);
|
|
343
|
+
if (!transformParameters) return;
|
|
344
|
+
return {
|
|
345
|
+
targetGrid: transformParameters.groups.targetGrid,
|
|
346
|
+
location: [
|
|
347
|
+
+transformParameters.groups.x,
|
|
348
|
+
+transformParameters.groups.y,
|
|
349
|
+
+transformParameters.groups.z
|
|
350
|
+
],
|
|
351
|
+
orientation: transformParameters.groups.orientation
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
async getPaint() {
|
|
355
|
+
const { controller } = this;
|
|
356
|
+
const match = await this.#omegga.addWatcher(
|
|
357
|
+
(line) => {
|
|
358
|
+
const match2 = line.match(
|
|
359
|
+
/^\[[^\]]+\]\[[^\]]+\]\d+\) BP_PlayerState_C .+?PersistentLevel\.(?<state>BP_PlayerState_C_\d+)\.ColorSelectionState = \(SelectedColor=\(B=(?<b>\d+),G=(?<g>\d+),R=(?<r>\d+),A=(?<a>\d+)\),MaterialIndex=(?<materialIndex>\d+),MaterialAlpha=(?<materialAlpha>\d+)\)$/
|
|
360
|
+
);
|
|
361
|
+
if (!match2) return;
|
|
362
|
+
if (match2.groups.state !== this.state) return;
|
|
363
|
+
const colorRaw = [+match2.groups.r, +match2.groups.g, +match2.groups.b];
|
|
324
364
|
return {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
+transformParameters.groups.z,
|
|
330
|
-
],
|
|
331
|
-
orientation: transformParameters.groups.orientation,
|
|
365
|
+
materialIndex: match2.groups.materialIndex,
|
|
366
|
+
materialAlpha: match2.groups.materialAlpha,
|
|
367
|
+
material: index.brick.BRICK_CONSTANTS.DEFAULT_MATERIALS[Number(match2.groups.materialIndex)],
|
|
368
|
+
color: colorRaw
|
|
332
369
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const { controller } = this;
|
|
382
|
-
const brickTemplateRegExp = /^(?<index>\d+)\) Tool_Selector_C (.+):PersistentLevel\.(?<tool>Tool_Selector_C_\d+)\.CurrentTemplate = (.+)Brickadia.BrickBuildingTemplate'(.+)Transient.(?<templateName>BrickBuildingTemplate_\d+)'$/;
|
|
383
|
-
const brickTemplateOwnerRegExp = /^(?<index>\d+)\) Tool_Selector_C (.+):PersistentLevel\.(?<tool>Tool_Selector_C_\d+)\.Owner = (.+)(?<controller>BP_PlayerController_C_\d+)'$/;
|
|
384
|
-
const minBoundsRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.MinBounds = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
385
|
-
const maxBoundsRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.MaxBounds = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
386
|
-
const centerRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.Center = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
387
|
-
const [templates, owners, minBounds, maxBounds, centers] = await Promise.all([
|
|
388
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk('GetAll Tool_Selector_C CurrentTemplate', brickTemplateRegExp, {
|
|
389
|
-
first: 'index',
|
|
390
|
-
timeoutDelay: 2000,
|
|
391
|
-
afterMatchDelay: 100,
|
|
392
|
-
}),
|
|
393
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk('GetAll Tool_Selector_C Owner', brickTemplateOwnerRegExp, {
|
|
394
|
-
first: 'index',
|
|
395
|
-
timeoutDelay: 2000,
|
|
396
|
-
afterMatchDelay: 100,
|
|
397
|
-
}),
|
|
398
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk('GetAll BrickBuildingTemplate MinBounds', minBoundsRegExp, {
|
|
399
|
-
first: 'index',
|
|
400
|
-
timeoutDelay: 2000,
|
|
401
|
-
afterMatchDelay: 100,
|
|
402
|
-
}),
|
|
403
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk('GetAll BrickBuildingTemplate MaxBounds', maxBoundsRegExp, {
|
|
404
|
-
first: 'index',
|
|
405
|
-
timeoutDelay: 2000,
|
|
406
|
-
afterMatchDelay: 100,
|
|
407
|
-
}),
|
|
408
|
-
__classPrivateFieldGet(this, _Player_omegga, "f").watchLogChunk('GetAll BrickBuildingTemplate Center', centerRegExp, {
|
|
409
|
-
first: 'index',
|
|
410
|
-
timeoutDelay: 2000,
|
|
411
|
-
afterMatchDelay: 100,
|
|
412
|
-
}),
|
|
413
|
-
]);
|
|
414
|
-
if (!templates.length ||
|
|
415
|
-
!owners.length ||
|
|
416
|
-
!minBounds.length ||
|
|
417
|
-
!maxBounds.length ||
|
|
418
|
-
!centers.length)
|
|
419
|
-
return;
|
|
420
|
-
// get selector for this controller, we need to handle if there are multiple selectors for the same controller
|
|
421
|
-
const selectors = owners
|
|
422
|
-
.filter(selectors => selectors.groups.controller === controller)
|
|
423
|
-
.map(selectors => selectors.groups.tool)
|
|
424
|
-
.sort();
|
|
425
|
-
const selector = selectors[0]; // grab the most recently created
|
|
426
|
-
if (!selector) {
|
|
427
|
-
return;
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
timeoutDelay: 1e3,
|
|
373
|
+
exec: () => this.#omegga.writeln("GetAll BRPlayerState ColorSelectionState")
|
|
374
|
+
}
|
|
375
|
+
).catch(() => null);
|
|
376
|
+
if (!match?.[0]) return;
|
|
377
|
+
return match[0];
|
|
378
|
+
}
|
|
379
|
+
async isCrouched(pawn) {
|
|
380
|
+
if (!pawn) pawn = await this.getPawn();
|
|
381
|
+
const reg = /(?<index>\d+)\) BP_FigureV2_C .+?PersistentLevel\.(?<pawn>BP_FigureV2_C_\d+)\.bIsCrouched = (?<crouched>True|False)$/;
|
|
382
|
+
const resp = await this.#omegga.watchLogChunk(
|
|
383
|
+
"GetAll BP_FigureV2_C bIsCrouched Name=" + pawn,
|
|
384
|
+
reg,
|
|
385
|
+
{ first: "index", timeoutDelay: 500 }
|
|
386
|
+
);
|
|
387
|
+
const me = resp.find((r) => r.groups.pawn === pawn);
|
|
388
|
+
if (!me) return false;
|
|
389
|
+
return me.groups.crouched == "True";
|
|
390
|
+
}
|
|
391
|
+
async isDead(pawn) {
|
|
392
|
+
if (!pawn) pawn = await this.getPawn();
|
|
393
|
+
const reg = /(?<index>\d+)\) BP_FigureV2_C .+?PersistentLevel\.(?<pawn>BP_FigureV2_C_\d+)\.bIsDead = (?<dead>True|False)$/;
|
|
394
|
+
const resp = await this.#omegga.watchLogChunk(
|
|
395
|
+
"GetAll BP_FigureV2_C bIsDead Name=" + pawn,
|
|
396
|
+
reg,
|
|
397
|
+
{ first: "index", timeoutDelay: 500 }
|
|
398
|
+
);
|
|
399
|
+
const me = resp.find((r) => r.groups.pawn === pawn);
|
|
400
|
+
if (!me) return true;
|
|
401
|
+
return me.groups.dead == "True";
|
|
402
|
+
}
|
|
403
|
+
async getTemplateBounds() {
|
|
404
|
+
const { controller } = this;
|
|
405
|
+
const brickTemplateRegExp = /^(?<index>\d+)\) Tool_Selector_C (.+):PersistentLevel\.(?<tool>Tool_Selector_C_\d+)\.CurrentTemplate = (.+)Brickadia.BrickBuildingTemplate'(.+)Transient.(?<templateName>BrickBuildingTemplate_\d+)'$/;
|
|
406
|
+
const brickTemplateOwnerRegExp = /^(?<index>\d+)\) Tool_Selector_C (.+):PersistentLevel\.(?<tool>Tool_Selector_C_\d+)\.Owner = (.+)(?<controller>BP_PlayerController_C_\d+)'$/;
|
|
407
|
+
const minBoundsRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.MinBounds = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
408
|
+
const maxBoundsRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.MaxBounds = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
409
|
+
const centerRegExp = /^(?<index>\d+)\) BrickBuildingTemplate (.+)Transient\.(?<templateName>BrickBuildingTemplate_\d+)\.Center = \(X=(?<x>.+),Y=(?<y>.+),Z=(?<z>.+)\)$/;
|
|
410
|
+
const [templates, owners, minBounds, maxBounds, centers] = await Promise.all([
|
|
411
|
+
this.#omegga.watchLogChunk(
|
|
412
|
+
"GetAll Tool_Selector_C CurrentTemplate",
|
|
413
|
+
brickTemplateRegExp,
|
|
414
|
+
{
|
|
415
|
+
first: "index",
|
|
416
|
+
timeoutDelay: 2e3,
|
|
417
|
+
afterMatchDelay: 100
|
|
428
418
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
419
|
+
),
|
|
420
|
+
this.#omegga.watchLogChunk(
|
|
421
|
+
"GetAll Tool_Selector_C Owner",
|
|
422
|
+
brickTemplateOwnerRegExp,
|
|
423
|
+
{
|
|
424
|
+
first: "index",
|
|
425
|
+
timeoutDelay: 2e3,
|
|
426
|
+
afterMatchDelay: 100
|
|
437
427
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
maxBound: [+maxBound.groups.x, +maxBound.groups.y, +maxBound.groups.z],
|
|
447
|
-
center: [+center.groups.x, +center.groups.y, +center.groups.z],
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
async getTemplateBoundsData() {
|
|
451
|
-
const templateBounds = await this.getTemplateBounds();
|
|
452
|
-
if (!templateBounds)
|
|
453
|
-
return;
|
|
454
|
-
const saveData = await __classPrivateFieldGet(this, _Player_omegga, "f").getSaveData({
|
|
455
|
-
center: templateBounds.center,
|
|
456
|
-
extent: [
|
|
457
|
-
Math.round((templateBounds.maxBound[0] - templateBounds.minBound[0]) / 2),
|
|
458
|
-
Math.round((templateBounds.maxBound[1] - templateBounds.minBound[1]) / 2),
|
|
459
|
-
Math.round((templateBounds.maxBound[2] - templateBounds.minBound[2]) / 2),
|
|
460
|
-
],
|
|
461
|
-
});
|
|
462
|
-
if (!saveData)
|
|
463
|
-
return;
|
|
464
|
-
// filter bricks outside the bounds
|
|
465
|
-
// no longer necessary thanks to Bricks.SaveRegion
|
|
466
|
-
/* saveData.bricks = (saveData.bricks as Brick[]).filter(brick => {
|
|
467
|
-
return brickUtils.checkBounds(
|
|
468
|
-
brick,
|
|
469
|
-
saveData.brick_assets,
|
|
470
|
-
templateBounds
|
|
471
|
-
);
|
|
472
|
-
}) as typeof saveData.bricks; */
|
|
473
|
-
if (saveData.bricks.length > 0) {
|
|
474
|
-
return saveData;
|
|
428
|
+
),
|
|
429
|
+
this.#omegga.watchLogChunk(
|
|
430
|
+
"GetAll BrickBuildingTemplate MinBounds",
|
|
431
|
+
minBoundsRegExp,
|
|
432
|
+
{
|
|
433
|
+
first: "index",
|
|
434
|
+
timeoutDelay: 2e3,
|
|
435
|
+
afterMatchDelay: 100
|
|
475
436
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
offY,
|
|
485
|
-
offZ,
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
async loadDataAtGhostBrick(saveData, { rotate = true, offX = 0, offY = 0, offZ = 0, quiet = true } = {}) {
|
|
489
|
-
const ghostBrickData = await this.getGhostBrick();
|
|
490
|
-
if (!ghostBrickData || !saveData)
|
|
491
|
-
return;
|
|
492
|
-
// get bounds of the bricks
|
|
493
|
-
const bounds = util_1.brick.getBounds(saveData);
|
|
494
|
-
if (rotate) {
|
|
495
|
-
const orientation = util_1.brick.BRICK_CONSTANTS.orientationMap[ghostBrickData.orientation];
|
|
496
|
-
saveData.bricks = saveData.bricks.map(brick => util_1.brick.rotate(brick, orientation));
|
|
497
|
-
// rotate bounds, if we dont use the original bounds they are off by 1 sometimes >:(
|
|
498
|
-
bounds.minBound = util_1.brick.BRICK_CONSTANTS.translationTable[util_1.brick.d2o(...orientation)](bounds.minBound);
|
|
499
|
-
bounds.maxBound = util_1.brick.BRICK_CONSTANTS.translationTable[util_1.brick.d2o(...orientation)](bounds.maxBound);
|
|
500
|
-
bounds.center = util_1.brick.BRICK_CONSTANTS.translationTable[util_1.brick.d2o(...orientation)](bounds.center);
|
|
437
|
+
),
|
|
438
|
+
this.#omegga.watchLogChunk(
|
|
439
|
+
"GetAll BrickBuildingTemplate MaxBounds",
|
|
440
|
+
maxBoundsRegExp,
|
|
441
|
+
{
|
|
442
|
+
first: "index",
|
|
443
|
+
timeoutDelay: 2e3,
|
|
444
|
+
afterMatchDelay: 100
|
|
501
445
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
446
|
+
),
|
|
447
|
+
this.#omegga.watchLogChunk(
|
|
448
|
+
"GetAll BrickBuildingTemplate Center",
|
|
449
|
+
centerRegExp,
|
|
450
|
+
{
|
|
451
|
+
first: "index",
|
|
452
|
+
timeoutDelay: 2e3,
|
|
453
|
+
afterMatchDelay: 100
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
]);
|
|
457
|
+
if (!templates.length || !owners.length || !minBounds.length || !maxBounds.length || !centers.length)
|
|
458
|
+
return;
|
|
459
|
+
const selectors = owners.filter((selectors2) => selectors2.groups.controller === controller).map((selectors2) => selectors2.groups.tool).sort();
|
|
460
|
+
const selector = selectors[0];
|
|
461
|
+
if (!selector) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const brickTemplates = templates.filter((template) => template.groups.tool === selector).map((template) => template.groups.templateName).sort();
|
|
465
|
+
const templateName = brickTemplates[0];
|
|
466
|
+
if (!templateName) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const minBound = minBounds.find(
|
|
470
|
+
(minBound2) => minBound2.groups.templateName === templateName
|
|
471
|
+
);
|
|
472
|
+
const maxBound = maxBounds.find(
|
|
473
|
+
(maxBound2) => maxBound2.groups.templateName === templateName
|
|
474
|
+
);
|
|
475
|
+
const center = centers.find(
|
|
476
|
+
(center2) => center2.groups.templateName === templateName
|
|
477
|
+
);
|
|
478
|
+
if (!minBound || !maxBound || !center) return;
|
|
479
|
+
return {
|
|
480
|
+
minBound: [+minBound.groups.x, +minBound.groups.y, +minBound.groups.z],
|
|
481
|
+
maxBound: [+maxBound.groups.x, +maxBound.groups.y, +maxBound.groups.z],
|
|
482
|
+
center: [+center.groups.x, +center.groups.y, +center.groups.z]
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
async getTemplateBoundsData() {
|
|
486
|
+
const templateBounds = await this.getTemplateBounds();
|
|
487
|
+
if (!templateBounds) return;
|
|
488
|
+
const saveData = await this.#omegga.getSaveData({
|
|
489
|
+
center: templateBounds.center,
|
|
490
|
+
extent: [
|
|
491
|
+
Math.round(
|
|
492
|
+
(templateBounds.maxBound[0] - templateBounds.minBound[0]) / 2
|
|
493
|
+
),
|
|
494
|
+
Math.round(
|
|
495
|
+
(templateBounds.maxBound[1] - templateBounds.minBound[1]) / 2
|
|
496
|
+
),
|
|
497
|
+
Math.round(
|
|
498
|
+
(templateBounds.maxBound[2] - templateBounds.minBound[2]) / 2
|
|
499
|
+
)
|
|
500
|
+
]
|
|
501
|
+
});
|
|
502
|
+
if (!saveData) return;
|
|
503
|
+
if (saveData.bricks.length > 0) {
|
|
504
|
+
return saveData;
|
|
505
|
+
}
|
|
506
|
+
return void 0;
|
|
507
|
+
}
|
|
508
|
+
loadBricks(saveName) {
|
|
509
|
+
this.#omegga.loadBricksOnPlayer(saveName, this);
|
|
510
|
+
}
|
|
511
|
+
async loadSaveData(saveData, { offX = 0, offY = 0, offZ = 0 } = {}) {
|
|
512
|
+
await this.#omegga.loadSaveDataOnPlayer(saveData, this, {
|
|
513
|
+
offX,
|
|
514
|
+
offY,
|
|
515
|
+
offZ
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
async loadDataAtGhostBrick(saveData, { rotate = true, offX = 0, offY = 0, offZ = 0, quiet = true } = {}) {
|
|
519
|
+
const ghostBrickData = await this.getGhostBrick();
|
|
520
|
+
if (!ghostBrickData || !saveData) return;
|
|
521
|
+
const bounds = index.brick.getBounds(saveData);
|
|
522
|
+
if (rotate) {
|
|
523
|
+
const orientation = index.brick.BRICK_CONSTANTS.orientationMap[ghostBrickData.orientation];
|
|
524
|
+
saveData.bricks = saveData.bricks.map(
|
|
525
|
+
(brick) => index.brick.rotate(brick, orientation)
|
|
526
|
+
);
|
|
527
|
+
bounds.minBound = index.brick.BRICK_CONSTANTS.translationTable[index.brick.d2o(...orientation)](bounds.minBound);
|
|
528
|
+
bounds.maxBound = index.brick.BRICK_CONSTANTS.translationTable[index.brick.d2o(...orientation)](bounds.maxBound);
|
|
529
|
+
bounds.center = index.brick.BRICK_CONSTANTS.translationTable[index.brick.d2o(...orientation)](bounds.center);
|
|
530
|
+
}
|
|
531
|
+
const offset = bounds.center.map(
|
|
532
|
+
(center, index2) => ghostBrickData.location[index2] - center
|
|
533
|
+
);
|
|
534
|
+
await this.#omegga.loadSaveData(saveData, {
|
|
535
|
+
offX: offX + offset[0],
|
|
536
|
+
offY: offY + offset[1],
|
|
537
|
+
offZ: offZ + offset[2],
|
|
538
|
+
quiet
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
kill() {
|
|
542
|
+
Player.kill(this.#omegga, this);
|
|
543
|
+
}
|
|
544
|
+
damage(amount) {
|
|
545
|
+
Player.damage(this.#omegga, this, amount);
|
|
546
|
+
}
|
|
547
|
+
heal(amount) {
|
|
548
|
+
Player.heal(this.#omegga, this, amount);
|
|
549
|
+
}
|
|
550
|
+
giveItem(item) {
|
|
551
|
+
Player.giveItem(this.#omegga, this, item);
|
|
552
|
+
}
|
|
553
|
+
takeItem(item) {
|
|
554
|
+
Player.takeItem(this.#omegga, this, item);
|
|
555
|
+
}
|
|
556
|
+
setTeam(teamIndex) {
|
|
557
|
+
Player.setTeam(this.#omegga, this, teamIndex);
|
|
558
|
+
}
|
|
559
|
+
setMinigame(index2) {
|
|
560
|
+
Player.setMinigame(this.#omegga, this, index2);
|
|
561
|
+
}
|
|
562
|
+
setScore(minigameIndex, score) {
|
|
563
|
+
Player.setScore(this.#omegga, this, minigameIndex, score);
|
|
564
|
+
}
|
|
565
|
+
getScore(minigameIndex) {
|
|
566
|
+
return Player.getScore(this.#omegga, this, minigameIndex);
|
|
567
|
+
}
|
|
568
|
+
setLeaderboard(key, value) {
|
|
569
|
+
Player.setLeaderboard(this.#omegga, this, key, value);
|
|
570
|
+
}
|
|
571
|
+
async getLeaderboard(key) {
|
|
572
|
+
return Player.getLeaderboard(this.#omegga, this, key);
|
|
573
|
+
}
|
|
539
574
|
}
|
|
540
|
-
_Player_omegga = new WeakMap();
|
|
541
575
|
global.Player = Player;
|
|
542
576
|
exports.default = Player;
|
|
543
|
-
//# sourceMappingURL=player.js.map
|
|
577
|
+
//# sourceMappingURL=player.js.map
|