isaacscript-common 17.5.0 → 17.7.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 +42 -4
- package/dist/isaacscript-common.lua +31 -7
- package/dist/src/classes/ModFeature.d.ts +11 -0
- package/dist/src/classes/ModFeature.d.ts.map +1 -1
- package/dist/src/classes/ModFeature.lua +8 -0
- package/dist/src/classes/features/other/ModdedElementSets.d.ts +8 -0
- package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/src/functions/decorators.d.ts +2 -2
- package/dist/src/functions/decorators.d.ts.map +1 -1
- package/dist/src/functions/input.d.ts +22 -5
- package/dist/src/functions/input.d.ts.map +1 -1
- package/dist/src/functions/input.lua +37 -10
- package/package.json +1 -1
- package/src/classes/ModFeature.ts +21 -0
- package/src/classes/features/other/ModdedElementSets.ts +8 -0
- package/src/functions/decorators.ts +4 -2
- package/src/functions/input.ts +39 -10
package/dist/index.d.ts
CHANGED
|
@@ -6965,7 +6965,16 @@ declare interface IsaacAPIClassTypeToType {
|
|
|
6965
6965
|
}
|
|
6966
6966
|
|
|
6967
6967
|
/**
|
|
6968
|
-
*
|
|
6968
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
6969
|
+
*
|
|
6970
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
6971
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
6972
|
+
*/
|
|
6973
|
+
export declare function isActionPressed(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
6974
|
+
|
|
6975
|
+
/**
|
|
6976
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
6977
|
+
* being held down).
|
|
6969
6978
|
*
|
|
6970
6979
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
6971
6980
|
* function will return true if any of the buttons are pressed.
|
|
@@ -6973,8 +6982,18 @@ declare interface IsaacAPIClassTypeToType {
|
|
|
6973
6982
|
export declare function isActionPressedOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
6974
6983
|
|
|
6975
6984
|
/**
|
|
6976
|
-
*
|
|
6977
|
-
*
|
|
6985
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
6986
|
+
* it).
|
|
6987
|
+
*
|
|
6988
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
6989
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
6990
|
+
* triggered.
|
|
6991
|
+
*/
|
|
6992
|
+
export declare function isActionTriggered(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
6993
|
+
|
|
6994
|
+
/**
|
|
6995
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
6996
|
+
* released).
|
|
6978
6997
|
*
|
|
6979
6998
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
6980
6999
|
* function will return true if any of the buttons are pressed.
|
|
@@ -7507,7 +7526,7 @@ export declare function isKeeper(player: EntityPlayer): boolean;
|
|
|
7507
7526
|
export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
|
|
7508
7527
|
|
|
7509
7528
|
/**
|
|
7510
|
-
* Helper function to see if a
|
|
7529
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
7511
7530
|
*
|
|
7512
7531
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
7513
7532
|
* This function will return true if any of the values are pressed.
|
|
@@ -10864,12 +10883,18 @@ declare class ModdedElementSets extends Feature {
|
|
|
10864
10883
|
* - any runes
|
|
10865
10884
|
* - any objects like Dice Shard
|
|
10866
10885
|
*
|
|
10886
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
10887
|
+
*
|
|
10867
10888
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
10868
10889
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
10869
10890
|
* @param exceptions Optional. An array of cards to not select.
|
|
10870
10891
|
*/
|
|
10871
10892
|
getRandomCard(seedOrRNG?: Seed | RNG, exceptions?: CardType[]): CardType;
|
|
10872
10893
|
/**
|
|
10894
|
+
* Helper function to get a random card type that matches the provided `ItemConfigCardType`.
|
|
10895
|
+
*
|
|
10896
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
10897
|
+
*
|
|
10873
10898
|
* @param itemConfigCardType The item config card type that represents the pool of cards to select
|
|
10874
10899
|
* from.
|
|
10875
10900
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
@@ -10881,6 +10906,8 @@ declare class ModdedElementSets extends Feature {
|
|
|
10881
10906
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul
|
|
10882
10907
|
* of Isaac, etc.). This will never return a Rune Shard.
|
|
10883
10908
|
*
|
|
10909
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
10910
|
+
*
|
|
10884
10911
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
10885
10912
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
10886
10913
|
* @param exceptions Optional. An array of runes to not select.
|
|
@@ -11039,6 +11066,17 @@ declare class ModdedElementSets extends Feature {
|
|
|
11039
11066
|
*/
|
|
11040
11067
|
export declare class ModFeature {
|
|
11041
11068
|
private mod;
|
|
11069
|
+
/**
|
|
11070
|
+
* An optional function that allows for conditional callback execution. If specified, any class
|
|
11071
|
+
* method that is annotated with a `@Callback` or `@CallbackCustom` decorator will only be fired
|
|
11072
|
+
* if the executed conditional function returns true.
|
|
11073
|
+
*
|
|
11074
|
+
* This property is used to easily turn entire mod features on and off (rather than repeating
|
|
11075
|
+
* conditional logic and early returning at the beginning of every callback function).
|
|
11076
|
+
*
|
|
11077
|
+
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
11078
|
+
*/
|
|
11079
|
+
private callbackConditionalFunc;
|
|
11042
11080
|
/**
|
|
11043
11081
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
11044
11082
|
* save data manager, if any).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 17.
|
|
3
|
+
isaacscript-common 17.7.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -34863,25 +34863,41 @@ end
|
|
|
34863
34863
|
function ____exports.getShootActions(self)
|
|
34864
34864
|
return ____exports.SHOOTING_ACTIONS_SET
|
|
34865
34865
|
end
|
|
34866
|
+
function ____exports.isActionPressed(self, controllerIndex, ...)
|
|
34867
|
+
local buttonActions = {...}
|
|
34868
|
+
return __TS__ArraySome(
|
|
34869
|
+
buttonActions,
|
|
34870
|
+
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
34871
|
+
)
|
|
34872
|
+
end
|
|
34866
34873
|
function ____exports.isActionPressedOnAnyInput(self, ...)
|
|
34867
34874
|
local buttonActions = {...}
|
|
34868
34875
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
34869
34876
|
return __TS__ArraySome(
|
|
34870
34877
|
controllerIndexes,
|
|
34871
|
-
function(____, controllerIndex) return
|
|
34872
|
-
|
|
34873
|
-
|
|
34878
|
+
function(____, controllerIndex) return ____exports.isActionPressed(
|
|
34879
|
+
nil,
|
|
34880
|
+
controllerIndex,
|
|
34881
|
+
table.unpack(buttonActions)
|
|
34874
34882
|
) end
|
|
34875
34883
|
)
|
|
34876
34884
|
end
|
|
34885
|
+
function ____exports.isActionTriggered(self, controllerIndex, ...)
|
|
34886
|
+
local buttonActions = {...}
|
|
34887
|
+
return __TS__ArraySome(
|
|
34888
|
+
buttonActions,
|
|
34889
|
+
function(____, buttonAction) return Input.IsActionTriggered(buttonAction, controllerIndex) end
|
|
34890
|
+
)
|
|
34891
|
+
end
|
|
34877
34892
|
function ____exports.isActionTriggeredOnAnyInput(self, ...)
|
|
34878
34893
|
local buttonActions = {...}
|
|
34879
34894
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
34880
34895
|
return __TS__ArraySome(
|
|
34881
34896
|
controllerIndexes,
|
|
34882
|
-
function(____, controllerIndex) return
|
|
34883
|
-
|
|
34884
|
-
|
|
34897
|
+
function(____, controllerIndex) return ____exports.isActionTriggered(
|
|
34898
|
+
nil,
|
|
34899
|
+
controllerIndex,
|
|
34900
|
+
table.unpack(buttonActions)
|
|
34885
34901
|
) end
|
|
34886
34902
|
)
|
|
34887
34903
|
end
|
|
@@ -49196,6 +49212,13 @@ function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, va
|
|
|
49196
49212
|
end
|
|
49197
49213
|
function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback, callback, parameters, vanilla)
|
|
49198
49214
|
local function wrappedCallback(____, ...)
|
|
49215
|
+
local conditionalFunc = modFeature.callbackConditionalFunc
|
|
49216
|
+
if conditionalFunc ~= nil then
|
|
49217
|
+
local shouldRun = conditionalFunc(nil)
|
|
49218
|
+
if not shouldRun then
|
|
49219
|
+
return nil
|
|
49220
|
+
end
|
|
49221
|
+
end
|
|
49199
49222
|
local castedCallback = callback
|
|
49200
49223
|
return castedCallback(modFeature, ...)
|
|
49201
49224
|
end
|
|
@@ -49284,6 +49307,7 @@ function ModFeature.prototype.____constructor(self, mod, init)
|
|
|
49284
49307
|
if init == nil then
|
|
49285
49308
|
init = true
|
|
49286
49309
|
end
|
|
49310
|
+
self.callbackConditionalFunc = nil
|
|
49287
49311
|
self.initialized = false
|
|
49288
49312
|
self.mod = mod
|
|
49289
49313
|
if init then
|
|
@@ -36,6 +36,17 @@ export declare const ADD_CALLBACK_CUSTOM_ARGS_KEY = "__addCallbackCustomArgs";
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class ModFeature {
|
|
38
38
|
private mod;
|
|
39
|
+
/**
|
|
40
|
+
* An optional function that allows for conditional callback execution. If specified, any class
|
|
41
|
+
* method that is annotated with a `@Callback` or `@CallbackCustom` decorator will only be fired
|
|
42
|
+
* if the executed conditional function returns true.
|
|
43
|
+
*
|
|
44
|
+
* This property is used to easily turn entire mod features on and off (rather than repeating
|
|
45
|
+
* conditional logic and early returning at the beginning of every callback function).
|
|
46
|
+
*
|
|
47
|
+
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
48
|
+
*/
|
|
49
|
+
private callbackConditionalFunc;
|
|
39
50
|
/**
|
|
40
51
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
41
52
|
* save data manager, if any).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAatE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;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"}
|
|
1
|
+
{"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAatE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;OASG;IACH,OAAO,CAAC,uBAAuB,CAAgC;IAE/D;;;;;;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"}
|
|
@@ -63,6 +63,13 @@ function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, va
|
|
|
63
63
|
end
|
|
64
64
|
function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback, callback, parameters, vanilla)
|
|
65
65
|
local function wrappedCallback(____, ...)
|
|
66
|
+
local conditionalFunc = modFeature.callbackConditionalFunc
|
|
67
|
+
if conditionalFunc ~= nil then
|
|
68
|
+
local shouldRun = conditionalFunc(nil)
|
|
69
|
+
if not shouldRun then
|
|
70
|
+
return nil
|
|
71
|
+
end
|
|
72
|
+
end
|
|
66
73
|
local castedCallback = callback
|
|
67
74
|
return castedCallback(modFeature, ...)
|
|
68
75
|
end
|
|
@@ -182,6 +189,7 @@ function ModFeature.prototype.____constructor(self, mod, init)
|
|
|
182
189
|
if init == nil then
|
|
183
190
|
init = true
|
|
184
191
|
end
|
|
192
|
+
self.callbackConditionalFunc = nil
|
|
185
193
|
self.initialized = false
|
|
186
194
|
self.mod = mod
|
|
187
195
|
if init then
|
|
@@ -348,12 +348,18 @@ export declare class ModdedElementSets extends Feature {
|
|
|
348
348
|
* - any runes
|
|
349
349
|
* - any objects like Dice Shard
|
|
350
350
|
*
|
|
351
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
352
|
+
*
|
|
351
353
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
352
354
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
353
355
|
* @param exceptions Optional. An array of cards to not select.
|
|
354
356
|
*/
|
|
355
357
|
getRandomCard(seedOrRNG?: Seed | RNG, exceptions?: CardType[]): CardType;
|
|
356
358
|
/**
|
|
359
|
+
* Helper function to get a random card type that matches the provided `ItemConfigCardType`.
|
|
360
|
+
*
|
|
361
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
362
|
+
*
|
|
357
363
|
* @param itemConfigCardType The item config card type that represents the pool of cards to select
|
|
358
364
|
* from.
|
|
359
365
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
@@ -365,6 +371,8 @@ export declare class ModdedElementSets extends Feature {
|
|
|
365
371
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul
|
|
366
372
|
* of Isaac, etc.). This will never return a Rune Shard.
|
|
367
373
|
*
|
|
374
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
375
|
+
*
|
|
368
376
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
369
377
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
370
378
|
* @param exceptions Optional. An array of runes to not select.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAkCtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,wBAAwB,CAAyB;IACzD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D;;;;;;;;;;;OAWG;IAEI,yBAAyB,IAAI,SAAS,eAAe,EAAE;IAK9D;;;;;;;;;;;OAWG;IAEI,uBAAuB,IAAI,WAAW,CAAC,eAAe,CAAC;IAK9D;;;;;;;;;;OAUG;IAEI,qBAAqB,IAAI,SAAS,WAAW,EAAE;IAKtD;;;;;;;;;;OAUG;IAEI,mBAAmB,IAAI,WAAW,CAAC,WAAW,CAAC;IAKtD;;;;;;;OAOG;IAEI,uBAAuB,CAC5B,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC;IAoC5B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IAEI,kCAAkC,CACvC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,eAAe,EAAE;IAkBpB;;;;OAIG;IAEI,4BAA4B,CACjC,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,aAAa,GAC3B,eAAe,EAAE;IAepB;;;;OAIG;IAEI,sCAAsC,CAC3C,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,eAAe,EAAE;IAkBpB;;;;;;;;OAQG;IAEI,8BAA8B,CACnC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC;IAcxB
|
|
1
|
+
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAkCtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,wBAAwB,CAAyB;IACzD,OAAO,CAAC,sBAAsB,CAA8B;IAE5D,OAAO,CAAC,4BAA4B,CAAyB;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":"decorators.d.ts","sourceRoot":"","sources":["../../../src/functions/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAGL,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,EAC5C,WAAW,EAAE,CAAC,EACd,GAAG,YAAY,EAAE,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,kGAIvC,MAAM,+CAElB,IAAI,CA+BR;AAED;;;;;GAKG;AAEH,wBAAgB,cAAc,CAAC,CAAC,SAAS,iBAAiB,EACxD,iBAAiB,EAAE,CAAC,EACpB,GAAG,YAAY,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,wGAO7C,MAAM,+CAElB,IAAI,CAiCR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonAction, Controller, Keyboard } from "isaac-typescript-definitions";
|
|
1
|
+
import { ButtonAction, Controller, ControllerIndex, Keyboard } from "isaac-typescript-definitions";
|
|
2
2
|
export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
3
3
|
export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
4
4
|
/**
|
|
@@ -11,22 +11,39 @@ export declare function controllerToString(controller: Controller): string | und
|
|
|
11
11
|
export declare function getMoveActions(): ReadonlySet<ButtonAction>;
|
|
12
12
|
export declare function getShootActions(): ReadonlySet<ButtonAction>;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
15
|
+
*
|
|
16
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
17
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isActionPressed(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
22
|
+
* being held down).
|
|
15
23
|
*
|
|
16
24
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
17
25
|
* function will return true if any of the buttons are pressed.
|
|
18
26
|
*/
|
|
19
27
|
export declare function isActionPressedOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
29
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
30
|
+
* it).
|
|
31
|
+
*
|
|
32
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
33
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
34
|
+
* triggered.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isActionTriggered(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
39
|
+
* released).
|
|
23
40
|
*
|
|
24
41
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
25
42
|
* function will return true if any of the buttons are pressed.
|
|
26
43
|
*/
|
|
27
44
|
export declare function isActionTriggeredOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
28
45
|
/**
|
|
29
|
-
* Helper function to see if a
|
|
46
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
30
47
|
*
|
|
31
48
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
32
49
|
* This function will return true if any of the values are pressed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAuBtC,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AASF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED,wBAAgB,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAE1D;AAED,wBAAgB,eAAe,IAAI,WAAW,CAAC,YAAY,CAAC,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,eAAe,EAChC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAKT;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,eAAe,EAChC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEjE;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -45,7 +45,19 @@ end
|
|
|
45
45
|
function ____exports.getShootActions(self)
|
|
46
46
|
return ____exports.SHOOTING_ACTIONS_SET
|
|
47
47
|
end
|
|
48
|
-
---
|
|
48
|
+
--- Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
49
|
+
--
|
|
50
|
+
-- This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
51
|
+
-- as you want to check for. This function will return true if any of the buttons are pressed.
|
|
52
|
+
function ____exports.isActionPressed(self, controllerIndex, ...)
|
|
53
|
+
local buttonActions = {...}
|
|
54
|
+
return __TS__ArraySome(
|
|
55
|
+
buttonActions,
|
|
56
|
+
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
--- Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
60
|
+
-- being held down).
|
|
49
61
|
--
|
|
50
62
|
-- This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
51
63
|
-- function will return true if any of the buttons are pressed.
|
|
@@ -54,14 +66,28 @@ function ____exports.isActionPressedOnAnyInput(self, ...)
|
|
|
54
66
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
55
67
|
return __TS__ArraySome(
|
|
56
68
|
controllerIndexes,
|
|
57
|
-
function(____, controllerIndex) return
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
function(____, controllerIndex) return ____exports.isActionPressed(
|
|
70
|
+
nil,
|
|
71
|
+
controllerIndex,
|
|
72
|
+
table.unpack(buttonActions)
|
|
60
73
|
) end
|
|
61
74
|
)
|
|
62
75
|
end
|
|
63
|
-
---
|
|
64
|
-
--
|
|
76
|
+
--- Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
77
|
+
-- it).
|
|
78
|
+
--
|
|
79
|
+
-- This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
80
|
+
-- buttons as you want to check for. This function will return true if any of the buttons are
|
|
81
|
+
-- triggered.
|
|
82
|
+
function ____exports.isActionTriggered(self, controllerIndex, ...)
|
|
83
|
+
local buttonActions = {...}
|
|
84
|
+
return __TS__ArraySome(
|
|
85
|
+
buttonActions,
|
|
86
|
+
function(____, buttonAction) return Input.IsActionTriggered(buttonAction, controllerIndex) end
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
--- Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
90
|
+
-- released).
|
|
65
91
|
--
|
|
66
92
|
-- This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
67
93
|
-- function will return true if any of the buttons are pressed.
|
|
@@ -70,13 +96,14 @@ function ____exports.isActionTriggeredOnAnyInput(self, ...)
|
|
|
70
96
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
71
97
|
return __TS__ArraySome(
|
|
72
98
|
controllerIndexes,
|
|
73
|
-
function(____, controllerIndex) return
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
function(____, controllerIndex) return ____exports.isActionTriggered(
|
|
100
|
+
nil,
|
|
101
|
+
controllerIndex,
|
|
102
|
+
table.unpack(buttonActions)
|
|
76
103
|
) end
|
|
77
104
|
)
|
|
78
105
|
end
|
|
79
|
-
--- Helper function to see if a
|
|
106
|
+
--- Helper function to see if a specific keyboard key is being held down by the player.
|
|
80
107
|
--
|
|
81
108
|
-- This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
82
109
|
-- This function will return true if any of the values are pressed.
|
package/package.json
CHANGED
|
@@ -62,6 +62,18 @@ type ModFeatureConstructor = TSTLClassMetatable["constructor"] & {
|
|
|
62
62
|
export class ModFeature {
|
|
63
63
|
private mod: ModUpgradedBase;
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* An optional function that allows for conditional callback execution. If specified, any class
|
|
67
|
+
* method that is annotated with a `@Callback` or `@CallbackCustom` decorator will only be fired
|
|
68
|
+
* if the executed conditional function returns true.
|
|
69
|
+
*
|
|
70
|
+
* This property is used to easily turn entire mod features on and off (rather than repeating
|
|
71
|
+
* conditional logic and early returning at the beginning of every callback function).
|
|
72
|
+
*
|
|
73
|
+
* By default, this is set to null. Override this property in your class if you need to use it.
|
|
74
|
+
*/
|
|
75
|
+
private callbackConditionalFunc: (() => boolean) | null = null;
|
|
76
|
+
|
|
65
77
|
/**
|
|
66
78
|
* Whether or not the feature has registered its callbacks yet (and submitted its variables to the
|
|
67
79
|
* save data manager, if any).
|
|
@@ -195,6 +207,15 @@ function addCallback(
|
|
|
195
207
|
// We need to wrap the callback in a new function so that we can explicitly pass the class as the
|
|
196
208
|
// first argument. (Otherwise, the method will not be able to properly access `this`.
|
|
197
209
|
const wrappedCallback = (...callbackArgs: unknown[]) => {
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
211
|
+
const conditionalFunc = modFeature["callbackConditionalFunc"];
|
|
212
|
+
if (conditionalFunc !== null) {
|
|
213
|
+
const shouldRun = conditionalFunc();
|
|
214
|
+
if (!shouldRun) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
198
219
|
const castedCallback = callback as (
|
|
199
220
|
this: void,
|
|
200
221
|
...args: unknown[]
|
|
@@ -1007,6 +1007,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1007
1007
|
* - any runes
|
|
1008
1008
|
* - any objects like Dice Shard
|
|
1009
1009
|
*
|
|
1010
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1011
|
+
*
|
|
1010
1012
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
1011
1013
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
1012
1014
|
* @param exceptions Optional. An array of cards to not select.
|
|
@@ -1020,6 +1022,10 @@ export class ModdedElementSets extends Feature {
|
|
|
1020
1022
|
}
|
|
1021
1023
|
|
|
1022
1024
|
/**
|
|
1025
|
+
* Helper function to get a random card type that matches the provided `ItemConfigCardType`.
|
|
1026
|
+
*
|
|
1027
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1028
|
+
*
|
|
1023
1029
|
* @param itemConfigCardType The item config card type that represents the pool of cards to select
|
|
1024
1030
|
* from.
|
|
1025
1031
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
@@ -1040,6 +1046,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1040
1046
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul
|
|
1041
1047
|
* of Isaac, etc.). This will never return a Rune Shard.
|
|
1042
1048
|
*
|
|
1049
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1050
|
+
*
|
|
1043
1051
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
1044
1052
|
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
1045
1053
|
* @param exceptions Optional. An array of runes to not select.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* automatically register callbacks.
|
|
4
4
|
*
|
|
5
5
|
* Currently, there are two decorators:
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
6
|
+
* - `@Callback`
|
|
7
|
+
* - `@CallbackCustom`
|
|
8
8
|
*
|
|
9
9
|
* For example:
|
|
10
10
|
*
|
|
@@ -37,6 +37,7 @@ import { getTSTLClassName } from "./tstlClass";
|
|
|
37
37
|
*
|
|
38
38
|
* @ignore
|
|
39
39
|
*/
|
|
40
|
+
// We tell TypeDoc to ignore this function because it generates a bunch of spam.
|
|
40
41
|
export function Callback<T extends ModCallback>(
|
|
41
42
|
modCallback: T,
|
|
42
43
|
...optionalArgs: AllButFirst<AddCallbackParameters[T]>
|
|
@@ -84,6 +85,7 @@ export function Callback<T extends ModCallback>(
|
|
|
84
85
|
*
|
|
85
86
|
* @ignore
|
|
86
87
|
*/
|
|
88
|
+
// We tell TypeDoc to ignore this function because it generates a bunch of spam.
|
|
87
89
|
export function CallbackCustom<T extends ModCallbackCustom>(
|
|
88
90
|
modCallbackCustom: T,
|
|
89
91
|
...optionalArgs: AllButFirst<AddCallbackParametersCustom[T]>
|
package/src/functions/input.ts
CHANGED
|
@@ -66,7 +66,23 @@ export function getShootActions(): ReadonlySet<ButtonAction> {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
70
|
+
*
|
|
71
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
72
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
73
|
+
*/
|
|
74
|
+
export function isActionPressed(
|
|
75
|
+
controllerIndex: ControllerIndex,
|
|
76
|
+
...buttonActions: ButtonAction[]
|
|
77
|
+
): boolean {
|
|
78
|
+
return buttonActions.some((buttonAction) =>
|
|
79
|
+
Input.IsActionPressed(buttonAction, controllerIndex),
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
85
|
+
* being held down).
|
|
70
86
|
*
|
|
71
87
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
72
88
|
* function will return true if any of the buttons are pressed.
|
|
@@ -76,15 +92,30 @@ export function isActionPressedOnAnyInput(
|
|
|
76
92
|
): boolean {
|
|
77
93
|
const controllerIndexes = getEnumValues(ControllerIndex);
|
|
78
94
|
return controllerIndexes.some((controllerIndex) =>
|
|
79
|
-
buttonActions
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
isActionPressed(controllerIndex, ...buttonActions),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
101
|
+
* it).
|
|
102
|
+
*
|
|
103
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
104
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
105
|
+
* triggered.
|
|
106
|
+
*/
|
|
107
|
+
export function isActionTriggered(
|
|
108
|
+
controllerIndex: ControllerIndex,
|
|
109
|
+
...buttonActions: ButtonAction[]
|
|
110
|
+
): boolean {
|
|
111
|
+
return buttonActions.some((buttonAction) =>
|
|
112
|
+
Input.IsActionTriggered(buttonAction, controllerIndex),
|
|
82
113
|
);
|
|
83
114
|
}
|
|
84
115
|
|
|
85
116
|
/**
|
|
86
|
-
* Iterates over all inputs to determine if a
|
|
87
|
-
*
|
|
117
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
118
|
+
* released).
|
|
88
119
|
*
|
|
89
120
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
90
121
|
* function will return true if any of the buttons are pressed.
|
|
@@ -94,14 +125,12 @@ export function isActionTriggeredOnAnyInput(
|
|
|
94
125
|
): boolean {
|
|
95
126
|
const controllerIndexes = getEnumValues(ControllerIndex);
|
|
96
127
|
return controllerIndexes.some((controllerIndex) =>
|
|
97
|
-
buttonActions
|
|
98
|
-
Input.IsActionTriggered(buttonAction, controllerIndex),
|
|
99
|
-
),
|
|
128
|
+
isActionTriggered(controllerIndex, ...buttonActions),
|
|
100
129
|
);
|
|
101
130
|
}
|
|
102
131
|
|
|
103
132
|
/**
|
|
104
|
-
* Helper function to see if a
|
|
133
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
105
134
|
*
|
|
106
135
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
107
136
|
* This function will return true if any of the values are pressed.
|