@s2script/sdk 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +53 -0
  2. package/dist/cli.js +3836 -370
  3. package/package.json +3 -2
  4. package/sound.d.ts +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s2script/sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "description": "s2script SDK — the builtin capability types (imported as @s2script/sdk/entity, …) plus the `s2s` CLI for building Source 2 / CS2 plugins.",
6
6
  "type": "module",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@clack/prompts": "^1.7.0",
23
- "fflate": "^0.8.2"
23
+ "fflate": "^0.8.2",
24
+ "semver": "^7.8.5"
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public"
package/sound.d.ts CHANGED
@@ -18,8 +18,23 @@ export interface SoundEmitOptions {
18
18
  * only: a stashed context used after the handler returns (or past an await) is a no-op `false`
19
19
  * (the engine manifest is gone). */
20
20
  export interface PrecacheContext {
21
- /** Add a resource path (e.g. "soundevents/mypack.vsndevts") to the session resource manifest.
22
- * True iff the engine accepted the add. */
21
+ /**
22
+ * Add a resource path to the game session manifest — a soundevents file, a model, a particle.
23
+ *
24
+ * @example
25
+ * pc.add("soundevents/mypack.vsndevts");
26
+ * pc.add("models/props/cs_office/microwave.vmdl");
27
+ *
28
+ * Returns true iff the engine ACCEPTED the string, which is not the same as the resource existing
29
+ * or being loadable: it returns true for a path with no file behind it too. A model that was never
30
+ * really there still spawns as the pink-and-black ERROR box, and the engine only says so later, at
31
+ * spawn time, with "requested but is not in the system (Missing from a manifest?)". Treat a `false`
32
+ * as fatal and a `true` as "not rejected".
33
+ *
34
+ * TIMING: the manifest is built once per map, before plugins that load later exist. A plugin loaded
35
+ * AFTER that point — including on the boot map of a fresh server start — misses that map's
36
+ * precache, and its resources stay unusable until the next map change.
37
+ */
23
38
  add(path: string): boolean;
24
39
  }
25
40