isaacscript-common 18.3.1 → 18.3.2

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/dist/index.d.ts CHANGED
@@ -3088,6 +3088,10 @@ export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
3088
3088
 
3089
3089
  export declare function directionToDegrees(direction: Direction): int;
3090
3090
 
3091
+ export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
3092
+
3093
+ export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
3094
+
3091
3095
  export declare function directionToVector(direction: Direction): Readonly<Vector>;
3092
3096
 
3093
3097
  declare class DisableAllSound extends Feature {
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 18.3.1
3
+ isaacscript-common 18.3.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -16352,6 +16352,34 @@ ____exports.DIRECTION_TO_DEGREES = {
16352
16352
  [Direction.RIGHT] = 0,
16353
16353
  [Direction.DOWN] = 90
16354
16354
  }
16355
+ return ____exports
16356
+ end,
16357
+ ["src.objects.directionToMoveAction"] = function(...)
16358
+ local ____exports = {}
16359
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
16360
+ local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
16361
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
16362
+ ____exports.DIRECTION_TO_MOVE_ACTION = {
16363
+ [Direction.NO_DIRECTION] = nil,
16364
+ [Direction.LEFT] = ButtonAction.LEFT,
16365
+ [Direction.UP] = ButtonAction.UP,
16366
+ [Direction.RIGHT] = ButtonAction.RIGHT,
16367
+ [Direction.DOWN] = ButtonAction.DOWN
16368
+ }
16369
+ return ____exports
16370
+ end,
16371
+ ["src.objects.directionToShootAction"] = function(...)
16372
+ local ____exports = {}
16373
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
16374
+ local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
16375
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
16376
+ ____exports.DIRECTION_TO_SHOOT_ACTION = {
16377
+ [Direction.NO_DIRECTION] = nil,
16378
+ [Direction.LEFT] = ButtonAction.SHOOT_LEFT,
16379
+ [Direction.UP] = ButtonAction.SHOOT_UP,
16380
+ [Direction.RIGHT] = ButtonAction.SHOOT_RIGHT,
16381
+ [Direction.DOWN] = ButtonAction.SHOOT_DOWN
16382
+ }
16355
16383
  return ____exports
16356
16384
  end,
16357
16385
  ["src.functions.array"] = function(...)
@@ -16995,6 +17023,10 @@ local ____directionNames = require("src.objects.directionNames")
16995
17023
  local DIRECTION_NAMES = ____directionNames.DIRECTION_NAMES
16996
17024
  local ____directionToDegrees = require("src.objects.directionToDegrees")
16997
17025
  local DIRECTION_TO_DEGREES = ____directionToDegrees.DIRECTION_TO_DEGREES
17026
+ local ____directionToMoveAction = require("src.objects.directionToMoveAction")
17027
+ local DIRECTION_TO_MOVE_ACTION = ____directionToMoveAction.DIRECTION_TO_MOVE_ACTION
17028
+ local ____directionToShootAction = require("src.objects.directionToShootAction")
17029
+ local DIRECTION_TO_SHOOT_ACTION = ____directionToShootAction.DIRECTION_TO_SHOOT_ACTION
16998
17030
  local ____directionToVector = require("src.objects.directionToVector")
16999
17031
  local DIRECTION_TO_VECTOR = ____directionToVector.DIRECTION_TO_VECTOR
17000
17032
  function ____exports.angleToDirection(self, angleDegrees)
@@ -17020,6 +17052,12 @@ end
17020
17052
  function ____exports.directionToDegrees(self, direction)
17021
17053
  return DIRECTION_TO_DEGREES[direction]
17022
17054
  end
17055
+ function ____exports.directionToMoveAction(self, direction)
17056
+ return DIRECTION_TO_MOVE_ACTION[direction]
17057
+ end
17058
+ function ____exports.directionToShootAction(self, direction)
17059
+ return DIRECTION_TO_SHOOT_ACTION[direction]
17060
+ end
17023
17061
  function ____exports.directionToVector(self, direction)
17024
17062
  return DIRECTION_TO_VECTOR[direction]
17025
17063
  end
@@ -1,4 +1,4 @@
1
- import { Direction } from "isaac-typescript-definitions";
1
+ import { ButtonAction, Direction } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function to convert the degrees of an angle to the `Direction` enum.
4
4
  *
@@ -8,6 +8,8 @@ import { Direction } from "isaac-typescript-definitions";
8
8
  */
9
9
  export declare function angleToDirection(angleDegrees: int): Direction;
10
10
  export declare function directionToDegrees(direction: Direction): int;
11
+ export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
12
+ export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
11
13
  export declare function directionToVector(direction: Direction): Readonly<Vector>;
12
14
  export declare function getDirectionName(direction: Direction): string | undefined;
13
15
  //# sourceMappingURL=direction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/functions/direction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAKzD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,CAwB7D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAE5D;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAExE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE"}
1
+ {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/functions/direction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOvE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,CAwB7D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAE5D;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAExE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE"}
@@ -5,6 +5,10 @@ local ____directionNames = require("src.objects.directionNames")
5
5
  local DIRECTION_NAMES = ____directionNames.DIRECTION_NAMES
6
6
  local ____directionToDegrees = require("src.objects.directionToDegrees")
7
7
  local DIRECTION_TO_DEGREES = ____directionToDegrees.DIRECTION_TO_DEGREES
8
+ local ____directionToMoveAction = require("src.objects.directionToMoveAction")
9
+ local DIRECTION_TO_MOVE_ACTION = ____directionToMoveAction.DIRECTION_TO_MOVE_ACTION
10
+ local ____directionToShootAction = require("src.objects.directionToShootAction")
11
+ local DIRECTION_TO_SHOOT_ACTION = ____directionToShootAction.DIRECTION_TO_SHOOT_ACTION
8
12
  local ____directionToVector = require("src.objects.directionToVector")
9
13
  local DIRECTION_TO_VECTOR = ____directionToVector.DIRECTION_TO_VECTOR
10
14
  --- Helper function to convert the degrees of an angle to the `Direction` enum.
@@ -35,6 +39,12 @@ end
35
39
  function ____exports.directionToDegrees(self, direction)
36
40
  return DIRECTION_TO_DEGREES[direction]
37
41
  end
42
+ function ____exports.directionToMoveAction(self, direction)
43
+ return DIRECTION_TO_MOVE_ACTION[direction]
44
+ end
45
+ function ____exports.directionToShootAction(self, direction)
46
+ return DIRECTION_TO_SHOOT_ACTION[direction]
47
+ end
38
48
  function ____exports.directionToVector(self, direction)
39
49
  return DIRECTION_TO_VECTOR[direction]
40
50
  end
@@ -0,0 +1,9 @@
1
+ import { ButtonAction } from "isaac-typescript-definitions";
2
+ export declare const DIRECTION_TO_MOVE_ACTION: {
3
+ readonly [-1]: undefined;
4
+ readonly 0: ButtonAction.LEFT;
5
+ readonly 1: ButtonAction.UP;
6
+ readonly 2: ButtonAction.RIGHT;
7
+ readonly 3: ButtonAction.DOWN;
8
+ };
9
+ //# sourceMappingURL=directionToMoveAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directionToMoveAction.d.ts","sourceRoot":"","sources":["../../../src/objects/directionToMoveAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,wBAAwB;;;;;;CAMmC,CAAC"}
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
4
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
5
+ ____exports.DIRECTION_TO_MOVE_ACTION = {
6
+ [Direction.NO_DIRECTION] = nil,
7
+ [Direction.LEFT] = ButtonAction.LEFT,
8
+ [Direction.UP] = ButtonAction.UP,
9
+ [Direction.RIGHT] = ButtonAction.RIGHT,
10
+ [Direction.DOWN] = ButtonAction.DOWN
11
+ }
12
+ return ____exports
@@ -0,0 +1,9 @@
1
+ import { ButtonAction } from "isaac-typescript-definitions";
2
+ export declare const DIRECTION_TO_SHOOT_ACTION: {
3
+ readonly [-1]: undefined;
4
+ readonly 0: ButtonAction.SHOOT_LEFT;
5
+ readonly 1: ButtonAction.SHOOT_UP;
6
+ readonly 2: ButtonAction.SHOOT_RIGHT;
7
+ readonly 3: ButtonAction.SHOOT_DOWN;
8
+ };
9
+ //# sourceMappingURL=directionToShootAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directionToShootAction.d.ts","sourceRoot":"","sources":["../../../src/objects/directionToShootAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,yBAAyB;;;;;;CAMkC,CAAC"}
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
4
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
5
+ ____exports.DIRECTION_TO_SHOOT_ACTION = {
6
+ [Direction.NO_DIRECTION] = nil,
7
+ [Direction.LEFT] = ButtonAction.SHOOT_LEFT,
8
+ [Direction.UP] = ButtonAction.SHOOT_UP,
9
+ [Direction.RIGHT] = ButtonAction.SHOOT_RIGHT,
10
+ [Direction.DOWN] = ButtonAction.SHOOT_DOWN
11
+ }
12
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "18.3.1",
3
+ "version": "18.3.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,6 +1,8 @@
1
- import { Direction } from "isaac-typescript-definitions";
1
+ import { ButtonAction, Direction } from "isaac-typescript-definitions";
2
2
  import { DIRECTION_NAMES } from "../objects/directionNames";
3
3
  import { DIRECTION_TO_DEGREES } from "../objects/directionToDegrees";
4
+ import { DIRECTION_TO_MOVE_ACTION } from "../objects/directionToMoveAction";
5
+ import { DIRECTION_TO_SHOOT_ACTION } from "../objects/directionToShootAction";
4
6
  import { DIRECTION_TO_VECTOR } from "../objects/directionToVector";
5
7
 
6
8
  /**
@@ -40,6 +42,18 @@ export function directionToDegrees(direction: Direction): int {
40
42
  return DIRECTION_TO_DEGREES[direction];
41
43
  }
42
44
 
45
+ export function directionToMoveAction(
46
+ direction: Direction,
47
+ ): ButtonAction | undefined {
48
+ return DIRECTION_TO_MOVE_ACTION[direction];
49
+ }
50
+
51
+ export function directionToShootAction(
52
+ direction: Direction,
53
+ ): ButtonAction | undefined {
54
+ return DIRECTION_TO_SHOOT_ACTION[direction];
55
+ }
56
+
43
57
  export function directionToVector(direction: Direction): Readonly<Vector> {
44
58
  return DIRECTION_TO_VECTOR[direction];
45
59
  }
@@ -0,0 +1,10 @@
1
+ import { ButtonAction, Direction } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
3
+
4
+ export const DIRECTION_TO_MOVE_ACTION = {
5
+ [Direction.NO_DIRECTION]: undefined, // -1
6
+ [Direction.LEFT]: ButtonAction.LEFT, // 0
7
+ [Direction.UP]: ButtonAction.UP, // 1
8
+ [Direction.RIGHT]: ButtonAction.RIGHT, // 2
9
+ [Direction.DOWN]: ButtonAction.DOWN, // 3
10
+ } as const satisfies HasAllEnumKeys<Direction, ButtonAction | undefined>;
@@ -0,0 +1,10 @@
1
+ import { ButtonAction, Direction } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
3
+
4
+ export const DIRECTION_TO_SHOOT_ACTION = {
5
+ [Direction.NO_DIRECTION]: undefined, // -1
6
+ [Direction.LEFT]: ButtonAction.SHOOT_LEFT, // 0
7
+ [Direction.UP]: ButtonAction.SHOOT_UP, // 1
8
+ [Direction.RIGHT]: ButtonAction.SHOOT_RIGHT, // 2
9
+ [Direction.DOWN]: ButtonAction.SHOOT_DOWN, // 3
10
+ } as const satisfies HasAllEnumKeys<Direction, ButtonAction | undefined>;