isaacscript-common 20.5.0 → 20.6.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.
package/dist/index.d.ts CHANGED
@@ -7664,8 +7664,12 @@ export declare function isModifierKeyPressed(): boolean;
7664
7664
 
7665
7665
  export declare function isMoveAction(buttonAction: ButtonAction): boolean;
7666
7666
 
7667
+ export declare function isMoveActionPressed(controllerIndex: ControllerIndex): boolean;
7668
+
7667
7669
  export declare function isMoveActionPressedOnAnyInput(): boolean;
7668
7670
 
7671
+ export declare function isMoveActionTriggered(controllerIndex: ControllerIndex): boolean;
7672
+
7669
7673
  export declare function isMoveActionTriggeredOnAnyInput(): boolean;
7670
7674
 
7671
7675
  export declare function isNarrowRoom(roomShape: RoomShape): boolean;
@@ -7868,8 +7872,12 @@ export declare function isSerializedVector(object: unknown): object is Serialize
7868
7872
 
7869
7873
  export declare function isShootAction(buttonAction: ButtonAction): boolean;
7870
7874
 
7875
+ export declare function isShootActionPressed(controllerIndex: ControllerIndex): boolean;
7876
+
7871
7877
  export declare function isShootActionPressedOnAnyInput(): boolean;
7872
7878
 
7879
+ export declare function isShootActionTriggered(controllerIndex: ControllerIndex): boolean;
7880
+
7873
7881
  export declare function isShootActionTriggeredOnAnyInput(): boolean;
7874
7882
 
7875
7883
  /** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
@@ -8476,10 +8484,12 @@ export declare function logSounds(): void;
8476
8484
 
8477
8485
  /**
8478
8486
  * Helper function for logging every key and value of a Lua table. This is a deep log; the function
8479
- * will recursively call itself if it counters a table within a table.
8487
+ * will recursively call itself if it encounters a table within a table.
8480
8488
  *
8481
8489
  * This function will only work on tables that have string keys (because it logs the keys in order,
8482
8490
  * instead of randomly). It will throw a run-time error if it encounters a non-string key.
8491
+ *
8492
+ * In order to prevent infinite recursion, this function will not log deeper than 10 nested tables.
8483
8493
  */
8484
8494
  export declare function logTable(luaTable: unknown, parentTables?: number): void;
8485
8495
 
