isaacscript-common 33.12.0 → 33.12.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.
@@ -3558,12 +3558,29 @@ export declare function deserializeVector(vector: SerializedVector): Vector;
3558
3558
  /** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76). */
3559
3559
  export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
3560
3560
 
3561
+ /**
3562
+ * Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
3563
+ * 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
3564
+ * `Vector.GetAngleDegrees` method works.)
3565
+ */
3561
3566
  export declare function directionToDegrees(direction: Direction): int;
3562
3567
 
3568
+ /**
3569
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
3570
+ * (0) would return `ButtonAction.LEFT` (0).
3571
+ */
3563
3572
  export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
3564
3573
 
3574
+ /**
3575
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
3576
+ * (0) would return `ButtonAction.SHOOT_LEFT` (4).
3577
+ */
3565
3578
  export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
3566
3579
 
3580
+ /**
3581
+ * Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
3582
+ * convert to `Vector(-1, 0).
3583
+ */
3567
3584
  export declare function directionToVector(direction: Direction): Readonly<Vector>;
3568
3585
 
3569
3586
  declare class DisableAllSound extends Feature {
@@ -5105,6 +5122,10 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
5105
5122
  */
5106
5123
  export declare function getDimension(): Dimension;
5107
5124
 
5125
+ /**
5126
+ * Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
5127
+ * return "left".
5128
+ */
5108
5129
  export declare function getDirectionName(direction: Direction): string | undefined;
5109
5130
 
5110
5131
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 33.12.0
3
+ isaacscript-common 33.12.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -37332,7 +37332,7 @@ function ____exports.loadFromDisk(self, mod, oldSaveData, classConstructors)
37332
37332
  end,
37333
37333
  SAVE_DATA_MANAGER_DEBUG
37334
37334
  )
37335
- log("The save data manager loaded data from the \"save#.dat\" file.")
37335
+ log("The save data manager loaded data from the \"save#.dat\" file for mod: " .. mod.Name)
37336
37336
  end
37337
37337
  return ____exports
37338
37338
  end,
@@ -37452,7 +37452,7 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
37452
37452
  local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
37453
37453
  local jsonString = jsonEncode(nil, allSaveData)
37454
37454
  mod:SaveData(jsonString)
37455
- log("The save data manager wrote data to the \"save#.dat\" file.")
37455
+ log("The save data manager wrote data to the \"save#.dat\" file for mod: " .. mod.Name)
37456
37456
  end
37457
37457
  return ____exports
37458
37458
  end,
@@ -1 +1 @@
1
- {"version":3,"file":"loadFromDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/loadFromDisk.ts"],"names":[],"mappings":";;AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAsDN"}
1
+ {"version":3,"file":"loadFromDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/loadFromDisk.ts"],"names":[],"mappings":";;AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAwDN"}
@@ -73,6 +73,6 @@ function ____exports.loadFromDisk(self, mod, oldSaveData, classConstructors)
73
73
  end,
74
74
  SAVE_DATA_MANAGER_DEBUG
75
75
  )
76
- log("The save data manager loaded data from the \"save#.dat\" file.")
76
+ log("The save data manager loaded data from the \"save#.dat\" file for mod: " .. mod.Name)
77
77
  end
78
78
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"saveToDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/saveToDisk.ts"],"names":[],"mappings":";;AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAGhE,wBAAgB,UAAU,CACxB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GACxD,IAAI,CAQN"}
1
+ {"version":3,"file":"saveToDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/saveToDisk.ts"],"names":[],"mappings":";;AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAGhE,wBAAgB,UAAU,CACxB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GACxD,IAAI,CAUN"}
@@ -41,6 +41,6 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
41
41
  local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
42
42
  local jsonString = jsonEncode(nil, allSaveData)
43
43
  mod:SaveData(jsonString)
44
- log("The save data manager wrote data to the \"save#.dat\" file.")
44
+ log("The save data manager wrote data to the \"save#.dat\" file for mod: " .. mod.Name)
45
45
  end
46
46
  return ____exports
@@ -8,9 +8,30 @@ import { Direction } from "isaac-typescript-definitions";
8
8
  * works.)
9
9
  */
10
10
  export declare function angleToDirection(angleDegrees: int): Direction;
11
+ /**
12
+ * Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
13
+ * 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
14
+ * `Vector.GetAngleDegrees` method works.)
15
+ */
11
16
  export declare function directionToDegrees(direction: Direction): int;
17
+ /**
18
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
19
+ * (0) would return `ButtonAction.LEFT` (0).
20
+ */
12
21
  export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
22
+ /**
23
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
24
+ * (0) would return `ButtonAction.SHOOT_LEFT` (4).
25
+ */
13
26
  export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
27
+ /**
28
+ * Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
29
+ * convert to `Vector(-1, 0).
30
+ */
14
31
  export declare function directionToVector(direction: Direction): Readonly<Vector>;
