@evitcastudio/kit 3.3.2 → 3.5.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 +209 -127
- package/lib/bundle/cli/cli.js +35 -28
- package/lib/bundle/cli/kit-game-templates/multi/dist/src/client/index.js +286 -0
- package/lib/bundle/cli/kit-game-templates/multi/src/client/index.ts +1 -1
- package/lib/cli/app-bundler.d.ts.map +1 -1
- package/lib/cli/app-bundler.js +18 -4
- package/lib/events/event-system.d.ts +2 -3
- package/lib/events/event-system.d.ts.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/kit.d.ts +5 -5
- package/lib/kit.d.ts.map +1 -1
- package/lib/kit.js +10 -5
- package/lib/plugins/camera/index.d.ts +3 -0
- package/lib/plugins/camera/index.d.ts.map +1 -0
- package/lib/plugins/camera/index.js +2 -0
- package/lib/plugins/kit-plugin.d.ts +1 -1
- package/lib/plugins/kit-plugin.d.ts.map +1 -1
- package/lib/types/shared-types.d.ts +8 -3
- package/lib/types/shared-types.d.ts.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,27 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./evitcastudio_round_branding.png" width="128" height="128" alt="Evitca Studio Logo" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">@evitcastudio/kit</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
A lightweight, extensible framework and developer toolkit for the Vylocity Game Engine.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@evitcastudio/kit"><img src="https://img.shields.io/npm/v/@evitcastudio/kit.svg?color=10b981" alt="npm version" /></a>
|
|
13
|
+
<a href="https://github.com/EvitcaStudio/Kit/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License" /></a>
|
|
14
|
+
<a href="https://github.com/EvitcaStudio/Kit"><img src="https://img.shields.io/badge/TypeScript-Ready-3178c6.svg" alt="TypeScript" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Modular Plugin Architecture**: Centralized service locator (`Kit.registerPlugin`, `Kit.getPlugin`) with lifecycle hooks and a decoupled typed event bus (`Kit.on`, `Kit.off`).
|
|
22
|
+
- **Official Plugins Included**:
|
|
23
|
+
- **`Camera` (Lens)**: 5 specialized camera types (`Follow`, `Pan`, `Spectate`, `Influence`, `Transition`), 29 shake presets, smooth zoom, zero-pop transitions, and native 2D canvas debug overlays.
|
|
24
|
+
- **`Network`**: Structured client-server packet communication with registered names and automatic indexing for bandwidth optimization.
|
|
25
|
+
- **Developer CLI (`kit`)**:
|
|
26
|
+
- **`kit init`**: Interactive scaffolding for Singleplayer and Multiplayer game templates.
|
|
27
|
+
- **`kit build`**: Zero-config compilation, asset hashing (`.vyr`), metadata manifest generation, and production minification/obfuscation.
|
|
28
|
+
- **`kit host`**: Built-in local HTTP and game server hosting with hot-reloading and LAN network URLs.
|
|
29
|
+
- **`kit create`**: Instant boilerplate generator for typed plugins.
|
|
30
|
+
- **`kit doctor`**: Comprehensive environment and project health diagnostics.
|
|
31
|
+
- **Smart Asset Pipeline**: Fast hashing, automatic passthrough for subdirectories, and automatic metadata manifest generation (`resource.json`, `bounds.json`, `sizes.json`, `icon-points.json`).
|
|
32
|
+
- **Zero-Config TypeScript**: Powered by Bun for blazing fast bundling, incremental watch mode, and complete type safety.
|
|
33
|
+
|
|
34
|
+
---
|
|
4
35
|
|
|
5
36
|
## Installation
|
|
6
37
|
|
|
7
38
|
```bash
|
|
39
|
+
# Global CLI installation (recommended)
|
|
8
40
|
bun install -g @evitcastudio/kit
|
|
41
|
+
|
|
42
|
+
# Or as a project dependency
|
|
43
|
+
bun add @evitcastudio/kit
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quickstart
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 1. Initialize a new project
|
|
52
|
+
kit init my-game --single --install
|
|
53
|
+
|
|
54
|
+
# 2. Build game and assets
|
|
55
|
+
cd my-game && kit build
|
|
56
|
+
|
|
57
|
+
# 3. Host locally
|
|
58
|
+
kit host
|
|
9
59
|
```
|
|
10
|
-
|
|
60
|
+
|
|
61
|
+
Your game will immediately be accessible at `http://localhost:8090` (or `http://localhost:30000` for multiplayer).
|
|
62
|
+
|
|
63
|
+
---
|
|
11
64
|
|
|
12
65
|
## CLI Reference & Usage
|
|
13
66
|
|
|
14
|
-
Kit includes
|
|
67
|
+
Kit includes the `kit` CLI for scaffolding, asset compilation, boilerplate generation, and local testing.
|
|
15
68
|
|
|
16
69
|
### Global Options
|
|
17
70
|
- `-v, --verbose`: Enables verbose output and detailed debugging logs.
|
|
18
|
-
- `-h, --help`: Displays help and usage information
|
|
71
|
+
- `-h, --help`: Displays help and usage information.
|
|
19
72
|
- `-V, --version`: Displays the installed Kit CLI version.
|
|
20
73
|
|
|
21
74
|
---
|
|
22
75
|
|
|
23
76
|
### `kit init [name]`
|
|
24
|
-
Initializes a new game project
|
|
77
|
+
Initializes a new game project. Run without arguments for an interactive setup prompt.
|
|
25
78
|
|
|
26
79
|
```bash
|
|
27
80
|
# Interactive setup
|
|
@@ -31,195 +84,224 @@ kit init
|
|
|
31
84
|
kit init my-game --single --install
|
|
32
85
|
```
|
|
33
86
|
|
|
34
|
-
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
| `
|
|
38
|
-
| `-
|
|
39
|
-
| `-
|
|
40
|
-
| `-
|
|
41
|
-
| `-i, --install` | `boolean` | `false` | Automatically runs `bun install` inside the new project directory after creation. |
|
|
87
|
+
| Option | Description | Default |
|
|
88
|
+
| :--- | :--- | :--- |
|
|
89
|
+
| `[name]` | Project folder name. | `kit-project` |
|
|
90
|
+
| `-s, --single` | Scaffolds a single-player game template. | `false` |
|
|
91
|
+
| `-m, --multi` | Scaffolds a multiplayer game template. | `false` |
|
|
92
|
+
| `-f, --force` | Overwrites destination folder if it already exists. | `false` |
|
|
93
|
+
| `-i, --install` | Automatically runs `bun install` after scaffolding. | `false` |
|
|
42
94
|
|
|
43
95
|
---
|
|
44
96
|
|
|
45
97
|
### `kit build`
|
|
46
|
-
|
|
98
|
+
Compiles TypeScript application code to `dist/`, hashes raw assets into unique identifiers (`.vyr`), mirrors asset subdirectories, and generates metadata manifests.
|
|
47
99
|
|
|
48
100
|
```bash
|
|
49
|
-
# Zero-config build (auto-detects project architecture
|
|
101
|
+
# Zero-config build (auto-detects project architecture)
|
|
50
102
|
kit build
|
|
51
103
|
|
|
52
|
-
#
|
|
53
|
-
kit build -p
|
|
54
|
-
|
|
55
|
-
# Watch mode: auto-rebuilds on source or resource changes
|
|
104
|
+
# Watch mode (incremental rebuilds on source or resource changes)
|
|
56
105
|
kit build --watch
|
|
57
106
|
|
|
58
|
-
#
|
|
59
|
-
kit build -
|
|
60
|
-
|
|
61
|
-
# Save the resource manifest to a custom location
|
|
62
|
-
kit build --manifest ./dist/resource.json
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### Flags & Options:
|
|
66
|
-
| Flag / Option | Type | Required | Default | Description |
|
|
67
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
68
|
-
| `-i, --in <path>` | `string` | No | `./src/resources` | Input directory containing raw game assets (`.vyi`, `.vym`, `.vyint`, audio, etc.). |
|
|
69
|
-
| `-o, --out <path>` | `string` | No | `./dist` | Destination directory where processed `resources/` and bundled app files will be written. |
|
|
70
|
-
| `-m, --manifest <path>` | `string` | No | `./resource.json` | Path where the resource lookup JSON should be saved. If omitted, defaults to `./resource.json` in the current working directory. |
|
|
71
|
-
| `-w, --watch` | `boolean` | No | `false` | Watches the source and resource directories for changes and triggers automatic incremental rebuilds. |
|
|
72
|
-
| `-is, --ignore-sound` | `boolean` | No | `false` | Skips processing and copying sound and music files (`.mp3`, `.ogg`, `.wav`, etc.). |
|
|
73
|
-
| `-p, --prod` | `boolean` | No | `false` | Production mode: enables full minification, identifier obfuscation/mangling, and strips sourcemaps. |
|
|
74
|
-
| `--minify` | `boolean` | No | `false` | Minifies bundled JavaScript syntax, whitespace, and variable names. |
|
|
75
|
-
| `--obfuscate` | `boolean` | No | `false` | Mangles and obfuscates identifiers across bundled output. |
|
|
76
|
-
| `--sourcemap <mode>` | `string` | No | `linked` (`none` in prod) | Sourcemap mode (`none`, `linked`, `inline`, `external`). |
|
|
77
|
-
| `--app` / `--no-app` | `boolean` | No | `true` (auto) | Toggles application code bundling. Enabled automatically if `src/index.ts` or `src/client/index.ts` exists. |
|
|
78
|
-
|
|
79
|
-
#### What is the Resource Manifest (`resource.json`)?
|
|
80
|
-
A manifest is an index or lookup table. `kit build` obfuscates asset names into unique identifiers (`uuid.vyr`) as a security benefit to protect and hide original asset filenames in production. It generates `resource.json` mapping your original human-readable asset names to their engine identifiers:
|
|
81
|
-
```json
|
|
82
|
-
{
|
|
83
|
-
"icon": [
|
|
84
|
-
{
|
|
85
|
-
"fileName": "player.vyi",
|
|
86
|
-
"resourceIdentifier": "3cf72322-6b92-4ea5-bbca-b96fae1fe440.vyr"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"map": [ ... ],
|
|
90
|
-
"sound": [ ... ]
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
#### Custom Asset Subdirectories (Automatic Pass-Through)
|
|
95
|
-
Any subdirectories inside your resource folder (e.g. `src/resources/images`, `src/resources/fonts`, `src/resources/emitters`, `src/resources/particles`, etc.) are automatically mirrored to `<out>/resources/<folder>/`. Non-engine files remain in their original form.
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
### `kit create <type> <name>`
|
|
100
|
-
Scaffolds boilerplate files inside an existing Kit project following standard architectural conventions.
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# Generate a typed plugin
|
|
104
|
-
kit create plugin Inventory
|
|
107
|
+
# Production build (minified, obfuscated identifiers, stripped sourcemaps)
|
|
108
|
+
kit build -p
|
|
105
109
|
```
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
| Option | Description | Default |
|
|
112
|
+
| :--- | :--- | :--- |
|
|
113
|
+
| `-i, --in <path>` | Input resource directory containing raw game assets. | `./src/resources` |
|
|
114
|
+
| `-o, --out <path>` | Output directory for processed assets and bundled code. | `./dist` |
|
|
115
|
+
| `-m, --manifest <path>` | Custom destination path for `resource.json`. | `./resource.json` |
|
|
116
|
+
| `-w, --watch` | Watches source and resource folders for auto-rebuilding. | `false` |
|
|
117
|
+
| `-p, --prod` | Production mode (minification, mangled identifiers, no maps). | `false` |
|
|
118
|
+
| `--minify` / `--obfuscate` | Granular syntax minification or identifier mangling. | `false` |
|
|
119
|
+
| `--sourcemap <mode>` | Sourcemap mode (`none`, `linked`, `inline`, `external`). | `linked` |
|
|
120
|
+
| `--app` / `--no-app` | Toggles application code bundling. | `true` |
|
|
121
|
+
|
|
122
|
+
#### Generated Metadata Manifests
|
|
123
|
+
During build, Kit produces optimized metadata indices in your project:
|
|
124
|
+
- **`resource.json`**: Maps original human-readable asset filenames to obfuscated engine identifiers (`uuid.vyr`).
|
|
125
|
+
- **`bounds.json` & `sizes.json`**: Pre-calculated collision boundaries and dimensions for icons and tiles.
|
|
126
|
+
- **`icon-points.json`**: Defined anchor points and equipment attachment coordinates for sprites.
|
|
109
127
|
|
|
110
128
|
---
|
|
111
129
|
|
|
112
130
|
### `kit host`
|
|
113
|
-
Hosts
|
|
131
|
+
Hosts your compiled game project locally for browser or multiplayer testing.
|
|
114
132
|
|
|
115
133
|
```bash
|
|
116
|
-
# Host
|
|
134
|
+
# Host dist folder on default port 8090
|
|
117
135
|
kit host
|
|
118
136
|
|
|
119
137
|
# Build before hosting and specify custom port
|
|
120
138
|
kit host -b -p 8080
|
|
121
139
|
```
|
|
122
140
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
141
|
+
| Option | Description | Default |
|
|
142
|
+
| :--- | :--- | :--- |
|
|
143
|
+
| `-p, --port <number>` | Port to bind the server to. | `8090` |
|
|
144
|
+
| `-d, --dir <path>` | Directory of built files to serve. | `./dist` |
|
|
145
|
+
| `-b, --build` | Runs `kit build` prior to starting server. | `false` |
|
|
127
146
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### `kit create <type> <name>`
|
|
150
|
+
Scaffolds typed boilerplate into an existing Kit project.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
kit create plugin Inventory
|
|
154
|
+
```
|
|
155
|
+
Generates `src/plugins/inventory.ts` subclassing `KitPlugin` with lifecycle hooks ready to extend.
|
|
131
156
|
|
|
132
157
|
---
|
|
133
158
|
|
|
134
159
|
### `kit doctor`
|
|
135
|
-
Inspects your local environment and
|
|
160
|
+
Inspects your local environment and project health (Bun runtime, Git availability, `package.json`, project architecture, and build pipeline).
|
|
136
161
|
|
|
137
162
|
```bash
|
|
138
163
|
kit doctor
|
|
139
164
|
```
|
|
140
165
|
|
|
141
|
-
#### What it checks:
|
|
142
|
-
- **Bun Runtime:** Verifies that Bun is installed and detects the version.
|
|
143
|
-
- **Git Installation:** Verifies that Git is accessible in your `PATH`.
|
|
144
|
-
- **Project Structure:** If executed within a game project, checks `package.json`, `@evitcastudio/kit` framework dependencies, and asset folders (`src/resources`).
|
|
145
|
-
- **Project Architecture:** Detects whether the project is **Singleplayer** (`src/index.ts`), **Multiplayer** (`src/client` & `src/server`), or **Dedicated Server**.
|
|
146
|
-
- **Build Pipeline:** Verifies that a valid build pipeline is configured (either native `kit build` in `package.json` or legacy `bun-build.ts`).
|
|
147
|
-
|
|
148
166
|
---
|
|
149
167
|
|
|
150
168
|
## Runtime Resource Loading
|
|
151
169
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`Kit.setResources()` should be called **before** `VYLO.load()`.
|
|
170
|
+
`Kit.setResources()` loads the generated `resource.json` manifest into the Vylocity engine prior to calling `VYLO.load()`:
|
|
155
171
|
|
|
156
172
|
```typescript
|
|
157
173
|
import resourceJSON from 'resource.json';
|
|
158
174
|
|
|
159
|
-
// Initialize
|
|
175
|
+
// Initialize engine with mapped resource identifiers
|
|
160
176
|
await Kit.setResources(resourceJSON);
|
|
177
|
+
await VYLO.load();
|
|
161
178
|
```
|
|
162
179
|
|
|
180
|
+
---
|
|
163
181
|
|
|
164
|
-
##
|
|
182
|
+
## Plugins
|
|
165
183
|
|
|
166
|
-
|
|
184
|
+
Kit features a modular plugin architecture. Plugins register via `Kit.registerPlugin()`, are retrievable globally through `Kit.getPlugin(name)`, and communicate across decoupled systems using Kit's typed event bus.
|
|
167
185
|
|
|
168
|
-
|
|
186
|
+
```typescript
|
|
187
|
+
import { Kit } from '@evitcastudio/kit';
|
|
188
|
+
import { CustomPlugin } from 'custom-plugin';
|
|
169
189
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
190
|
+
// Register with Kit
|
|
191
|
+
const plugin = Kit.registerPlugin(CustomPlugin);
|
|
192
|
+
|
|
193
|
+
// Retrieve anywhere by plugin name
|
|
194
|
+
const plugin = Kit.getPlugin<CustomPlugin>('CustomPlugin');
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### Official Plugins
|
|
200
|
+
|
|
201
|
+
#### 1. Camera Plugin (`Camera` / `@evitcastudio/lens`)
|
|
202
|
+
High-performance 2D camera system powered by [`@evitcastudio/lens`](https://github.com/EvitcaStudio/Lens). Supports 5 specialized camera types, 29 shake presets, smooth zoom, zero-pop transitions, native canvas debug overlays, and automatic event dispatching.
|
|
203
|
+
|
|
204
|
+
##### Setup & Quickstart
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
import { Kit, Camera } from '@evitcastudio/kit';
|
|
208
|
+
|
|
209
|
+
// 1. Register with Kit (indexes under name 'Camera')
|
|
210
|
+
const camera = Kit.registerPlugin(Camera);
|
|
211
|
+
|
|
212
|
+
// 2. Track player entity with smooth lerping & deadzone
|
|
213
|
+
camera.createFollowCamera('main', playerMob, {
|
|
214
|
+
lerp: 0.1,
|
|
215
|
+
deadzone: { width: 64, height: 64 }
|
|
216
|
+
});
|
|
173
217
|
```
|
|
174
218
|
|
|
175
|
-
|
|
219
|
+
##### Seamless Transitions
|
|
220
|
+
Blend smoothly between cameras or targets with Hermite spline interpolation and spring-damping (zero visual pop):
|
|
176
221
|
|
|
177
|
-
|
|
222
|
+
```typescript
|
|
223
|
+
await camera.switchTo(bossCamera, {
|
|
224
|
+
duration: 800,
|
|
225
|
+
smoothing: 'smoothDamp', // or 'cubicSpline'
|
|
226
|
+
springTension: 170,
|
|
227
|
+
springFriction: 26
|
|
228
|
+
});
|
|
229
|
+
```
|
|
178
230
|
|
|
179
|
-
|
|
180
|
-
|
|
231
|
+
##### Screen Shake & Zoom
|
|
232
|
+
```typescript
|
|
233
|
+
// Trigger built-in presets or infinite ambient shakes
|
|
234
|
+
camera.shakePreset('explosion-large');
|
|
235
|
+
camera.shakePreset('rumble', undefined, true);
|
|
181
236
|
|
|
182
|
-
|
|
183
|
-
|
|
237
|
+
// Smooth zoom animations with 30+ easing equations
|
|
238
|
+
camera.zoom(2, 500, 'easeOutCubic');
|
|
239
|
+
camera.zoom(1, 400, 'easeInOutQuad'); // Reset
|
|
240
|
+
```
|
|
184
241
|
|
|
242
|
+
##### Camera Event Bus
|
|
243
|
+
All camera lifecycle events automatically dispatch to Kit's global event bus (`Kit.on`), allowing audio, gamepad vibration, or UI systems to decouple from camera logic:
|
|
185
244
|
|
|
186
|
-
|
|
245
|
+
```typescript
|
|
246
|
+
Kit.on('Camera', 'shake-start', (event) => {
|
|
247
|
+
console.log('Camera shaking:', event.data.preset);
|
|
248
|
+
});
|
|
187
249
|
|
|
188
|
-
|
|
189
|
-
|
|
250
|
+
Kit.on('Camera', 'transition-start', () => {
|
|
251
|
+
// e.g. animate cinematic bars
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
##### Native Debug Overlay & Gizmos
|
|
256
|
+
Built-in 2D canvas overlay for debugging cameras, bounds, target vectors, and crosshairs:
|
|
190
257
|
|
|
191
|
-
|
|
192
|
-
|
|
258
|
+
```typescript
|
|
259
|
+
camera.setDebugMode({
|
|
260
|
+
enabled: true,
|
|
261
|
+
showCameraMarkers: true,
|
|
262
|
+
showTargetLines: true,
|
|
263
|
+
showBounds: true,
|
|
264
|
+
showCenterCrosshair: true,
|
|
265
|
+
bounds: { minX: 0, maxX: 2000, minY: 0, maxY: 2000 }
|
|
266
|
+
});
|
|
193
267
|
```
|
|
194
268
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
#### 2. Network Plugin (`Network`)
|
|
272
|
+
Handles client-server packet communication with registered packet names, automatic indexing, and minimal bandwidth usage.
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
import { Kit, Network } from '@evitcastudio/kit';
|
|
199
276
|
|
|
200
|
-
const
|
|
277
|
+
const network = Kit.registerPlugin(Network);
|
|
201
278
|
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
|
|
279
|
+
// Client-side: register server packet definitions & listen
|
|
280
|
+
network.registerPackets(['CHAT_MESSAGE', 'PLAYER_HEAL'] as const);
|
|
281
|
+
|
|
282
|
+
network.on('CHAT_MESSAGE', (client, senderName, message) => {
|
|
283
|
+
console.log(`[${senderName}]: ${message}`);
|
|
284
|
+
});
|
|
205
285
|
```
|
|
206
286
|
|
|
207
|
-
|
|
287
|
+
---
|
|
208
288
|
|
|
209
|
-
|
|
210
|
-
By listening to these events you can act on this data.
|
|
289
|
+
### Plugin Events
|
|
211
290
|
|
|
212
|
-
|
|
213
|
-
const listener = (pEvent: EmitterEvent) => {
|
|
214
|
-
const { data, timestamp } = pEvent;
|
|
215
|
-
// Here you can use the data that the event sent down.
|
|
216
|
-
}
|
|
291
|
+
Plugins can emit and listen to events across the entire application:
|
|
217
292
|
|
|
218
|
-
|
|
219
|
-
|
|
293
|
+
```typescript
|
|
294
|
+
// Listen for an event from any plugin
|
|
295
|
+
Kit.on('plugin-name', 'event-name', (event) => {
|
|
296
|
+
console.log(event.data, event.timestamp);
|
|
297
|
+
});
|
|
220
298
|
|
|
221
|
-
//
|
|
299
|
+
// Remove listener
|
|
222
300
|
Kit.off('plugin-name', 'event-name', listener);
|
|
223
301
|
```
|
|
224
302
|
|
|
225
|
-
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
MIT © [Evitca Studio](https://evitcastudio.com) & [doubleactii](https://github.com/doubleactii)
|
package/lib/bundle/cli/cli.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
/*!
|
|
5
|
-
* @evitcastudio/kit@3.
|
|
6
|
-
* Compiled
|
|
5
|
+
* @evitcastudio/kit@3.5.0 git+https://github.com/EvitcaStudio/Kit.git
|
|
6
|
+
* Compiled Fri, 11 Sep 2026 04:24:00 UTC
|
|
7
7
|
* Copyright (c) 2026 Jared Bates, Evitca Studio, "doubleactii"
|
|
8
8
|
*
|
|
9
9
|
* @evitcastudio/kit is licensed under the MIT License.
|
|
@@ -1943,7 +1943,7 @@ var {
|
|
|
1943
1943
|
|
|
1944
1944
|
// src/cli/resource-builder.ts
|
|
1945
1945
|
import { promises as fs2, existsSync as existsSync2 } from "fs";
|
|
1946
|
-
import { join as join4, extname as extname3, basename as basename3, resolve as
|
|
1946
|
+
import { join as join4, extname as extname3, basename as basename3, resolve as resolve4, relative as relative3 } from "path";
|
|
1947
1947
|
|
|
1948
1948
|
// node_modules/chokidar/index.js
|
|
1949
1949
|
import { EventEmitter } from "events";
|
|
@@ -3609,17 +3609,11 @@ function v4(options, buf, offset) {
|
|
|
3609
3609
|
return native_default.randomUUID();
|
|
3610
3610
|
}
|
|
3611
3611
|
options = options || {};
|
|
3612
|
-
const rnds = options.random
|
|
3613
|
-
if (rnds.length < 16) {
|
|
3614
|
-
throw new Error("Random bytes length must be >= 16");
|
|
3615
|
-
}
|
|
3612
|
+
const rnds = options.random || (options.rng || rng)();
|
|
3616
3613
|
rnds[6] = rnds[6] & 15 | 64;
|
|
3617
3614
|
rnds[8] = rnds[8] & 63 | 128;
|
|
3618
3615
|
if (buf) {
|
|
3619
3616
|
offset = offset || 0;
|
|
3620
|
-
if (offset < 0 || offset + 16 > buf.length) {
|
|
3621
|
-
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
3622
|
-
}
|
|
3623
3617
|
for (let i = 0;i < 16; ++i) {
|
|
3624
3618
|
buf[offset + i] = rnds[i];
|
|
3625
3619
|
}
|
|
@@ -9143,7 +9137,7 @@ class WorkerPool {
|
|
|
9143
9137
|
|
|
9144
9138
|
// src/cli/app-bundler.ts
|
|
9145
9139
|
import { promises as fs, existsSync } from "fs";
|
|
9146
|
-
import { join as join3, dirname as dirname3, extname as extname2 } from "path";
|
|
9140
|
+
import { join as join3, dirname as dirname3, extname as extname2, resolve as resolve3 } from "path";
|
|
9147
9141
|
|
|
9148
9142
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
9149
9143
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -9413,12 +9407,6 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
9413
9407
|
if (env.TERM === "xterm-kitty") {
|
|
9414
9408
|
return 3;
|
|
9415
9409
|
}
|
|
9416
|
-
if (env.TERM === "xterm-ghostty") {
|
|
9417
|
-
return 3;
|
|
9418
|
-
}
|
|
9419
|
-
if (env.TERM === "wezterm") {
|
|
9420
|
-
return 3;
|
|
9421
|
-
}
|
|
9422
9410
|
if ("TERM_PROGRAM" in env) {
|
|
9423
9411
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
9424
9412
|
switch (env.TERM_PROGRAM) {
|
|
@@ -9783,7 +9771,7 @@ async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
9783
9771
|
name: "kit-project-resolver",
|
|
9784
9772
|
setup(build) {
|
|
9785
9773
|
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
9786
|
-
const resourcePath =
|
|
9774
|
+
const resourcePath = resolve3(pProjectRoot, "resource.json");
|
|
9787
9775
|
if (existsSync(resourcePath)) {
|
|
9788
9776
|
return { path: resourcePath };
|
|
9789
9777
|
}
|
|
@@ -9841,7 +9829,7 @@ async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
9841
9829
|
name: "kit-project-resolver",
|
|
9842
9830
|
setup(build) {
|
|
9843
9831
|
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
9844
|
-
const resourcePath =
|
|
9832
|
+
const resourcePath = resolve3(pProjectRoot, "resource.json");
|
|
9845
9833
|
if (existsSync(resourcePath)) {
|
|
9846
9834
|
return { path: resourcePath };
|
|
9847
9835
|
}
|
|
@@ -9881,7 +9869,21 @@ async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
9881
9869
|
identifiers: shouldObfuscate,
|
|
9882
9870
|
syntax: true,
|
|
9883
9871
|
whitespace: true
|
|
9884
|
-
} : false
|
|
9872
|
+
} : false,
|
|
9873
|
+
plugins: [
|
|
9874
|
+
{
|
|
9875
|
+
name: "kit-project-resolver",
|
|
9876
|
+
setup(build) {
|
|
9877
|
+
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
9878
|
+
const resourcePath = resolve3(pProjectRoot, "resource.json");
|
|
9879
|
+
if (existsSync(resourcePath)) {
|
|
9880
|
+
return { path: resourcePath };
|
|
9881
|
+
}
|
|
9882
|
+
return;
|
|
9883
|
+
});
|
|
9884
|
+
}
|
|
9885
|
+
}
|
|
9886
|
+
]
|
|
9885
9887
|
});
|
|
9886
9888
|
if (!serverResult.success) {
|
|
9887
9889
|
console.error(serverResult.logs);
|
|
@@ -9985,7 +9987,7 @@ async function processDirectory(pDirectoryPath) {
|
|
|
9985
9987
|
const contents = await fs2.readdir(pDirectoryPath);
|
|
9986
9988
|
for (const item of contents) {
|
|
9987
9989
|
const itemPath = join4(pDirectoryPath, item);
|
|
9988
|
-
if (
|
|
9990
|
+
if (resolve4(itemPath) === resourceOutDirectory) {
|
|
9989
9991
|
continue;
|
|
9990
9992
|
}
|
|
9991
9993
|
const stats = await fs2.stat(itemPath);
|
|
@@ -10334,7 +10336,7 @@ async function runWatch() {
|
|
|
10334
10336
|
try {
|
|
10335
10337
|
const stats = await fs2.stat(pFilePath);
|
|
10336
10338
|
if (stats.isFile()) {
|
|
10337
|
-
fileStats.set(
|
|
10339
|
+
fileStats.set(resolve4(pFilePath), { mtime: stats.mtimeMs, size: stats.size });
|
|
10338
10340
|
}
|
|
10339
10341
|
} catch {
|
|
10340
10342
|
}
|
|
@@ -10369,7 +10371,7 @@ async function runWatch() {
|
|
|
10369
10371
|
watcher.on("all", async (event, filePath) => {
|
|
10370
10372
|
if (event === "addDir" || event === "unlinkDir")
|
|
10371
10373
|
return;
|
|
10372
|
-
const absPath =
|
|
10374
|
+
const absPath = resolve4(filePath);
|
|
10373
10375
|
if (event === "unlink") {
|
|
10374
10376
|
fileStats.delete(absPath);
|
|
10375
10377
|
const relativePath2 = relative3(projectRootDirectory, filePath).replace(/\\/g, "/");
|
|
@@ -10396,8 +10398,8 @@ async function processResources({ inDirectory, outDirectory, manifestPath, watch
|
|
|
10396
10398
|
projectRootDirectory = process.cwd();
|
|
10397
10399
|
const resolvedIn = inDirectory || (existsSync2(join4(projectRootDirectory, "src", "resources")) ? "src/resources" : "");
|
|
10398
10400
|
const resolvedOut = outDirectory || "dist";
|
|
10399
|
-
resourceInDirectory = resolvedIn ?
|
|
10400
|
-
resourceOutDirectory = resolvedOut ?
|
|
10401
|
+
resourceInDirectory = resolvedIn ? resolve4(resolvedIn) : "";
|
|
10402
|
+
resourceOutDirectory = resolvedOut ? resolve4(resolvedOut) : "";
|
|
10401
10403
|
customManifestPath = manifestPath;
|
|
10402
10404
|
isVerbose = verbose;
|
|
10403
10405
|
ignoringSound = ignoreSound;
|
|
@@ -11484,7 +11486,7 @@ import os2 from "os";
|
|
|
11484
11486
|
// package.json
|
|
11485
11487
|
var package_default = {
|
|
11486
11488
|
name: "@evitcastudio/kit",
|
|
11487
|
-
version: "3.
|
|
11489
|
+
version: "3.5.0",
|
|
11488
11490
|
author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
11489
11491
|
main: "./lib/index.js",
|
|
11490
11492
|
types: "./lib/index.d.ts",
|
|
@@ -11494,6 +11496,10 @@ var package_default = {
|
|
|
11494
11496
|
".": {
|
|
11495
11497
|
import: "./lib/index.js",
|
|
11496
11498
|
types: "./lib/index.d.ts"
|
|
11499
|
+
},
|
|
11500
|
+
"./camera": {
|
|
11501
|
+
import: "./lib/plugins/camera/index.js",
|
|
11502
|
+
types: "./lib/plugins/camera/index.d.ts"
|
|
11497
11503
|
}
|
|
11498
11504
|
},
|
|
11499
11505
|
description: "A single-player/multiplayer framework for the Vylocity Game Engine.",
|
|
@@ -11544,6 +11550,7 @@ var package_default = {
|
|
|
11544
11550
|
},
|
|
11545
11551
|
dependencies: {
|
|
11546
11552
|
"@clack/prompts": "^1.1.0",
|
|
11553
|
+
"@evitcastudio/lens": "^4.3.0",
|
|
11547
11554
|
chalk: "^5.4.0",
|
|
11548
11555
|
chokidar: "^5.0.0",
|
|
11549
11556
|
commander: "^12.1.0",
|
|
@@ -12030,7 +12037,7 @@ Error creating plugin: ${message}`));
|
|
|
12030
12037
|
|
|
12031
12038
|
// src/cli/host.ts
|
|
12032
12039
|
import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
|
|
12033
|
-
import { join as join7, resolve as
|
|
12040
|
+
import { join as join7, resolve as resolve5 } from "path";
|
|
12034
12041
|
import { networkInterfaces } from "os";
|
|
12035
12042
|
function getNetworkAddress() {
|
|
12036
12043
|
const interfaces = networkInterfaces();
|
|
@@ -12050,7 +12057,7 @@ async function processHost(pOptions = {}) {
|
|
|
12050
12057
|
const cwd = process.cwd();
|
|
12051
12058
|
const defaultPort = 8090;
|
|
12052
12059
|
const port = pOptions.port || defaultPort;
|
|
12053
|
-
const distDir = pOptions.directory ?
|
|
12060
|
+
const distDir = pOptions.directory ? resolve5(pOptions.directory) : join7(cwd, "dist");
|
|
12054
12061
|
const architecture = detectArchitecture(join7(cwd, "src"));
|
|
12055
12062
|
if (!existsSync4(distDir)) {
|
|
12056
12063
|
const message = `Target directory "${distDir}" does not exist. Run "kit build" or use "kit host -b" first.`;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// node_modules/@evitcastudio/kit/lib/events/event-system.js
|
|
2
|
+
class EventEmitter {
|
|
3
|
+
listener;
|
|
4
|
+
plugin;
|
|
5
|
+
constructor(pListener, pPlugin) {
|
|
6
|
+
this.listener = pListener;
|
|
7
|
+
this.plugin = pPlugin;
|
|
8
|
+
}
|
|
9
|
+
emit(pEvent) {
|
|
10
|
+
if (pEvent.plugin && pEvent.plugin !== this.plugin.name) {
|
|
11
|
+
throw new Error(`Event mismatch: ${this.plugin.name} tried to emit an event from the ${pEvent.plugin} namespace.`);
|
|
12
|
+
}
|
|
13
|
+
const event = {
|
|
14
|
+
plugin: this.plugin.name,
|
|
15
|
+
event: pEvent.event,
|
|
16
|
+
data: pEvent?.data,
|
|
17
|
+
timestamp: Date.now()
|
|
18
|
+
};
|
|
19
|
+
Object.freeze(event);
|
|
20
|
+
this.listener(event);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// node_modules/@evitcastudio/kit/lib/kit.js
|
|
25
|
+
var extensionToPath = {
|
|
26
|
+
".vyint": "interface",
|
|
27
|
+
".vym": "map",
|
|
28
|
+
".vyi": "icon",
|
|
29
|
+
".vymac": "macros",
|
|
30
|
+
".aac": "sound",
|
|
31
|
+
".mp3": "sound",
|
|
32
|
+
".wav": "sound",
|
|
33
|
+
".m4a": "sound",
|
|
34
|
+
".ogg": "sound",
|
|
35
|
+
".flac": "sound"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
class Kit {
|
|
39
|
+
static plugins = {};
|
|
40
|
+
static emitters = new Map;
|
|
41
|
+
static events = {};
|
|
42
|
+
constructor() {
|
|
43
|
+
throw new Error("[Kit] is not to be instantiated.");
|
|
44
|
+
}
|
|
45
|
+
static init(pPlugins) {
|
|
46
|
+
pPlugins.forEach((pPlugin) => {
|
|
47
|
+
this.registerPlugin(pPlugin);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static registerPlugin(pPlugin) {
|
|
51
|
+
if (Array.isArray(pPlugin)) {
|
|
52
|
+
const plugins = [];
|
|
53
|
+
pPlugin.forEach((pPlugin2) => {
|
|
54
|
+
const plugin = this.registerPlugin(pPlugin2);
|
|
55
|
+
if (plugin && !Array.isArray(plugin)) {
|
|
56
|
+
plugins.push(plugin);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return plugins;
|
|
60
|
+
} else {
|
|
61
|
+
const plugin = new pPlugin;
|
|
62
|
+
const pluginName = plugin.name;
|
|
63
|
+
if (!pluginName || typeof pluginName !== "string" || !/^[a-zA-Z0-9-_]+$/.test(pluginName)) {
|
|
64
|
+
throw new Error(`[Kit] Invalid plugin name: '${pluginName}'. The name must be a non-empty string containing only alphanumeric characters, dashes, or underscores.`);
|
|
65
|
+
}
|
|
66
|
+
if (Kit.plugins[pluginName]) {
|
|
67
|
+
throw new Error(`[Kit] plugin with name '${pluginName}' is already registered.`);
|
|
68
|
+
}
|
|
69
|
+
const listener = function(pEvent) {
|
|
70
|
+
Kit.emit(pEvent);
|
|
71
|
+
};
|
|
72
|
+
const emitter = new EventEmitter(listener, plugin);
|
|
73
|
+
Kit.emitters.set(pluginName, emitter);
|
|
74
|
+
Kit.plugins[pluginName] = plugin;
|
|
75
|
+
plugin._register(emitter);
|
|
76
|
+
plugin.onRegistered();
|
|
77
|
+
return plugin;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static getPlugin(pName) {
|
|
81
|
+
const plugin = Kit.plugins[pName];
|
|
82
|
+
if (!plugin) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
return plugin;
|
|
86
|
+
}
|
|
87
|
+
static getPlugins() {
|
|
88
|
+
return Object.keys(Kit.plugins);
|
|
89
|
+
}
|
|
90
|
+
static emit(pEvent) {
|
|
91
|
+
const { plugin, event } = pEvent;
|
|
92
|
+
const eventScope = `${plugin}-${event}`;
|
|
93
|
+
if (!Kit.events[eventScope]) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
Kit.events[eventScope].forEach((pListener) => pListener(pEvent));
|
|
97
|
+
}
|
|
98
|
+
static on(pPluginName, pEventName, pListener) {
|
|
99
|
+
const eventScope = `${pPluginName}-${pEventName}`;
|
|
100
|
+
if (!Kit.events[eventScope]) {
|
|
101
|
+
Kit.events[eventScope] = [];
|
|
102
|
+
}
|
|
103
|
+
Kit.events[eventScope].push(pListener);
|
|
104
|
+
}
|
|
105
|
+
static off(pPluginName, pEventName, pListener) {
|
|
106
|
+
const eventScope = `${pPluginName}-${pEventName}`;
|
|
107
|
+
if (Kit.events[eventScope].includes(pListener)) {
|
|
108
|
+
Kit.events[eventScope].splice(Kit.events[eventScope].indexOf(pListener), 1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
static setResource(pData) {
|
|
112
|
+
pData.forEach((pResource) => {
|
|
113
|
+
const extensionMatch = pResource.fileName.match(/\.[^.]+$/);
|
|
114
|
+
const fileNameWithoutExtensionMatch = pResource.fileName.match(/(.+?)(?=\.[^.]+$|$)/);
|
|
115
|
+
if (extensionMatch && fileNameWithoutExtensionMatch) {
|
|
116
|
+
const extension = extensionMatch[0];
|
|
117
|
+
const fileNameWithoutExtension = fileNameWithoutExtensionMatch[0];
|
|
118
|
+
const resourceType = extensionToPath[extension];
|
|
119
|
+
if (resourceType) {
|
|
120
|
+
globalThis.VYLO.Resource.setResource(resourceType, fileNameWithoutExtension, `${pResource.resourceIdentifier}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
static async setResources(pResourceJson) {
|
|
126
|
+
if (!globalThis.VYLO) {
|
|
127
|
+
throw new Error("[Kit] VYLO is not defined. Please ensure the VYLO variable is available in the global namespace.");
|
|
128
|
+
}
|
|
129
|
+
if (pResourceJson) {
|
|
130
|
+
const resources = Object.values(pResourceJson);
|
|
131
|
+
const consolidatedData = resources.flat();
|
|
132
|
+
this.setResource(consolidatedData);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// node_modules/@evitcastudio/kit/lib/plugins/kit-plugin.js
|
|
137
|
+
class KitPlugin {
|
|
138
|
+
_emitter = null;
|
|
139
|
+
_register(pEmitter) {
|
|
140
|
+
this._emitter = pEmitter;
|
|
141
|
+
}
|
|
142
|
+
emit(pEvent) {
|
|
143
|
+
if (!this._emitter) {
|
|
144
|
+
console.error("[Kit Plugin] emitter not set. This is an indication that the plugin is not registered.");
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
this._emitter.emit(pEvent);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// node_modules/@evitcastudio/kit/lib/plugins/network/index.js
|
|
151
|
+
class Network extends KitPlugin {
|
|
152
|
+
name = "Network";
|
|
153
|
+
initiated = false;
|
|
154
|
+
packets = new Map;
|
|
155
|
+
reversedPacketMap = new Map;
|
|
156
|
+
onRegistered() {
|
|
157
|
+
this.initiated = true;
|
|
158
|
+
}
|
|
159
|
+
listeners = new Map;
|
|
160
|
+
onPacket(pPacketName, pListener) {
|
|
161
|
+
if (!this.packets.has(pPacketName)) {
|
|
162
|
+
throw new Error(`Packet name '${pPacketName}' is not registered.`);
|
|
163
|
+
}
|
|
164
|
+
this.listeners.set(pPacketName, pListener);
|
|
165
|
+
}
|
|
166
|
+
on(pPacketName, pListener) {
|
|
167
|
+
this.onPacket(pPacketName, pListener);
|
|
168
|
+
}
|
|
169
|
+
onNetwork(pClient, pPacketName, pData = [], pVerbose) {
|
|
170
|
+
if (!this.initiated)
|
|
171
|
+
return;
|
|
172
|
+
if (typeof pPacketName === "number") {
|
|
173
|
+
const packetName = this.reversedPacketMap.get(pPacketName);
|
|
174
|
+
if (!packetName) {
|
|
175
|
+
if (pVerbose) {
|
|
176
|
+
console.group(`Kit.${this.name}Plugin.onNetwork`);
|
|
177
|
+
console.warn(`Unknown packet index: ${pPacketName}`);
|
|
178
|
+
console.groupEnd();
|
|
179
|
+
}
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const listener = this.listeners.get(packetName);
|
|
183
|
+
if (pVerbose) {
|
|
184
|
+
console.group(`Kit.${this.name}Plugin.onNetwork`);
|
|
185
|
+
if (!listener) {
|
|
186
|
+
console.warn(`No listener was registered for this packet: ${packetName}`);
|
|
187
|
+
}
|
|
188
|
+
console.log(`Packet name: ${pPacketName}`);
|
|
189
|
+
console.log(`Resolved packet name: ${packetName}`);
|
|
190
|
+
console.log(`Data:`, pData);
|
|
191
|
+
console.groupEnd();
|
|
192
|
+
}
|
|
193
|
+
listener?.(pClient, ...pData);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
registerPackets(pPackets) {
|
|
197
|
+
this.packets.clear();
|
|
198
|
+
this.reversedPacketMap.clear();
|
|
199
|
+
pPackets.forEach((name, index) => {
|
|
200
|
+
this.packets.set(name, index);
|
|
201
|
+
this.reversedPacketMap.set(index, name);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
getPacket(pPacketName) {
|
|
205
|
+
const packet = this.packets.get(pPacketName);
|
|
206
|
+
if (packet === undefined) {
|
|
207
|
+
console.warn(`Packet '${pPacketName}' is not registered.`);
|
|
208
|
+
}
|
|
209
|
+
return packet;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// kit-game-templates/multi/src/map-types.ts
|
|
213
|
+
VYLO.setType("Tile", {
|
|
214
|
+
atlasName: "default-atlas",
|
|
215
|
+
iconName: "cobble"
|
|
216
|
+
});
|
|
217
|
+
VYLO.setType("Mob/Player", {
|
|
218
|
+
atlasName: "default-atlas",
|
|
219
|
+
iconName: "player"
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// kit-game-templates/multi/src/client/packets/s-packets.ts
|
|
223
|
+
var serverPackets = [
|
|
224
|
+
"SERVER_EXAMPLE1_PACKET",
|
|
225
|
+
"SERVER_EXAMPLE2_PACKET",
|
|
226
|
+
"SERVER_EXAMPLE3_PACKET"
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
// kit-game-templates/multi/src/client/c-network.ts
|
|
230
|
+
Kit.registerPlugin(Network);
|
|
231
|
+
var networkPlugin = Kit.getPlugin("Network");
|
|
232
|
+
if (!networkPlugin) {
|
|
233
|
+
throw new Error("Network plugin not found.");
|
|
234
|
+
}
|
|
235
|
+
networkPlugin.registerPackets(serverPackets);
|
|
236
|
+
networkPlugin.on("SERVER_EXAMPLE3_PACKET", (pClient, pData, pData2, pData3) => {
|
|
237
|
+
console.log("data", pData, pData2, pData3);
|
|
238
|
+
});
|
|
239
|
+
VYLO.setType("Client", {
|
|
240
|
+
onPacket(pPacketName, pData) {
|
|
241
|
+
networkPlugin?.onNetwork(this, pPacketName, pData, true);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
// kit-game-templates/multi/resource.json
|
|
245
|
+
var resource_default = {
|
|
246
|
+
interface: [],
|
|
247
|
+
icon: [],
|
|
248
|
+
map: [],
|
|
249
|
+
sound: [],
|
|
250
|
+
macros: []
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// kit-game-templates/multi/src/client/index.ts
|
|
254
|
+
await Kit.setResources(resource_default);
|
|
255
|
+
var networkPlugin2 = Kit.getPlugin("Network");
|
|
256
|
+
VYLO.setType("World", {
|
|
257
|
+
onNew() {
|
|
258
|
+
console.log("World created.");
|
|
259
|
+
},
|
|
260
|
+
onMapLoaded(pName) {
|
|
261
|
+
console.log(`'${pName}' map loaded.`);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
VYLO.setType("Client", {
|
|
265
|
+
mainOutput: "",
|
|
266
|
+
maxFPS: 0,
|
|
267
|
+
hideFPS: false,
|
|
268
|
+
screenView: {
|
|
269
|
+
scaleTo: "normal",
|
|
270
|
+
scaleNearest: true,
|
|
271
|
+
disableImageSmoothing: true
|
|
272
|
+
},
|
|
273
|
+
onConnect() {
|
|
274
|
+
console.log("onConnect");
|
|
275
|
+
this.sendPacket(networkPlugin2?.getPacket("SERVER_EXAMPLE2_PACKET"), [1, 2, 3]);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
VYLO.setType("Mob/Player", {
|
|
279
|
+
onLogin() {
|
|
280
|
+
console.log("onLogin");
|
|
281
|
+
},
|
|
282
|
+
onLogout() {
|
|
283
|
+
console.log("onLogout");
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
await VYLO.load();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bundler.d.ts","sourceRoot":"","sources":["../../src/cli/app-bundler.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAYvE;AA+DD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"app-bundler.d.ts","sourceRoot":"","sources":["../../src/cli/app-bundler.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAYvE;AA+DD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CA2OhI"}
|
package/lib/cli/app-bundler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises as fs, existsSync } from 'node:fs';
|
|
2
|
-
import { join, dirname, extname } from 'node:path';
|
|
2
|
+
import { join, dirname, extname, resolve } from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import Bun from 'bun';
|
|
5
5
|
import { theme } from './theme';
|
|
@@ -144,7 +144,7 @@ export async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
144
144
|
name: 'kit-project-resolver',
|
|
145
145
|
setup(build) {
|
|
146
146
|
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
147
|
-
const resourcePath =
|
|
147
|
+
const resourcePath = resolve(pProjectRoot, 'resource.json');
|
|
148
148
|
if (existsSync(resourcePath)) {
|
|
149
149
|
return { path: resourcePath };
|
|
150
150
|
}
|
|
@@ -202,7 +202,7 @@ export async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
202
202
|
name: 'kit-project-resolver',
|
|
203
203
|
setup(build) {
|
|
204
204
|
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
205
|
-
const resourcePath =
|
|
205
|
+
const resourcePath = resolve(pProjectRoot, 'resource.json');
|
|
206
206
|
if (existsSync(resourcePath)) {
|
|
207
207
|
return { path: resourcePath };
|
|
208
208
|
}
|
|
@@ -242,7 +242,21 @@ export async function bundleApp(pProjectRoot, pOutDir, pOptions = {}) {
|
|
|
242
242
|
identifiers: shouldObfuscate,
|
|
243
243
|
syntax: true,
|
|
244
244
|
whitespace: true
|
|
245
|
-
} : false
|
|
245
|
+
} : false,
|
|
246
|
+
plugins: [
|
|
247
|
+
{
|
|
248
|
+
name: 'kit-project-resolver',
|
|
249
|
+
setup(build) {
|
|
250
|
+
build.onResolve({ filter: /^resource\.json$/ }, () => {
|
|
251
|
+
const resourcePath = resolve(pProjectRoot, 'resource.json');
|
|
252
|
+
if (existsSync(resourcePath)) {
|
|
253
|
+
return { path: resourcePath };
|
|
254
|
+
}
|
|
255
|
+
return undefined;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
]
|
|
246
260
|
});
|
|
247
261
|
if (!serverResult.success) {
|
|
248
262
|
console.error(serverResult.logs);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { EmitterEvent, Listener } from '../types/shared-types';
|
|
2
|
-
import type { KitPlugin } from '../plugins/kit-plugin';
|
|
1
|
+
import type { EmitterEvent, Listener, KitPluginLike } from '../types/shared-types';
|
|
3
2
|
export declare class EventEmitter {
|
|
4
3
|
private listener;
|
|
5
4
|
private plugin;
|
|
6
|
-
constructor(pListener: Listener, pPlugin:
|
|
5
|
+
constructor(pListener: Listener, pPlugin: KitPluginLike);
|
|
7
6
|
/**
|
|
8
7
|
* Emit an event to all listeners.
|
|
9
8
|
* @param pEvent - The event to emit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-system.d.ts","sourceRoot":"","sources":["../../src/events/event-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"event-system.d.ts","sourceRoot":"","sources":["../../src/events/event-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEnF,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAgB;gBAElB,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa;IAKvD;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;CAcnC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Kit } from './kit';
|
|
2
2
|
export { EventEmitter } from './events/event-system';
|
|
3
|
-
export type { EmitterEvent, ResourceData, Listener, KitPluginConstructor } from './types/shared-types';
|
|
3
|
+
export type { EmitterEvent, ResourceData, Listener, KitPluginLike, KitPluginConstructor } from './types/shared-types';
|
|
4
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';
|
|
8
|
+
export { Camera, CameraPlugin, CameraManager, BaseCamera, FollowCamera, SpectateCamera, PanCamera, InfluenceCamera, TransitionCamera, GizmoRenderer } from './plugins/camera';
|
|
9
|
+
export type { CameraManagerOptions, CameraDebugOptions, CameraEventName, CameraEventMap, CameraEventListener, GameInstance, Vector2D, ShakePresetConfig, ShakeOptions, EaseType, DurationSettings, EaseSettings, ShakePreset, CameraOffset, FollowCameraOptions, SpectateCameraOptions, PanCameraOptions, InfluenceCameraOptions, TransitionCameraOptions, CameraType } from './plugins/camera';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
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;
|
|
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,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACtH,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;AACzD,OAAO,EACH,MAAM,EACN,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACR,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,EACb,MAAM,kBAAkB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,3 +3,4 @@ export { EventEmitter } from './events/event-system';
|
|
|
3
3
|
// Plugins
|
|
4
4
|
export { KitPlugin } from './plugins/kit-plugin';
|
|
5
5
|
export { Network } from './plugins/network';
|
|
6
|
+
export { Camera, CameraPlugin, CameraManager, BaseCamera, FollowCamera, SpectateCamera, PanCamera, InfluenceCamera, TransitionCamera, GizmoRenderer } from './plugins/camera';
|
package/lib/kit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KitPlugin } from './plugins/kit-plugin';
|
|
2
|
-
import type { ResourceData, Listener, KitPluginConstructor } from './types/shared-types';
|
|
2
|
+
import type { ResourceData, Listener, KitPluginConstructor, KitPluginLike } from './types/shared-types';
|
|
3
3
|
export declare class Kit {
|
|
4
4
|
/**
|
|
5
5
|
* A record of all plugins registered with the Kit class.
|
|
@@ -19,18 +19,18 @@ export declare class Kit {
|
|
|
19
19
|
* @deprecated Use `registerPlugin` instead.
|
|
20
20
|
* @param pPlugins - An array of plugins to initialize.
|
|
21
21
|
*/
|
|
22
|
-
static init<T
|
|
22
|
+
static init<T = KitPluginLike>(pPlugins: KitPluginConstructor<T>[]): void;
|
|
23
23
|
/**
|
|
24
24
|
* Register a plugin with the Kit class.
|
|
25
25
|
* @param pPlugin - The plugin to register.
|
|
26
26
|
*/
|
|
27
|
-
static registerPlugin<T
|
|
28
|
-
static registerPlugin<T
|
|
27
|
+
static registerPlugin<T = KitPluginLike>(pPlugin: KitPluginConstructor<T>): T;
|
|
28
|
+
static registerPlugin<T = KitPluginLike>(pPlugin: KitPluginConstructor<T>[]): T[];
|
|
29
29
|
/**
|
|
30
30
|
* Gets a plugin by name.
|
|
31
31
|
* @param pName - String name of the plugin to retrieve.
|
|
32
32
|
*/
|
|
33
|
-
static getPlugin<T
|
|
33
|
+
static getPlugin<T = KitPlugin>(pName: string): T | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Lists all registered plugins.
|
|
36
36
|
*/
|
package/lib/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAgB,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAgB,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAgBtH,qBAAa,GAAG;IACZ;;OAEG;IACF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAqC;IAC3D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAC1D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuC;IAE5D,OAAO;IAIP;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,aAAa,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IAMzE;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,aAAa,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7E,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,aAAa,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;IA2CjF;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAQ9D;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;IAI7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,IAAI;IAWlB;;;;;MAKE;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,IAAI;IAQ7E;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,IAAI;IAO9E;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiB1B;;OAEG;WACU,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAa1F"}
|
package/lib/kit.js
CHANGED
|
@@ -50,7 +50,8 @@ export class Kit {
|
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
const plugin = new pPlugin();
|
|
53
|
-
const
|
|
53
|
+
const pluginRecord = plugin;
|
|
54
|
+
const pluginName = pluginRecord?.name;
|
|
54
55
|
if (!pluginName || typeof pluginName !== 'string' || !/^[a-zA-Z0-9-_]+$/.test(pluginName)) {
|
|
55
56
|
throw new Error(`[Kit] Invalid plugin name: '${pluginName}'. The name must be a non-empty string containing only alphanumeric characters, dashes, or underscores.`);
|
|
56
57
|
}
|
|
@@ -60,11 +61,15 @@ export class Kit {
|
|
|
60
61
|
const listener = function (pEvent) {
|
|
61
62
|
Kit.emit(pEvent);
|
|
62
63
|
};
|
|
63
|
-
const emitter = new EventEmitter(listener,
|
|
64
|
+
const emitter = new EventEmitter(listener, pluginRecord);
|
|
64
65
|
Kit.emitters.set(pluginName, emitter);
|
|
65
|
-
Kit.plugins[pluginName] =
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
Kit.plugins[pluginName] = pluginRecord;
|
|
67
|
+
if (typeof pluginRecord._register === 'function') {
|
|
68
|
+
pluginRecord._register(emitter);
|
|
69
|
+
}
|
|
70
|
+
if (typeof pluginRecord.onRegistered === 'function') {
|
|
71
|
+
pluginRecord.onRegistered();
|
|
72
|
+
}
|
|
68
73
|
return plugin;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CameraPlugin, CameraPlugin as Camera, CameraManager, BaseCamera, FollowCamera, SpectateCamera, PanCamera, InfluenceCamera, TransitionCamera, GizmoRenderer } from '@evitcastudio/lens';
|
|
2
|
+
export type { KitPluginEmitter, CameraManagerOptions, CameraDebugOptions, CameraEventName, CameraEventMap, CameraEventListener, GameInstance, Vector2D, ShakePresetConfig, ShakeOptions, EaseType, DurationSettings, EaseSettings, ShakePreset, CameraOffset, FollowCameraOptions, SpectateCameraOptions, PanCameraOptions, InfluenceCameraOptions, TransitionCameraOptions, CameraType } from '@evitcastudio/lens';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/camera/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,YAAY,EACZ,YAAY,IAAI,MAAM,EACtB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EAChB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACR,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,EACb,MAAM,oBAAoB,CAAC"}
|
|
@@ -8,7 +8,7 @@ export declare abstract class KitPlugin {
|
|
|
8
8
|
/**
|
|
9
9
|
* The emitter that belongs to this plugin.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
protected _emitter: EventEmitter | null;
|
|
12
12
|
/**
|
|
13
13
|
* Register this plugin with the event system.
|
|
14
14
|
* @param pEmitter - The emitter that belongs to this plugin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/kit-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,8BAAsB,SAAS;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"kit-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/kit-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,8BAAsB,SAAS;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAQ;IAE/C;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY;IAIhC;;OAEG;IACH,QAAQ,CAAC,YAAY,IAAI,IAAI;IAE7B;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,YAAY;CAO5B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { KitPlugin } from '../plugins/kit-plugin';
|
|
2
1
|
import type { VyloType } from './vylo.d.ts';
|
|
3
2
|
/**
|
|
4
3
|
* The EmitterEvent type is used to define the shape of the data that is passed to the event listeners.
|
|
@@ -19,12 +18,18 @@ type ResourceData = {
|
|
|
19
18
|
fileName: string;
|
|
20
19
|
};
|
|
21
20
|
type Listener = (pData: EmitterEvent) => void;
|
|
22
|
-
|
|
21
|
+
interface KitPluginLike {
|
|
22
|
+
name: string;
|
|
23
|
+
onRegistered?(): void;
|
|
24
|
+
_register?(pEmitter: unknown): void;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
type KitPluginConstructor<T = KitPluginLike> = new (...args: unknown[]) => T;
|
|
23
28
|
declare global {
|
|
24
29
|
/**
|
|
25
30
|
* The Vylocity engine.
|
|
26
31
|
*/
|
|
27
32
|
var VYLO: VyloType;
|
|
28
33
|
}
|
|
29
|
-
export type { EmitterEvent, ResourceData, Listener, KitPluginConstructor };
|
|
34
|
+
export type { EmitterEvent, ResourceData, Listener, KitPluginLike, KitPluginConstructor };
|
|
30
35
|
//# sourceMappingURL=shared-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C;;GAEG;AACH,KAAK,YAAY,GAAG;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAA;AAED,KAAK,YAAY,GAAG;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAC;AAEF,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;AAE9C,UAAU,aAAa;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,IAAI,IAAI,CAAC;IACtB,SAAS,CAAC,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,KAAK,oBAAoB,CAAC,CAAC,GAAG,aAAa,IAAI,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7E,OAAO,CAAC,MAAM,CAAC;IACX;;OAEG;IAEH,IAAI,IAAI,EAAE,QAAQ,CAAC;CACtB;AAED,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evitcastudio/kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"author": "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./lib/index.js",
|
|
12
12
|
"types": "./lib/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./camera": {
|
|
15
|
+
"import": "./lib/plugins/camera/index.js",
|
|
16
|
+
"types": "./lib/plugins/camera/index.d.ts"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"description": "A single-player/multiplayer framework for the Vylocity Game Engine.",
|
|
@@ -60,6 +64,7 @@
|
|
|
60
64
|
},
|
|
61
65
|
"dependencies": {
|
|
62
66
|
"@clack/prompts": "^1.1.0",
|
|
67
|
+
"@evitcastudio/lens": "^4.3.0",
|
|
63
68
|
"chalk": "^5.4.0",
|
|
64
69
|
"chokidar": "^5.0.0",
|
|
65
70
|
"commander": "^12.1.0",
|