@@ -11378,29 +11388,12 @@ declare class ModdedElementSets extends Feature {
11378
11388
  * mod features from this class in order to enable the `@Callback` and `@CustomCallback` decorators
11379
11389
  * that automatically subscribe to callbacks.
11380
11390
  *
11381
- * If your feature has variables that are managed by the save data manager, put them as a `v` class
11382
- * member and they will automatically be registered with the save data manager when the class is
11383
- * instantiated.
11384
- *
11385
- * For example:
11386
- *
11387
- * ```ts
11388
- * export class MyFeature extends ModFeature {
11389
- * v = {
11390
- * run: {
11391
- * foo: 123,
11392
- * }
11393
- * }
11394
- *
11395
- * @Callback(ModCallback.POST_GAME_STARTED)
11396
- * postGameStarted(isContinued: boolean): void {
11397
- * Isaac.DebugString(`Callback fired: POST_GAME_STARTED`);
11398
- * }
11399
- * }
11400
- * ```
11391
+ * When instantiating a mod feature class, you must pass your upgraded mod as the first argument to
11392
+ * the constructor.
11401
11393
  *
11402
- * When instantiating a feature class, you must pass your upgraded mod as the first argument to the
11403
- * constructor.
11394
+ * If your feature has variables that are managed by the save data manager, you need to explicitly
11395
+ * register them with the save data manager yourself in your class constructor. (It can't be
11396
+ * automatically done because parent classes don't have access to child class properties.)
11404
11397
  *
11405
11398
  * In almost all cases, you will want the callback functions to be immediately subscribed after
11406
11399
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
@@ -11619,7 +11612,7 @@ export declare function newPickingUpItem(): PickingUpItem;
11619
11612
  export declare function newPlayerHealth(): PlayerHealth;
11620
11613
 
11621
11614
  /**
11622
- * Helper function to initialize an RNG object using Blade's recommended shift index.
11615
+ * Helper function to initialize a new RNG object using Blade's recommended shift index.
11623
11616
  *
11624
11617
  * @param seed The seed to initialize it with. Default is `getRandomSeed()`.
11625
11618
  */
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.5.0
3
+ isaacscript-common 20.6.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -28091,6 +28091,8 @@ function ____exports.logTable(self, luaTable, parentTables)
28091
28091
  end
28092
28092
  if parentTables == 0 then
28093
28093
  log(nil, "Printing out a Lua table:")
28094
+ elseif parentTables > 10 then
28095
+ return
28094
28096
  end
28095
28097
  local numSpaces = (parentTables + 1) * 2
28096
28098
  local indentation = string.rep(
@@ -37423,12 +37425,26 @@ end
37423
37425
  function ____exports.isMoveAction(self, buttonAction)
37424
37426
  return ____exports.MOVEMENT_ACTIONS_SET:has(buttonAction)
37425
37427
  end
37428
+ function ____exports.isMoveActionPressed(self, controllerIndex)
37429
+ return ____exports.isActionPressed(
37430
+ nil,
37431
+ controllerIndex,
37432
+ table.unpack(MOVEMENT_ACTIONS)
37433
+ )
37434
+ end
37426
37435
  function ____exports.isMoveActionPressedOnAnyInput(self)
37427
37436
  return __TS__ArraySome(
37428
37437
  MOVEMENT_ACTIONS,
37429
37438
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
37430
37439
  )
37431
37440
  end
37441
+ function ____exports.isMoveActionTriggered(self, controllerIndex)
37442
+ return ____exports.isActionTriggered(
37443
+ nil,
37444
+ controllerIndex,
37445
+ table.unpack(MOVEMENT_ACTIONS)
37446
+ )
37447
+ end
37432
37448
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
37433
37449
  return __TS__ArraySome(
37434
37450
  MOVEMENT_ACTIONS,
@@ -37438,12 +37454,26 @@ end
37438
37454
  function ____exports.isShootAction(self, buttonAction)
37439
37455
  return ____exports.SHOOTING_ACTIONS_SET:has(buttonAction)
37440
37456
  end
37457
+ function ____exports.isShootActionPressed(self, controllerIndex)
37458
+ return ____exports.isActionPressed(
37459
+ nil,
37460
+ controllerIndex,
37461
+ table.unpack(SHOOTING_ACTIONS)
37462
+ )
37463
+ end
37441
37464
  function ____exports.isShootActionPressedOnAnyInput(self)
37442
37465
  return __TS__ArraySome(
37443
37466
  SHOOTING_ACTIONS,
37444
37467
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
37445
37468
  )
37446
37469
  end
37470
+ function ____exports.isShootActionTriggered(self, controllerIndex)
37471
+ return ____exports.isActionTriggered(
37472
+ nil,
37473
+ controllerIndex,
37474
+ table.unpack(SHOOTING_ACTIONS)
37475
+ )
37476
+ end
37447
37477
  function ____exports.isShootActionTriggeredOnAnyInput(self)
37448
37478
  return __TS__ArraySome(
37449
37479
  SHOOTING_ACTIONS,
@@ -49767,7 +49797,7 @@ local __TS__Class = ____lualib.__TS__Class
49767
49797
  local Map = ____lualib.Map
49768
49798
  local __TS__New = ____lualib.__TS__New
49769
49799
  local ____exports = {}
49770
- local initDecoratedCallbacks, addCallback, removeCallback, initSaveDataManager, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
49800
+ local initDecoratedCallbacks, addCallback, removeCallback, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
49771
49801
  local ____array = require("src.functions.array")
49772
49802
  local isArray = ____array.isArray
49773
49803
  local ____tstlClass = require("src.functions.tstlClass")
@@ -49776,7 +49806,6 @@ local getTSTLClassName = ____tstlClass.getTSTLClassName
49776
49806
  local ____types = require("src.functions.types")
49777
49807
  local isFunction = ____types.isFunction
49778
49808
  local isNumber = ____types.isNumber
49779
- local isTable = ____types.isTable
49780
49809
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
49781
49810
  local modFeatureConstructor = constructor
49782
49811
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -49888,30 +49917,6 @@ function removeCallback(self, modFeatureConstructor, mod, modCallback, vanilla)
49888
49917
  mod:RemoveCallbackCustom(modCallback, wrappedCallback)
49889
49918
  end
49890
49919
  end
49891
- function initSaveDataManager(self, modFeature, tstlClassName, init)
49892
- local ____modFeature_0 = modFeature
49893
- local v = ____modFeature_0.v
49894
- if v == nil then
49895
- return
49896
- end
49897
- if not isTable(nil, v) then
49898
- error("Failed to initialize a mod feature class due to having a \"v\" property that is not an object. (The \"v\" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)")
49899
- end
49900
- local mod = modFeature.mod
49901
- local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
49902
- local saveDataManagerMethod = mod[saveDataManagerMethodName]
49903
- if saveDataManagerMethod == nil then
49904
- error("Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
49905
- end
49906
- if type(saveDataManagerMethod) ~= "function" then
49907
- error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
49908
- end
49909
- if init then
49910
- saveDataManagerMethod(nil, tstlClassName, v)
49911
- else
49912
- saveDataManagerMethod(nil, tstlClassName)
49913
- end
49914
- end
49915
49920
  ____exports.MOD_FEATURE_CALLBACKS_KEY = "__callbacks"
49916
49921
  ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks"
49917
49922
  WRAPPED_CALLBACK_METHODS_KEY = "__wrappedCallbackMethods"
@@ -49962,7 +49967,6 @@ function ModFeature.prototype.init(self, init)
49962
49967
  false,
49963
49968
  init
49964
49969
  )
49965
- initSaveDataManager(nil, self, tstlClassName, init)
49966
49970
  end
49967
49971
  function ModFeature.prototype.uninit(self)
49968
49972
  self:init(false)
@@ -8,29 +8,12 @@ export declare const MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks";
8
8
  * mod features from this class in order to enable the `@Callback` and `@CustomCallback` decorators
9
9
  * that automatically subscribe to callbacks.
10
10
  *
11
- * If your feature has variables that are managed by the save data manager, put them as a `v` class
12
- * member and they will automatically be registered with the save data manager when the class is
13
- * instantiated.
11
+ * When instantiating a mod feature class, you must pass your upgraded mod as the first argument to
12
+ * the constructor.
14
13
  *
15
- * For example:
16
- *
17
- * ```ts
18
- * export class MyFeature extends ModFeature {
19
- * v = {
20
- * run: {
21
- * foo: 123,
22
- * }
23
- * }
24
- *
25
- * @Callback(ModCallback.POST_GAME_STARTED)
26
- * postGameStarted(isContinued: boolean): void {
27
- * Isaac.DebugString(`Callback fired: POST_GAME_STARTED`);
28
- * }
29
- * }
30
- * ```
31
- *
32
- * When instantiating a feature class, you must pass your upgraded mod as the first argument to the
33
- * constructor.
14
+ * If your feature has variables that are managed by the save data manager, you need to explicitly
15
+ * register them with the save data manager yourself in your class constructor. (It can't be
16
+ * automatically done because parent classes don't have access to child class properties.)
34
17
  *
35
18
  * In almost all cases, you will want the callback functions to be immediately subscribed after
36
19
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,yBAAyB,EAC/B,CAAC,CAAC,CAAC,SAAS,OAAO,EACjB,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,iBAAiB,EAC7D,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"}
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;;;;;;;;;;;;;;;GAeG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,yBAAyB,EAC/B,CAAC,CAAC,CAAC,SAAS,OAAO,EACjB,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,iBAAiB,EAC7D,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;IAoB9B;;;;;;OAMG;IACI,MAAM,IAAI,IAAI;CAGtB"}
@@ -3,7 +3,7 @@ local __TS__Class = ____lualib.__TS__Class
3
3
  local Map = ____lualib.Map
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
- local initDecoratedCallbacks, addCallback, removeCallback, initSaveDataManager, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
6
+ local initDecoratedCallbacks, addCallback, removeCallback, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
7
7
  local ____array = require("src.functions.array")
8
8
  local isArray = ____array.isArray
9
9
  local ____tstlClass = require("src.functions.tstlClass")
@@ -12,7 +12,6 @@ local getTSTLClassName = ____tstlClass.getTSTLClassName
12
12
  local ____types = require("src.functions.types")
13
13
  local isFunction = ____types.isFunction
14
14
  local isNumber = ____types.isNumber
15
- local isTable = ____types.isTable
16
15
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
17
16
  local modFeatureConstructor = constructor
18
17
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -124,30 +123,6 @@ function removeCallback(self, modFeatureConstructor, mod, modCallback, vanilla)
124
123
  mod:RemoveCallbackCustom(modCallback, wrappedCallback)
125
124
  end
126
125
  end
127
- function initSaveDataManager(self, modFeature, tstlClassName, init)
128
- local ____modFeature_0 = modFeature
129
- local v = ____modFeature_0.v
130
- if v == nil then
131
- return
132
- end
133
- if not isTable(nil, v) then
134
- error("Failed to initialize a mod feature class due to having a \"v\" property that is not an object. (The \"v\" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)")
135
- end
136
- local mod = modFeature.mod
137
- local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
138
- local saveDataManagerMethod = mod[saveDataManagerMethodName]
139
- if saveDataManagerMethod == nil then
140
- error("Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
141
- end
142
- if type(saveDataManagerMethod) ~= "function" then
143
- error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
144
- end
145
- if init then
146
- saveDataManagerMethod(nil, tstlClassName, v)
147
- else
148
- saveDataManagerMethod(nil, tstlClassName)
149
- end
150
- end
151
126
  ____exports.MOD_FEATURE_CALLBACKS_KEY = "__callbacks"
152
127
  ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks"
153
128
  WRAPPED_CALLBACK_METHODS_KEY = "__wrappedCallbackMethods"
@@ -156,29 +131,12 @@ WRAPPED_CUSTOM_CALLBACK_METHODS_KEY = "__wrappedCustomCallbacksMethods"
156
131
  -- mod features from this class in order to enable the `@Callback` and `@CustomCallback` decorators
157
132
  -- that automatically subscribe to callbacks.
158
133
  --
159
- -- If your feature has variables that are managed by the save data manager, put them as a `v` class
160
- -- member and they will automatically be registered with the save data manager when the class is
161
- -- instantiated.
162
- --
163
- -- For example:
164
- --
165
- -- ```ts
166
- -- export class MyFeature extends ModFeature {
167
- -- v = {
168
- -- run: {
169
- -- foo: 123,
170
- -- }
171
- -- }
172
- --
173
- -- @Callback (ModCallback.POST_GAME_STARTED)
174
- -- postGameStarted(isContinued: boolean): void {
175
- -- Isaac.DebugString(`Callback fired: POST_GAME_STARTED`);
176
- -- }
177
- -- }
178
- -- ```
134
+ -- When instantiating a mod feature class, you must pass your upgraded mod as the first argument to
135
+ -- the constructor.
179
136
  --
180
- -- When instantiating a feature class, you must pass your upgraded mod as the first argument to the
181
- -- constructor.
137
+ -- If your feature has variables that are managed by the save data manager, you need to explicitly
138
+ -- register them with the save data manager yourself in your class constructor. (It can't be
139
+ -- automatically done because parent classes don't have access to child class properties.)
182
140
  --
183
141
  -- In almost all cases, you will want the callback functions to be immediately subscribed after
184
142
  -- instantiating the class. However, if this is not the case, you can pass `false` as the optional
@@ -229,7 +187,6 @@ function ModFeature.prototype.init(self, init)
229
187
  false,
230
188
  init
231
189
  )
232
- initSaveDataManager(nil, self, tstlClassName, init)
233
190
  end
234
191
  function ModFeature.prototype.uninit(self)
235
192
  self:init(false)
@@ -56,10 +56,14 @@ export declare function isKeyboardPressed(...keys: Keyboard[]): boolean;
56
56
  */
57
57
  export declare function isModifierKeyPressed(): boolean;
58
58
  export declare function isMoveAction(buttonAction: ButtonAction): boolean;
59
+ export declare function isMoveActionPressed(controllerIndex: ControllerIndex): boolean;
59
60
  export declare function isMoveActionPressedOnAnyInput(): boolean;
61
+ export declare function isMoveActionTriggered(controllerIndex: ControllerIndex): boolean;
60
62
  export declare function isMoveActionTriggeredOnAnyInput(): boolean;
61
63
  export declare function isShootAction(buttonAction: ButtonAction): boolean;
64
+ export declare function isShootActionPressed(controllerIndex: ControllerIndex): boolean;
62
65
  export declare function isShootActionPressedOnAnyInput(): boolean;
66
+ export declare function isShootActionTriggered(controllerIndex: ControllerIndex): boolean;
63
67
  export declare function isShootActionTriggeredOnAnyInput(): boolean;
64
68
  /**
65
69
  * Helper function to get the string that would be typed if someone pressed the corresponding key.
@@ -1 +1 @@
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;AAC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ttonAction)
128
128
  end
129
+ function ____exports.isMoveActionPressed(self, controllerIndex)
130
+ return ____exports.isActionPressed(
131
+ nil,
132
+ controllerIndex,
133
+ table.unpack(MOVEMENT_ACTIONS)
134
+ )
135
+ end
129
136
  function ____exports.isMoveActionPressedOnAnyInput(self)
130
137
  return __TS__ArraySome(
131
138
  MOVEMENT_ACTIONS,
132
139
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
133
140
  )
134
141
  end
142
+ function ____exports.isMoveActionTriggered(self, controllerIndex)
143
+ return ____exports.isActionTriggered(
144
+ nil,
145
+ controllerIndex,
146
+ table.unpack(MOVEMENT_ACTIONS)
147
+ )
148
+ end
135
149
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
136
150
  return __TS__ArraySome(
137
151
  MOVEMENT_ACTIONS,
@@ -141,12 +155,26 @@ end
141
155
  function ____exports.isShootAction(self, buttonAction)
142
156
  return ____exports.SHOOTING_ACTIONS_SET:has(buttonAction)
143
157
  end
158
+ function ____exports.isShootActionPressed(self, controllerIndex)
159
+ return ____exports.isActionPressed(
160
+ nil,
161
+ controllerIndex,
162
+ table.unpack(SHOOTING_ACTIONS)
163
+ )
164
+ end
144
165
  function ____exports.isShootActionPressedOnAnyInput(self)
145
166
  return __TS__ArraySome(
146
167
  SHOOTING_ACTIONS,
147
168
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
148
169
  )
149
170
  end
171
+ function ____exports.isShootActionTriggered(self, controllerIndex)
172
+ return ____exports.isActionTriggered(
173
+ nil,
174
+ controllerIndex,
175
+ table.unpack(SHOOTING_ACTIONS)
176
+ )
177
+ end
150
178
  function ____exports.isShootActionTriggeredOnAnyInput(self)
151
179
  return __TS__ArraySome(
152
180
  SHOOTING_ACTIONS,
@@ -46,10 +46,12 @@ export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): vo
46
46
  export declare function logSounds(): void;
47
47
  /**
48
48
  * Helper function for logging every key and value of a Lua table. This is a deep log; the function
49
- * will recursively call itself if it counters a table within a table.
49
+ * will recursively call itself if it encounters a table within a table.
50
50
  *
51
51
  * This function will only work on tables that have string keys (because it logs the keys in order,
52
52
  * instead of randomly). It will throw a run-time error if it encounters a non-string key.
53
+ *
54
+ * In order to prevent infinite recursion, this function will not log deeper than 10 nested tables.
53
55
  */
54
56
  export declare function logTable(luaTable: unknown, parentTables?: number): void;
55
57
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"logMisc.d.ts","sourceRoot":"","sources":["../../../src/functions/logMisc.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,UAAU,EAKV,cAAc,EAGd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAmBtC,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAU3D;AAED,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,eAAe,EAAE,GAAG,IAAI,CAS7E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAI3C;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7E;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGhD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI1C;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,UAAU,EACrD,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EACtB,QAAQ,EAAE,MAAM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8BN;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAkBpD;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAEvE;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAoBnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAG7D"}
@@ -388,16 +388,20 @@ function ____exports.logSounds(self)
388
388
  end
389
389
  end
390
390
  --- Helper function for logging every key and value of a Lua table. This is a deep log; the function
391
- -- will recursively call itself if it counters a table within a table.
391
+ -- will recursively call itself if it encounters a table within a table.
392
392
  --
393
393
  -- This function will only work on tables that have string keys (because it logs the keys in order,
394
394
  -- instead of randomly). It will throw a run-time error if it encounters a non-string key.
395
+ --
396
+ -- In order to prevent infinite recursion, this function will not log deeper than 10 nested tables.
395
397
  function ____exports.logTable(self, luaTable, parentTables)
396
398
  if parentTables == nil then
397
399
  parentTables = 0
398
400
  end
399
401
  if parentTables == 0 then
400
402
  log(nil, "Printing out a Lua table:")
403
+ elseif parentTables > 10 then
404
+ return
401
405
  end
402
406
  local numSpaces = (parentTables + 1) * 2
403
407
  local indentation = string.rep(
@@ -25,7 +25,7 @@ export declare function isRNG(object: unknown): object is RNG;
25
25
  */
26
26
  export declare function isSerializedRNG(object: unknown): object is SerializedRNG;
27
27
  /**
28
- * Helper function to initialize an RNG object using Blade's recommended shift index.
28
+ * Helper function to initialize a new RNG object using Blade's recommended shift index.
29
29
  *
30
30
  * @param seed The seed to initialize it with. Default is `getRandomSeed()`.
31
31
  */
@@ -26,7 +26,7 @@ end
26
26
  function ____exports.isRNG(self, object)
27
27
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
28
28
  end
29
- --- Helper function to initialize an RNG object using Blade's recommended shift index.
29
+ --- Helper function to initialize a new RNG object using Blade's recommended shift index.
30
30
  --
31
31
  -- @param seed The seed to initialize it with. Default is `getRandomSeed()`.
32
32
  function ____exports.newRNG(self, seed)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.5.0",
3
+ "version": "20.6.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -5,7 +5,7 @@ import {
5
5
  getTSTLClassConstructor,
6
6
  getTSTLClassName,
7
7
  } from "../functions/tstlClass";
8
- import { isFunction, isNumber, isTable } from "../functions/types";
8
+ import { isFunction, isNumber } from "../functions/types";
9
9
  import { TSTLClassMetatable } from "../interfaces/TSTLClassMetatable";
10
10
  import { AnyFunction } from "../types/AnyFunction";
11
11
  import { ModUpgradedBase } from "./ModUpgradedBase";
@@ -41,29 +41,12 @@ type ModFeatureConstructor = TSTLClassMetatable["constructor"] & {
41
41
  * mod features from this class in order to enable the `@Callback` and `@CustomCallback` decorators
42
42
  * that automatically subscribe to callbacks.
43
43
  *
44
- * If your feature has variables that are managed by the save data manager, put them as a `v` class
45
- * member and they will automatically be registered with the save data manager when the class is
46
- * instantiated.
44
+ * When instantiating a mod feature class, you must pass your upgraded mod as the first argument to
45
+ * the constructor.
47
46
  *
48
- * For example:
49
- *
50
- * ```ts
51
- * export class MyFeature extends ModFeature {
52
- * v = {
53
- * run: {
54
- * foo: 123,
55
- * }
56
- * }
57
- *
58
- * @Callback(ModCallback.POST_GAME_STARTED)
59
- * postGameStarted(isContinued: boolean): void {
60
- * Isaac.DebugString(`Callback fired: POST_GAME_STARTED`);
61
- * }
62
- * }
63
- * ```
64
- *
65
- * When instantiating a feature class, you must pass your upgraded mod as the first argument to the
66
- * constructor.
47
+ * If your feature has variables that are managed by the save data manager, you need to explicitly
48
+ * register them with the save data manager yourself in your class constructor. (It can't be
49
+ * automatically done because parent classes don't have access to child class properties.)
67
50
  *
68
51
  * In almost all cases, you will want the callback functions to be immediately subscribed after
69
52
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
@@ -147,7 +130,6 @@ export class ModFeature {
147
130
 
148
131
  initDecoratedCallbacks(this, constructor, tstlClassName, true, init);
149
132
  initDecoratedCallbacks(this, constructor, tstlClassName, false, init);
150
- initSaveDataManager(this, tstlClassName, init);
151
133
  }
152
134
 
153
135
  /**
@@ -334,46 +316,3 @@ function removeCallback(
334
316
  (mod.RemoveCallbackCustom as AnyFunction)(modCallback, wrappedCallback);
335
317
  }
336
318
  }
337
-
338
- function initSaveDataManager(
339
- modFeature: ModFeature,
340
- tstlClassName: string,
341
- init: boolean,
342
- ) {
343
- // Do nothing if this class does not have any variables.
344
- const { v } = modFeature as unknown as Record<string, unknown>;
345
- if (v === undefined) {
346
- return;
347
- }
348
-
349
- if (!isTable(v)) {
350
- error(
351
- 'Failed to initialize a mod feature class due to having a "v" property that is not an object. (The "v" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)',
352
- );
353
- }
354
-
355
- // Do nothing if we have not enabled the save data manager.
356
- // eslint-disable-next-line @typescript-eslint/dot-notation
357
- const mod = modFeature["mod"] as unknown as Record<string, unknown>;
358
- const saveDataManagerMethodName = init
359
- ? "saveDataManager"
360
- : "saveDataManagerRemove";
361
- const saveDataManagerMethod = mod[saveDataManagerMethodName];
362
- if (saveDataManagerMethod === undefined) {
363
- error(
364
- 'Failed to initialize a mod feature class due to having a "v" object and not having the save data manager initialized. You must pass "ISCFeature.SAVE_DATA_MANAGER" to the "upgradeMod" function.',
365
- );
366
- }
367
-
368
- if (typeof saveDataManagerMethod !== "function") {
369
- error(
370
- `The "${saveDataManagerMethodName}" property of the "ModUpgraded" object was not a function.`,
371
- );
372
- }
373
-
374
- if (init) {
375
- saveDataManagerMethod(tstlClassName, v);
376
- } else {
377
- saveDataManagerMethod(tstlClassName);
378
- }
379
- }
@@ -154,12 +154,22 @@ export function isMoveAction(buttonAction: ButtonAction): boolean {
154
154
  return MOVEMENT_ACTIONS_SET.has(buttonAction);
155
155
  }
156
156
 
157
+ export function isMoveActionPressed(controllerIndex: ControllerIndex): boolean {
158
+ return isActionPressed(controllerIndex, ...MOVEMENT_ACTIONS);
159
+ }
160
+
157
161
  export function isMoveActionPressedOnAnyInput(): boolean {
158
162
  return MOVEMENT_ACTIONS.some((moveAction) =>
159
163
  isActionPressedOnAnyInput(moveAction),
160
164
  );
161
165
  }
162
166
 
167
+ export function isMoveActionTriggered(
168
+ controllerIndex: ControllerIndex,
169
+ ): boolean {
170
+ return isActionTriggered(controllerIndex, ...MOVEMENT_ACTIONS);
171
+ }
172
+
163
173
  export function isMoveActionTriggeredOnAnyInput(): boolean {
164
174
  return MOVEMENT_ACTIONS.some((moveAction) =>
165
175
  isActionTriggeredOnAnyInput(moveAction),
@@ -170,12 +180,24 @@ export function isShootAction(buttonAction: ButtonAction): boolean {
170
180
  return SHOOTING_ACTIONS_SET.has(buttonAction);
171
181
  }
172
182
 
183
+ export function isShootActionPressed(
184
+ controllerIndex: ControllerIndex,
185
+ ): boolean {
186
+ return isActionPressed(controllerIndex, ...SHOOTING_ACTIONS);
187
+ }
188
+
173
189
  export function isShootActionPressedOnAnyInput(): boolean {
174
190
  return SHOOTING_ACTIONS.some((shootAction) =>
175
191
  isActionPressedOnAnyInput(shootAction),
176
192
  );
177
193
  }
178
194
 
195
+ export function isShootActionTriggered(
196
+ controllerIndex: ControllerIndex,
197
+ ): boolean {
198
+ return isActionTriggered(controllerIndex, ...SHOOTING_ACTIONS);
199
+ }
200
+
179
201
  export function isShootActionTriggeredOnAnyInput(): boolean {
180
202
  return SHOOTING_ACTIONS.some((shootAction) =>
181
203
  isActionTriggeredOnAnyInput(shootAction),
@@ -326,14 +326,18 @@ export function logSounds(): void {
326
326
 
327
327
  /**
328
328
  * Helper function for logging every key and value of a Lua table. This is a deep log; the function
329
- * will recursively call itself if it counters a table within a table.
329
+ * will recursively call itself if it encounters a table within a table.
330
330
  *
331
331
  * This function will only work on tables that have string keys (because it logs the keys in order,
332
332
  * instead of randomly). It will throw a run-time error if it encounters a non-string key.
333
+ *
334
+ * In order to prevent infinite recursion, this function will not log deeper than 10 nested tables.
333
335
  */
334
336
  export function logTable(luaTable: unknown, parentTables = 0): void {
335
337
  if (parentTables === 0) {
336
338
  log("Printing out a Lua table:");
339
+ } else if (parentTables > 10) {
340
+ return;
337
341
  }
338
342
 
339
343
  const numSpaces = (parentTables + 1) * 2; // 2, 4, 6, etc.
@@ -83,7 +83,7 @@ export function isSerializedRNG(object: unknown): object is SerializedRNG {
83
83
  }
84
84
 
85
85
  /**
86
- * Helper function to initialize an RNG object using Blade's recommended shift index.
86
+ * Helper function to initialize a new RNG object using Blade's recommended shift index.
87
87
  *
88
88
  * @param seed The seed to initialize it with. Default is `getRandomSeed()`.
89
89
  */