@evitcastudio/kit 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -13
- package/lib/bundle/cli/cli.js +14 -3
- package/lib/bundle/cli/kit-game-templates/multi/README.md +3 -13
- package/lib/bundle/cli/kit-game-templates/multi/package.json +4 -3
- package/lib/bundle/cli/kit-game-templates/multi/src/server/settings.json +1 -1
- package/lib/bundle/cli/kit-game-templates/single/README.md +3 -13
- package/lib/bundle/cli/kit-game-templates/single/bun-serve.ts +2 -1
- package/lib/bundle/cli/kit-game-templates/single/package.json +3 -3
- package/lib/cli/init.d.ts.map +1 -0
- package/lib/{src/cli → cli}/init.js +14 -0
- package/lib/cli/main.d.ts +5 -0
- package/lib/cli/main.d.ts.map +1 -1
- package/lib/cli/main.js +7 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/plugins/network/index.d.ts +7 -0
- package/lib/plugins/network/index.d.ts.map +1 -1
- package/lib/plugins/network/index.js +18 -5
- package/package.json +1 -1
- package/lib/package.json +0 -72
- package/lib/src/cli/init.d.ts.map +0 -1
- package/lib/src/cli/main.d.ts +0 -13
- package/lib/src/cli/main.d.ts.map +0 -1
- package/lib/src/cli/main.js +0 -16
- package/lib/src/cli/resource-builder.d.ts +0 -6
- package/lib/src/cli/resource-builder.d.ts.map +0 -1
- package/lib/src/cli/resource-builder.js +0 -191
- package/lib/src/cli/types.d.ts +0 -11
- package/lib/src/cli/types.d.ts.map +0 -1
- package/lib/src/cli/types.js +0 -1
- package/lib/src/events/event-system.d.ts +0 -13
- package/lib/src/events/event-system.d.ts.map +0 -1
- package/lib/src/events/event-system.js +0 -25
- package/lib/src/index.d.ts +0 -8
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js +0 -5
- package/lib/src/kit.d.ts +0 -67
- package/lib/src/kit.d.ts.map +0 -1
- package/lib/src/kit.js +0 -158
- package/lib/src/plugins/kit-plugin.d.ts +0 -27
- package/lib/src/plugins/kit-plugin.d.ts.map +0 -1
- package/lib/src/plugins/kit-plugin.js +0 -24
- package/lib/src/plugins/network/index.d.ts +0 -55
- package/lib/src/plugins/network/index.d.ts.map +0 -1
- package/lib/src/plugins/network/index.js +0 -101
- package/lib/src/types/shared-types.d.ts +0 -30
- package/lib/src/types/shared-types.d.ts.map +0 -1
- package/lib/src/types/shared-types.js +0 -1
- /package/lib/{src/cli → cli}/init.d.ts +0 -0
package/README.md
CHANGED
|
@@ -5,11 +5,33 @@
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
bun install -g @evitcastudio/kit
|
|
9
9
|
```
|
|
10
10
|
> **Note:** The `-g` flag ensures the `kit` CLI tool is globally available in your PATH.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Scaffolding a New Project
|
|
13
|
+
|
|
14
|
+
The `kit init` command provides an interactive walkthrough to quickly scaffold a new project for the Vylocity Game Engine.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Start the interactive walkthrough
|
|
18
|
+
kit init
|
|
19
|
+
|
|
20
|
+
# Or scaffold a project with flags
|
|
21
|
+
kit init <project-name> --single # For single-player
|
|
22
|
+
kit init <project-name> --multi # For multiplayer
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The command will create a structured directory for your project, including pre-configured `package.json`, essential Vylocity files, and a local development environment.
|
|
26
|
+
|
|
27
|
+
After scaffolding, follow these steps to get started:
|
|
28
|
+
1. `cd <project-name>`
|
|
29
|
+
2. `bun install`
|
|
30
|
+
3. `bun run build`
|
|
31
|
+
|
|
32
|
+
## Building the Project
|
|
33
|
+
|
|
34
|
+
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
13
35
|
|
|
14
36
|
The `kit build` command locates all Vylocity engine-related resources in your source directory, anonymizes them, and moves them to a deploy-ready output directory.
|
|
15
37
|
|
|
@@ -17,33 +39,74 @@ The `kit build` command locates all Vylocity engine-related resources in your so
|
|
|
17
39
|
kit build -i ./<in-dir> -o ./<out-dir>
|
|
18
40
|
```
|
|
19
41
|
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
```bash
|
|
43
|
+
# To learn more about this command
|
|
44
|
+
kit build --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Executing this command automatically generates a `resource.json` map in your project's directory.
|
|
48
|
+
**Best Practice:** Exclude `resource.json` from version control (`.gitignore`), as it is a build artifact.
|
|
22
49
|
|
|
23
50
|
## Runtime Resource Loading
|
|
24
51
|
|
|
25
|
-
>
|
|
26
|
-
> `Kit.setResources()` should be called **before** `VYLO.load()`.
|
|
52
|
+
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
27
53
|
|
|
28
|
-
>
|
|
29
|
-
> Depending on your build environment (e.g., webpack, vite, or bun), you may need specific loaders or assertions to import JSON natively.
|
|
54
|
+
> `Kit.setResources()` should be called **before** `VYLO.load()`.
|
|
30
55
|
|
|
31
56
|
```typescript
|
|
32
|
-
import resourceJSON from '
|
|
57
|
+
import resourceJSON from 'resource.json';
|
|
33
58
|
|
|
34
59
|
// Initialize the engine with mapped resources
|
|
35
60
|
await Kit.setResources(resourceJSON);
|
|
36
61
|
```
|
|
37
62
|
|
|
63
|
+
## Local Development & Testing
|
|
64
|
+
|
|
65
|
+
Once your project is scaffolded and dependencies are installed and the project has been built, you can run your game locally.
|
|
66
|
+
|
|
67
|
+
### Running the Game
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# For Single-Player or Multiplayer games
|
|
71
|
+
bun run host
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Accessing the Game
|
|
75
|
+
|
|
76
|
+
The server will be available at the following locations after being hosted:
|
|
77
|
+
|
|
78
|
+
> **Singleplayer**
|
|
79
|
+
[http://localhost:8090](http://localhost:8090) defined in `./bun-serve.ts`
|
|
80
|
+
|
|
81
|
+
> **Multiplayer or Singleplayer & Multiplayer**
|
|
82
|
+
[http://localhost:30000](http://localhost:30000) defined in `./src/server/settings.json`
|
|
83
|
+
|
|
84
|
+
|
|
38
85
|
## Plugin Architecture
|
|
39
86
|
|
|
40
87
|
```ts
|
|
41
88
|
import { Plugin } from 'custom-plugin';
|
|
42
89
|
|
|
90
|
+
// Register a single plugin
|
|
43
91
|
const plugin = Kit.registerPlugin(Plugin);
|
|
44
92
|
```
|
|
45
93
|
|
|
46
|
-
|
|
94
|
+
```ts
|
|
95
|
+
// Register multiple plugins
|
|
96
|
+
import { Plugin1 } from 'custom-plugin1';
|
|
97
|
+
import { Plugin2 } from 'custom-plugin2';
|
|
98
|
+
|
|
99
|
+
const plugins = Kit.registerPlugins([Plugin1, Plugin2]);
|
|
100
|
+
|
|
101
|
+
// After being registered, kit can find the plugin by name.
|
|
102
|
+
const plugin1 = Kit.getPlugin('plugin1-name');
|
|
103
|
+
const plugin2 = Kit.getPlugin('plugin2-name');
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Listening for plugin events
|
|
107
|
+
|
|
108
|
+
Plugins emit events, this is how they pass relevant data to other plugins or the main thread.
|
|
109
|
+
By listening to these events you can act on this data.
|
|
47
110
|
|
|
48
111
|
```js
|
|
49
112
|
const listener = (pEvent: EmitterEvent) => {
|
|
@@ -51,11 +114,11 @@ const listener = (pEvent: EmitterEvent) => {
|
|
|
51
114
|
// Here you can use the data that the event sent down.
|
|
52
115
|
}
|
|
53
116
|
|
|
54
|
-
//
|
|
55
|
-
Kit.on('
|
|
117
|
+
// Choose to listen to specific event from a plugin
|
|
118
|
+
Kit.on('plugin-name', 'event-name', listener);
|
|
56
119
|
|
|
57
120
|
// You can also stop listening for an event
|
|
58
|
-
Kit.off('
|
|
121
|
+
Kit.off('plugin-name', 'event-name', listener);
|
|
59
122
|
```
|
|
60
123
|
|
|
61
124
|
For more information check out the [wiki](https://github.com/EvitcaStudio/Kit/wiki)
|
package/lib/bundle/cli/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* @evitcastudio/kit@2.
|
|
5
|
-
* Compiled
|
|
4
|
+
* @evitcastudio/kit@2.3.0 git+https://github.com/EvitcaStudio/Kit.git
|
|
5
|
+
* Compiled Fri, 20 Mar 2026 17:27:39 UTC
|
|
6
6
|
* Copyright (c) 2026 Jared Bates, Evitca Studio, "doubleactii"
|
|
7
7
|
*
|
|
8
8
|
* @evitcastudio/kit is licensed under the MIT License.
|
|
@@ -3657,7 +3657,7 @@ import { spawnSync } from "node:child_process";
|
|
|
3657
3657
|
// package.json
|
|
3658
3658
|
var package_default = {
|
|
3659
3659
|
name: "@evitcastudio/kit",
|
|
3660
|
-
version: "2.
|
|
3660
|
+
version: "2.3.0",
|
|
3661
3661
|
author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
3662
3662
|
main: "./lib/index.js",
|
|
3663
3663
|
types: "./lib/index.d.ts",
|
|
@@ -3751,6 +3751,8 @@ function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
|
|
|
3751
3751
|
const destPath = path.join(pDest, file);
|
|
3752
3752
|
const stats = fs2.statSync(srcPath);
|
|
3753
3753
|
if (stats.isDirectory()) {
|
|
3754
|
+
if (file === ".git")
|
|
3755
|
+
continue;
|
|
3754
3756
|
copyTemplate(srcPath, destPath, pProjectName, pVersion, pAuthor);
|
|
3755
3757
|
} else {
|
|
3756
3758
|
const ext = path.extname(file).toLowerCase();
|
|
@@ -3844,6 +3846,15 @@ async function processInit(pOptions) {
|
|
|
3844
3846
|
} else {
|
|
3845
3847
|
copyTemplate(templatesDir, projectPath, projectName, package_default.version, author);
|
|
3846
3848
|
}
|
|
3849
|
+
try {
|
|
3850
|
+
spawnSync("git", ["init"], { cwd: projectPath });
|
|
3851
|
+
spawnSync("git", ["add", "."], { cwd: projectPath });
|
|
3852
|
+
spawnSync("git", ["commit", "-m", "Initial commit from Kit CLI"], {
|
|
3853
|
+
cwd: projectPath,
|
|
3854
|
+
env: { ...process.env, GIT_AUTHOR_NAME: author.split(" <")[0], GIT_AUTHOR_EMAIL: author.split("<")[1]?.slice(0, -1) || "" }
|
|
3855
|
+
});
|
|
3856
|
+
} catch {
|
|
3857
|
+
}
|
|
3847
3858
|
s.stop(`Project ${source_default.green(projectName)} created!`);
|
|
3848
3859
|
console.log(`${source_default.cyan("│")}`);
|
|
3849
3860
|
console.log(`${source_default.cyan("│")} ${source_default.white.bold("Next steps:")}`);
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
# kit-
|
|
1
|
+
# kit-multiplayer-template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is a multiplayer game template for the Vylocity Game Engine.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
bun install
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
To run:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bun run index.ts
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
This project was created using `bun init` in bun v1.1.42. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
5
|
+
More info coming soon.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"author": "{{PROJECT_AUTHOR}}",
|
|
5
|
+
"description": "",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"module": "src/index.ts",
|
|
7
8
|
"engines": {
|
|
8
9
|
"bun": ">=1.1.0"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
|
-
"@evitcastudio/kit": "
|
|
12
|
+
"@evitcastudio/kit": "latest"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@evitcastudio/copy-bun-plugin": "^1.0.4",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"typescript": "^5.7.2"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
|
-
"build": "kit build -v -i ./src/resources -o ./dist && bun bun-build.ts",
|
|
21
|
+
"build": "kit build -v -i ./src/resources -o ./dist && bun run bun-build.ts",
|
|
21
22
|
"host": "bun run build && cd dist && node server.js"
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
# kit-
|
|
1
|
+
# kit-single-player-template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is a single-player game template for the Vylocity Game Engine.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
bun install
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
To run:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bun run index.ts
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
This project was created using `bun init` in bun v1.1.42. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
5
|
+
More info coming soon.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { logMessage } from './bun-build.ts';
|
|
3
2
|
|
|
4
3
|
const server = Bun.serve({
|
|
@@ -12,12 +11,14 @@ const server = Bun.serve({
|
|
|
12
11
|
},
|
|
13
12
|
});
|
|
14
13
|
|
|
14
|
+
// signal interrupt event
|
|
15
15
|
process.on('SIGINT', () => {
|
|
16
16
|
logMessage('info', 'Shutting down server...');
|
|
17
17
|
server.stop();
|
|
18
18
|
process.exit(0);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
// signal termination event
|
|
21
22
|
process.on('SIGTERM', () => {
|
|
22
23
|
logMessage('info', 'Shutting down server...');
|
|
23
24
|
server.stop();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"author": "{{PROJECT_AUTHOR}}",
|
|
5
5
|
"description": "",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "kit build -v -i ./src/resources -o ./dist && bun run bun-build.ts",
|
|
13
|
-
"
|
|
13
|
+
"host": "bun run build && bun run bun-serve.ts"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@evitcastudio/kit": "
|
|
17
|
+
"@evitcastudio/kit": "latest"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@evitcastudio/copy-bun-plugin": "^1.0.4",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAgED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoItE"}
|
|
@@ -40,6 +40,8 @@ function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
|
|
|
40
40
|
const destPath = path.join(pDest, file);
|
|
41
41
|
const stats = fs.statSync(srcPath);
|
|
42
42
|
if (stats.isDirectory()) {
|
|
43
|
+
if (file === '.git')
|
|
44
|
+
continue; // Do not copy .git directories
|
|
43
45
|
copyTemplate(srcPath, destPath, pProjectName, pVersion, pAuthor);
|
|
44
46
|
}
|
|
45
47
|
else {
|
|
@@ -152,6 +154,18 @@ export async function processInit(pOptions) {
|
|
|
152
154
|
else {
|
|
153
155
|
copyTemplate(templatesDir, projectPath, projectName, packageJSON.version, author);
|
|
154
156
|
}
|
|
157
|
+
// Initialize git and create initial commit
|
|
158
|
+
try {
|
|
159
|
+
spawnSync('git', ['init'], { cwd: projectPath });
|
|
160
|
+
spawnSync('git', ['add', '.'], { cwd: projectPath });
|
|
161
|
+
spawnSync('git', ['commit', '-m', 'Initial commit from Kit CLI'], {
|
|
162
|
+
cwd: projectPath,
|
|
163
|
+
env: { ...process.env, GIT_AUTHOR_NAME: author.split(' <')[0], GIT_AUTHOR_EMAIL: author.split('<')[1]?.slice(0, -1) || '' }
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Silently fail if git is not installed or config is missing
|
|
168
|
+
}
|
|
155
169
|
s.stop(`Project ${chalk.green(projectName)} created!`);
|
|
156
170
|
console.log(`${chalk.cyan('│')}`);
|
|
157
171
|
console.log(`${chalk.cyan('│')} ${chalk.white.bold('Next steps:')}`);
|
package/lib/cli/main.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ProcessOptions } from './types';
|
|
2
|
+
import { type InitOptions } from './init';
|
|
2
3
|
export declare class KitCLI {
|
|
3
4
|
/**
|
|
4
5
|
* Start resource builder.
|
|
5
6
|
*/
|
|
6
7
|
static processResources(pProcessOptions: ProcessOptions): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Start project initialization.
|
|
10
|
+
*/
|
|
11
|
+
static init(pInitOptions: InitOptions): Promise<void>;
|
|
7
12
|
}
|
|
8
13
|
//# sourceMappingURL=main.d.ts.map
|
package/lib/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEvD,qBAAa,MAAM;IACf;;OAEG;WACU,gBAAgB,CAAC,eAAe,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E;;OAEG;WACU,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG9D"}
|
package/lib/cli/main.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { processResources } from './resource-builder';
|
|
2
|
+
import { processInit } from './init';
|
|
2
3
|
export class KitCLI {
|
|
3
4
|
/**
|
|
4
5
|
* Start resource builder.
|
|
@@ -6,4 +7,10 @@ export class KitCLI {
|
|
|
6
7
|
static async processResources(pProcessOptions) {
|
|
7
8
|
await processResources(pProcessOptions);
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Start project initialization.
|
|
12
|
+
*/
|
|
13
|
+
static async init(pInitOptions) {
|
|
14
|
+
await processInit(pInitOptions);
|
|
15
|
+
}
|
|
9
16
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Kit } from './kit';
|
|
2
2
|
export { EventEmitter } from './events/event-system';
|
|
3
3
|
export type { EmitterEvent, ResourceData, Listener, KitPluginConstructor } from './types/shared-types';
|
|
4
|
-
export type { Client, Diob
|
|
4
|
+
export type { Client, Diob } from './types/vylo';
|
|
5
5
|
export { KitPlugin } from './plugins/kit-plugin';
|
|
6
6
|
export { Network } from './plugins/network';
|
|
7
7
|
export type { NetworkListener } from './plugins/network';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACvG,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACvG,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -25,6 +25,13 @@ export declare class Network extends KitPlugin {
|
|
|
25
25
|
* @param pPacketName - The name of the packet that will be listened to.
|
|
26
26
|
* @param pListener - The listener that will be called when the packet is received.
|
|
27
27
|
*/
|
|
28
|
+
onPacket<T extends unknown[]>(pPacketName: string, pListener: NetworkListener<T>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Register a listener for a packet.
|
|
31
|
+
* @deprecated Use `onPacket` instead.
|
|
32
|
+
* @param pPacketName - The name of the packet that will be listened to.
|
|
33
|
+
* @param pListener - The listener that will be called when the packet is received.
|
|
34
|
+
*/
|
|
28
35
|
on<T extends unknown[]>(pPacketName: string, pListener: NetworkListener<T>): void;
|
|
29
36
|
/**
|
|
30
37
|
* API for receiving data from the server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtG,qBAAa,OAAQ,SAAQ,SAAS;IAClC,IAAI,SAAa;IACjB;;OAEG;IACH,OAAO,CAAC,SAAS,CAAkB;IACnC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAkC;IACjD;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,YAAY,IAAI,IAAI;IAGpB;;OAEG;IACH,OAAO,CAAC,SAAS,CAAiD;IAClE;;;;OAIG;IACH,EAAE,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtG,qBAAa,OAAQ,SAAQ,SAAS;IAClC,IAAI,SAAa;IACjB;;OAEG;IACH,OAAO,CAAC,SAAS,CAAkB;IACnC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAkC;IACjD;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,YAAY,IAAI,IAAI;IAGpB;;OAEG;IACH,OAAO,CAAC,SAAS,CAAiD;IAClE;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;IAOvF;;;;;OAKG;IACH,EAAE,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;IAGjF;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,GAAE,OAAO,EAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI;IA+BzG;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IASlD;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAOrD"}
|
|
@@ -25,12 +25,21 @@ export class Network extends KitPlugin {
|
|
|
25
25
|
* @param pPacketName - The name of the packet that will be listened to.
|
|
26
26
|
* @param pListener - The listener that will be called when the packet is received.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
onPacket(pPacketName, pListener) {
|
|
29
29
|
if (!this.packets.has(pPacketName)) {
|
|
30
30
|
throw new Error(`Packet name '${pPacketName}' is not registered.`);
|
|
31
31
|
}
|
|
32
32
|
this.listeners.set(pPacketName, pListener);
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Register a listener for a packet.
|
|
36
|
+
* @deprecated Use `onPacket` instead.
|
|
37
|
+
* @param pPacketName - The name of the packet that will be listened to.
|
|
38
|
+
* @param pListener - The listener that will be called when the packet is received.
|
|
39
|
+
*/
|
|
40
|
+
on(pPacketName, pListener) {
|
|
41
|
+
this.onPacket(pPacketName, pListener);
|
|
42
|
+
}
|
|
34
43
|
/**
|
|
35
44
|
* API for receiving data from the server.
|
|
36
45
|
* @param pClient - The client involved with this packet.
|
|
@@ -44,19 +53,23 @@ export class Network extends KitPlugin {
|
|
|
44
53
|
if (typeof pPacketName === 'number') {
|
|
45
54
|
const packetName = this.reversedPacketMap.get(pPacketName);
|
|
46
55
|
if (!packetName) {
|
|
47
|
-
|
|
56
|
+
if (pVerbose) {
|
|
57
|
+
console.group(`Kit.${this.name}Plugin.onNetwork`);
|
|
58
|
+
console.warn(`Unknown packet index: ${pPacketName}`);
|
|
59
|
+
console.groupEnd();
|
|
60
|
+
}
|
|
48
61
|
return;
|
|
49
62
|
}
|
|
50
63
|
const listener = this.listeners.get(packetName);
|
|
51
64
|
if (pVerbose) {
|
|
52
65
|
console.group(`Kit.${this.name}Plugin.onNetwork`);
|
|
66
|
+
if (!listener) {
|
|
67
|
+
console.warn(`No listener was registered for this packet: ${packetName}`);
|
|
68
|
+
}
|
|
53
69
|
console.log(`Packet name: ${pPacketName}`);
|
|
54
70
|
console.log(`Resolved packet name: ${packetName}`);
|
|
55
71
|
console.log(`Data:`, pData);
|
|
56
72
|
console.groupEnd();
|
|
57
|
-
if (!listener) {
|
|
58
|
-
console.warn(`No listener registered for packet: ${packetName}`);
|
|
59
|
-
}
|
|
60
73
|
}
|
|
61
74
|
listener?.(pClient, ...pData);
|
|
62
75
|
}
|
package/package.json
CHANGED
package/lib/package.json
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@evitcastudio/kit",
|
|
3
|
-
"version": "2.2.0",
|
|
4
|
-
"author": "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"types": "./lib/index.d.ts",
|
|
7
|
-
"module": "./lib/index.js",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./lib/index.js",
|
|
12
|
-
"types": "./lib/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"description": "A single-player/multiplayer framework for the Vylocity Game Engine.",
|
|
16
|
-
"cli-description": "The ultimate toolkit for Vylocity game development.",
|
|
17
|
-
"keywords": [
|
|
18
|
-
"framework",
|
|
19
|
-
"multiplayer",
|
|
20
|
-
"single-player",
|
|
21
|
-
"toolkit",
|
|
22
|
-
"kit",
|
|
23
|
-
"vylocity"
|
|
24
|
-
],
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/EvitcaStudio/Kit.git"
|
|
28
|
-
},
|
|
29
|
-
"bugs": {
|
|
30
|
-
"url": "https://github.com/EvitcaStudio/Kit/issues"
|
|
31
|
-
},
|
|
32
|
-
"homepage": "https://github.com/EvitcaStudio/Kit",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"scripts": {
|
|
35
|
-
"prepare": "bun run build-all",
|
|
36
|
-
"prepublishOnly": "bun run build-types && bun run build",
|
|
37
|
-
"test": "bun test",
|
|
38
|
-
"lint": "bun eslint ./src",
|
|
39
|
-
"pack": "bun pm pack --dry-run",
|
|
40
|
-
"build-types": "bun tsc && shx cp ./src/types/vylo.d.ts ./lib/types/vylo.d.ts",
|
|
41
|
-
"build": "bun bun-build.ts",
|
|
42
|
-
"build-docs": "bun typedoc",
|
|
43
|
-
"build-all": "bun run build-types && bun run build && bun run build-docs"
|
|
44
|
-
},
|
|
45
|
-
"bin": {
|
|
46
|
-
"kit": "lib/bundle/cli/cli.js"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@eslint/create-config": "1.4.0",
|
|
50
|
-
"@eslint/js": "^9.17.0",
|
|
51
|
-
"@types/bun": "latest",
|
|
52
|
-
"@types/node": "^22.10.2",
|
|
53
|
-
"bun": "^1.1.42",
|
|
54
|
-
"eslint": "^9.17.0",
|
|
55
|
-
"globals": "^15.14.0",
|
|
56
|
-
"shx": "^0.3.4",
|
|
57
|
-
"typedoc": "^0.27.5",
|
|
58
|
-
"typescript": "^5.7.2",
|
|
59
|
-
"typescript-eslint": "^8.19.0"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"chalk": "^5.4.0",
|
|
63
|
-
"commander": "^12.1.0",
|
|
64
|
-
"uuid": "^11.0.3"
|
|
65
|
-
},
|
|
66
|
-
"directories": {
|
|
67
|
-
"test": "tests"
|
|
68
|
-
},
|
|
69
|
-
"files": [
|
|
70
|
-
"/lib"
|
|
71
|
-
]
|
|
72
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/init.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AA+DD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAwHtE"}
|
package/lib/src/cli/main.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ProcessOptions } from './types';
|
|
2
|
-
import { type InitOptions } from './init';
|
|
3
|
-
export declare class KitCLI {
|
|
4
|
-
/**
|
|
5
|
-
* Start resource builder.
|
|
6
|
-
*/
|
|
7
|
-
static processResources(pProcessOptions: ProcessOptions): Promise<void>;
|
|
8
|
-
/**
|
|
9
|
-
* Start project initialization.
|
|
10
|
-
*/
|
|
11
|
-
static init(pInitOptions: InitOptions): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEvD,qBAAa,MAAM;IACf;;OAEG;WACU,gBAAgB,CAAC,eAAe,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E;;OAEG;WACU,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG9D"}
|
package/lib/src/cli/main.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { processResources } from './resource-builder';
|
|
2
|
-
import { processInit } from './init';
|
|
3
|
-
export class KitCLI {
|
|
4
|
-
/**
|
|
5
|
-
* Start resource builder.
|
|
6
|
-
*/
|
|
7
|
-
static async processResources(pProcessOptions) {
|
|
8
|
-
await processResources(pProcessOptions);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Start project initialization.
|
|
12
|
-
*/
|
|
13
|
-
static async init(pInitOptions) {
|
|
14
|
-
await processInit(pInitOptions);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ProcessOptions } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Main entry point for building resources.
|
|
4
|
-
*/
|
|
5
|
-
export declare function processResources({ inDirectory, outDirectory, verbose, ignoreSound }: ProcessOptions): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=resource-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource-builder.d.ts","sourceRoot":"","sources":["../../../src/cli/resource-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA+K9C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzH"}
|