isaacscript-common 26.1.1 → 26.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1788,8 +1788,7 @@ declare class CustomHotkeys extends Feature {
1788
1788
  }
1789
1789
 
1790
1790
  declare class CustomItemPools extends Feature {
1791
- private customItemPoolMap;
1792
- private postGameStartedReordered;
1791
+ private postGameStartedReorderedFalse;
1793
1792
  /**
1794
1793
  * Helper function to register a custom item pool. Use this function once when your mod first
1795
1794
  * loads to declare the items that you want to be in the item pools. Then, in the middle of a run,
@@ -8062,7 +8061,7 @@ export declare function isReflectionRender(): boolean;
8062
8061
  /**
8063
8062
  * Helper function to check if the player is using Afterbirth+ or Repentance.
8064
8063
  *
8065
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
8064
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
8066
8065
  *
8067
8066
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
8068
8067
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 26.1.1
3
+ isaacscript-common 26.1.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -38349,6 +38349,7 @@ local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedA
38349
38349
  local ____Feature = require("src.classes.private.Feature")
38350
38350
  local Feature = ____Feature.Feature
38351
38351
  local v = {run = {customItemPools = __TS__New(Map)}}
38352
+ local customItemPoolMap = __TS__New(Map)
38352
38353
  ____exports.CustomItemPools = __TS__Class()
38353
38354
  local CustomItemPools = ____exports.CustomItemPools
38354
38355
  CustomItemPools.name = "CustomItemPools"
@@ -38356,20 +38357,16 @@ __TS__ClassExtends(CustomItemPools, Feature)
38356
38357
  function CustomItemPools.prototype.____constructor(self)
38357
38358
  Feature.prototype.____constructor(self)
38358
38359
  self.v = v
38359
- self.customItemPoolMap = __TS__New(Map)
38360
- self.postGameStartedReordered = function(____, isContinued)
38361
- if isContinued then
38362
- return
38363
- end
38364
- v.run.customItemPools = copyMap(nil, self.customItemPoolMap)
38360
+ self.postGameStartedReorderedFalse = function()
38361
+ v.run.customItemPools = copyMap(nil, customItemPoolMap)
38365
38362
  end
38366
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
38363
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReorderedFalse, {false}}}
38367
38364
  end
38368
38365
  function CustomItemPools.prototype.registerCustomItemPool(self, itemPoolTypeCustom, collectibles)
38369
- if self.customItemPoolMap:has(itemPoolTypeCustom) then
38366
+ if customItemPoolMap:has(itemPoolTypeCustom) then
38370
38367
  error(("Failed to register a custom item pool since the provided type of " .. tostring(itemPoolTypeCustom)) .. " was already registered.")
38371
38368
  end
38372
- self.customItemPoolMap:set(itemPoolTypeCustom, collectibles)
38369
+ customItemPoolMap:set(itemPoolTypeCustom, collectibles)
38373
38370
  end
38374
38371
  function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTypeCustom, decrease, seedOrRNG, defaultItem)
38375
38372
  if decrease == nil then
@@ -48010,7 +48007,7 @@ function ____exports.flight(self, params)
48010
48007
  else
48011
48008
  removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
48012
48009
  end
48013
- printEnabled(nil, v.persistent.speed, "set speed")
48010
+ printEnabled(nil, v.persistent.flight, "flight")
48014
48011
  end
48015
48012
  function ____exports.fool(self)
48016
48013
  ____exports.startingRoom(nil)
@@ -48499,7 +48496,7 @@ function ____exports.speed(self, params)
48499
48496
  player:EvaluateItems()
48500
48497
  local value = tostring(v.persistent.speed)
48501
48498
  ____exports.flight(nil, value)
48502
- printEnabled(nil, v.persistent.speed, "set speed and flight")
48499
+ printEnabled(nil, v.persistent.speed, "set speed")
48503
48500
  end
48504
48501
  function ____exports.startRoom(self)
48505
48502
  ____exports.startingRoom(nil)
@@ -48759,7 +48756,7 @@ function FadeInRemover.prototype.____constructor(self)
48759
48756
  game:Fadein(INSTANT_FADE_IN_SPEED)
48760
48757
  end
48761
48758
  end
48762
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
48759
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered, {nil}}}
48763
48760
  end
48764
48761
  function FadeInRemover.prototype.removeFadeIn(self)
48765
48762
  self.enabled = true
@@ -2,8 +2,7 @@ import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
2
2
  import { WeightedArray } from "../../../types/WeightedArray";
3
3
  import { Feature } from "../../private/Feature";
4
4
  export declare class CustomItemPools extends Feature {
5
- private customItemPoolMap;
6
- private postGameStartedReordered;
5
+ private postGameStartedReorderedFalse;
7
6
  /**
8
7
  * Helper function to register a custom item pool. Use this function once when your mod first
9
8
  * loads to declare the items that you want to be in the item pools. Then, in the middle of a run,
@@ -1 +1 @@
1
- {"version":3,"file":"CustomItemPools.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomItemPools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAO7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,eAAgB,SAAQ,OAAO;IAI1C,OAAO,CAAC,iBAAiB,CAGrB;IAeJ,OAAO,CAAC,wBAAwB,CAM9B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IAEI,sBAAsB,CAC3B,kBAAkB,EAAE,YAAY,EAChC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAC3C,IAAI;IAUP;;;;;;;;;;;;;;;;;OAiBG;IAEI,4BAA4B,CACjC,kBAAkB,EAAE,YAAY,EAChC,QAAQ,UAAQ,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,WAAW,kBAAuB,GACjC,eAAe;CA2BnB"}
1
+ {"version":3,"file":"CustomItemPools.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomItemPools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAO7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAahD,qBAAa,eAAgB,SAAQ,OAAO;IAmB1C,OAAO,CAAC,6BAA6B,CAEnC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IAEI,sBAAsB,CAC3B,kBAAkB,EAAE,YAAY,EAChC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAC3C,IAAI;IAUP;;;;;;;;;;;;;;;;;OAiBG;IAEI,4BAA4B,CACjC,kBAAkB,EAAE,YAAY,EAChC,QAAQ,UAAQ,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,WAAW,kBAAuB,GACjC,eAAe;CA2BnB"}
@@ -22,6 +22,7 @@ local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedA
22
22
  local ____Feature = require("src.classes.private.Feature")
23
23
  local Feature = ____Feature.Feature
24
24
  local v = {run = {customItemPools = __TS__New(Map)}}
25
+ local customItemPoolMap = __TS__New(Map)
25
26
  ____exports.CustomItemPools = __TS__Class()
26
27
  local CustomItemPools = ____exports.CustomItemPools
27
28
  CustomItemPools.name = "CustomItemPools"
@@ -29,20 +30,16 @@ __TS__ClassExtends(CustomItemPools, Feature)
29
30
  function CustomItemPools.prototype.____constructor(self)
30
31
  Feature.prototype.____constructor(self)
31
32
  self.v = v
32
- self.customItemPoolMap = __TS__New(Map)
33
- self.postGameStartedReordered = function(____, isContinued)
34
- if isContinued then
35
- return
36
- end
37
- v.run.customItemPools = copyMap(nil, self.customItemPoolMap)
33
+ self.postGameStartedReorderedFalse = function()
34
+ v.run.customItemPools = copyMap(nil, customItemPoolMap)
38
35
  end
39
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
36
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReorderedFalse, {false}}}
40
37
  end
41
38
  function CustomItemPools.prototype.registerCustomItemPool(self, itemPoolTypeCustom, collectibles)
42
- if self.customItemPoolMap:has(itemPoolTypeCustom) then
39
+ if customItemPoolMap:has(itemPoolTypeCustom) then
43
40
  error(("Failed to register a custom item pool since the provided type of " .. tostring(itemPoolTypeCustom)) .. " was already registered.")
44
41
  end
45
- self.customItemPoolMap:set(itemPoolTypeCustom, collectibles)
42
+ customItemPoolMap:set(itemPoolTypeCustom, collectibles)
46
43
  end
47
44
  function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTypeCustom, decrease, seedOrRNG, defaultItem)
48
45
  if decrease == nil then
@@ -1 +1 @@
1
- {"version":3,"file":"FadeInRemover.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/FadeInRemover.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,qBAAa,aAAc,SAAQ,OAAO;IACxC,OAAO,CAAC,OAAO,CAAS;IAexB,OAAO,CAAC,wBAAwB,CAI9B;IAEF;;;;;;;;;OASG;IAEI,YAAY,IAAI,IAAI;IAI3B;;;;;OAKG;IAEI,aAAa,IAAI,IAAI;CAG7B"}
1
+ {"version":3,"file":"FadeInRemover.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/FadeInRemover.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,qBAAa,aAAc,SAAQ,OAAO;IACxC,OAAO,CAAC,OAAO,CAAS;IAgBxB,OAAO,CAAC,wBAAwB,CAI9B;IAEF;;;;;;;;;OASG;IAEI,YAAY,IAAI,IAAI;IAI3B;;;;;OAKG;IAEI,aAAa,IAAI,IAAI;CAG7B"}
@@ -24,7 +24,7 @@ function FadeInRemover.prototype.____constructor(self)
24
24
  game:Fadein(INSTANT_FADE_IN_SPEED)
25
25
  end
26
26
  end
27
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
27
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered, {nil}}}
28
28
  end
29
29
  function FadeInRemover.prototype.removeFadeIn(self)
30
30
  self.enabled = true
@@ -585,7 +585,7 @@ function ____exports.flight(self, params)
585
585
  else
586
586
  removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
587
587
  end
588
- printEnabled(nil, v.persistent.speed, "set speed")
588
+ printEnabled(nil, v.persistent.flight, "flight")
589
589
  end
590
590
  --- Alias for the "startingRoom" command.
591
591
  function ____exports.fool(self)
@@ -1176,7 +1176,7 @@ function ____exports.speed(self, params)
1176
1176
  player:EvaluateItems()
1177
1177
  local value = tostring(v.persistent.speed)
1178
1178
  ____exports.flight(nil, value)
1179
- printEnabled(nil, v.persistent.speed, "set speed and flight")
1179
+ printEnabled(nil, v.persistent.speed, "set speed")
1180
1180
  end
1181
1181
  --- Alias for the "startingRoom" command.
1182
1182
  function ____exports.startRoom(self)
@@ -60,7 +60,7 @@ export declare function isReflectionRender(): boolean;
60
60
  /**
61
61
  * Helper function to check if the player is using Afterbirth+ or Repentance.
62
62
  *
63
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
63
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
64
64
  *
65
65
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
66
66
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
@@ -104,7 +104,7 @@ function ____exports.isReflectionRender(self)
104
104
  end
105
105
  --- Helper function to check if the player is using Afterbirth+ or Repentance.
106
106
  --
107
- -- This function should always be used over the `REPENTANCE` constant, since it is not safe.
107
+ -- This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
108
108
  --
109
109
  -- Specifically, this function checks for the `Sprite.GetAnimation` method:
110
110
  -- https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "26.1.1",
3
+ "version": "26.1.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/index.rollup.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^12.0.0"
25
+ "isaac-typescript-definitions": "^12.0.1"
26
26
  }
27
27
  }
@@ -14,15 +14,15 @@ const v = {
14
14
  },
15
15
  };
16
16
 
17
+ const customItemPoolMap = new Map<
18
+ ItemPoolType,
19
+ WeightedArray<CollectibleType>
20
+ >();
21
+
17
22
  export class CustomItemPools extends Feature {
18
23
  /** @internal */
19
24
  public override v = v;
20
25
 
21
- private customItemPoolMap = new Map<
22
- ItemPoolType,
23
- WeightedArray<CollectibleType>
24
- >();
25
-
26
26
  /** @internal */
27
27
  constructor() {
28
28
  super();
@@ -30,18 +30,16 @@ export class CustomItemPools extends Feature {
30
30
  this.customCallbacksUsed = [
31
31
  [
32
32
  ModCallbackCustom.POST_GAME_STARTED_REORDERED,
33
- this.postGameStartedReordered,
33
+ this.postGameStartedReorderedFalse,
34
+ [false],
34
35
  ],
35
36
  ];
36
37
  }
37
38
 
38
39
  // ModCallbackCustom.POST_GAME_STARTED_REORDERED
39
- private postGameStartedReordered = (isContinued: boolean) => {
40
- if (isContinued) {
41
- return;
42
- }
43
-
44
- v.run.customItemPools = copyMap(this.customItemPoolMap);
40
+ // false
41
+ private postGameStartedReorderedFalse = () => {
42
+ v.run.customItemPools = copyMap(customItemPoolMap);
45
43
  };
46
44
 
47
45
  /**
@@ -82,13 +80,13 @@ export class CustomItemPools extends Feature {
82
80
  itemPoolTypeCustom: ItemPoolType,
83
81
  collectibles: WeightedArray<CollectibleType>,
84
82
  ): void {
85
- if (this.customItemPoolMap.has(itemPoolTypeCustom)) {
83
+ if (customItemPoolMap.has(itemPoolTypeCustom)) {
86
84
  error(
87
85
  `Failed to register a custom item pool since the provided type of ${itemPoolTypeCustom} was already registered.`,
88
86
  );
89
87
  }
90
88
 
91
- this.customItemPoolMap.set(itemPoolTypeCustom, collectibles);
89
+ customItemPoolMap.set(itemPoolTypeCustom, collectibles);
92
90
  }
93
91
 
94
92
  /**
@@ -16,6 +16,7 @@ export class FadeInRemover extends Feature {
16
16
  [
17
17
  ModCallbackCustom.POST_GAME_STARTED_REORDERED,
18
18
  this.postGameStartedReordered,
19
+ [undefined],
19
20
  ],
20
21
  ];
21
22
  }
@@ -639,7 +639,7 @@ export function flight(params: string): void {
639
639
  removeCollectibleCostume(player, collectibleUsedToShowFlight);
640
640
  }
641
641
 
642
- printEnabled(v.persistent.speed, "set speed");
642
+ printEnabled(v.persistent.flight, "flight");
643
643
  }
644
644
 
645
645
  /** Alias for the "startingRoom" command. */
@@ -1479,7 +1479,7 @@ export function speed(params: string): void {
1479
1479
  const value = tostring(v.persistent.speed);
1480
1480
  flight(value);
1481
1481
 
1482
- printEnabled(v.persistent.speed, "set speed and flight");
1482
+ printEnabled(v.persistent.speed, "set speed");
1483
1483
  }
1484
1484
 
1485
1485
  /** Alias for the "startingRoom" command. */
@@ -2,11 +2,11 @@ import { isNumber, isString, isTable } from "./types";
2
2
 
3
3
  function sortNormal(a: unknown, b: unknown): -1 | 0 | 1 {
4
4
  if (!isNumber(a) && !isString(a)) {
5
- error(`Failed to sort since the first value was not a number or string.`);
5
+ error("Failed to sort since the first value was not a number or string.");
6
6
  }
7
7
 
8
8
  if (!isNumber(b) && !isString(b)) {
9
- error(`Failed to sort since the second value was not a number or string.`);
9
+ error("Failed to sort since the second value was not a number or string.");
10
10
  }
11
11
 
12
12
  if (a < b) {
@@ -137,7 +137,7 @@ export function getGotoCommand(
137
137
  const isNormalRoom =
138
138
  roomType === RoomType.DEFAULT && !useSpecialRoomsForRoomTypeDefault;
139
139
  const roomTypeSpecialGotoPrefix = ROOM_TYPE_SPECIAL_GOTO_PREFIXES[roomType];
140
- const prefix = isNormalRoom ? `d` : `s.${roomTypeSpecialGotoPrefix}`;
140
+ const prefix = isNormalRoom ? "d" : `s.${roomTypeSpecialGotoPrefix}`;
141
141
 
142
142
  return `goto ${prefix}.${roomVariant}`;
143
143
  }
@@ -111,7 +111,7 @@ export function isReflectionRender(): boolean {
111
111
  /**
112
112
  * Helper function to check if the player is using Afterbirth+ or Repentance.
113
113
  *
114
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
114
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
115
115
  *
116
116
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
117
117
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes