@s2script/sdk 0.26.0 → 0.27.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s2script/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.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",
package/sdkhooks.d.ts CHANGED
@@ -55,7 +55,11 @@ export declare const UseType: {
55
55
  * that is not a member here throws.
56
56
  */
57
57
  export declare const SDKHookType: {
58
- /** Pre-apply damage (`DispatchTraceAttack`). Mutate {@link DamageInfo.damage} in place. */
58
+ /**
59
+ * Pre-apply damage, provided by the selected game package (CS2: `CBaseEntity::TakeDamageOld`).
60
+ * Mutate {@link DamageInfo.damage} in place. {@link SDKHook} returns `false` when no game package
61
+ * provides damage hooks.
62
+ */
59
63
  readonly OnTakeDamage: "OnTakeDamage";
60
64
  /**
61
65
  * CheckTransmit mux (wiki `SDKHook_SetTransmit`). `Handled` / `Stop` hide this entity from this
@@ -112,8 +116,8 @@ export declare const SDKHookType: {
112
116
  /** `CanBeAutobalanced`. Return a boolean (not {@link HookResultValue}); last defined wins. */
113
117
  readonly CanBeAutobalanced: "CanBeAutobalanced";
114
118
  /**
115
- * Post-apply damage (`DispatchTraceAttack` after the original). {@link DamageInfo} is read-only
116
- * for effect; mutations are not written back. Return is ignored.
119
+ * Post-apply damage (after the original ran), provided by the selected game package.
120
+ * {@link DamageInfo} is read-only for effect; `damage` assignment is ignored. Return is ignored.
117
121
  */
118
122
  readonly OnTakeDamagePost: "OnTakeDamagePost";
119
123
  /**
@@ -126,7 +130,7 @@ export declare const SDKHookType: {
126
130
  readonly OnTakeDamageAlivePost: "OnTakeDamageAlivePost";
127
131
  /**
128
132
  * `TraceAttack` pre ({@link TraceAttackInfo}). No distinct CS2 virtual yet — {@link SDKHook}
129
- * returns `false` (OnTakeDamage remains the DTA mux).
133
+ * returns `false` (use OnTakeDamage).
130
134
  */
131
135
  readonly TraceAttack: "TraceAttack";
132
136
  /**
@@ -220,8 +224,9 @@ export declare function SDKHook(
220
224
  callback: (info: DamageInfo) => HookResultValue | void,
221
225
  ): boolean;
222
226
  /**
223
- * Post-apply damage. {@link DamageInfo} is a read of the live info after the original ran.
224
- * Return is ignored; Handled does not zero the hit (that is the pre-hook).
227
+ * Post-apply damage. {@link DamageInfo} reads the info after the original ran; it is valid only
228
+ * during the synchronous callback. Return is ignored; Handled does not zero the hit (that is the
229
+ * pre-hook).
225
230
  */
226
231
  export declare function SDKHook(
227
232
  entity: EntityRef | null,
package/unsafe.d.ts CHANGED
@@ -22,6 +22,32 @@ export interface EngineCalls {}
22
22
  */
23
23
  export interface EngineHooks {}
24
24
 
25
+ /** Generated bindings augment this map from gamedata/functions.jsonc. */
26
+ export interface EngineFunctions {}
27
+
28
+ export interface FunctionStatus {
29
+ readonly canonicalId: string;
30
+ readonly availability: 'available' | 'unavailable';
31
+ readonly reason: string | null;
32
+ readonly hookObservation: 'not-requested' | 'pending' | 'active' | 'failed';
33
+ readonly provenance: {
34
+ readonly archiveHash: string;
35
+ readonly baseContractHash: string;
36
+ readonly appliedOverrides: readonly { readonly path: string; readonly sha256: string }[];
37
+ readonly finalTargetHash: string;
38
+ readonly resolverReceipt: string;
39
+ readonly required: boolean;
40
+ };
41
+ }
42
+
43
+ export interface Disposable { dispose(): boolean; }
44
+
45
+ export interface FunctionSubscription extends Disposable {
46
+ readonly status: 'pending' | 'active' | 'failed' | 'disposed';
47
+ readonly reason: string | null;
48
+ dispose(): boolean;
49
+ }
50
+
25
51
  /**
26
52
  * Plugin-declared engine calls and inbound hooks, resolved from this plugin's own gamedata.
27
53
  *
@@ -34,6 +60,7 @@ export interface EngineHooks {}
34
60
  * if (onFoo) onFoo((view) => { view.reason = 0; });
35
61
  */
36
62
  export declare const Engine: {
63
+ function<K extends keyof EngineFunctions>(name: K): EngineFunctions[K];
37
64
  /**
38
65
  * The declared call, or `null` when its descriptor failed a load-time gate (signature miss,
39
66
  * validator rejection, slot outside `.text`, missing platform entry, or the plugin is not