isaacscript-common 6.11.1 → 6.11.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.
Files changed (90) hide show
  1. package/dist/callbacks/postFlip.lua +2 -2
  2. package/dist/callbacks/subscriptions/postFirstFlip.d.ts +1 -1
  3. package/dist/callbacks/subscriptions/postFirstFlip.d.ts.map +1 -1
  4. package/dist/callbacks/subscriptions/postFirstFlip.lua +2 -2
  5. package/dist/callbacks/subscriptions/postFlip.d.ts +1 -1
  6. package/dist/callbacks/subscriptions/postFlip.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postFlip.lua +2 -2
  8. package/dist/enums/ModCallbackCustom.d.ts +2 -2
  9. package/dist/enums/private/StageTravelState.d.ts +6 -1
  10. package/dist/enums/private/StageTravelState.d.ts.map +1 -1
  11. package/dist/enums/private/StageTravelState.lua +10 -0
  12. package/dist/enums/private/TrapdoorAnimation.d.ts +6 -0
  13. package/dist/enums/private/TrapdoorAnimation.d.ts.map +1 -0
  14. package/dist/enums/private/TrapdoorAnimation.lua +6 -0
  15. package/dist/features/customGridEntity.d.ts +8 -5
  16. package/dist/features/customGridEntity.d.ts.map +1 -1
  17. package/dist/features/customGridEntity.lua +58 -15
  18. package/dist/features/customStage/exports.d.ts.map +1 -1
  19. package/dist/features/customStage/exports.lua +0 -13
  20. package/dist/features/customStage/init.d.ts.map +1 -1
  21. package/dist/features/customStage/init.lua +16 -1
  22. package/dist/features/customStage/streakText.d.ts.map +1 -1
  23. package/dist/features/customStage/streakText.lua +0 -1
  24. package/dist/features/customTrapdoor/blackSprite.d.ts +2 -0
  25. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -0
  26. package/dist/features/customTrapdoor/blackSprite.lua +19 -0
  27. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +8 -3
  28. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
  29. package/dist/features/customTrapdoor/customTrapdoorConstants.lua +9 -1
  30. package/dist/features/customTrapdoor/exports.d.ts +11 -19
  31. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  32. package/dist/features/customTrapdoor/exports.lua +48 -82
  33. package/dist/features/customTrapdoor/init.d.ts +3 -0
  34. package/dist/features/customTrapdoor/init.d.ts.map +1 -0
  35. package/dist/features/customTrapdoor/init.lua +173 -0
  36. package/dist/features/customTrapdoor/openClose.d.ts +5 -0
  37. package/dist/features/customTrapdoor/openClose.d.ts.map +1 -0
  38. package/dist/features/customTrapdoor/openClose.lua +60 -0
  39. package/dist/features/customTrapdoor/touched.d.ts +4 -0
  40. package/dist/features/customTrapdoor/touched.d.ts.map +1 -0
  41. package/dist/features/customTrapdoor/touched.lua +141 -0
  42. package/dist/features/customTrapdoor/v.d.ts +16 -2
  43. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  44. package/dist/features/customTrapdoor/v.lua +8 -6
  45. package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
  46. package/dist/features/extraConsoleCommands/init.lua +3 -1
  47. package/dist/features/taintedLazarusPlayers.d.ts.map +1 -1
  48. package/dist/features/taintedLazarusPlayers.lua +13 -21
  49. package/dist/functions/log.lua +3 -3
  50. package/dist/functions/playerIndex.d.ts +5 -0
  51. package/dist/functions/playerIndex.d.ts.map +1 -1
  52. package/dist/functions/playerIndex.lua +16 -6
  53. package/dist/functions/table.d.ts +1 -1
  54. package/dist/functions/table.d.ts.map +1 -1
  55. package/dist/initFeatures.d.ts.map +1 -1
  56. package/dist/initFeatures.lua +3 -0
  57. package/dist/interfaces/CustomGridEntityData.d.ts +5 -1
  58. package/dist/interfaces/CustomGridEntityData.d.ts.map +1 -1
  59. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +3 -0
  60. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  61. package/package.json +2 -2
  62. package/src/callbacks/postFlip.ts +3 -2
  63. package/src/callbacks/subscriptions/postFirstFlip.ts +6 -3
  64. package/src/callbacks/subscriptions/postFlip.ts +6 -3
  65. package/src/enums/ModCallbackCustom.ts +2 -2
  66. package/src/enums/private/StageTravelState.ts +5 -1
  67. package/src/enums/private/TrapdoorAnimation.ts +5 -0
  68. package/src/features/customGridEntity.ts +68 -10
  69. package/src/features/customStage/exports.ts +3 -22
  70. package/src/features/customStage/init.ts +20 -0
  71. package/src/features/customStage/streakText.ts +0 -1
  72. package/src/features/customTrapdoor/blackSprite.ts +16 -0
  73. package/src/features/customTrapdoor/customTrapdoorConstants.ts +13 -3
  74. package/src/features/customTrapdoor/exports.ts +52 -121
  75. package/src/features/customTrapdoor/init.ts +215 -0
  76. package/src/features/customTrapdoor/openClose.ts +103 -0
  77. package/src/features/customTrapdoor/touched.ts +175 -0
  78. package/src/features/customTrapdoor/v.ts +16 -10
  79. package/src/features/deployJSONRoom.ts +1 -1
  80. package/src/features/extraConsoleCommands/init.ts +5 -2
  81. package/src/features/saveDataManager/main.ts +1 -1
  82. package/src/features/taintedLazarusPlayers.ts +32 -31
  83. package/src/functions/deepCopy.ts +2 -2
  84. package/src/functions/entities.ts +1 -1
  85. package/src/functions/playerIndex.ts +12 -0
  86. package/src/functions/rng.ts +1 -1
  87. package/src/functions/table.ts +2 -2
  88. package/src/initFeatures.ts +2 -0
  89. package/src/interfaces/CustomGridEntityData.ts +6 -1
  90. package/src/interfaces/private/CustomTrapdoorDescription.ts +4 -0
