isaacscript-common 1.0.565 → 1.0.569

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 = {
@@ -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;
@@ -60,8 +60,8 @@ export declare const FINAL_STAGE: number;
60
60
  * second TMTRAINER item subtracts one from that, and so on.
61
61
  */
62
62
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
63
- export declare const GENESIS_ROOM_VARIANT = 1000;
64
- export declare const GENESIS_ROOM_SUBTYPE = 99;
63
+ export declare const GENESIS_ROOM_VARIANT = -1;
64
+ export declare const GENESIS_ROOM_SUBTYPE = -1;
65
65
  export declare const GOLDEN_TRINKET_SHIFT: number;
66
66
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
67
67
  export declare const GAME_FRAMES_PER_SECOND = 30;
@@ -25,8 +25,8 @@ ____exports.EMPTY_PNG_PATH = "gfx/none.png"
25
25
  ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {FamiliarVariant.SCISSORS, FamiliarVariant.INCUBUS, FamiliarVariant.FATES_REWARD, FamiliarVariant.SPRINKLER, FamiliarVariant.LOST_SOUL, FamiliarVariant.TWISTED_BABY, FamiliarVariant.BLOOD_BABY, FamiliarVariant.DECAP_ATTACK})
26
26
  ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
27
27
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
28
- ____exports.GENESIS_ROOM_VARIANT = 1000
29
- ____exports.GENESIS_ROOM_SUBTYPE = 99
28
+ ____exports.GENESIS_ROOM_VARIANT = -1
29
+ ____exports.GENESIS_ROOM_SUBTYPE = -1
30
30
  ____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
31
31
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
32
32
  ____exports.GAME_FRAMES_PER_SECOND = 30
@@ -39,6 +39,7 @@ export declare function logEntity(this: void, entity: Entity): void;
39
39
  export declare function logKColor(this: void, kColor: KColor): void;
40
40
  export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
41
41
  export declare function logTable(this: void, table: unknown): void;
42
+ export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
42
43
  export declare function logSet(this: void, set: Set<AnyNotNil>): void;
43
44
  export declare function logVector(this: void, vector: Vector): void;
44
45
  /**
@@ -3,8 +3,12 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local ____array = require("functions.array")
5
5
  local arrayToString = ____array.arrayToString
6
+ local ____collectibles = require("functions.collectibles")
7
+ local getCollectibleName = ____collectibles.getCollectibleName
6
8
  local ____flag = require("functions.flag")
7
9
  local hasFlag = ____flag.hasFlag
10
+ local ____trinkets = require("functions.trinkets")
11
+ local getTrinketName = ____trinkets.getTrinketName
8
12
  function ____exports.getDebugPrependString(self, msg, numParentFunctions)
9
13
  if numParentFunctions == nil then
10
14
  numParentFunctions = 3
@@ -166,6 +170,47 @@ function ____exports.logTable(____table)
166
170
  )
167
171
  end
168
172
  end
173
+ function ____exports.logTemporaryEffects(player)
174
+ local effects = player:GetEffects()
175
+ local effectsList = effects:GetEffectsList()
176
+ ____exports.log("Logging all player temporary effects:")
177
+ if effectsList.Size == 0 then
178
+ ____exports.log(" n/a (no temporary effects)")
179
+ return
180
+ end
181
+ do
182
+ local i = 0
183
+ while i < effectsList.Size do
184
+ do
185
+ local effect = effectsList:Get(i)
186
+ if effect == nil then
187
+ goto __continue35
188
+ end
189
+ if effect.Item:IsCollectible() then
190
+ local collectibleName = getCollectibleName(nil, effect.Item.ID)
191
+ ____exports.log(
192
+ ((" " .. tostring(i + 1)) .. ") ") .. collectibleName
193
+ )
194
+ elseif effect.Item:IsTrinket() then
195
+ local trinketName = getTrinketName(nil, effect.Item.ID)
196
+ ____exports.log(
197
+ ((" " .. tostring(i + 1)) .. ") ") .. trinketName
198
+ )
199
+ elseif effect.Item:IsNull() then
200
+ ____exports.log(
201
+ ((" " .. tostring(i + 1)) .. ") Null item: ") .. tostring(effect.Item.ID)
202
+ )
203
+ else
204
+ ____exports.log(
205
+ ((" " .. tostring(i + 1)) .. ") Unknown type of temporary effect: ") .. tostring(effect.Item.ID)
206
+ )
207
+ end
208
+ end
209
+ ::__continue35::
210
+ i = i + 1
211
+ end
212
+ end
213
+ end
169
214
  function ____exports.logSet(set)
170
215
  ____exports.log("Printing out a TSTL Set:")
171
216
  for ____, value in __TS__Iterator(
@@ -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.565",
3
+ "version": "1.0.569",
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",