loreline 0.7.1 → 0.8.1

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/js/loreline.d.ts CHANGED
@@ -348,6 +348,56 @@ export class Interpreter {
348
348
  * @return The field value or null if the character or field doesn't exist
349
349
  */
350
350
  getCharacterField(character: string, name: string): any;
351
+
352
+ /**
353
+ * Sets a specific field of a character.
354
+ *
355
+ * @param character The name of the character
356
+ * @param name The name of the field to set
357
+ * @param value The value to set
358
+ */
359
+ setCharacterField(character: string, name: string, value: any): void;
360
+
361
+ /**
362
+ * Gets a state field by name, resolving from the current scope outward.
363
+ *
364
+ * @param name The name of the field to get
365
+ * @return The field value or null if not found
366
+ */
367
+ getStateField(name: string): any;
368
+
369
+ /**
370
+ * Sets a state field by name, resolving from the current scope outward.
371
+ *
372
+ * @param name The name of the field to set
373
+ * @param value The value to set
374
+ */
375
+ setStateField(name: string, value: any): void;
376
+
377
+ /**
378
+ * Gets a field from the top-level state directly.
379
+ *
380
+ * @param name The name of the field to get
381
+ * @return The field value or null if not found
382
+ */
383
+ getTopLevelStateField(name: string): any;
384
+
385
+ /**
386
+ * Sets a field on the top-level state directly.
387
+ *
388
+ * @param name The name of the field to set
389
+ * @param value The value to set
390
+ */
391
+ setTopLevelStateField(name: string, value: any): void;
392
+
393
+ /**
394
+ * Returns the current node being executed.
395
+ * During a dialogue callback, this returns the dialogue statement node.
396
+ * During a choice callback, this returns the choice statement node.
397
+ *
398
+ * @return The current node or null if no node is being executed
399
+ */
400
+ currentNode(): Node | null;
351
401
  }
352
402
 
353
403
  /**
@@ -410,6 +460,13 @@ export class Node {
410
460
  */
411
461
  toJson(): any;
412
462
 
463
+ /**
464
+ * Reconstructs a Node from a JSON representation.
465
+ * @param json The JSON object (as returned by node.toJson())
466
+ * @return The reconstructed Node
467
+ */
468
+ static fromJson(json: any): Node;
469
+
413
470
  /**
414
471
  * Traverses all child nodes of this node.
415
472
  * @param handleNode Function to call for each child node
@@ -425,6 +482,13 @@ export class Script extends Node {
425
482
  * Array of top-level declarations in the script.
426
483
  */
427
484
  body:Array<Node>;
485
+
486
+ /**
487
+ * Reconstructs a Script from a JSON representation.
488
+ * @param json The JSON object (as returned by script.toJson())
489
+ * @return The reconstructed Script
490
+ */
491
+ static fromJson(json: any): Script;
428
492
  }
429
493
 
430
494
  /**