32
+ /**
33
+ * Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
34
+ * return "left".
35
+ */
15
36
  export declare function getDirectionName(direction: Direction): string | undefined;
16
37
  //# sourceMappingURL=direction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/functions/direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;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@@ -36,18 +36,29 @@ function ____exports.angleToDirection(self, angleDegrees)
36
36
  end
37
37
  return Direction.RIGHT
38
38
  end
39
+ --- Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
40
+ -- 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
41
+ -- `Vector.GetAngleDegrees` method works.)
39
42
  function ____exports.directionToDegrees(self, direction)
40
43
  return DIRECTION_TO_DEGREES[direction]
41
44
  end
45
+ --- Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
46
+ -- (0) would return `ButtonAction.LEFT` (0).
42
47
  function ____exports.directionToMoveAction(self, direction)
43
48
  return DIRECTION_TO_MOVE_ACTION[direction]
44
49
  end
50
+ --- Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
51
+ -- (0) would return `ButtonAction.SHOOT_LEFT` (4).
45
52
  function ____exports.directionToShootAction(self, direction)
46
53
  return DIRECTION_TO_SHOOT_ACTION[direction]
47
54
  end
55
+ --- Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
56
+ -- convert to `Vector(-1, 0).
48
57
  function ____exports.directionToVector(self, direction)
49
58
  return DIRECTION_TO_VECTOR[direction]
50
59
  end
60
+ --- Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
61
+ -- return "left".
51
62
  function ____exports.getDirectionName(self, direction)
52
63
  return DIRECTION_NAMES[direction]
53
64
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "33.12.0",
3
+ "version": "33.12.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -463,7 +463,7 @@ export class SaveDataManager extends Feature {
463
463
  for (const tstlClass of tstlClasses) {
464
464
  const { name } = tstlClass;
465
465
  assertDefined(
466
- // Since we are accepting untrusted user input, this might nto be a real TSTL class.
466
+ // Since we are accepting untrusted user input, this might not be a real TSTL class.
467
467
  name as string | undefined,
468
468
  "Failed to register a class with the save data manager due to not being able to derive the name of the class.",
469
469
  );
@@ -67,7 +67,9 @@ export function loadFromDisk(
67
67
  SAVE_DATA_MANAGER_DEBUG,
68
68
  );
69
69
 
70
- log('The save data manager loaded data from the "save#.dat" file.');
70
+ log(
71
+ `The save data manager loaded data from the "save#.dat" file for mod: ${mod.Name}`,
72
+ );
71
73
  }
72
74
 
73
75
  function readSaveDatFile(mod: Mod) {
@@ -17,7 +17,9 @@ export function saveToDisk(
17
17
  );
18
18
  const jsonString = jsonEncode(allSaveData);
19
19
  mod.SaveData(jsonString);
20
- log('The save data manager wrote data to the "save#.dat" file.');
20
+ log(
21
+ `The save data manager wrote data to the "save#.dat" file for mod: ${mod.Name}`,
22
+ );
21
23
  }
22
24
 
23
25
  function getAllSaveDataToWriteToDisk(
@@ -39,26 +39,47 @@ export function angleToDirection(angleDegrees: int): Direction {
39
39
  return Direction.RIGHT;
40
40
  }
41
41
 
42
+ /**
43
+ * Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
44
+ * 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
45
+ * `Vector.GetAngleDegrees` method works.)
46
+ */
42
47
  export function directionToDegrees(direction: Direction): int {
43
48
  return DIRECTION_TO_DEGREES[direction];
44
49
  }
45
50
 
51
+ /**
52
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
53
+ * (0) would return `ButtonAction.LEFT` (0).
54
+ */
46
55
  export function directionToMoveAction(
47
56
  direction: Direction,
48
57
  ): ButtonAction | undefined {
49
58
  return DIRECTION_TO_MOVE_ACTION[direction];
50
59
  }
51
60
 
61
+ /**
62
+ * Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
63
+ * (0) would return `ButtonAction.SHOOT_LEFT` (4).
64
+ */
52
65
  export function directionToShootAction(
53
66
  direction: Direction,
54
67
  ): ButtonAction | undefined {
55
68
  return DIRECTION_TO_SHOOT_ACTION[direction];
56
69
  }
57
70
 
71
+ /**
72
+ * Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
73
+ * convert to `Vector(-1, 0).
74
+ */
58
75
  export function directionToVector(direction: Direction): Readonly<Vector> {
59
76
  return DIRECTION_TO_VECTOR[direction];
60
77
  }
61
78
 
79
+ /**
80
+ * Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
81
+ * return "left".
82
+ */
62
83
  export function getDirectionName(direction: Direction): string | undefined {
63
84
  return DIRECTION_NAMES[direction];
64
85
  }