@s2script/sdk 0.10.2 → 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.
package/entity.d.ts CHANGED
@@ -116,6 +116,20 @@ export declare class EntityRef {
116
116
  notifyStateChanged(offset: number): void;
117
117
  /** Raw identity-slot flags (engine m_flags), or null when stale/unavailable. Bit meanings are game-specific. */
118
118
  identityFlags(): number | null;
119
+ /**
120
+ * CLEAR identity-slot flag bits; returns the flags after the write, or null when stale.
121
+ *
122
+ * Clear-only by design: `mask` names bits to DROP and nothing can be raised, because handing a
123
+ * plugin the ability to set arbitrary identity bits is a far larger foot-gun than the one this
124
+ * closes. The invalid-ehandle bit is refused outright — a dead slot must never be presentable as
125
+ * live.
126
+ *
127
+ * The case this exists for is the staging bit. `setModel` asserts that an entity is NOT in the
128
+ * staging list, and a created-but-unspawned entity is, so the create -> setModel -> spawn ordering
129
+ * (what CS2's own body spawner does) is otherwise unavailable and the alternatives produce
130
+ * half-initialised entities that clients fail to copy.
131
+ */
132
+ clearIdentityFlags(mask: number): number | null;
119
133
  /** DispatchSpawn this created entity. With keyvalues, the entity's own Spawn() parses them (the
120
134
  * SourceMod DispatchKeyValue / CSSharp DispatchSpawn(kv) mechanism). Returns false if stale,
121
135
  * unresolved, or the keyvalue map is rejected (non-finite number, unsupported value type, empty
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s2script/sdk",
3
- "version": "0.10.2",
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