@@ -8,17 +8,18 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
8
8
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
9
9
  local ____featuresInitialized = require("featuresInitialized")
10
10
  local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
11
+ local ____log = require("functions.log")
12
+ local logError = ____log.logError
11
13
  local ____exports = require("features.saveDataManager.exports")
12
14
  local saveDataManager = ____exports.saveDataManager
13
15
  function postPlayerInit(self, player)
14
- local entityPtr = EntityPtr(player)
15
16
  local character = player:GetPlayerType()
16
17
  if character == PlayerType.LAZARUS_B then
17
18
  local ____v_run_queuedTaintedLazarus_0 = v.run.queuedTaintedLazarus
18
- ____v_run_queuedTaintedLazarus_0[#____v_run_queuedTaintedLazarus_0 + 1] = entityPtr
19
+ ____v_run_queuedTaintedLazarus_0[#____v_run_queuedTaintedLazarus_0 + 1] = player
19
20
  elseif character == PlayerType.LAZARUS_2_B then
20
21
  local ____v_run_queuedDeadTaintedLazarus_1 = v.run.queuedDeadTaintedLazarus
21
- ____v_run_queuedDeadTaintedLazarus_1[#____v_run_queuedDeadTaintedLazarus_1 + 1] = entityPtr
22
+ ____v_run_queuedDeadTaintedLazarus_1[#____v_run_queuedDeadTaintedLazarus_1 + 1] = player
22
23
  else
23
24
  return
24
25
  end
@@ -28,20 +29,19 @@ function checkDequeue(self)
28
29
  if #v.run.queuedTaintedLazarus == 0 or #v.run.queuedDeadTaintedLazarus == 0 then
29
30
  return
30
31
  end
31
- local taintedLazarusPtr = table.remove(v.run.queuedTaintedLazarus, 1)
32
- local deadTaintedLazarusPtr = table.remove(v.run.queuedDeadTaintedLazarus, 1)
33
- if taintedLazarusPtr == nil or deadTaintedLazarusPtr == nil then
34
- return
35
- end
36
- local taintedLazarus = taintedLazarusPtr.Ref
37
- local deadTaintedLazarus = deadTaintedLazarusPtr.Ref
32
+ local taintedLazarus = table.remove(v.run.queuedTaintedLazarus, 1)
33
+ local deadTaintedLazarus = table.remove(v.run.queuedDeadTaintedLazarus, 1)
38
34
  if taintedLazarus == nil or deadTaintedLazarus == nil then
39
35
  return
40
36
  end
41
37
  local taintedLazarusPtrHash = GetPtrHash(taintedLazarus)
42
38
  local deadTaintedLazarusPtrHash = GetPtrHash(deadTaintedLazarus)
43
- v.run.subPlayerMap:set(taintedLazarusPtrHash, deadTaintedLazarusPtr)
44
- v.run.subPlayerMap:set(deadTaintedLazarusPtrHash, taintedLazarusPtr)
39
+ if taintedLazarusPtrHash == deadTaintedLazarusPtrHash then
40
+ logError("Failed to cache the Tainted Lazarus player objects, since the hash for Tainted Lazarus and Dead Tainted Lazarus were the same.")
41
+ return
42
+ end
43
+ v.run.subPlayerMap:set(taintedLazarusPtrHash, deadTaintedLazarus)
44
+ v.run.subPlayerMap:set(deadTaintedLazarusPtrHash, taintedLazarus)
45
45
  end
46
46
  local FEATURE_NAME = "taintedLazarusPlayers"
47
47
  v = {run = {
@@ -72,14 +72,6 @@ end
72
72
  function ____exports.getTaintedLazarusSubPlayer(self, player)
73
73
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
74
74
  local ptrHash = GetPtrHash(player)
75
- local entityPtr = v.run.subPlayerMap:get(ptrHash)
76
- if entityPtr == nil then
77
- return nil
78
- end
79
- local entity = entityPtr.Ref
80
- if entity == nil then
81
- return nil
82
- end
83
- return entity:ToPlayer()
75
+ return v.run.subPlayerMap:get(ptrHash)
84
76
  end
85
77
  return ____exports
@@ -550,14 +550,14 @@ function ____exports.logTableDifferences(table1, table2)
550
550
  __TS__ArraySort(keys)
551
551
  for ____, key in ipairs(keys) do
552
552
  if not table1KeysSet:has(key) then
553
- ____exports.log(" Table 1 is missing key: " .. key)
553
+ ____exports.log(" Table 1 is missing key: " .. tostring(key))
554
554
  elseif not table2KeysSet:has(key) then
555
- ____exports.log(" Table 2 is missing key: " .. key)
555
+ ____exports.log(" Table 2 is missing key: " .. tostring(key))
556
556
  else
557
557
  local value1 = table1[key]
558
558
  local value2 = table2[key]
559
559
  if value1 ~= value2 then
560
- ____exports.log((((((" " .. key) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\"")
560
+ ____exports.log((((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\"")
561
561
  end
562
562
  end
563
563
  end
@@ -10,6 +10,11 @@ import { PlayerIndex } from "../types/PlayerIndex";
10
10
  * helper function instead to get a filtered list of players.
11
11
  */
12
12
  export declare function getAllPlayers(): EntityPlayer[];
13
+ /**
14
+ * Helper function to get all of the other players in the room besides the one provided. (This
15
+ * includes "child" players.)
16
+ */
17
+ export declare function getOtherPlayers(player: EntityPlayer): EntityPlayer[];
13
18
  /**
14
19
  * Helper function to get the corresponding `EntityPlayer` object that corresponds to a
15
20
  * `PlayerIndex`.
@@ -1 +1 @@
1
- {"version":3,"file":"playerIndex.d.ts","sourceRoot":"","sources":["../../src/functions/playerIndex.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAU9C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,GACvB,YAAY,GAAG,SAAS,CAG1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,6BAA6B,UAAQ,GACpC,WAAW,CA4Bb;AA2BD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,GACzB,GAAG,GAAG,SAAS,CAajB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,UAAQ,GAAG,YAAY,EAAE,CAS7E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,GACzB,YAAY,GAAG,SAAS,CAa1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE3D"}
1
+ {"version":3,"file":"playerIndex.d.ts","sourceRoot":"","sources":["../../src/functions/playerIndex.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAU9C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,EAAE,CAMpE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,GACvB,YAAY,GAAG,SAAS,CAG1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,6BAA6B,UAAQ,GACpC,WAAW,CA4Bb;AA2BD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,GACzB,GAAG,GAAG,SAAS,CAajB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,UAAQ,GAAG,YAAY,EAAE,CAS7E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,GACzB,YAAY,GAAG,SAAS,CAa1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE3D"}
@@ -1,8 +1,8 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Set = ____lualib.Set
3
3
  local __TS__New = ____lualib.__TS__New
4
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
4
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
5
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
6
6
  local ____exports = {}
7
7
  local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
8
8
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -79,15 +79,15 @@ end
79
79
  function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
80
80
  local character = player:GetPlayerType()
81
81
  repeat
82
- local ____switch10 = character
83
- local ____cond10 = ____switch10 == PlayerType.THE_SOUL
84
- if ____cond10 then
82
+ local ____switch12 = character
83
+ local ____cond12 = ____switch12 == PlayerType.THE_SOUL
84
+ if ____cond12 then
85
85
  do
86
86
  return differentiateForgottenAndSoul and CollectibleType.SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
87
87
  end
88
88
  end
89
- ____cond10 = ____cond10 or ____switch10 == PlayerType.LAZARUS_2_B
90
- if ____cond10 then
89
+ ____cond12 = ____cond12 or ____switch12 == PlayerType.LAZARUS_2_B
90
+ if ____cond12 then
91
91
  do
92
92
  return CollectibleType.INNER_EYE
93
93
  end
@@ -150,6 +150,16 @@ function ____exports.isChildPlayer(self, player)
150
150
  end
151
151
  DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
152
152
  EXCLUDED_CHARACTERS = __TS__New(Set, {PlayerType.ESAU, PlayerType.THE_SOUL_B})
153
+ --- Helper function to get all of the other players in the room besides the one provided. (This
154
+ -- includes "child" players.)
155
+ function ____exports.getOtherPlayers(self, player)
156
+ local playerPtrHash = GetPtrHash(player)
157
+ local players = ____exports.getAllPlayers(nil)
158
+ return __TS__ArrayFilter(
159
+ players,
160
+ function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
161
+ )
162
+ end
153
163
  --- Helper function to get the corresponding `EntityPlayer` object that corresponds to a
154
164
  -- `PlayerIndex`.
155
165
  function ____exports.getPlayerFromIndex(self, playerIndex)
@@ -3,7 +3,7 @@
3
3
  * In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
4
4
  * `clear` method does not exist. Use this helper function as a drop-in replacement for this.
5
5
  */
6
- export declare function clearTable(luaMap: LuaMap): void;
6
+ export declare function clearTable(luaMap: LuaMap<AnyNotNil, unknown>): void;
7
7
  /** Helper function to copy specific values from a object to a table. */
8
8
  export declare function copyValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/functions/table.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI/C;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,OAAO,EACf,IAA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I,CAGnD"}
1
+ {"version":3,"file":"initFeatures.d.ts","sourceRoot":"","sources":["../src/initFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA0BpD,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAGnD"}
@@ -10,6 +10,8 @@ local ____customGridEntity = require("features.customGridEntity")
10
10
  local customGridEntityInit = ____customGridEntity.customGridEntityInit
11
11
  local ____init = require("features.customStage.init")
12
12
  local customStageInit = ____init.customStageInit
13
+ local ____init = require("features.customTrapdoor.init")
14
+ local customTrapdoorInit = ____init.customTrapdoorInit
13
15
  local ____deployJSONRoom = require("features.deployJSONRoom")
14
16
  local deployJSONRoomInit = ____deployJSONRoom.deployJSONRoomInit
15
17
  local ____disableAllSound = require("features.disableAllSound")
@@ -55,6 +57,7 @@ function initFeaturesMajor(self, mod)
55
57
  customGridEntityInit(nil, mod)
56
58
  end
57
59
  function initFeaturesMinor(self, mod)
60
+ customTrapdoorInit(nil, mod)
58
61
  disableAllSoundInit(nil, mod)
59
62
  disableInputsInit(nil, mod)
60
63
  fadeInRemoverInit(nil, mod)
@@ -1,10 +1,14 @@
1
1
  import { GridCollisionClass, GridEntityType } from "isaac-typescript-definitions";
2
2
  export interface CustomGridEntityData {
3
+ /**
4
+ * This is not a real `GridEntityType`; rather it is an arbitrary integer selected by end-user
5
+ * mods.
6
+ */
3
7
  gridEntityTypeCustom: GridEntityType;
4
8
  roomListIndex: int;
5
9
  gridIndex: int;
6
10
  anm2Path: string;
7
- defaultAnimation: string;
11
+ defaultAnimation?: string;
8
12
  gridCollisionClass: GridCollisionClass;
9
13
  }
10
14
  //# sourceMappingURL=CustomGridEntityData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomGridEntityData.d.ts","sourceRoot":"","sources":["../../src/interfaces/CustomGridEntityData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,cAAc,CAAC;IACrC,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,kBAAkB,CAAC;CACxC"}
1
+ {"version":3,"file":"CustomGridEntityData.d.ts","sourceRoot":"","sources":["../../src/interfaces/CustomGridEntityData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,oBAAoB,EAAE,cAAc,CAAC;IAErC,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;CACxC"}
@@ -1,4 +1,7 @@
1
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
1
2
  export interface CustomTrapdoorDescription {
3
+ open: boolean;
4
+ destination: [stage: LevelStage, stageType: StageType] | string;
2
5
  firstSpawn: boolean;
3
6
  }
4
7
  //# sourceMappingURL=CustomTrapdoorDescription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC;IAChE,UAAU,EAAE,OAAO,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.11.1",
3
+ "version": "6.11.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/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.32"
25
+ "isaac-typescript-definitions": "^3.0.34"
26
26
  }
27
27
  }
@@ -21,6 +21,7 @@ import {
21
21
 
22
22
  const v = {
23
23
  run: {
24
+ /** We don't consider the case of a multiplayer game with more than one Tainted Lazarus. */
24
25
  usedFlipAtLeastOnce: false,
25
26
  },
26
27
  };
@@ -63,10 +64,10 @@ function useItemFlip(
63
64
 
64
65
  if (!v.run.usedFlipAtLeastOnce) {
65
66
  v.run.usedFlipAtLeastOnce = true;
66
- postFirstFlipFire(newLazarus);
67
+ postFirstFlipFire(newLazarus, player);
67
68
  }
68
69
 
69
- postFlipFire(newLazarus);
70
+ postFlipFire(newLazarus, player);
70
71
 
71
72
  return undefined;
72
73
  }
@@ -1,5 +1,5 @@
1
1
  export type PostFirstFlipRegisterParameters = [
2
- callback: (player: EntityPlayer) => void,
2
+ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
3
3
  ];
4
4
 
5
5
  const subscriptions: PostFirstFlipRegisterParameters[] = [];
@@ -17,8 +17,11 @@ export function postFirstFlipRegister(
17
17
  }
18
18
 
19
19
  /** @internal */
20
- export function postFirstFlipFire(player: EntityPlayer): void {
20
+ export function postFirstFlipFire(
21
+ newLazarus: EntityPlayer,
22
+ oldLazarus: EntityPlayer,
23
+ ): void {
21
24
  for (const [callback] of subscriptions) {
22
- callback(player);
25
+ callback(newLazarus, oldLazarus);
23
26
  }
24
27
  }
@@ -1,5 +1,5 @@
1
1
  export type PostFlipRegisterParameters = [
2
- callback: (player: EntityPlayer) => void,
2
+ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
3
3
  ];
4
4
 
5
5
  const subscriptions: PostFlipRegisterParameters[] = [];
@@ -15,8 +15,11 @@ export function postFlipRegister(...args: PostFlipRegisterParameters): void {
15
15
  }
16
16
 
17
17
  /** @internal */
18
- export function postFlipFire(player: EntityPlayer): void {
18
+ export function postFlipFire(
19
+ newLazarus: EntityPlayer,
20
+ oldLazarus: EntityPlayer,
21
+ ): void {
19
22
  for (const [callback] of subscriptions) {
20
- callback(player);
23
+ callback(newLazarus, oldLazarus);
21
24
  }
22
25
  }
@@ -295,7 +295,7 @@ export enum ModCallbackCustom {
295
295
  * before the player has actually used the Flip item.
296
296
  *
297
297
  * ```ts
298
- * function postFirstFlip(player: EntityPlayer): void {}
298
+ * function postFirstFlip(newLazarus: EntityPlayer, oldLazarus: EntityPlayer): void {}
299
299
  * ```
300
300
  */
301
301
  POST_FIRST_FLIP,
@@ -309,7 +309,7 @@ export enum ModCallbackCustom {
309
309
  * before the player has actually used the Flip item.
310
310
  *
311
311
  * ```ts
312
- * function postFlip(player: EntityPlayer): void {}
312
+ * function postFlip(newLazarus: EntityPlayer, oldLazarus: EntityPlayer): void {}
313
313
  * ```
314
314
  */
315
315
  POST_FLIP,
@@ -1,4 +1,8 @@
1
1
  export enum StageTravelState {
2
2
  NONE,
3
- // TODO
3
+ PLAYERS_JUMPING_DOWN,
4
+ PIXELATION_TO_BLACK,
5
+ PAUSING_ON_BLACK,
6
+ PIXELATION_TO_ROOM,
7
+ PLAYERS_LAYING_DOWN,
4
8
  }
@@ -0,0 +1,5 @@
1
+ export enum TrapdoorAnimation {
2
+ OPENED = "Opened",
3
+ CLOSED = "Closed",
4
+ OPEN_ANIMATION = "Open Animation",
5
+ }
@@ -19,6 +19,7 @@ import {
19
19
  import { getRoomListIndex } from "../functions/roomData";
20
20
  import { isVector } from "../functions/vector";
21
21
  import { CustomGridEntityData } from "../interfaces/CustomGridEntityData";
22
+ import { runNextGameFrame } from "./runInNFrames";
22
23
  import { saveDataManager } from "./saveDataManager/exports";
23
24
 
24
25
  const FEATURE_NAME = "customGridEntity";
@@ -30,6 +31,10 @@ const v = {
30
31
  () => new Map(),
31
32
  ),
32
33
  },
34
+
35
+ room: {
36
+ manuallyUsingShovel: false,
37
+ },
33
38
  };
34
39
 
35
40
  /** @internal */
@@ -53,12 +58,54 @@ export function customGridEntityInit(mod: ModUpgraded): void {
53
58
  function preUseItemWeNeedToGoDeeper(
54
59
  _collectibleType: CollectibleType,
55
60
  _rng: RNG,
56
- _player: EntityPlayer,
61
+ player: EntityPlayer,
57
62
  _useFlags: BitFlags<UseFlag>,
58
63
  _activeSlot: ActiveSlot,
59
64
  _customVarData: int,
60
65
  ): boolean | undefined {
61
- return undefined;
66
+ // If a player uses We Need to Go Deeper on top of a custom grid entity, then they will always get
67
+ // a crawlspace, due to how custom grids are implemented with decorations. Thus, remove the custom
68
+ // grid entity to prevent this from happening if needed.
69
+ const room = game.GetRoom();
70
+ const roomListIndex = getRoomListIndex();
71
+ const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
72
+ if (roomCustomGridEntities === undefined) {
73
+ return undefined;
74
+ }
75
+
76
+ const gridIndex = room.GetGridIndex(player.Position);
77
+ const customGridEntity = roomCustomGridEntities.get(gridIndex);
78
+ if (customGridEntity === undefined) {
79
+ return undefined;
80
+ }
81
+
82
+ // If the custom grid entity has collision, then the player should not be able to be standing on
83
+ // top of it.
84
+ if (customGridEntity.gridCollisionClass !== GridCollisionClass.NONE) {
85
+ return undefined;
86
+ }
87
+
88
+ removeGridEntity(customGridEntity.gridIndex, false);
89
+
90
+ const playerPtr = EntityPtr(player);
91
+ runNextGameFrame(() => {
92
+ const futureEntity = playerPtr.Ref;
93
+ if (futureEntity === undefined) {
94
+ return;
95
+ }
96
+
97
+ const futurePlayer = futureEntity.ToPlayer();
98
+ if (futurePlayer === undefined) {
99
+ return;
100
+ }
101
+
102
+ v.room.manuallyUsingShovel = true;
103
+ futurePlayer.UseActiveItem(CollectibleType.WE_NEED_TO_GO_DEEPER);
104
+ v.room.manuallyUsingShovel = false;
105
+ });
106
+
107
+ // Cancel the original effect.
108
+ return true;
62
109
  }
63
110
 
64
111
  // ModCallbackCustom.POST_NEW_ROOM_REORDERED
@@ -81,12 +128,18 @@ function postNewRoomReordered() {
81
128
 
82
129
  const sprite = decoration.GetSprite();
83
130
  sprite.Load(data.anm2Path, true);
84
- sprite.Play(data.defaultAnimation, true);
131
+ const animationToPlay =
132
+ data.defaultAnimation === undefined
133
+ ? sprite.GetDefaultAnimation()
134
+ : data.defaultAnimation;
135
+ sprite.Play(animationToPlay, true);
85
136
  }
86
137
  }
87
138
 
88
139
  /**
89
- * Helper function to spawn a custom grid entity.
140
+ * Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
141
+ * will reappear if the player leaves and re-enters the room. (It will be manually respawned in the
142
+ * `POST_NEW_ROOM` callback.)
90
143
  *
91
144
  * This is an IsaacScript feature because the vanilla game does not support any custom grid
92
145
  * entities. Under the hood, IsaacScript accomplishes this by using decorations with an arbitrary
@@ -103,17 +156,18 @@ function postNewRoomReordered() {
103
156
  * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
104
157
  * entity at. If a position is specified, the closest grid index will be
105
158
  * used.
106
- * @param anm2Path The path to the ANM2 file to use for the sprite.
107
- * @param defaultAnimation The name of the animation to play after the sprite is initialized and
108
- * after the player re-enters a room with this grid entity in it.
109
159
  * @param gridCollisionClass The collision class that you want the custom grid entity to have.
160
+ * @param anm2Path The path to the ANM2 file to use for the sprite.
161
+ * @param defaultAnimation Optional. The name of the animation to play after the sprite is
162
+ * initialized and after the player re-enters a room with this grid entity
163
+ * in it. If not specified, the default animation in the anm2 will be used.
110
164
  */
111
165
  export function spawnCustomGridEntity(
112
166
  gridEntityTypeCustom: GridEntityType,
113
167
  gridIndexOrPosition: int | Vector,
114
- anm2Path: string,
115
- defaultAnimation: string,
116
168
  gridCollisionClass: GridCollisionClass,
169
+ anm2Path: string,
170
+ defaultAnimation?: string,
117
171
  ): GridEntity {
118
172
  errorIfFeaturesNotInitialized(FEATURE_NAME);
119
173
 
@@ -142,7 +196,11 @@ export function spawnCustomGridEntity(
142
196
 
143
197
  const sprite = decoration.GetSprite();
144
198
  sprite.Load(anm2Path, true);
145
- sprite.Play(defaultAnimation, true);
199
+ const animationToPlay =
200
+ defaultAnimation === undefined
201
+ ? sprite.GetDefaultAnimation()
202
+ : defaultAnimation;
203
+ sprite.Play(animationToPlay, true);
146
204
 
147
205
  const customGridEntityData: CustomGridEntityData = {
148
206
  gridEntityTypeCustom,
@@ -1,10 +1,8 @@
1
1
  import {
2
- Direction,
3
2
  EntityType,
4
3
  GridRoom,
5
4
  LevelStage,
6
5
  RoomShape,
7
- RoomTransitionAnim,
8
6
  RoomType,
9
7
  StageType,
10
8
  } from "isaac-typescript-definitions";
@@ -12,12 +10,10 @@ import { game } from "../../cachedClasses";
12
10
  import { reorderedCallbacksSetStage } from "../../callbacks/reorderedCallbacks";
13
11
  import { getEntityIDFromConstituents } from "../../functions/entities";
14
12
  import { log, logError } from "../../functions/log";
15
- import { movePlayersToCenter } from "../../functions/playerCenter";
16
13
  import { newRNG } from "../../functions/rng";
17
14
  import { getRoomData } from "../../functions/roomData";
18
15
  import { getRooms } from "../../functions/rooms";
19
16
  import { getGotoCommand, setStage } from "../../functions/stage";
20
- import { runNextRoom } from "../runNextRoom";
21
17
  import { getRandomCustomStageRoom } from "./customStageUtils";
22
18
  import { topStreakTextStart } from "./streakText";
23
19
  import v, {
@@ -136,24 +132,9 @@ export function setCustomStage(name: string, verbose = false): void {
136
132
 
137
133
  // We must reload the current room in order for the `Level.SetStage` method to take effect.
138
134
  // Furthermore, we need to cancel the queued warp to the `GridRoom.DEBUG` room. We can accomplish
139
- // both of these things by initiating a room transition to the starting room of the floor. (We
140
- // assume that since we just warped to a new floor, we are already in the starting room.)
141
- game.StartRoomTransition(
142
- startingRoomGridIndex,
143
- Direction.NO_DIRECTION,
144
- RoomTransitionAnim.FADE,
145
- );
146
-
147
- // We do more setup once the room is reloaded from the transition.
148
- runNextRoom(postRoomTransition);
149
- }
150
-
151
- function postRoomTransition() {
152
- // After the room transition, the players will be placed next to a door, but they should be in the
153
- // center of the room to emulate what happens on a vanilla stage.
154
- movePlayersToCenter();
155
-
156
- topStreakTextStart();
135
+ // both of these things by initiating a room transition to an arbitrary room. However, we rely on
136
+ // the parent function to do this, since for normal purposes, we need to initiate a room
137
+ // transition for pixelation purposes.
157
138
  }
158
139
 
159
140
  export function setCustomStageDebug(): void {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DoorSlotFlag,
3
3
  GridEntityType,
4
+ LevelCurse,
4
5
  ModCallback,
5
6
  RoomShape,
6
7
  RoomType,
@@ -8,6 +9,7 @@ import {
8
9
  import { ModUpgraded } from "../../classes/ModUpgraded";
9
10
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
10
11
  import { isArray } from "../../functions/array";
12
+ import { hasFlag, removeFlag } from "../../functions/flag";
11
13
  import { CustomStage, RoomTypeMap } from "../../interfaces/CustomStage";
12
14
  import {
13
15
  CustomStageLua,
@@ -49,6 +51,7 @@ export function customStageInit(mod: ModUpgraded): void {
49
51
  versusScreenInit();
50
52
 
51
53
  mod.AddCallback(ModCallback.POST_RENDER, postRender); // 2
54
+ mod.AddCallback(ModCallback.POST_CURSE_EVAL, postCurseEval); // 12
52
55
  mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
53
56
  mod.AddCallback(ModCallback.GET_SHADER_PARAMS, getShaderParams); // 21
54
57
  mod.AddCallbackCustom(
@@ -137,6 +140,23 @@ function postRender() {
137
140
  versusScreenPostRender();
138
141
  }
139
142
 
143
+ // ModCallback.POST_CURSE_EVAL (12)
144
+ function postCurseEval(
145
+ curses: BitFlags<LevelCurse>,
146
+ ): BitFlags<LevelCurse> | undefined {
147
+ const customStage = v.run.currentCustomStage;
148
+ if (customStage === null) {
149
+ return undefined;
150
+ }
151
+
152
+ // Prevent XL floors on custom stages, since the streak text will not work properly.
153
+ if (hasFlag(curses, LevelCurse.MAZE)) {
154
+ return removeFlag(curses, LevelCurse.MAZE);
155
+ }
156
+
157
+ return undefined;
158
+ }
159
+
140
160
  // ModCallback.POST_GAME_STARTED (15)
141
161
  function postGameStarted() {
142
162
  // We don't early return here because we need to unconditionally reset the sprites.
@@ -287,7 +287,6 @@ function renderSprite(
287
287
  const adjustedX = centeredX + adjustment;
288
288
  const adjustedY = position.Y + STREAK_TEXT_BOTTOM_Y_OFFSET;
289
289
 
290
- sprite.RenderLayer(0, position);
291
290
  font.DrawStringScaled(
292
291
  name,
293
292
  adjustedX,
@@ -0,0 +1,16 @@
1
+ import { VectorZero } from "../../constants";
2
+ import { StageTravelState } from "../../enums/private/StageTravelState";
3
+ import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "../customStage/customStageConstants";
4
+ import v from "./v";
5
+
6
+ const sprite = Sprite();
7
+ sprite.Load(`${ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH}/black.anm2`, true);
8
+ sprite.SetFrame("Default", 0);
9
+
10
+ export function drawBlackSprite(): void {
11
+ if (v.run.state !== StageTravelState.PAUSING_ON_BLACK) {
12
+ return;
13
+ }
14
+
15
+ sprite.RenderLayer(0, VectorZero);
16
+ }
@@ -2,12 +2,22 @@ import { GridEntityType } from "isaac-typescript-definitions";
2
2
 
3
3
  export const CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor";
4
4
 
5
+ export const GridEntityTypeCustom = {
6
+ TRAPDOOR_CUSTOM: 1000 as GridEntityType,
7
+ } as const;
8
+
5
9
  /** This also applies to crawl spaces. The value was determined through trial and error. */
6
10
  export const TRAPDOOR_OPEN_DISTANCE = 60;
7
11
 
8
12
  export const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5;
9
13
  export const TRAPDOOR_BOSS_REACTION_FRAMES = 30;
10
14
 
11
- export const GridEntityTypeCustom = {
12
- TRAPDOOR_CUSTOM: 1000 as GridEntityType,
13
- } as const;
15
+ export const TRAPDOOR_TOUCH_DISTANCE = 16.5;
16
+
17
+ export const ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL: ReadonlySet<string> =
18
+ new Set(["Happy", "Sad", "Jump"]);
19
+
20
+ export const PIXELATION_TO_BLACK_FRAMES = 52;
21
+
22
+ export const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 10;
23
+ export const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 8;