isaacscript-common 1.0.563 → 1.0.567

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.
@@ -27,7 +27,7 @@ function postPEffectUpdateReordered(self, player)
27
27
  end
28
28
  if character ~= storedCharacter then
29
29
  v.run.characterMap:set(playerIndex, character)
30
- postPlayerChangeTypeFire(nil, player)
30
+ postPlayerChangeTypeFire(nil, player, character)
31
31
  end
32
32
  end
33
33
  v = {
@@ -28,7 +28,7 @@ function postPlayerRender(self, player)
28
28
  local finalFrame = getFinalFrameOfAnimation(nil, sprite)
29
29
  if frame == finalFrame then
30
30
  firedOnStage = effectiveStage
31
- preNewLevelFire(nil)
31
+ preNewLevelFire(nil, player)
32
32
  end
33
33
  end
34
34
  firedOnStage = nil
@@ -1 +1,2 @@
1
- export declare type PreNewLevelCallbackType = () => void;
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PreNewLevelCallbackType = (player: EntityPlayer) => void;
@@ -8,11 +8,11 @@ end
8
8
  function ____exports.preNewLevelRegister(self, callback)
9
9
  __TS__ArrayPush(subscriptions, {callback})
10
10
  end
11
- function ____exports.preNewLevelFire(self)
11
+ function ____exports.preNewLevelFire(self, player)
12
12
  for ____, ____value in ipairs(subscriptions) do
13
13
  local callback
14
14
  callback = ____value[1]
15
- callback(nil)
15
+ callback(nil, player)
16
16
  end
17
17
  end
18
18
  return ____exports
@@ -1,2 +1,2 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- export declare type PostPlayerChangeTypeCallbackType = (player: EntityPlayer) => void;
2
+ export declare type PostPlayerChangeTypeCallbackType = (player: EntityPlayer, character: PlayerType) => void;
@@ -8,11 +8,11 @@ end
8
8
  function ____exports.postPlayerChangeTypeRegister(self, callback)
9
9
  __TS__ArrayPush(subscriptions, {callback})
10
10
  end
11
- function ____exports.postPlayerChangeTypeFire(self, player)
11
+ function ____exports.postPlayerChangeTypeFire(self, player, character)
12
12
  for ____, ____value in ipairs(subscriptions) do
13
13
  local callback
14
14
  callback = ____value[1]
15
- callback(nil, player)
15
+ callback(nil, player, character)
16
16
  end
17
17
  end
18
18
  return ____exports
@@ -1,2 +1,2 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- export declare type PostTrinketBreakCallbackType = (player: EntityPlayer, trinketType: TrinketType) => void;
2
+ export declare type PostTrinketBreakCallbackType = (player: EntityPlayer, trinketType: TrinketType | int) => void;
@@ -34,6 +34,8 @@ function ____exports.logAllFlags(flags, flagEnum, description)
34
34
  description = description .. " "
35
35
  end
36
36
  ____exports.log(("Logging all " .. description) .. "flags:")
37
+ local hasNoFlags = true
38
+ local i = 1
37
39
  for ____, ____value in ipairs(
38
40
  __TS__ObjectEntries(flagEnum)
39
41
  ) do
@@ -42,8 +44,15 @@ function ____exports.logAllFlags(flags, flagEnum, description)
42
44
  local value
43
45
  value = ____value[2]
44
46
  if hasFlag(nil, flags, value) then
45
- ____exports.log("- Has flag: " .. key)
47
+ ____exports.log(
48
+ (((((" " .. tostring(i)) .. ") Has flag: ") .. key) .. " (") .. tostring(value)) .. ")"
49
+ )
50
+ hasNoFlags = false
46
51
  end
52
+ i = i + 1
53
+ end
54
+ if hasNoFlags then
55
+ ____exports.log(" n/a (no flags)")
47
56
  end
48
57
  end
49
58
  function ____exports.logAllDamageFlags(flags)
@@ -55,6 +64,8 @@ end
55
64
  function ____exports.logAllGameStateFlags()
56
65
  local game = Game()
57
66
  ____exports.log("Logging all game state flags:")
67
+ local hasNoFlags = true
68
+ local i = 1
58
69
  for ____, ____value in ipairs(
59
70
  __TS__ObjectEntries(GameStateFlag)
60
71
  ) do
@@ -65,8 +76,15 @@ function ____exports.logAllGameStateFlags()
65
76
  local gameStateFlag = value
66
77
  local flagValue = game:GetStateFlag(gameStateFlag)
67
78
  if flagValue then
68
- ____exports.log("- Has flag: " .. key)
79
+ ____exports.log(
80
+ (((((" " .. tostring(i)) .. ") Has flag: ") .. key) .. " (") .. tostring(value)) .. ")"
81
+ )
82
+ hasNoFlags = false
69
83
  end
84
+ i = i + 1
85
+ end
86
+ if hasNoFlags then
87
+ ____exports.log(" n/a (no flags)")
70
88
  end
71
89
  end
72
90
  function ____exports.logAllProjectileFlags(flags)
@@ -83,6 +101,7 @@ function ____exports.logAllSeedEffects()
83
101
  local seeds = game:GetSeeds()
84
102
  ____exports.log("Logging all seed effects:")
85
103
  local hasNoSeedEffects = true
104
+ local i = 1
86
105
  for ____, ____value in ipairs(
87
106
  __TS__ObjectEntries(SeedEffect)
88
107
  ) do
@@ -92,12 +111,15 @@ function ____exports.logAllSeedEffects()
92
111
  value = ____value[2]
93
112
  local seedEffect = value
94
113
  if seeds:HasSeedEffect(seedEffect) then
95
- ____exports.log("- " .. key)
114
+ ____exports.log(
115
+ (((((" " .. tostring(i)) .. ") ") .. key) .. " (") .. tostring(value)) .. ")"
116
+ )
96
117
  hasNoSeedEffects = false
97
118
  end
119
+ i = i + 1
98
120
  end
99
121
  if hasNoSeedEffects then
100
- ____exports.log("- n/a")
122
+ ____exports.log(" n/a (no seed effects)")
101
123
  end
102
124
  end
103
125
  function ____exports.logArray(array)
@@ -6,6 +6,13 @@
6
6
  */
7
7
  export declare function changeRoom(roomGridIndex: int): void;
8
8
  export declare function getAllRoomGridIndexes(): int[];
9
+ /**
10
+ * Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
11
+ * but it can change if e.g. the player is in the mirror world of Downpour/Dross.
12
+ *
13
+ * Note that this function does correctly handle detecting the Death Certificate dimension, which is
14
+ * tricky to properly detect.
15
+ */
9
16
  export declare function getCurrentDimension(): Dimension;
10
17
  /** An alias to the `Level.GetCurrentRoomDesc()` method. */
11
18
  export declare function getCurrentRoomDescReadOnly(): RoomDescriptorReadOnly;
@@ -172,7 +172,7 @@ export interface CallbackParametersCustom {
172
172
  ];
173
173
  [ModCallbacksCustom.MC_POST_TRINKET_BREAK]: [
174
174
  callback: PostTrinketBreakCallbackType,
175
- trinketType?: TrinketType
175
+ trinketType?: TrinketType | int
176
176
  ];
177
177
  [ModCallbacksCustom.MC_POST_SLOT_INIT]: [
178
178
  callback: PostSlotInitCallbackType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.563",
3
+ "version": "1.0.567",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.310",
28
+ "isaac-typescript-definitions": "^1.0.313",
29
29
  "isaacscript-lint": "^1.0.74",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",