cyberia 3.2.5 → 3.2.9
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/.github/workflows/engine-cyberia.cd.yml +2 -2
- package/.github/workflows/release.cd.yml +1 -2
- package/CHANGELOG.md +351 -1
- package/CLI-HELP.md +40 -13
- package/Dockerfile +0 -4
- package/README.md +242 -497
- package/bin/build.js +19 -5
- package/bin/cyberia.js +1149 -240
- package/bin/deploy.js +570 -1
- package/bin/file.js +6 -0
- package/bin/index.js +1149 -240
- package/bin/vs.js +1 -1
- package/conf.js +67 -89
- package/deployment.yaml +4 -222
- package/hardhat/package-lock.json +32 -32
- package/hardhat/package.json +3 -3
- package/jsconfig.json +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -2
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +2 -2
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +4 -222
- package/manifests/deployment/dd-cyberia-development/proxy.yaml +10 -118
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
- package/manifests/deployment/dd-test-development/deployment.yaml +136 -66
- package/manifests/deployment/dd-test-development/proxy.yaml +41 -5
- package/package.json +23 -14
- package/proxy.yaml +10 -118
- package/scripts/k3s-node-setup.sh +2 -2
- package/scripts/nat-iptables.sh +103 -18
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +18 -18
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +7 -14
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +76 -21
- package/src/api/core/core.controller.js +10 -10
- package/src/api/core/core.service.js +10 -10
- package/src/api/crypto/crypto.controller.js +8 -8
- package/src/api/crypto/crypto.service.js +8 -8
- package/src/api/cyberia-action/cyberia-action.controller.js +74 -0
- package/src/api/cyberia-action/cyberia-action.model.js +87 -0
- package/src/api/cyberia-action/cyberia-action.router.js +27 -0
- package/src/api/cyberia-action/cyberia-action.service.js +42 -0
- package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +13 -13
- package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +11 -11
- package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +2 -2
- package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +16 -16
- package/src/api/cyberia-entity/cyberia-entity.controller.js +10 -10
- package/src/api/cyberia-entity/cyberia-entity.service.js +10 -10
- package/src/api/cyberia-instance/cyberia-fallback-world.js +19 -209
- package/src/api/cyberia-instance/cyberia-instance.controller.js +14 -14
- package/src/api/cyberia-instance/cyberia-instance.model.js +3 -0
- package/src/api/cyberia-instance/cyberia-instance.service.js +22 -57
- package/src/api/cyberia-instance/cyberia-portal-connector.js +20 -246
- package/src/api/cyberia-instance/cyberia-world-generator.js +505 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +10 -10
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +216 -55
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +4 -1
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +18 -14
- package/src/api/cyberia-map/cyberia-map.controller.js +10 -10
- package/src/api/cyberia-map/cyberia-map.service.js +10 -10
- package/src/api/cyberia-quest/cyberia-quest.controller.js +74 -0
- package/src/api/cyberia-quest/cyberia-quest.model.js +67 -0
- package/src/api/cyberia-quest/cyberia-quest.router.js +27 -0
- package/src/api/cyberia-quest/cyberia-quest.service.js +42 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.controller.js +74 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.model.js +49 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.router.js +27 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.service.js +42 -0
- package/src/api/default/default.controller.js +10 -10
- package/src/api/default/default.service.js +10 -10
- package/src/api/document/document.controller.js +12 -12
- package/src/api/document/document.model.js +10 -16
- package/src/api/file/file.controller.js +8 -8
- package/src/api/file/file.model.js +10 -10
- package/src/api/file/file.service.js +36 -36
- package/src/api/instance/instance.controller.js +10 -10
- package/src/api/instance/instance.model.js +4 -10
- package/src/api/instance/instance.service.js +10 -10
- package/src/api/ipfs/ipfs.controller.js +12 -12
- package/src/api/ipfs/ipfs.model.js +4 -13
- package/src/api/ipfs/ipfs.service.js +14 -28
- package/src/api/object-layer/object-layer.controller.js +12 -12
- package/src/api/object-layer/object-layer.model.js +4 -17
- package/src/api/object-layer/object-layer.service.js +12 -12
- package/src/api/object-layer-render-frames/object-layer-render-frames.controller.js +10 -10
- package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +6 -16
- package/src/api/object-layer-render-frames/object-layer-render-frames.service.js +18 -14
- package/src/api/test/test.controller.js +8 -8
- package/src/api/test/test.service.js +8 -8
- package/src/api/user/guest.service.js +99 -0
- package/src/api/user/user.controller.js +6 -6
- package/src/api/user/user.model.js +8 -13
- package/src/api/user/user.service.js +3 -20
- package/src/cli/cluster.js +61 -14
- package/src/cli/db.js +47 -2
- package/src/cli/deploy.js +67 -35
- package/src/cli/fs.js +79 -8
- package/src/cli/image.js +43 -1
- package/src/cli/index.js +26 -1
- package/src/cli/release.js +57 -1
- package/src/cli/repository.js +69 -31
- package/src/cli/run.js +415 -36
- package/src/cli/ssh.js +1 -1
- package/src/cli/static.js +43 -115
- package/src/client/Cryptokoyn.index.js +18 -21
- package/src/client/CyberiaPortal.index.js +19 -23
- package/src/client/Default.index.js +21 -33
- package/src/client/Itemledger.index.js +20 -26
- package/src/client/Underpost.index.js +19 -23
- package/src/client/components/core/404.js +4 -4
- package/src/client/components/core/500.js +4 -4
- package/src/client/components/core/Account.js +73 -60
- package/src/client/components/core/AgGrid.js +23 -33
- package/src/client/components/core/Alert.js +12 -13
- package/src/client/components/core/AppStore.js +1 -1
- package/src/client/components/core/Auth.js +35 -37
- package/src/client/components/core/Badge.js +7 -13
- package/src/client/components/core/BtnIcon.js +15 -17
- package/src/client/components/core/CalendarCore.js +42 -63
- package/src/client/components/core/Chat.js +13 -15
- package/src/client/components/core/ClientEvents.js +87 -0
- package/src/client/components/core/ColorPaletteElement.js +309 -0
- package/src/client/components/core/Content.js +17 -14
- package/src/client/components/core/Css.js +15 -71
- package/src/client/components/core/CssCore.js +12 -16
- package/src/client/components/core/D3Chart.js +4 -4
- package/src/client/components/core/Docs.js +64 -91
- package/src/client/components/core/DropDown.js +69 -91
- package/src/client/components/core/EventBus.js +92 -0
- package/src/client/components/core/EventsUI.js +14 -17
- package/src/client/components/core/FileExplorer.js +96 -228
- package/src/client/components/core/FullScreen.js +47 -75
- package/src/client/components/core/Input.js +24 -69
- package/src/client/components/core/Keyboard.js +25 -18
- package/src/client/components/core/KeyboardAvoidance.js +145 -0
- package/src/client/components/core/LoadingAnimation.js +25 -31
- package/src/client/components/core/LogIn.js +41 -41
- package/src/client/components/core/LogOut.js +23 -14
- package/src/client/components/core/Modal.js +462 -178
- package/src/client/components/core/NotificationManager.js +14 -18
- package/src/client/components/core/Panel.js +54 -50
- package/src/client/components/core/PanelForm.js +25 -125
- package/src/client/components/core/Polyhedron.js +110 -214
- package/src/client/components/core/PublicProfile.js +39 -32
- package/src/client/components/core/Recover.js +48 -44
- package/src/client/components/core/Responsive.js +88 -32
- package/src/client/components/core/RichText.js +9 -18
- package/src/client/components/core/Router.js +24 -3
- package/src/client/components/core/SearchBox.js +37 -37
- package/src/client/components/core/SignUp.js +39 -30
- package/src/client/components/core/SocketIo.js +31 -2
- package/src/client/components/core/SocketIoHandler.js +6 -6
- package/src/client/components/core/ToggleSwitch.js +8 -20
- package/src/client/components/core/ToolTip.js +5 -17
- package/src/client/components/core/Translate.js +56 -59
- package/src/client/components/core/Validator.js +26 -16
- package/src/client/components/core/Wallet.js +15 -26
- package/src/client/components/core/Worker.js +163 -27
- package/src/client/components/core/windowGetDimensions.js +7 -7
- package/src/client/components/cryptokoyn/{MenuCryptokoyn.js → AppShellCryptokoyn.js} +57 -57
- package/src/client/components/cryptokoyn/CssCryptokoyn.js +15 -15
- package/src/client/components/cryptokoyn/LogInCryptokoyn.js +6 -4
- package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +6 -4
- package/src/client/components/cryptokoyn/RouterCryptokoyn.js +37 -0
- package/src/client/components/cryptokoyn/SettingsCryptokoyn.js +4 -4
- package/src/client/components/cryptokoyn/SignUpCryptokoyn.js +6 -4
- package/src/client/components/cyberia/InstanceEngineCyberia.js +141 -60
- package/src/client/components/cyberia/MapEngineCyberia.js +691 -214
- package/src/client/components/cyberia/ObjectLayerEngine.js +19 -0
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +1204 -94
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +196 -298
- package/src/client/components/cyberia-portal/{MenuCyberiaPortal.js → AppShellCyberiaPortal.js} +102 -102
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +305 -61
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +15 -15
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/MainBodyCyberiaPortal.js +4 -4
- package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +60 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +4 -4
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -4
- package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +87 -87
- package/src/client/components/default/CssDefault.js +12 -12
- package/src/client/components/default/LogInDefault.js +6 -4
- package/src/client/components/default/LogOutDefault.js +6 -4
- package/src/client/components/default/RouterDefault.js +47 -0
- package/src/client/components/default/SettingsDefault.js +4 -4
- package/src/client/components/default/SignUpDefault.js +6 -4
- package/src/client/components/default/TranslateDefault.js +3 -3
- package/src/client/components/itemledger/{MenuItemledger.js → AppShellItemledger.js} +57 -57
- package/src/client/components/itemledger/CssItemledger.js +15 -15
- package/src/client/components/itemledger/LogInItemledger.js +6 -4
- package/src/client/components/itemledger/LogOutItemledger.js +6 -4
- package/src/client/components/itemledger/RouterItemledger.js +38 -0
- package/src/client/components/itemledger/SettingsItemledger.js +4 -4
- package/src/client/components/itemledger/SignUpItemledger.js +6 -4
- package/src/client/components/itemledger/TranslateItemledger.js +3 -3
- package/src/client/components/underpost/{MenuUnderpost.js → AppShellUnderpost.js} +88 -88
- package/src/client/components/underpost/CssUnderpost.js +14 -14
- package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +4 -4
- package/src/client/components/underpost/DocumentSearchProvider.js +1 -1
- package/src/client/components/underpost/LabGalleryUnderpost.js +12 -15
- package/src/client/components/underpost/LogInUnderpost.js +6 -4
- package/src/client/components/underpost/LogOutUnderpost.js +6 -4
- package/src/client/components/underpost/RouterUnderpost.js +45 -0
- package/src/client/components/underpost/SettingsUnderpost.js +4 -4
- package/src/client/components/underpost/SignUpUnderpost.js +6 -4
- package/src/client/components/underpost/TranslateUnderpost.js +4 -4
- package/src/client/public/cyberia-docs/ACTION-SYSTEM.md +235 -0
- package/src/client/public/cyberia-docs/ARCHITECTURE.md +443 -0
- package/src/client/public/cyberia-docs/CYBERIA-CLI.md +417 -0
- package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +313 -0
- package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +260 -0
- package/src/client/public/cyberia-docs/ENTITY-PROFILE.md +241 -0
- package/src/client/public/cyberia-docs/HARDHAT-MODULE.md +300 -0
- package/src/client/public/cyberia-docs/OFF-CHAIN-ECONOMY.md +279 -0
- package/src/client/public/cyberia-docs/QUEST-SYSTEM.md +206 -0
- package/src/client/public/cyberia-docs/ROADMAP.md +240 -0
- package/src/client/public/cyberia-docs/WHITE-PAPER.md +732 -0
- package/src/client/services/atlas-sprite-sheet/atlas-sprite-sheet.service.js +14 -20
- package/src/client/services/core/core.service.js +17 -49
- package/src/client/services/crypto/crypto.service.js +8 -13
- package/src/client/services/cyberia-action/cyberia-action.service.js +99 -0
- package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +10 -16
- package/src/client/services/cyberia-entity/cyberia-entity.management.js +5 -5
- package/src/client/services/cyberia-entity/cyberia-entity.service.js +10 -16
- package/src/client/services/cyberia-instance/cyberia-instance.management.js +6 -6
- package/src/client/services/cyberia-instance/cyberia-instance.service.js +12 -18
- package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +10 -16
- package/src/client/services/cyberia-map/cyberia-map.management.js +6 -6
- package/src/client/services/cyberia-map/cyberia-map.service.js +12 -18
- package/src/client/services/cyberia-quest/cyberia-quest.service.js +99 -0
- package/src/client/services/cyberia-quest-progress/cyberia-quest-progress.service.js +99 -0
- package/src/client/services/default/default.management.js +159 -267
- package/src/client/services/default/default.service.js +10 -16
- package/src/client/services/document/document.service.js +14 -19
- package/src/client/services/file/file.service.js +8 -13
- package/src/client/services/instance/instance.management.js +5 -5
- package/src/client/services/instance/instance.service.js +10 -15
- package/src/client/services/ipfs/ipfs.service.js +12 -18
- package/src/client/services/object-layer/object-layer.management.js +12 -12
- package/src/client/services/object-layer/object-layer.service.js +20 -26
- package/src/client/services/object-layer-render-frames/object-layer-render-frames.service.js +10 -16
- package/src/client/services/test/test.service.js +8 -13
- package/src/client/services/user/guest.service.js +86 -0
- package/src/client/services/user/user.management.js +5 -5
- package/src/client/services/user/user.service.js +14 -20
- package/src/client/ssr/body/404.js +3 -3
- package/src/client/ssr/body/500.js +3 -3
- package/src/client/ssr/body/CacheControl.js +5 -2
- package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
- package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +13 -6
- package/src/client/ssr/head/PwaItemledger.js +197 -60
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
- package/src/client/ssr/offline/Maintenance.js +12 -11
- package/src/client/ssr/offline/NoNetworkConnection.js +3 -3
- package/src/client/ssr/pages/Test.js +2 -2
- package/src/client/sw/core.sw.js +212 -0
- package/src/grpc/cyberia/grpc-server.js +179 -67
- package/src/index.js +1 -1
- package/src/runtime/cyberia-client/Dockerfile +80 -0
- package/src/runtime/cyberia-server/Dockerfile +37 -0
- package/src/runtime/express/Dockerfile +4 -4
- package/src/runtime/lampp/Dockerfile +8 -7
- package/src/runtime/wp/Dockerfile +11 -17
- package/src/server/atlas-sprite-sheet-generator.js +4 -2
- package/src/server/client-build-docs.js +45 -46
- package/src/server/client-build.js +334 -60
- package/src/server/client-formatted.js +47 -16
- package/src/server/conf.js +5 -4
- package/src/server/data-query.js +32 -20
- package/src/server/dns.js +22 -0
- package/src/server/ipfs-client.js +232 -91
- package/src/server/object-layer.js +1 -6
- package/src/server/process.js +13 -27
- package/src/server/semantic-layer-generator-floor.js +11 -51
- package/src/server/semantic-layer-generator-resource.js +259 -0
- package/src/server/semantic-layer-generator-skin.js +41 -171
- package/src/server/semantic-layer-generator.js +122 -14
- package/src/server/shape-generator.js +108 -0
- package/src/server/start.js +17 -3
- package/src/server/valkey.js +141 -235
- package/tsconfig.docs.json +15 -0
- package/typedoc.dd-cyberia.json +29 -0
- package/typedoc.json +29 -0
- package/WHITE-PAPER.md +0 -1540
- package/hardhat/README.md +0 -531
- package/hardhat/WHITE-PAPER.md +0 -1540
- package/jsdoc.dd-cyberia.json +0 -68
- package/jsdoc.json +0 -68
- package/src/api/object-layer/README.md +0 -672
- package/src/client/components/core/ColorPalette.js +0 -5267
- package/src/client/components/core/JoyStick.js +0 -80
- package/src/client/components/cryptokoyn/RoutesCryptokoyn.js +0 -39
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +0 -62
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +0 -136
- package/src/client/components/default/RoutesDefault.js +0 -49
- package/src/client/components/itemledger/RoutesItemledger.js +0 -40
- package/src/client/components/underpost/RoutesUnderpost.js +0 -47
- package/src/client/sw/default.sw.js +0 -127
- package/src/client/sw/template.sw.js +0 -84
- package/src/grpc/cyberia/OFF_CHAIN_ECONOMY.md +0 -305
- package/src/grpc/cyberia/README.md +0 -326
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedural World Generator — pure-function module.
|
|
3
|
+
*
|
|
4
|
+
* Centralises every procedural entity generator used by the Cyberia Online
|
|
5
|
+
* engine (obstacles, foreground, resources, floors, portals, bots) together
|
|
6
|
+
* with the shared helpers they need (colour conversion, random numbers,
|
|
7
|
+
* occupancy-grid placement).
|
|
8
|
+
*
|
|
9
|
+
* Consumers:
|
|
10
|
+
* - cyberia-fallback-world.js (full fallback world)
|
|
11
|
+
* - cyberia-portal-connector.js (no generators — uses colour/random helpers only)
|
|
12
|
+
* - cyberia-instance.service.js (optional entity back-fill in portalConnect endpoint)
|
|
13
|
+
*
|
|
14
|
+
* All exported functions are stateless and synchronous.
|
|
15
|
+
*
|
|
16
|
+
* @module src/api/cyberia-instance/cyberia-world-generator
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
ENTITY_TYPE_DEFAULTS,
|
|
21
|
+
RESOURCE_ENTITY_TYPE_DEFAULTS,
|
|
22
|
+
} from '../cyberia-instance-conf/cyberia-instance-conf.defaults.js';
|
|
23
|
+
|
|
24
|
+
import { DefaultCyberiaItems, ITEM_TYPES } from '../../client/components/cyberia-portal/CommonCyberiaPortal.js';
|
|
25
|
+
|
|
26
|
+
import { PORTAL_MODES, PORTAL_MODE_COLOR_KEY, EXTRA_PORTAL_MODES } from './cyberia-portal-connector.js';
|
|
27
|
+
|
|
28
|
+
// ── Color helpers ────────────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert a { r, g, b, a } palette entry to an `rgba(…)` CSS string.
|
|
32
|
+
* @param {{ r: number, g: number, b: number, a: number }} c
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
const colorToRgba = (c) => `rgba(${c.r}, ${c.g}, ${c.b}, ${c.a / 255})`;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Look up a palette entry by key from a colours array.
|
|
39
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
40
|
+
* @param {string} key
|
|
41
|
+
* @returns {{ r: number, g: number, b: number, a: number } | undefined}
|
|
42
|
+
*/
|
|
43
|
+
const findColor = (colors, key) => colors.find((c) => c.key === key);
|
|
44
|
+
|
|
45
|
+
// ── Random helpers ───────────────────────────────────────────────────────────
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Return a random integer in [min, max] (inclusive).
|
|
49
|
+
* @param {number} min
|
|
50
|
+
* @param {number} max
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
const randInt = (min, max) => min + Math.floor(Math.random() * (max - min + 1));
|
|
54
|
+
|
|
55
|
+
// ── Entity count ranges ──────────────────────────────────────────────────────
|
|
56
|
+
// [min, max] — actual count is random within range on each generation call.
|
|
57
|
+
|
|
58
|
+
const OBSTACLE_RANGE = [20, 35];
|
|
59
|
+
const FOREGROUND_RANGE = [10, 20];
|
|
60
|
+
const BOT_RANGE = [8, 16];
|
|
61
|
+
const RESOURCE_RANGE = [6, 12];
|
|
62
|
+
const BOT_WEAPON_CHANCE = 0.6;
|
|
63
|
+
const PORTAL_DIM_RANGE = [2, 3];
|
|
64
|
+
const PORTAL_COUNT_RANGE = [2, 4];
|
|
65
|
+
|
|
66
|
+
// ── Bot defaults ─────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
const DEFAULT_BOT_DIM_RANGE = [2, 3];
|
|
69
|
+
const DEFAULT_FLOOR_TILE_DIM = 4;
|
|
70
|
+
|
|
71
|
+
function pickDefaultResourceItemIds() {
|
|
72
|
+
const resourceBuilds = RESOURCE_ENTITY_TYPE_DEFAULTS.filter((build) => build.liveItemIds?.length);
|
|
73
|
+
if (resourceBuilds.length === 0) {
|
|
74
|
+
return ['wood'];
|
|
75
|
+
}
|
|
76
|
+
const build = resourceBuilds[randInt(0, resourceBuilds.length - 1)];
|
|
77
|
+
return [...build.liveItemIds];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** NPC skin pool — all items with type 'skin' from DefaultCyberiaItems. */
|
|
81
|
+
const BOT_SKIN_POOL = DefaultCyberiaItems.filter((e) => e.item.type === ITEM_TYPES.skin).map((e) => e.item.id);
|
|
82
|
+
|
|
83
|
+
// ── Occupancy grid ───────────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 2D boolean grid that tracks which cells are blocked (obstacle / placed entity).
|
|
87
|
+
* Used to find valid walkable positions when placing portals and bots.
|
|
88
|
+
*/
|
|
89
|
+
class OccupancyGrid {
|
|
90
|
+
/**
|
|
91
|
+
* @param {number} width Grid columns.
|
|
92
|
+
* @param {number} height Grid rows.
|
|
93
|
+
*/
|
|
94
|
+
constructor(width, height) {
|
|
95
|
+
this.width = width;
|
|
96
|
+
this.height = height;
|
|
97
|
+
// false = walkable, true = blocked
|
|
98
|
+
this.cells = Array.from({ length: height }, () => new Array(width).fill(false));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Mark a rectangular region as blocked.
|
|
103
|
+
* @param {number} x
|
|
104
|
+
* @param {number} y
|
|
105
|
+
* @param {number} w
|
|
106
|
+
* @param {number} h
|
|
107
|
+
*/
|
|
108
|
+
block(x, y, w, h) {
|
|
109
|
+
for (let row = y; row < y + h && row < this.height; row++) {
|
|
110
|
+
for (let col = x; col < x + w && col < this.width; col++) {
|
|
111
|
+
if (row >= 0 && col >= 0) this.cells[row][col] = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Check whether a rectangle fits entirely within walkable (unblocked) cells.
|
|
118
|
+
* @param {number} x
|
|
119
|
+
* @param {number} y
|
|
120
|
+
* @param {number} w
|
|
121
|
+
* @param {number} h
|
|
122
|
+
* @returns {boolean}
|
|
123
|
+
*/
|
|
124
|
+
fits(x, y, w, h) {
|
|
125
|
+
if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) return false;
|
|
126
|
+
for (let row = y; row < y + h; row++) {
|
|
127
|
+
for (let col = x; col < x + w; col++) {
|
|
128
|
+
if (this.cells[row][col]) return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Find a random walkable position for a rectangle of given dimensions.
|
|
136
|
+
* Tries up to `maxAttempts` random positions before giving up.
|
|
137
|
+
* @param {number} w
|
|
138
|
+
* @param {number} h
|
|
139
|
+
* @param {number} [maxAttempts=200]
|
|
140
|
+
* @returns {{ x: number, y: number } | null} Position or null if no fit found.
|
|
141
|
+
*/
|
|
142
|
+
findPosition(w, h, maxAttempts = 200) {
|
|
143
|
+
const maxX = Math.max(0, this.width - w);
|
|
144
|
+
const maxY = Math.max(0, this.height - h);
|
|
145
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
146
|
+
const x = randInt(0, maxX);
|
|
147
|
+
const y = randInt(0, maxY);
|
|
148
|
+
if (this.fits(x, y, w, h)) return { x, y };
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Populate the grid from an array of obstacle entities.
|
|
155
|
+
* @param {Array<{ initCellX: number, initCellY: number, dimX: number, dimY: number }>} obstacles
|
|
156
|
+
*/
|
|
157
|
+
addObstacles(obstacles) {
|
|
158
|
+
for (const o of obstacles) {
|
|
159
|
+
this.block(o.initCellX, o.initCellY, o.dimX, o.dimY);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ── Procedural entity generators ─────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Generate floor tiles that cover the entire map grid.
|
|
168
|
+
* Floor is NOT random — it tiles deterministically so every cell is covered.
|
|
169
|
+
*
|
|
170
|
+
* @param {{ gridX: number, gridY: number }} mapDims
|
|
171
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
172
|
+
* @param {object} [opts]
|
|
173
|
+
* @param {number} [opts.tileDim=4] Floor tile size in cells.
|
|
174
|
+
* @returns {object[]}
|
|
175
|
+
*/
|
|
176
|
+
function generateFloorEntities(mapDims, colors, opts = {}) {
|
|
177
|
+
const { tileDim = DEFAULT_FLOOR_TILE_DIM } = opts;
|
|
178
|
+
const floorDefault = ENTITY_TYPE_DEFAULTS.find((d) => d.entityType === 'floor');
|
|
179
|
+
const floorItemIds = floorDefault?.liveItemIds?.length ? [...floorDefault.liveItemIds] : [];
|
|
180
|
+
const floorColor = findColor(colors, 'FLOOR');
|
|
181
|
+
const rgba = floorColor ? colorToRgba(floorColor) : '';
|
|
182
|
+
|
|
183
|
+
const entities = [];
|
|
184
|
+
for (let y = 0; y < mapDims.gridY; y += tileDim) {
|
|
185
|
+
for (let x = 0; x < mapDims.gridX; x += tileDim) {
|
|
186
|
+
entities.push({
|
|
187
|
+
entityType: 'floor',
|
|
188
|
+
initCellX: x,
|
|
189
|
+
initCellY: y,
|
|
190
|
+
dimX: Math.min(tileDim, mapDims.gridX - x),
|
|
191
|
+
dimY: Math.min(tileDim, mapDims.gridY - y),
|
|
192
|
+
color: rgba,
|
|
193
|
+
objectLayerItemIds: floorItemIds,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return entities;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Generate procedural obstacle entities for a map.
|
|
202
|
+
*
|
|
203
|
+
* @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
|
|
204
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
|
|
205
|
+
* @param {object} [opts]
|
|
206
|
+
* @param {number} [opts.count] Override count (ignores range).
|
|
207
|
+
* @param {number} [opts.minDim=1] Minimum obstacle width/height (cells).
|
|
208
|
+
* @param {number} [opts.maxDim=4] Maximum obstacle width/height (cells).
|
|
209
|
+
* @returns {object[]} Array of CyberiaEntity plain objects.
|
|
210
|
+
*/
|
|
211
|
+
function generateObstacles(mapDims, colors, opts = {}) {
|
|
212
|
+
const { minDim = 1, maxDim = 4 } = opts;
|
|
213
|
+
const count = opts.count ?? randInt(OBSTACLE_RANGE[0], OBSTACLE_RANGE[1]);
|
|
214
|
+
const { gridX, gridY } = mapDims;
|
|
215
|
+
|
|
216
|
+
const obstacleColor = findColor(colors, 'OBSTACLE');
|
|
217
|
+
const rgba = obstacleColor ? colorToRgba(obstacleColor) : 'rgba(80, 80, 80, 1)';
|
|
218
|
+
|
|
219
|
+
const entities = [];
|
|
220
|
+
for (let i = 0; i < count; i++) {
|
|
221
|
+
const dimX = randInt(minDim, maxDim);
|
|
222
|
+
const dimY = randInt(minDim, maxDim);
|
|
223
|
+
const maxX = Math.max(0, gridX - dimX);
|
|
224
|
+
const maxY = Math.max(0, gridY - dimY);
|
|
225
|
+
entities.push({
|
|
226
|
+
entityType: 'obstacle',
|
|
227
|
+
initCellX: randInt(0, maxX),
|
|
228
|
+
initCellY: randInt(0, maxY),
|
|
229
|
+
dimX,
|
|
230
|
+
dimY,
|
|
231
|
+
color: rgba,
|
|
232
|
+
objectLayerItemIds: [],
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
return entities;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Generate procedural foreground entities for a map.
|
|
240
|
+
*
|
|
241
|
+
* @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
|
|
242
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
|
|
243
|
+
* @param {object} [opts]
|
|
244
|
+
* @param {number} [opts.count] Override count (ignores range).
|
|
245
|
+
* @param {number} [opts.minDim=2] Minimum foreground width/height (cells).
|
|
246
|
+
* @param {number} [opts.maxDim=6] Maximum foreground width/height (cells).
|
|
247
|
+
* @returns {object[]} Array of CyberiaEntity plain objects.
|
|
248
|
+
*/
|
|
249
|
+
function generateForeground(mapDims, colors, opts = {}) {
|
|
250
|
+
const { minDim = 2, maxDim = 6 } = opts;
|
|
251
|
+
const count = opts.count ?? randInt(FOREGROUND_RANGE[0], FOREGROUND_RANGE[1]);
|
|
252
|
+
const { gridX, gridY } = mapDims;
|
|
253
|
+
|
|
254
|
+
const fgColor = findColor(colors, 'FOREGROUND');
|
|
255
|
+
const rgba = fgColor ? colorToRgba(fgColor) : 'rgba(200, 200, 200, 0.31)';
|
|
256
|
+
|
|
257
|
+
const entities = [];
|
|
258
|
+
for (let i = 0; i < count; i++) {
|
|
259
|
+
const dimX = randInt(minDim, maxDim);
|
|
260
|
+
const dimY = randInt(minDim, maxDim);
|
|
261
|
+
const maxX = Math.max(0, gridX - dimX);
|
|
262
|
+
const maxY = Math.max(0, gridY - dimY);
|
|
263
|
+
entities.push({
|
|
264
|
+
entityType: 'foreground',
|
|
265
|
+
initCellX: randInt(0, maxX),
|
|
266
|
+
initCellY: randInt(0, maxY),
|
|
267
|
+
dimX,
|
|
268
|
+
dimY,
|
|
269
|
+
color: rgba,
|
|
270
|
+
objectLayerItemIds: [],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return entities;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Generate procedural resource entities for a map.
|
|
278
|
+
*
|
|
279
|
+
* Resources are static, exploitable entities (wood, minerals, etc.).
|
|
280
|
+
* They use the RESOURCE palette colour as fallback and are placed
|
|
281
|
+
* on walkable cells via the occupancy grid when provided.
|
|
282
|
+
*
|
|
283
|
+
* @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
|
|
284
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
|
|
285
|
+
* @param {object} [opts]
|
|
286
|
+
* @param {number} [opts.count] Override count (ignores range).
|
|
287
|
+
* @param {number} [opts.dim=2] Resource width/height (cells).
|
|
288
|
+
* @param {number} [opts.maxLife=80] Hit-points before destruction.
|
|
289
|
+
* @param {string[]} [opts.itemIds] Object layer item IDs (default: resource liveItemIds from instance defaults).
|
|
290
|
+
* @param {OccupancyGrid} [opts.grid] If provided, places resources only on walkable cells.
|
|
291
|
+
* @returns {object[]} Array of CyberiaEntity plain objects.
|
|
292
|
+
*/
|
|
293
|
+
function generateResources(mapDims, colors, opts = {}) {
|
|
294
|
+
const { dim = 2, maxLife = 80 } = opts;
|
|
295
|
+
const count = opts.count ?? randInt(RESOURCE_RANGE[0], RESOURCE_RANGE[1]);
|
|
296
|
+
const fixedItemIds = opts.itemIds != null ? [...opts.itemIds] : null;
|
|
297
|
+
const resColor = findColor(colors, 'RESOURCE');
|
|
298
|
+
const rgba = resColor ? colorToRgba(resColor) : 'rgba(100, 180, 80, 1)';
|
|
299
|
+
|
|
300
|
+
const entities = [];
|
|
301
|
+
for (let i = 0; i < count; i++) {
|
|
302
|
+
let cellX, cellY;
|
|
303
|
+
if (opts.grid) {
|
|
304
|
+
const pos = opts.grid.findPosition(dim, dim);
|
|
305
|
+
if (!pos) continue;
|
|
306
|
+
opts.grid.block(pos.x, pos.y, dim, dim);
|
|
307
|
+
cellX = pos.x;
|
|
308
|
+
cellY = pos.y;
|
|
309
|
+
} else {
|
|
310
|
+
const maxX = Math.max(0, mapDims.gridX - dim);
|
|
311
|
+
const maxY = Math.max(0, mapDims.gridY - dim);
|
|
312
|
+
cellX = randInt(0, maxX);
|
|
313
|
+
cellY = randInt(0, maxY);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
entities.push({
|
|
317
|
+
entityType: 'resource',
|
|
318
|
+
initCellX: cellX,
|
|
319
|
+
initCellY: cellY,
|
|
320
|
+
dimX: dim,
|
|
321
|
+
dimY: dim,
|
|
322
|
+
color: rgba,
|
|
323
|
+
objectLayerItemIds: fixedItemIds ? [...fixedItemIds] : pickDefaultResourceItemIds(),
|
|
324
|
+
maxLife,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return entities;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Generate a portal entity at a random walkable position with random dimensions.
|
|
332
|
+
*
|
|
333
|
+
* @param {{ gridX: number, gridY: number }} mapDims
|
|
334
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
335
|
+
* @param {OccupancyGrid} [grid] If provided, places portal only on walkable cells and marks them blocked.
|
|
336
|
+
* @param {string} [portalSubtype] One of PORTAL_MODE_LIST values. Determines the portal colour.
|
|
337
|
+
* @returns {object|null} Portal entity or null if no valid position found.
|
|
338
|
+
*/
|
|
339
|
+
function generatePortalEntity(mapDims, colors, grid, portalSubtype) {
|
|
340
|
+
const colorKey = portalSubtype ? PORTAL_MODE_COLOR_KEY[portalSubtype] : 'PORTAL';
|
|
341
|
+
const portalColor = findColor(colors, colorKey) || findColor(colors, 'PORTAL');
|
|
342
|
+
const rgba = portalColor ? colorToRgba(portalColor) : 'rgba(0, 200, 200, 1)';
|
|
343
|
+
const dimX = randInt(PORTAL_DIM_RANGE[0], PORTAL_DIM_RANGE[1]);
|
|
344
|
+
const dimY = randInt(PORTAL_DIM_RANGE[0], PORTAL_DIM_RANGE[1]);
|
|
345
|
+
|
|
346
|
+
if (grid) {
|
|
347
|
+
const pos = grid.findPosition(dimX, dimY);
|
|
348
|
+
if (!pos) return null;
|
|
349
|
+
grid.block(pos.x, pos.y, dimX, dimY);
|
|
350
|
+
return {
|
|
351
|
+
entityType: 'portal',
|
|
352
|
+
portalSubtype: portalSubtype || 'inter-portal',
|
|
353
|
+
initCellX: pos.x,
|
|
354
|
+
initCellY: pos.y,
|
|
355
|
+
dimX,
|
|
356
|
+
dimY,
|
|
357
|
+
color: rgba,
|
|
358
|
+
objectLayerItemIds: [],
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const maxX = Math.max(0, mapDims.gridX - dimX);
|
|
363
|
+
const maxY = Math.max(0, mapDims.gridY - dimY);
|
|
364
|
+
return {
|
|
365
|
+
entityType: 'portal',
|
|
366
|
+
portalSubtype: portalSubtype || 'inter-portal',
|
|
367
|
+
initCellX: randInt(0, maxX),
|
|
368
|
+
initCellY: randInt(0, maxY),
|
|
369
|
+
dimX,
|
|
370
|
+
dimY,
|
|
371
|
+
color: rgba,
|
|
372
|
+
objectLayerItemIds: [],
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Generate a random number of portal entities for a map, each with a
|
|
378
|
+
* randomly assigned portal subtype (and corresponding colour).
|
|
379
|
+
*
|
|
380
|
+
* @param {{ gridX: number, gridY: number }} mapDims
|
|
381
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
382
|
+
* @param {object} [opts]
|
|
383
|
+
* @param {number} [opts.count] Override count (ignores range).
|
|
384
|
+
* @param {OccupancyGrid} [opts.grid] If provided, places portals only on walkable cells.
|
|
385
|
+
* @returns {object[]}
|
|
386
|
+
*/
|
|
387
|
+
function generatePortalEntities(mapDims, colors, opts = {}) {
|
|
388
|
+
const count = opts.count ?? randInt(PORTAL_COUNT_RANGE[0], PORTAL_COUNT_RANGE[1]);
|
|
389
|
+
const entities = [];
|
|
390
|
+
for (let i = 0; i < count; i++) {
|
|
391
|
+
// First portal is always inter-portal (reserved for the ring topology);
|
|
392
|
+
// extra portals get a random non-ring subtype.
|
|
393
|
+
const subtype =
|
|
394
|
+
i === 0 ? PORTAL_MODES.INTER_PORTAL : EXTRA_PORTAL_MODES[Math.floor(Math.random() * EXTRA_PORTAL_MODES.length)];
|
|
395
|
+
const portal = generatePortalEntity(mapDims, colors, opts.grid, subtype);
|
|
396
|
+
if (portal) entities.push(portal);
|
|
397
|
+
}
|
|
398
|
+
return entities;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Generate bot entities for a map.
|
|
403
|
+
*
|
|
404
|
+
* @param {{ gridX: number, gridY: number }} mapDims
|
|
405
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
406
|
+
* @param {object} [opts]
|
|
407
|
+
* @param {number} [opts.count] Override count (ignores range).
|
|
408
|
+
* @param {number} [opts.spawnRadius]
|
|
409
|
+
* @param {number} [opts.aggroRange]
|
|
410
|
+
* @param {number} [opts.maxLife]
|
|
411
|
+
* @param {OccupancyGrid} [opts.grid] If provided, places bots only on walkable cells.
|
|
412
|
+
* @returns {object[]}
|
|
413
|
+
*/
|
|
414
|
+
function generateBots(mapDims, colors, opts = {}) {
|
|
415
|
+
const count = opts.count ?? randInt(BOT_RANGE[0], BOT_RANGE[1]);
|
|
416
|
+
const { spawnRadius = 5, aggroRange = 10, maxLife = 100 } = opts;
|
|
417
|
+
const botColor = findColor(colors, 'BOT');
|
|
418
|
+
const rgba = botColor ? colorToRgba(botColor) : 'rgba(255, 128, 0, 1)';
|
|
419
|
+
|
|
420
|
+
const entities = [];
|
|
421
|
+
for (let i = 0; i < count; i++) {
|
|
422
|
+
const dim = randInt(DEFAULT_BOT_DIM_RANGE[0], DEFAULT_BOT_DIM_RANGE[1]);
|
|
423
|
+
|
|
424
|
+
let cellX, cellY;
|
|
425
|
+
if (opts.grid) {
|
|
426
|
+
const pos = opts.grid.findPosition(dim, dim);
|
|
427
|
+
if (!pos) continue;
|
|
428
|
+
opts.grid.block(pos.x, pos.y, dim, dim);
|
|
429
|
+
cellX = pos.x;
|
|
430
|
+
cellY = pos.y;
|
|
431
|
+
} else {
|
|
432
|
+
const maxX = Math.max(0, mapDims.gridX - dim);
|
|
433
|
+
const maxY = Math.max(0, mapDims.gridY - dim);
|
|
434
|
+
cellX = randInt(0, maxX);
|
|
435
|
+
cellY = randInt(0, maxY);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const skin = BOT_SKIN_POOL[Math.floor(Math.random() * BOT_SKIN_POOL.length)];
|
|
439
|
+
const hasWeapon = Math.random() < BOT_WEAPON_CHANCE;
|
|
440
|
+
const itemIds = hasWeapon ? [skin, 'atlas_pistol_mk2'] : [skin];
|
|
441
|
+
|
|
442
|
+
entities.push({
|
|
443
|
+
entityType: 'bot',
|
|
444
|
+
initCellX: cellX,
|
|
445
|
+
initCellY: cellY,
|
|
446
|
+
dimX: dim,
|
|
447
|
+
dimY: dim,
|
|
448
|
+
color: rgba,
|
|
449
|
+
objectLayerItemIds: itemIds,
|
|
450
|
+
spawnRadius,
|
|
451
|
+
aggroRange,
|
|
452
|
+
maxLife,
|
|
453
|
+
lifeRegen: 0,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
return entities;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Generate all procedural fallback entities (obstacles + foreground + resources) for a map.
|
|
461
|
+
*
|
|
462
|
+
* @param {{ gridX: number, gridY: number }} mapDims
|
|
463
|
+
* @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
|
|
464
|
+
* @param {object} [opts]
|
|
465
|
+
* @param {number} [opts.obstacleCount]
|
|
466
|
+
* @param {number} [opts.foregroundCount]
|
|
467
|
+
* @param {number} [opts.resourceCount]
|
|
468
|
+
* @param {OccupancyGrid} [opts.grid]
|
|
469
|
+
* @returns {{ obstacles: object[], foreground: object[], resources: object[] }}
|
|
470
|
+
*/
|
|
471
|
+
function generateProceduralEntities(mapDims, colors, opts = {}) {
|
|
472
|
+
return {
|
|
473
|
+
obstacles: generateObstacles(mapDims, colors, { count: opts.obstacleCount }),
|
|
474
|
+
foreground: generateForeground(mapDims, colors, { count: opts.foregroundCount }),
|
|
475
|
+
resources: generateResources(mapDims, colors, { count: opts.resourceCount, grid: opts.grid }),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// ── Public API ───────────────────────────────────────────────────────────────
|
|
480
|
+
|
|
481
|
+
export {
|
|
482
|
+
// Helpers
|
|
483
|
+
colorToRgba,
|
|
484
|
+
findColor,
|
|
485
|
+
randInt,
|
|
486
|
+
// Placement
|
|
487
|
+
OccupancyGrid,
|
|
488
|
+
// Generators
|
|
489
|
+
generateFloorEntities,
|
|
490
|
+
generateObstacles,
|
|
491
|
+
generateForeground,
|
|
492
|
+
generateResources,
|
|
493
|
+
generatePortalEntity,
|
|
494
|
+
generatePortalEntities,
|
|
495
|
+
generateBots,
|
|
496
|
+
generateProceduralEntities,
|
|
497
|
+
// Ranges
|
|
498
|
+
OBSTACLE_RANGE,
|
|
499
|
+
FOREGROUND_RANGE,
|
|
500
|
+
BOT_RANGE,
|
|
501
|
+
RESOURCE_RANGE,
|
|
502
|
+
BOT_WEAPON_CHANCE,
|
|
503
|
+
PORTAL_DIM_RANGE,
|
|
504
|
+
PORTAL_COUNT_RANGE,
|
|
505
|
+
};
|
|
@@ -3,8 +3,8 @@ import { CyberiaInstanceConfService } from './cyberia-instance-conf.service.js';
|
|
|
3
3
|
|
|
4
4
|
const logger = loggerFactory(import.meta);
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
post
|
|
6
|
+
class CyberiaInstanceConfController {
|
|
7
|
+
static post = async (req, res, options) => {
|
|
8
8
|
try {
|
|
9
9
|
const result = await CyberiaInstanceConfService.post(req, res, options);
|
|
10
10
|
return res.status(200).json({
|
|
@@ -18,8 +18,8 @@ const CyberiaInstanceConfController = {
|
|
|
18
18
|
message: error.message,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
}
|
|
22
|
-
get
|
|
21
|
+
};
|
|
22
|
+
static get = async (req, res, options) => {
|
|
23
23
|
try {
|
|
24
24
|
const { page, limit } = req.query;
|
|
25
25
|
const result = await CyberiaInstanceConfService.get(
|
|
@@ -38,8 +38,8 @@ const CyberiaInstanceConfController = {
|
|
|
38
38
|
message: error.message,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
}
|
|
42
|
-
put
|
|
41
|
+
};
|
|
42
|
+
static put = async (req, res, options) => {
|
|
43
43
|
try {
|
|
44
44
|
const result = await CyberiaInstanceConfService.put(req, res, options);
|
|
45
45
|
return res.status(200).json({
|
|
@@ -53,8 +53,8 @@ const CyberiaInstanceConfController = {
|
|
|
53
53
|
message: error.message,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
}
|
|
57
|
-
delete
|
|
56
|
+
};
|
|
57
|
+
static delete = async (req, res, options) => {
|
|
58
58
|
try {
|
|
59
59
|
const result = await CyberiaInstanceConfService.delete(req, res, options);
|
|
60
60
|
return res.status(200).json({
|
|
@@ -68,7 +68,7 @@ const CyberiaInstanceConfController = {
|
|
|
68
68
|
message: error.message,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
73
|
|
|
74
74
|
export { CyberiaInstanceConfController };
|