isaacscript-common 18.3.1 → 18.4.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/dist/index.d.ts +21 -1
- package/dist/isaacscript-common.lua +40 -2
- package/dist/src/classes/ModFeature.d.ts +13 -1
- package/dist/src/classes/ModFeature.d.ts.map +1 -1
- package/dist/src/classes/ModFeature.lua +1 -1
- package/dist/src/core/constants.d.ts +6 -0
- package/dist/src/core/constants.d.ts.map +1 -1
- package/dist/src/core/constants.lua +9 -3
- package/dist/src/functions/direction.d.ts +3 -1
- package/dist/src/functions/direction.d.ts.map +1 -1
- package/dist/src/functions/direction.lua +10 -0
- package/dist/src/objects/directionToMoveAction.d.ts +9 -0
- package/dist/src/objects/directionToMoveAction.d.ts.map +1 -0
- package/dist/src/objects/directionToMoveAction.lua +12 -0
- package/dist/src/objects/directionToShootAction.d.ts +9 -0
- package/dist/src/objects/directionToShootAction.d.ts.map +1 -0
- package/dist/src/objects/directionToShootAction.lua +12 -0
- package/package.json +1 -1
- package/src/classes/ModFeature.ts +28 -8
- package/src/core/constants.ts +6 -0
- package/src/functions/direction.ts +15 -1
- package/src/objects/directionToMoveAction.ts +10 -0
- package/src/objects/directionToShootAction.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -1320,6 +1320,8 @@ declare class CollectibleItemPoolType extends Feature {
|
|
|
1320
1320
|
export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
|
|
1321
1321
|
|
|
1322
1322
|
/**
|
|
1323
|
+
* Equal to `Color(1, 1, 1)`.
|
|
1324
|
+
*
|
|
1323
1325
|
* This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
|
|
1324
1326
|
* so it is not safe to use.)
|
|
1325
1327
|
*
|
|
@@ -3088,6 +3090,10 @@ export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
|
|
|
3088
3090
|
|
|
3089
3091
|
export declare function directionToDegrees(direction: Direction): int;
|
|
3090
3092
|
|
|
3093
|
+
export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
|
|
3094
|
+
|
|
3095
|
+
export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
|
|
3096
|
+
|
|
3091
3097
|
export declare function directionToVector(direction: Direction): Readonly<Vector>;
|
|
3092
3098
|
|
|
3093
3099
|
declare class DisableAllSound extends Feature {
|
|
@@ -11226,8 +11232,18 @@ export declare class ModFeature {
|
|
|
11226
11232
|
* conditional logic and early returning at the beginning of every callback function).
|
|
11227
11233
|
*
|
|
11228
11234
|
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
11235
|
+
*
|
|
11236
|
+
* The function has the following signature:
|
|
11237
|
+
*
|
|
11238
|
+
* ```ts
|
|
11239
|
+
* (
|
|
11240
|
+
* vanilla: boolean, // Whether or not this is a vanilla or custom callback.
|
|
11241
|
+
* modCallback: ModCallback | ModCallbackCustom,
|
|
11242
|
+
* ...callbackArgs: unknown[]
|
|
11243
|
+
* ) => boolean;
|
|
11244
|
+
* ```
|
|
11229
11245
|
*/
|
|
11230
|
-
protected callbackConditionalFunc: (() => boolean) | null;
|
|
11246
|
+
protected callbackConditionalFunc: ((vanilla: boolean, modCallback: ModCallback | ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
|
|
11231
11247
|
/**
|
|
11232
11248
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
11233
11249
|
* save data manager, if any).
|
|
@@ -14937,6 +14953,8 @@ export declare function validateInterfaceMatchesEnum<T extends Record<Enum, unkn
|
|
|
14937
14953
|
export declare function vectorEquals(vector1: Vector, vector2: Vector): boolean;
|
|
14938
14954
|
|
|
14939
14955
|
/**
|
|
14956
|
+
* Equal to `Vector(1, 1)`.
|
|
14957
|
+
*
|
|
14940
14958
|
* This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
|
|
14941
14959
|
* is not safe to use.)
|
|
14942
14960
|
*/
|
|
@@ -14948,6 +14966,8 @@ export declare function vectorToDirection(vector: Vector): Direction;
|
|
|
14948
14966
|
export declare function vectorToString(vector: Vector, round?: boolean): string;
|
|
14949
14967
|
|
|
14950
14968
|
/**
|
|
14969
|
+
* Equal to `Vector(0, 0)`.
|
|
14970
|
+
*
|
|
14951
14971
|
* This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
|
|
14952
14972
|
* is not safe to use.)
|
|
14953
14973
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 18.
|
|
3
|
+
isaacscript-common 18.4.0
|
|
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
|
|
@@ -49339,7 +49377,7 @@ function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback,
|
|
|
49339
49377
|
local function wrappedCallback(____, ...)
|
|
49340
49378
|
local conditionalFunc = modFeature.callbackConditionalFunc
|
|
49341
49379
|
if conditionalFunc ~= nil then
|
|
49342
|
-
local shouldRun = conditionalFunc(nil)
|
|
49380
|
+
local shouldRun = conditionalFunc(nil, vanilla, modCallback, ...)
|
|
49343
49381
|
if not shouldRun then
|
|
49344
49382
|
return nil
|
|
49345
49383
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ModCallback } from "isaac-typescript-definitions";
|
|
2
|
+
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
1
3
|
import { ModUpgradedBase } from "./ModUpgradedBase";
|
|
2
4
|
export declare const MOD_FEATURE_CALLBACKS_KEY = "__callbacks";
|
|
3
5
|
export declare const MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks";
|
|
@@ -45,8 +47,18 @@ export declare class ModFeature {
|
|
|
45
47
|
* conditional logic and early returning at the beginning of every callback function).
|
|
46
48
|
*
|
|
47
49
|
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
50
|
+
*
|
|
51
|
+
* The function has the following signature:
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* (
|
|
55
|
+
* vanilla: boolean, // Whether or not this is a vanilla or custom callback.
|
|
56
|
+
* modCallback: ModCallback | ModCallbackCustom,
|
|
57
|
+
* ...callbackArgs: unknown[]
|
|
58
|
+
* ) => boolean;
|
|
59
|
+
* ```
|
|
48
60
|
*/
|
|
49
|
-
protected callbackConditionalFunc: (() => boolean) | null;
|
|
61
|
+
protected callbackConditionalFunc: ((vanilla: boolean, modCallback: ModCallback | ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
|
|
50
62
|
/**
|
|
51
63
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
52
64
|
* save data manager, if any).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAS/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAyBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,uBAAuB,EAC7B,CAAC,CACC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GAAG,iBAAiB,EAC5C,GAAG,YAAY,EAAE,OAAO,EAAE,KACvB,OAAO,CAAC,GACb,IAAI,CAAQ;IAEhB;;;;;;OAMG;IACI,WAAW,UAAS;gBAEf,GAAG,EAAE,eAAe,EAAE,IAAI,UAAO;IAQ7C;;;;;OAKG;IACI,IAAI,CAAC,IAAI,UAAO,GAAG,IAAI;IAqB9B;;;;;;OAMG;IACI,MAAM,IAAI,IAAI;CAGtB"}
|
|
@@ -66,7 +66,7 @@ function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback,
|
|
|
66
66
|
local function wrappedCallback(____, ...)
|
|
67
67
|
local conditionalFunc = modFeature.callbackConditionalFunc
|
|
68
68
|
if conditionalFunc ~= nil then
|
|
69
|
-
local shouldRun = conditionalFunc(nil)
|
|
69
|
+
local shouldRun = conditionalFunc(nil, vanilla, modCallback, ...)
|
|
70
70
|
if not shouldRun then
|
|
71
71
|
return nil
|
|
72
72
|
end
|
|
@@ -133,16 +133,22 @@ export declare const TELEPORTER_ACTIVATION_DISTANCE: number;
|
|
|
133
133
|
*/
|
|
134
134
|
export declare const UI_HEART_WIDTH = 12;
|
|
135
135
|
/**
|
|
136
|
+
* Equal to `Vector(1, 1)`.
|
|
137
|
+
*
|
|
136
138
|
* This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
|
|
137
139
|
* is not safe to use.)
|
|
138
140
|
*/
|
|
139
141
|
export declare const VectorOne: Readonly<Vector>;
|
|
140
142
|
/**
|
|
143
|
+
* Equal to `Vector(0, 0)`.
|
|
144
|
+
*
|
|
141
145
|
* This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
|
|
142
146
|
* is not safe to use.)
|
|
143
147
|
*/
|
|
144
148
|
export declare const VectorZero: Readonly<Vector>;
|
|
145
149
|
/**
|
|
150
|
+
* Equal to `Color(1, 1, 1)`.
|
|
151
|
+
*
|
|
146
152
|
* This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
|
|
147
153
|
* so it is not safe to use.)
|
|
148
154
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAMtC;;;;;G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zC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAM,CAAC;AAElC,yCAAyC;AACzC,eAAO,MAAM,uCAAuC,QAAmB,CAAC;AAExE,iCAAiC;AACjC,eAAO,MAAM,sCAAsC,QAAmB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,gCAAgC,QAAmB,CAAC;AAEjE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD,eAAO,MAAM,cAAc,QAA+B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAyB,CAAC;AAExD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,6FAA6F;AAC7F,eAAO,MAAM,gDAAgD,QAAQ,CAAC;AAEtE,4CAA4C;AAC5C,eAAO,MAAM,8BAA8B,QAA4B,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAkB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAsB,CAAC"}
|
|
@@ -115,13 +115,19 @@ ____exports.TELEPORTER_ACTIVATION_DISTANCE = ____exports.DISTANCE_OF_GRID_TILE /
|
|
|
115
115
|
--- This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
116
116
|
-- corner.
|
|
117
117
|
____exports.UI_HEART_WIDTH = 12
|
|
118
|
-
---
|
|
118
|
+
--- Equal to `Vector(1, 1)`.
|
|
119
|
+
--
|
|
120
|
+
-- This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
|
|
119
121
|
-- is not safe to use.)
|
|
120
122
|
____exports.VectorOne = Vector(1, 1)
|
|
121
|
-
---
|
|
123
|
+
--- Equal to `Vector(0, 0)`.
|
|
124
|
+
--
|
|
125
|
+
-- This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
|
|
122
126
|
-- is not safe to use.)
|
|
123
127
|
____exports.VectorZero = Vector(0, 0)
|
|
124
|
-
---
|
|
128
|
+
--- Equal to `Color(1, 1, 1)`.
|
|
129
|
+
--
|
|
130
|
+
-- This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
|
|
125
131
|
-- so it is not safe to use.)
|
|
126
132
|
--
|
|
127
133
|
-- If you need to mutate this, make a copy first with the `copyColor` helper function.
|
|
@@ -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;
|
|
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
|
@@ -82,8 +82,24 @@ export class ModFeature {
|
|
|
82
82
|
* conditional logic and early returning at the beginning of every callback function).
|
|
83
83
|
*
|
|
84
84
|
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
85
|
+
*
|
|
86
|
+
* The function has the following signature:
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* (
|
|
90
|
+
* vanilla: boolean, // Whether or not this is a vanilla or custom callback.
|
|
91
|
+
* modCallback: ModCallback | ModCallbackCustom,
|
|
92
|
+
* ...callbackArgs: unknown[]
|
|
93
|
+
* ) => boolean;
|
|
94
|
+
* ```
|
|
85
95
|
*/
|
|
86
|
-
protected callbackConditionalFunc:
|
|
96
|
+
protected callbackConditionalFunc:
|
|
97
|
+
| ((
|
|
98
|
+
vanilla: boolean,
|
|
99
|
+
modCallback: ModCallback | ModCallbackCustom,
|
|
100
|
+
...callbackArgs: unknown[]
|
|
101
|
+
) => boolean)
|
|
102
|
+
| null = null;
|
|
87
103
|
|
|
88
104
|
/**
|
|
89
105
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
@@ -205,13 +221,18 @@ function initDecoratedCallbacks(
|
|
|
205
221
|
modFeature,
|
|
206
222
|
modFeatureConstructor,
|
|
207
223
|
mod,
|
|
208
|
-
modCallback,
|
|
224
|
+
modCallback, // eslint-disable-line isaacscript/strict-enums
|
|
209
225
|
callback,
|
|
210
226
|
parameters,
|
|
211
227
|
vanilla,
|
|
212
228
|
);
|
|
213
229
|
} else {
|
|
214
|
-
removeCallback(
|
|
230
|
+
removeCallback(
|
|
231
|
+
modFeatureConstructor,
|
|
232
|
+
mod,
|
|
233
|
+
modCallback, // eslint-disable-line isaacscript/strict-enums
|
|
234
|
+
vanilla,
|
|
235
|
+
);
|
|
215
236
|
}
|
|
216
237
|
}
|
|
217
238
|
}
|
|
@@ -220,9 +241,8 @@ function addCallback(
|
|
|
220
241
|
modFeature: ModFeature,
|
|
221
242
|
modFeatureConstructor: ModFeatureConstructor,
|
|
222
243
|
mod: ModUpgradedBase,
|
|
223
|
-
modCallback:
|
|
224
|
-
// eslint-disable-
|
|
225
|
-
callback: Function,
|
|
244
|
+
modCallback: ModCallback | ModCallbackCustom,
|
|
245
|
+
callback: Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
226
246
|
parameters: unknown[],
|
|
227
247
|
vanilla: boolean,
|
|
228
248
|
) {
|
|
@@ -232,7 +252,7 @@ function addCallback(
|
|
|
232
252
|
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
233
253
|
const conditionalFunc = modFeature["callbackConditionalFunc"];
|
|
234
254
|
if (conditionalFunc !== null) {
|
|
235
|
-
const shouldRun = conditionalFunc();
|
|
255
|
+
const shouldRun = conditionalFunc(vanilla, modCallback, ...callbackArgs);
|
|
236
256
|
if (!shouldRun) {
|
|
237
257
|
return undefined;
|
|
238
258
|
}
|
|
@@ -284,7 +304,7 @@ function addCallback(
|
|
|
284
304
|
function removeCallback(
|
|
285
305
|
modFeatureConstructor: ModFeatureConstructor,
|
|
286
306
|
mod: ModUpgradedBase,
|
|
287
|
-
modCallback:
|
|
307
|
+
modCallback: ModCallback | ModCallbackCustom,
|
|
288
308
|
vanilla: boolean,
|
|
289
309
|
) {
|
|
290
310
|
if (vanilla) {
|
package/src/core/constants.ts
CHANGED
|
@@ -190,18 +190,24 @@ export const TELEPORTER_ACTIVATION_DISTANCE = DISTANCE_OF_GRID_TILE / 2;
|
|
|
190
190
|
export const UI_HEART_WIDTH = 12;
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
|
+
* Equal to `Vector(1, 1)`.
|
|
194
|
+
*
|
|
193
195
|
* This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
|
|
194
196
|
* is not safe to use.)
|
|
195
197
|
*/
|
|
196
198
|
export const VectorOne: Readonly<Vector> = Vector(1, 1);
|
|
197
199
|
|
|
198
200
|
/**
|
|
201
|
+
* Equal to `Vector(0, 0)`.
|
|
202
|
+
*
|
|
199
203
|
* This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
|
|
200
204
|
* is not safe to use.)
|
|
201
205
|
*/
|
|
202
206
|
export const VectorZero: Readonly<Vector> = Vector(0, 0);
|
|
203
207
|
|
|
204
208
|
/**
|
|
209
|
+
* Equal to `Color(1, 1, 1)`.
|
|
210
|
+
*
|
|
205
211
|
* This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
|
|
206
212
|
* so it is not safe to use.)
|
|
207
213
|
*
|
|
@@ -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>;
|