point-click-lib 0.0.7 → 0.0.9

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.
@@ -1,3 +1,5 @@
1
+ import { default as default_2 } from 'zod';
2
+ import { XY } from 'typed-geometry';
1
3
  import { z } from 'zod';
2
4
 
3
5
  export declare type ActorData = z.infer<typeof ActorDataSchema>;
@@ -237,6 +239,8 @@ declare const actStepSchema: z.ZodObject<{
237
239
  timeElapsed?: number | undefined;
238
240
  }>;
239
241
 
242
+ export declare const advanceTimeOneStep: (props: GameRunnerProps, eventReporter: InGameEventReporter, debugLogger: LogToDebug) => (state: GameData) => void;
243
+
240
244
  export declare const AmbientNoiseConsequenceSchema: z.ZodObject<{
241
245
  type: z.ZodLiteral<"ambientNoise">;
242
246
  sound: z.ZodOptional<z.ZodString>;
@@ -391,6 +395,12 @@ export declare type BoardProgression = z.infer<typeof BoardProgressionSchema>;
391
395
 
392
396
  export declare const BoardProgressionSchema: z.ZodEnum<["sound", "buttons"]>;
393
397
 
398
+ export declare const CELL_SIZE = 5;
399
+
400
+ export declare type CellMatrix = default_2.infer<typeof cellMatrixSchema>;
401
+
402
+ export declare const cellMatrixSchema: default_2.ZodArray<default_2.ZodArray<default_2.ZodUnion<[default_2.ZodLiteral<0>, default_2.ZodLiteral<1>]>, "many">, "many">;
403
+
394
404
  export declare const changeHistory: VersionChange[];
395
405
 
396
406
  export declare const ChangePlayerCharacterConsequenceSchema: z.ZodObject<{
@@ -3507,6 +3517,13 @@ export declare const consequenceTypes: ConsequenceType[];
3507
3517
 
3508
3518
  export declare type ConsequenceWithDeprecated = z.infer<typeof ConsequenceSchemaWithDeprecated>;
3509
3519
 
3520
+ /**
3521
+ * Takes the next step in the sequence, shifting stages the array
3522
+ * when the stage is complete, until the sequence has finished
3523
+ * @returns a partial state
3524
+ */
3525
+ export declare const continueSequence: (props: GameRunnerProps, eventReporter: InGameEventReporter, debugLogger: LogToDebug) => (state: GameData) => Partial<GameData>;
3526
+
3510
3527
  export declare type Conversation = z.infer<typeof ConversationSchema>;
3511
3528
 
3512
3529
  export declare type ConversationBranch = z.infer<typeof ConversationBranchSchema>;
@@ -12539,6 +12556,18 @@ export declare type ConversationWithDeprecatedConsequences = z.infer<typeof Conv
12539
12556
 
12540
12557
  export declare const DB_VERSION = 4;
12541
12558
 
12559
+ export declare const DEFAULT_ANIMATION: {
12560
+ readonly say: "talk";
12561
+ readonly move: "walk";
12562
+ readonly goTo: "walk";
12563
+ readonly wait: "default";
12564
+ readonly act: "default";
12565
+ };
12566
+
12567
+ export declare const DEFAULT_TALK_TIME = 200;
12568
+
12569
+ export declare const describeCommand: (command: Command, useNames?: boolean) => string;
12570
+
12542
12571
  declare type DesignParseResult = {
12543
12572
  success: true;
12544
12573
  gameDesign: GameDesign;
@@ -12611,6 +12640,13 @@ export declare const EndingSchema: z.ZodObject<{
12611
12640
  imageWidth?: number | undefined;
12612
12641
  }>;
12613
12642
 
12643
+ export declare function findPath(start: XY, goal: XY, matrix: CellMatrix, cellSize: number): XY[];
12644
+
12645
+ export declare function findTarget(ids: {
12646
+ targetId?: string;
12647
+ roomId?: string;
12648
+ }, gameContents: GameContents, excludeItems?: boolean): CommandTarget | undefined;
12649
+
12614
12650
  export declare type FixedGameInfo = z.infer<typeof FixedGameInfoSchema>;
12615
12651
 
12616
12652
  export declare const FixedGameInfoSchema: z.ZodObject<{
@@ -27967,6 +28003,9 @@ export declare const GameDataSchema: z.ZodIntersection<z.ZodObject<{
27967
28003
  requiredInventory?: string[] | undefined;
27968
28004
  }>>;
27969
28005
  gameNotBegun: z.ZodBoolean;
28006
+ cellMatrix: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>, "many">, "many">>;
28007
+ viewAngleX: z.ZodNumber;
28008
+ viewAngleY: z.ZodNumber;
27970
28009
  }, "strip", z.ZodTypeAny, {
27971
28010
  actorOrders: Record<string, ({
27972
28011
  type: "move";
@@ -28027,6 +28066,8 @@ export declare const GameDataSchema: z.ZodIntersection<z.ZodObject<{
28027
28066
  endStatus?: string | undefined;
28028
28067
  })[]>;
28029
28068
  gameNotBegun: boolean;
28069
+ viewAngleX: number;
28070
+ viewAngleY: number;
28030
28071
  sequenceRunning?: {
28031
28072
  id: string;
28032
28073
  stages: {
@@ -28395,6 +28436,7 @@ export declare const GameDataSchema: z.ZodIntersection<z.ZodObject<{
28395
28436
  flagsThatMustBeTrue?: string[] | undefined;
28396
28437
  requiredInventory?: string[] | undefined;
28397
28438
  } | undefined;
28439
+ cellMatrix?: (0 | 1)[][] | undefined;
28398
28440
  }, {
28399
28441
  actorOrders: Record<string, ({
28400
28442
  type: "move";
@@ -28455,6 +28497,8 @@ export declare const GameDataSchema: z.ZodIntersection<z.ZodObject<{
28455
28497
  endStatus?: string | undefined;
28456
28498
  })[]>;
28457
28499
  gameNotBegun: boolean;
28500
+ viewAngleX: number;
28501
+ viewAngleY: number;
28458
28502
  sequenceRunning?: {
28459
28503
  id: string;
28460
28504
  stages: {
@@ -28823,6 +28867,7 @@ export declare const GameDataSchema: z.ZodIntersection<z.ZodObject<{
28823
28867
  flagsThatMustBeTrue?: string[] | undefined;
28824
28868
  requiredInventory?: string[] | undefined;
28825
28869
  } | undefined;
28870
+ cellMatrix?: (0 | 1)[][] | undefined;
28826
28871
  }>>;
28827
28872
 
28828
28873
  export declare type GameDesign = z.infer<typeof GameDesignSchema>;
@@ -38885,6 +38930,9 @@ export declare const GameHappeningsSchema: z.ZodObject<{
38885
38930
  requiredInventory?: string[] | undefined;
38886
38931
  }>>;
38887
38932
  gameNotBegun: z.ZodBoolean;
38933
+ cellMatrix: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>, "many">, "many">>;
38934
+ viewAngleX: z.ZodNumber;
38935
+ viewAngleY: z.ZodNumber;
38888
38936
  }, "strip", z.ZodTypeAny, {
38889
38937
  actorOrders: Record<string, ({
38890
38938
  type: "move";
@@ -38945,6 +38993,8 @@ export declare const GameHappeningsSchema: z.ZodObject<{
38945
38993
  endStatus?: string | undefined;
38946
38994
  })[]>;
38947
38995
  gameNotBegun: boolean;
38996
+ viewAngleX: number;
38997
+ viewAngleY: number;
38948
38998
  sequenceRunning?: {
38949
38999
  id: string;
38950
39000
  stages: {
@@ -39313,6 +39363,7 @@ export declare const GameHappeningsSchema: z.ZodObject<{
39313
39363
  flagsThatMustBeTrue?: string[] | undefined;
39314
39364
  requiredInventory?: string[] | undefined;
39315
39365
  } | undefined;
39366
+ cellMatrix?: (0 | 1)[][] | undefined;
39316
39367
  }, {
39317
39368
  actorOrders: Record<string, ({
39318
39369
  type: "move";
@@ -39373,6 +39424,8 @@ export declare const GameHappeningsSchema: z.ZodObject<{
39373
39424
  endStatus?: string | undefined;
39374
39425
  })[]>;
39375
39426
  gameNotBegun: boolean;
39427
+ viewAngleX: number;
39428
+ viewAngleY: number;
39376
39429
  sequenceRunning?: {
39377
39430
  id: string;
39378
39431
  stages: {
@@ -39741,8 +39794,29 @@ export declare const GameHappeningsSchema: z.ZodObject<{
39741
39794
  flagsThatMustBeTrue?: string[] | undefined;
39742
39795
  requiredInventory?: string[] | undefined;
39743
39796
  } | undefined;
39797
+ cellMatrix?: (0 | 1)[][] | undefined;
39744
39798
  }>;
39745
39799
 
39800
+ export declare type GameRunnerProps = GameDesign & GameRuntimeOptions;
39801
+
39802
+ export declare type GameRuntimeOptions = {
39803
+ instantMode?: boolean;
39804
+ orderSpeed?: number;
39805
+ playSound: PlaySound;
39806
+ cellSize: number;
39807
+ defaultTalkTime: number;
39808
+ };
39809
+
39810
+ export declare function generateCellMatrix(roomData: RoomData, cellSize: number): CellMatrix;
39811
+
39812
+ export declare function getDefaultResponseText(command: Command, unreachable: boolean): string;
39813
+
39814
+ export declare function getTargetPoint(target: ActorData | HotspotZone, roomData: RoomData): XY;
39815
+
39816
+ export declare function getViewAngleXCenteredOn(xPosition: number, roomData: RoomData): number;
39817
+
39818
+ export declare function getViewAngleYCenteredOn(yPosition: number, roomData: RoomData): number;
39819
+
39746
39820
  export declare type GotoOrder = z.infer<typeof GotoOrderSchema>;
39747
39821
 
39748
39822
  export declare const GotoOrderSchema: z.ZodObject<{
@@ -39788,6 +39862,8 @@ export declare const GotoOrderSchema: z.ZodObject<{
39788
39862
  speed?: number | undefined;
39789
39863
  }>;
39790
39864
 
39865
+ export declare const handleConversationChoice: ({ sequences, defaultTalkTime }: GameRunnerProps, debugLogger: LogToDebug) => (state: GameData, choice: ConversationChoice) => GameData;
39866
+
39791
39867
  export declare type HotspotZone = z.infer<typeof HotspotZoneSchema>;
39792
39868
 
39793
39869
  export declare const HotspotZoneSchema: z.ZodObject<{
@@ -40642,6 +40718,14 @@ export declare const ImmediateConsequenceSchemaWithDeprecated: z.ZodUnion<[z.Zod
40642
40718
 
40643
40719
  export declare const immediateConsequenceTypes: ConsequenceType[];
40644
40720
 
40721
+ export declare interface InGameEventReporter {
40722
+ reportConsequence: (consequence: Consequence, success: boolean, offscreen: boolean) => void;
40723
+ reportCommand: (command: Command) => void;
40724
+ reportOrder: (order: Order, actor: ActorData) => void;
40725
+ reportStage: (stage: Stage) => void;
40726
+ reportCurrentConversation: () => void;
40727
+ }
40728
+
40645
40729
  export declare type Interaction = z.infer<typeof InteractionSchema>;
40646
40730
 
40647
40731
  export declare const InteractionSchema: z.ZodObject<{
@@ -42995,6 +43079,8 @@ export declare const InventoryConsequenceSchema: z.ZodObject<{
42995
43079
  actorId?: string | undefined;
42996
43080
  }>;
42997
43081
 
43082
+ export declare const issueMoveOrder: (props: GameRunnerProps, debugLogger?: LogToDebug) => (state: GameData, destination: XY, actorId: string, appendToExisting?: boolean, ignoreObstacles?: boolean) => Partial<GameData>;
43083
+
42998
43084
  export declare type ItemData = z.infer<typeof ItemDataSchema>;
42999
43085
 
43000
43086
  export declare const ItemDataSchema: z.ZodIntersection<z.ZodObject<{
@@ -43030,6 +43116,12 @@ export declare const ItemDataSchema: z.ZodIntersection<z.ZodObject<{
43030
43116
  row?: number | undefined;
43031
43117
  }>>;
43032
43118
 
43119
+ export declare type LogToDebug = (message: string, subject?: string) => void;
43120
+
43121
+ export declare const makeCommandHandler: (props: GameRunnerProps, eventReporter: InGameEventReporter, debugLogger?: LogToDebug) => (state: GameData, command: Command) => GameData;
43122
+
43123
+ export declare function matchInteraction(command: Command, room: RoomData | undefined, interactions: Interaction[], gameState: GameData): Interaction | undefined;
43124
+
43033
43125
  export declare type MoveOrder = z.infer<typeof MoveOrderSchema>;
43034
43126
 
43035
43127
  export declare const MoveOrderSchema: z.ZodObject<{
@@ -43780,6 +43872,10 @@ declare const PagePictureSchema: z.ZodObject<{
43780
43872
 
43781
43873
  export declare const parseAndUpgrade: (maybeGameDesign: unknown) => DesignParseResult;
43782
43874
 
43875
+ export declare interface PlaySound {
43876
+ (soundId: string, volume?: number): boolean;
43877
+ }
43878
+
43783
43879
  export declare type Polygon = z.infer<typeof PolygonSchema>;
43784
43880
 
43785
43881
  declare const PolygonSchema: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
@@ -63860,6 +63956,12 @@ export declare type VersionChange = {
63860
63956
  }[];
63861
63957
  };
63862
63958
 
63959
+ export declare const wildCard: {
63960
+ readonly ITEM: "$ITEM";
63961
+ readonly TARGET: "$TARGET";
63962
+ readonly VERB: "$VERB";
63963
+ };
63964
+
63863
63965
  export declare const xPlacement: z.ZodEnum<["center", "left", "right"]>;
63864
63966
 
63865
63967
  export declare const yPlacement: z.ZodEnum<["center", "top", "bottom"]>;