isaacscript-common 7.4.3 → 7.6.0

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 (183) hide show
  1. package/dist/callbacks/postGridEntity.d.ts.map +1 -1
  2. package/dist/callbacks/postGridEntity.lua +53 -6
  3. package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -1
  4. package/dist/callbacks/postPlayerChangeStat.lua +9 -2
  5. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts +1 -0
  6. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.lua +5 -2
  8. package/dist/callbacks/subscriptions/postGridEntityCustomInit.d.ts +9 -0
  9. package/dist/callbacks/subscriptions/postGridEntityCustomInit.d.ts.map +1 -0
  10. package/dist/callbacks/subscriptions/postGridEntityCustomInit.lua +23 -0
  11. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.d.ts +9 -0
  12. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.d.ts.map +1 -0
  13. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.lua +23 -0
  14. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.d.ts +9 -0
  15. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.d.ts.map +1 -0
  16. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.lua +29 -0
  17. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts +3 -2
  18. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts.map +1 -1
  19. package/dist/classes/DefaultMap.d.ts +3 -2
  20. package/dist/classes/DefaultMap.d.ts.map +1 -1
  21. package/dist/classes/DefaultMap.lua +2 -1
  22. package/dist/enums/ModCallbackCustom.d.ts +131 -81
  23. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  24. package/dist/enums/ModCallbackCustom.lua +67 -61
  25. package/dist/enums/StatType.d.ts +3 -1
  26. package/dist/enums/StatType.d.ts.map +1 -1
  27. package/dist/enums/StatType.lua +2 -0
  28. package/dist/features/customGridEntity.d.ts +30 -13
  29. package/dist/features/customGridEntity.d.ts.map +1 -1
  30. package/dist/features/customGridEntity.lua +67 -48
  31. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  32. package/dist/features/customStage/customStageGridEntities.lua +46 -36
  33. package/dist/features/customStage/customStageUtils.d.ts +2 -1
  34. package/dist/features/customStage/customStageUtils.d.ts.map +1 -1
  35. package/dist/features/customStage/customStageUtils.lua +40 -1
  36. package/dist/features/customStage/exports.d.ts +1 -25
  37. package/dist/features/customStage/exports.d.ts.map +1 -1
  38. package/dist/features/customStage/exports.lua +28 -29
  39. package/dist/features/customStage/v.d.ts +0 -2
  40. package/dist/features/customStage/v.d.ts.map +1 -1
  41. package/dist/features/customStage/v.lua +0 -2
  42. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  43. package/dist/features/customStage/versusScreen.lua +74 -60
  44. package/dist/features/customTrapdoor/exports.d.ts +28 -16
  45. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  46. package/dist/features/customTrapdoor/exports.lua +45 -61
  47. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  48. package/dist/features/customTrapdoor/init.lua +12 -10
  49. package/dist/features/customTrapdoor/spawn.d.ts +6 -0
  50. package/dist/features/customTrapdoor/spawn.d.ts.map +1 -0
  51. package/dist/features/customTrapdoor/spawn.lua +52 -0
  52. package/dist/features/customTrapdoor/v.d.ts +2 -2
  53. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  54. package/dist/functions/dev.d.ts +20 -0
  55. package/dist/functions/dev.d.ts.map +1 -0
  56. package/dist/functions/dev.lua +34 -0
  57. package/dist/functions/doors.d.ts +6 -5
  58. package/dist/functions/doors.d.ts.map +1 -1
  59. package/dist/functions/doors.lua +25 -12
  60. package/dist/functions/enums.d.ts +3 -3
  61. package/dist/functions/enums.lua +3 -3
  62. package/dist/functions/playerStats.d.ts.map +1 -1
  63. package/dist/functions/playerStats.lua +2 -1
  64. package/dist/functions/players.d.ts.map +1 -1
  65. package/dist/functions/players.lua +3 -2
  66. package/dist/functions/rooms.d.ts +5 -0
  67. package/dist/functions/rooms.d.ts.map +1 -1
  68. package/dist/functions/rooms.lua +12 -2
  69. package/dist/index.d.ts +172 -11037
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.lua +1134 -8
  72. package/dist/interfaces/{CustomStageLua.d.ts → CustomStageTSConfig.d.ts} +86 -60
  73. package/dist/interfaces/CustomStageTSConfig.d.ts.map +1 -0
  74. package/dist/interfaces/{CustomStageLua.lua → CustomStageTSConfig.lua} +0 -0
  75. package/dist/interfaces/JSONRoomsFile.d.ts +6 -5
  76. package/dist/interfaces/JSONRoomsFile.d.ts.map +1 -1
  77. package/dist/interfaces/StatTypeType.d.ts +1 -0
  78. package/dist/interfaces/StatTypeType.d.ts.map +1 -1
  79. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts +6 -0
  80. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts.map +1 -1
  81. package/dist/interfaces/private/CustomStage.d.ts +1 -1
  82. package/dist/interfaces/private/CustomStage.d.ts.map +1 -1
  83. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
  84. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  85. package/dist/interfaces/private/CustomTrapdoorDestination.d.ts +14 -0
  86. package/dist/interfaces/private/CustomTrapdoorDestination.d.ts.map +1 -0
  87. package/dist/interfaces/{index.lua → private/CustomTrapdoorDestination.lua} +0 -0
  88. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  89. package/dist/objects/callbackRegisterFunctions.lua +9 -0
  90. package/dist/types/PossibleStatType.d.ts +7 -0
  91. package/dist/types/PossibleStatType.d.ts.map +1 -0
  92. package/dist/types/{TrapdoorDestination.lua → PossibleStatType.lua} +0 -0
  93. package/package.json +1 -1
  94. package/src/callbacks/postGridEntity.ts +75 -10
  95. package/src/callbacks/postPlayerChangeStat.ts +8 -4
  96. package/src/callbacks/subscriptions/postGridEntityCustomBroken.ts +4 -0
  97. package/src/callbacks/subscriptions/postGridEntityCustomInit.ts +38 -0
  98. package/src/callbacks/subscriptions/postGridEntityCustomRemove.ts +35 -0
  99. package/src/callbacks/subscriptions/postGridEntityCustomStateChanged.ts +42 -0
  100. package/src/callbacks/subscriptions/postPlayerChangeStat.ts +4 -7
  101. package/src/classes/DefaultMap.ts +3 -2
  102. package/src/enums/ModCallbackCustom.ts +73 -20
  103. package/src/enums/StatType.ts +3 -3
  104. package/src/features/customGridEntity.ts +87 -61
  105. package/src/features/customStage/customStageGridEntities.ts +36 -23
  106. package/src/features/customStage/customStageUtils.ts +52 -1
  107. package/src/features/customStage/exports.ts +33 -45
  108. package/src/features/customStage/init.ts +1 -1
  109. package/src/features/customStage/v.ts +0 -6
  110. package/src/features/customStage/versusScreen.ts +70 -55
  111. package/src/features/customTrapdoor/exports.ts +60 -66
  112. package/src/features/customTrapdoor/init.ts +12 -11
  113. package/src/features/customTrapdoor/spawn.ts +54 -0
  114. package/src/features/customTrapdoor/v.ts +2 -2
  115. package/src/functions/dev.ts +31 -0
  116. package/src/functions/doors.ts +37 -21
  117. package/src/functions/enums.ts +3 -3
  118. package/src/functions/playerStats.ts +1 -0
  119. package/src/functions/players.ts +7 -3
  120. package/src/functions/rooms.ts +18 -0
  121. package/src/index.ts +207 -9
  122. package/src/interfaces/{CustomStageLua.ts → CustomStageTSConfig.ts} +107 -41
  123. package/src/interfaces/JSONRoomsFile.ts +6 -5
  124. package/src/interfaces/StatTypeType.ts +1 -0
  125. package/src/interfaces/private/AddCallbackParameterCustom.ts +6 -0
  126. package/src/interfaces/private/CustomStage.ts +4 -1
  127. package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
  128. package/src/interfaces/private/CustomTrapdoorDestination.ts +14 -0
  129. package/src/objects/callbackRegisterFunctions.ts +9 -0
  130. package/src/types/PossibleStatType.ts +12 -0
  131. package/dist/classes/index.d.ts +0 -3
  132. package/dist/classes/index.d.ts.map +0 -1
  133. package/dist/classes/index.lua +0 -18
  134. package/dist/core/index.d.ts +0 -5
  135. package/dist/core/index.d.ts.map +0 -1
  136. package/dist/core/index.lua +0 -34
  137. package/dist/enums/DecorationVariant.d.ts +0 -10
  138. package/dist/enums/DecorationVariant.d.ts.map +0 -1
  139. package/dist/enums/DecorationVariant.lua +0 -7
  140. package/dist/enums/index.d.ts +0 -11
  141. package/dist/enums/index.d.ts.map +0 -1
  142. package/dist/enums/index.lua +0 -82
  143. package/dist/features/index.d.ts +0 -30
  144. package/dist/features/index.d.ts.map +0 -1
  145. package/dist/features/index.lua +0 -216
  146. package/dist/functions/index.d.ts +0 -100
  147. package/dist/functions/index.d.ts.map +0 -1
  148. package/dist/functions/index.lua +0 -794
  149. package/dist/interfaces/CustomStageLua.d.ts.map +0 -1
  150. package/dist/interfaces/index.d.ts +0 -12
  151. package/dist/interfaces/index.d.ts.map +0 -1
  152. package/dist/maps/index.d.ts +0 -5
  153. package/dist/maps/index.d.ts.map +0 -1
  154. package/dist/maps/index.lua +0 -34
  155. package/dist/objects/index.d.ts +0 -2
  156. package/dist/objects/index.d.ts.map +0 -1
  157. package/dist/objects/index.lua +0 -10
  158. package/dist/types/TrapdoorDestination.d.ts +0 -6
  159. package/dist/types/TrapdoorDestination.d.ts.map +0 -1
  160. package/dist/types/index.d.ts +0 -11
  161. package/dist/types/index.d.ts.map +0 -1
  162. package/dist/types/index.lua +0 -10
  163. package/src/classes/index.ts +0 -2
  164. package/src/classes/indexTypeDoc.ts +0 -2
  165. package/src/core/index.ts +0 -4
  166. package/src/core/indexTypeDoc.ts +0 -4
  167. package/src/enums/DecorationVariant.ts +0 -10
  168. package/src/enums/index.ts +0 -10
  169. package/src/enums/indexTypeDoc.ts +0 -10
  170. package/src/features/index.ts +0 -59
  171. package/src/features/indexTypeDoc.ts +0 -30
  172. package/src/functions/index.ts +0 -101
  173. package/src/functions/indexTypeDoc.ts +0 -101
  174. package/src/indexTypeDoc.ts +0 -13
  175. package/src/interfaces/index.ts +0 -11
  176. package/src/interfaces/indexTypeDoc.ts +0 -11
  177. package/src/maps/index.ts +0 -4
  178. package/src/maps/indexTypeDoc.ts +0 -4
  179. package/src/objects/index.ts +0 -1
  180. package/src/objects/indexTypeDoc.ts +0 -1
  181. package/src/types/TrapdoorDestination.ts +0 -8
  182. package/src/types/index.ts +0 -10
  183. package/src/types/indexTypeDoc.ts +0 -10
@@ -7,8 +7,6 @@ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
7
7
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
8
8
  local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
9
9
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
10
- local ____DecorationVariant = require("enums.DecorationVariant")
11
- local DecorationVariant = ____DecorationVariant.DecorationVariant
12
10
  local ____entities = require("functions.entities")
13
11
  local removeEntities = ____entities.removeEntities
14
12
  local ____entitiesSpecific = require("functions.entitiesSpecific")
@@ -21,21 +19,22 @@ local getCollectibles = ____pickupsSpecific.getCollectibles
21
19
  local getTrinkets = ____pickupsSpecific.getTrinkets
22
20
  local ____stage = require("functions.stage")
23
21
  local calculateStageType = ____stage.calculateStageType
24
- local ____types = require("functions.types")
25
- local asNumber = ____types.asNumber
26
22
  local ____vector = require("functions.vector")
27
23
  local vectorEquals = ____vector.vectorEquals
24
+ local ____customGridEntity = require("features.customGridEntity")
25
+ local isCustomGridEntity = ____customGridEntity.isCustomGridEntity
28
26
  local ____exports = require("features.customTrapdoor.exports")
29
27
  local spawnCustomTrapdoor = ____exports.spawnCustomTrapdoor
28
+ local spawnCustomTrapdoorToVanilla = ____exports.spawnCustomTrapdoorToVanilla
30
29
  local ____exports = require("features.customStage.exports")
31
30
  local DEFAULT_BASE_STAGE = ____exports.DEFAULT_BASE_STAGE
32
31
  local ____v = require("features.customStage.v")
33
32
  local v = ____v.default
34
33
  function getNewDoorPNGPath(self, customStage, fileName)
35
34
  repeat
36
- local ____switch21 = fileName
37
- local ____cond21 = ____switch21 == "gfx/grid/door_01_normaldoor.anm2"
38
- if ____cond21 then
35
+ local ____switch24 = fileName
36
+ local ____cond24 = ____switch24 == "gfx/grid/door_01_normaldoor.anm2"
37
+ if ____cond24 then
39
38
  do
40
39
  local ____customStage_doorPNGPaths_normal_0 = customStage.doorPNGPaths
41
40
  if ____customStage_doorPNGPaths_normal_0 ~= nil then
@@ -44,8 +43,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
44
43
  return ____customStage_doorPNGPaths_normal_0
45
44
  end
46
45
  end
47
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_02_treasureroomdoor.anm2"
48
- if ____cond21 then
46
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_02_treasureroomdoor.anm2"
47
+ if ____cond24 then
49
48
  do
50
49
  local ____customStage_doorPNGPaths_treasureRoom_2 = customStage.doorPNGPaths
51
50
  if ____customStage_doorPNGPaths_treasureRoom_2 ~= nil then
@@ -54,8 +53,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
54
53
  return ____customStage_doorPNGPaths_treasureRoom_2
55
54
  end
56
55
  end
57
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_03_ambushroomdoor.anm2"
58
- if ____cond21 then
56
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_03_ambushroomdoor.anm2"
57
+ if ____cond24 then
59
58
  do
60
59
  local ____customStage_doorPNGPaths_normalChallengeRoom_4 = customStage.doorPNGPaths
61
60
  if ____customStage_doorPNGPaths_normalChallengeRoom_4 ~= nil then
@@ -64,8 +63,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
64
63
  return ____customStage_doorPNGPaths_normalChallengeRoom_4
65
64
  end
66
65
  end
67
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_04_selfsacrificeroomdoor.anm2"
68
- if ____cond21 then
66
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_04_selfsacrificeroomdoor.anm2"
67
+ if ____cond24 then
69
68
  do
70
69
  local ____customStage_doorPNGPaths_curseRoom_6 = customStage.doorPNGPaths
71
70
  if ____customStage_doorPNGPaths_curseRoom_6 ~= nil then
@@ -74,8 +73,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
74
73
  return ____customStage_doorPNGPaths_curseRoom_6
75
74
  end
76
75
  end
77
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_05_arcaderoomdoor.anm2"
78
- if ____cond21 then
76
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_05_arcaderoomdoor.anm2"
77
+ if ____cond24 then
79
78
  do
80
79
  local ____customStage_doorPNGPaths_arcade_8 = customStage.doorPNGPaths
81
80
  if ____customStage_doorPNGPaths_arcade_8 ~= nil then
@@ -84,8 +83,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
84
83
  return ____customStage_doorPNGPaths_arcade_8
85
84
  end
86
85
  end
87
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_07_devilroomdoor.anm2"
88
- if ____cond21 then
86
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_07_devilroomdoor.anm2"
87
+ if ____cond24 then
89
88
  do
90
89
  local ____customStage_doorPNGPaths_devilRoom_10 = customStage.doorPNGPaths
91
90
  if ____customStage_doorPNGPaths_devilRoom_10 ~= nil then
@@ -94,8 +93,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
94
93
  return ____customStage_doorPNGPaths_devilRoom_10
95
94
  end
96
95
  end
97
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_07_holyroomdoor.anm2"
98
- if ____cond21 then
96
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_07_holyroomdoor.anm2"
97
+ if ____cond24 then
99
98
  do
100
99
  local ____customStage_doorPNGPaths_angelRoom_12 = customStage.doorPNGPaths
101
100
  if ____customStage_doorPNGPaths_angelRoom_12 ~= nil then
@@ -104,8 +103,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
104
103
  return ____customStage_doorPNGPaths_angelRoom_12
105
104
  end
106
105
  end
107
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_08_holeinwall.anm2"
108
- if ____cond21 then
106
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_08_holeinwall.anm2"
107
+ if ____cond24 then
109
108
  do
110
109
  local ____customStage_doorPNGPaths_secretRoom_14 = customStage.doorPNGPaths
111
110
  if ____customStage_doorPNGPaths_secretRoom_14 ~= nil then
@@ -114,8 +113,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
114
113
  return ____customStage_doorPNGPaths_secretRoom_14
115
114
  end
116
115
  end
117
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_09_bossambushroomdoor.anm2"
118
- if ____cond21 then
116
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_09_bossambushroomdoor.anm2"
117
+ if ____cond24 then
119
118
  do
120
119
  local ____customStage_doorPNGPaths_bossChallengeRoom_16 = customStage.doorPNGPaths
121
120
  if ____customStage_doorPNGPaths_bossChallengeRoom_16 ~= nil then
@@ -124,8 +123,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
124
123
  return ____customStage_doorPNGPaths_bossChallengeRoom_16
125
124
  end
126
125
  end
127
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_10_bossroomdoor.anm2"
128
- if ____cond21 then
126
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_10_bossroomdoor.anm2"
127
+ if ____cond24 then
129
128
  do
130
129
  local ____customStage_doorPNGPaths_bossRoom_18 = customStage.doorPNGPaths
131
130
  if ____customStage_doorPNGPaths_bossRoom_18 ~= nil then
@@ -134,8 +133,8 @@ function getNewDoorPNGPath(self, customStage, fileName)
134
133
  return ____customStage_doorPNGPaths_bossRoom_18
135
134
  end
136
135
  end
137
- ____cond21 = ____cond21 or ____switch21 == "gfx/grid/door_15_bossrushdoor.anm2"
138
- if ____cond21 then
136
+ ____cond24 = ____cond24 or ____switch24 == "gfx/grid/door_15_bossrushdoor.anm2"
137
+ if ____cond24 then
139
138
  do
140
139
  local ____customStage_doorPNGPaths_bossRush_20 = customStage.doorPNGPaths
141
140
  if ____customStage_doorPNGPaths_bossRush_20 ~= nil then
@@ -159,12 +158,11 @@ function ____exports.setCustomDecorationGraphics(self, customStage, gridEntity)
159
158
  if customStage.decorationsPNGPath == nil then
160
159
  return
161
160
  end
162
- local gridEntityType = gridEntity:GetType()
163
- if gridEntityType ~= GridEntityType.DECORATION then
161
+ if isCustomGridEntity(nil, gridEntity) then
164
162
  return
165
163
  end
166
- local variant = gridEntity:GetVariant()
167
- if variant ~= asNumber(nil, DecorationVariant.VANILLA_DECORATION) then
164
+ local gridEntityType = gridEntity:GetType()
165
+ if gridEntityType ~= GridEntityType.DECORATION then
168
166
  return
169
167
  end
170
168
  local sprite = gridEntity:GetSprite()
@@ -179,6 +177,9 @@ function ____exports.setCustomRockGraphics(self, customStage, gridEntity)
179
177
  if customStage.rocksPNGPath == nil then
180
178
  return
181
179
  end
180
+ if isCustomGridEntity(nil, gridEntity) then
181
+ return
182
+ end
182
183
  local gridEntityRock = gridEntity:ToRock()
183
184
  if gridEntityRock == nil then
184
185
  return
@@ -198,6 +199,9 @@ function ____exports.setCustomPitGraphics(self, customStage, gridEntity)
198
199
  if customStage.pitsPNGPath == nil then
199
200
  return
200
201
  end
202
+ if isCustomGridEntity(nil, gridEntity) then
203
+ return
204
+ end
201
205
  local gridEntityPit = gridEntity:ToPit()
202
206
  if gridEntityPit == nil then
203
207
  return
@@ -214,6 +218,9 @@ function ____exports.setCustomDoorGraphics(self, customStage, gridEntity)
214
218
  if customStage.doorPNGPaths == nil then
215
219
  return
216
220
  end
221
+ if isCustomGridEntity(nil, gridEntity) then
222
+ return
223
+ end
217
224
  local gridEntityDoor = gridEntity:ToDoor()
218
225
  if gridEntityDoor == nil then
219
226
  return
@@ -232,11 +239,14 @@ function ____exports.convertVanillaTrapdoors(self, customStage, gridEntity)
232
239
  return
233
240
  end
234
241
  removeGridEntity(nil, gridEntity, true)
235
- local baseStage = customStage.baseStage == nil and DEFAULT_BASE_STAGE or customStage.baseStage
236
- local vanillaNextStage = baseStage + 2
237
- local vanillaNextStageType = calculateStageType(nil, vanillaNextStage)
238
- local destination = v.run.firstFloor and ({customStage.name, 2}) or ({vanillaNextStage, vanillaNextStageType})
239
- spawnCustomTrapdoor(nil, gridEntity.Position, destination)
242
+ if v.run.firstFloor then
243
+ spawnCustomTrapdoor(nil, gridEntity.Position, customStage.name, 2)
244
+ else
245
+ local baseStage = customStage.baseStage == nil and DEFAULT_BASE_STAGE or customStage.baseStage
246
+ local stage = baseStage + 2
247
+ local stageType = calculateStageType(nil, stage)
248
+ spawnCustomTrapdoorToVanilla(nil, gridEntity.Position, stage, stageType)
249
+ end
240
250
  end
241
251
  --- The rewards are based on the ones from the wiki:
242
252
  -- https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /// <reference types="isaac-typescript-definitions" />
3
- import { CustomStageRoomMetadata } from "../../interfaces/CustomStageLua";
3
+ import { CustomStageBossPoolEntry, CustomStageRoomMetadata } from "../../interfaces/CustomStageTSConfig";
4
4
  /**
5
5
  * Helper function to get a random custom stage room from an array of custom stage rooms.
6
6
  *
@@ -9,4 +9,5 @@ import { CustomStageRoomMetadata } from "../../interfaces/CustomStageLua";
9
9
  * https://stackoverflow.com/questions/1761626/weighted-random-numbers
10
10
  */
11
11
  export declare function getRandomCustomStageRoom(roomsMetadata: readonly CustomStageRoomMetadata[], seedOrRNG?: Seed | RNG, verbose?: boolean): CustomStageRoomMetadata;
12
+ export declare function getRandomBossRoomFromPool(roomsMetadata: readonly CustomStageRoomMetadata[], bossPool: readonly CustomStageBossPoolEntry[], seedOrRNG?: Seed | RNG, verbose?: boolean): CustomStageRoomMetadata;
12
13
  //# sourceMappingURL=customStageUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customStageUtils.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageUtils.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAYzB"}
1
+ {"version":3,"file":"customStageUtils.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageUtils.ts"],"names":[],"mappings":";;AAIA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAYzB;AA0BD,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,QAAQ,EAAE,SAAS,wBAAwB,EAAE,EAC7C,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,uBAAuB,CAiBzB"}
@@ -1,7 +1,8 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
4
  local ____exports = {}
4
- local getTotalWeightOfCustomStageRooms, getCustomStageRoomWithChosenWeight
5
+ local getTotalWeightOfCustomStageRooms, getCustomStageRoomWithChosenWeight, getTotalWeightOfBossPool, getBossEntryWithChosenWeight
5
6
  local ____array = require("functions.array")
6
7
  local sumArray = ____array.sumArray
7
8
  local ____log = require("functions.log")
@@ -26,6 +27,22 @@ function getCustomStageRoomWithChosenWeight(self, roomsMetadata, chosenWeight)
26
27
  end
27
28
  error("Failed to get a custom stage room with chosen weight: " .. tostring(chosenWeight))
28
29
  end
30
+ function getTotalWeightOfBossPool(self, bossPool)
31
+ local weights = __TS__ArrayMap(
32
+ bossPool,
33
+ function(____, bossEntry) return bossEntry.weight end
34
+ )
35
+ return sumArray(nil, weights)
36
+ end
37
+ function getBossEntryWithChosenWeight(self, bossPool, chosenWeight)
38
+ for ____, bossEntry in ipairs(bossPool) do
39
+ if chosenWeight < bossEntry.weight then
40
+ return bossEntry
41
+ end
42
+ chosenWeight = chosenWeight - bossEntry.weight
43
+ end
44
+ error("Failed to get a custom stage boss entry with chosen weight: " .. tostring(chosenWeight))
45
+ end
29
46
  --- Helper function to get a random custom stage room from an array of custom stage rooms.
30
47
  --
31
48
  -- Note that this function does not simply choose a random element in the provided array; it will
@@ -48,4 +65,26 @@ function ____exports.getRandomCustomStageRoom(self, roomsMetadata, seedOrRNG, ve
48
65
  end
49
66
  return getCustomStageRoomWithChosenWeight(nil, roomsMetadata, chosenWeight)
50
67
  end
68
+ function ____exports.getRandomBossRoomFromPool(self, roomsMetadata, bossPool, seedOrRNG, verbose)
69
+ if seedOrRNG == nil then
70
+ seedOrRNG = getRandomSeed(nil)
71
+ end
72
+ if verbose == nil then
73
+ verbose = false
74
+ end
75
+ local totalWeight = getTotalWeightOfBossPool(nil, bossPool)
76
+ if verbose then
77
+ log("Total weight of the custom stage boss pool provided: " .. tostring(totalWeight))
78
+ end
79
+ local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
80
+ if verbose then
81
+ log("Randomly chose weight for custom stage boss pool: " .. tostring(chosenWeight))
82
+ end
83
+ local bossEntry = getBossEntryWithChosenWeight(nil, bossPool, chosenWeight)
84
+ local roomsMetadataForBoss = __TS__ArrayFilter(
85
+ roomsMetadata,
86
+ function(____, roomMetadata) return roomMetadata.subType == bossEntry.subType end
87
+ )
88
+ return ____exports.getRandomCustomStageRoom(nil, roomsMetadataForBoss, seedOrRNG, verbose)
89
+ end
51
90
  return ____exports
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { EntityType, LevelStage, StageType } from "isaac-typescript-definitions";
8
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
9
9
  export declare const DEFAULT_BASE_STAGE = LevelStage.BASEMENT_2;
10
10
  export declare const DEFAULT_BASE_STAGE_TYPE = StageType.ORIGINAL;
11
11
  export declare const INVALID_STAGE_VALUE: LevelStage;
@@ -23,30 +23,6 @@ export declare const INVALID_STAGE_VALUE: LevelStage;
23
23
  * Default is false.
24
24
  */
25
25
  export declare function setCustomStage(name: string, firstFloor?: boolean, verbose?: boolean): void;
26
- /**
27
- * By default, unknown bosses will be drawn on the boss "versus" screen as "???". If your custom
28
- * stage has custom bosses, you can use this function to register the corresponding graphic file
29
- * files for them.
30
- *
31
- * For reference:
32
- * - The vanilla name sprite for Monstro is located at:
33
- * `resources/gfx/ui/boss/bossname_20.0_monstro.png`
34
- * - The vanilla portrait sprite for Monstro is located at:
35
- * `resources/gfx/ui/boss/portrait_20.0_monstro.png`
36
- *
37
- * (Note that boss metadata like this cannot be specified with the rest of the custom stage metadata
38
- * in the "tsconfig.json" file because there is not a way to retrieve the name of an entity at
39
- * run-time.)
40
- *
41
- * @param entityType The entity type of the custom boss.
42
- * @param variant The variant of the custom boss.
43
- * @param subType The sub-type of the custom boss.
44
- * @param namePNGPath The full path to the PNG file that contains the name of the boss that will be
45
- * displayed on the top of the boss "versus" screen.
46
- * @param portraitPNGPath The full path to the PNG file that contains the portrait of the boss that
47
- * will be displayed on the right side of the boss "versus" screen.
48
- */
49
- export declare function registerCustomBoss(entityType: EntityType, variant: int, subType: int, namePNGPath: string, portraitPNGPath: string): void;
50
26
  /**
51
27
  * Helper function to disable the custom stage. This is typically called before taking the player to
52
28
  * a vanilla floor.
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EACV,UAAU,EAGV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAoBtC,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,YAAmB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI,CAwDN;AA4ED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB,IAAI,CAGN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH,OAAO,EAEL,UAAU,EAGV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAoBtC,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,YAAmB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI,CAwDN;AAkGD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -1,8 +1,10 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
4
  local ____exports = {}
4
5
  local setStageRoomsData
5
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
6
8
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
7
9
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
8
10
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
@@ -11,8 +13,8 @@ local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
11
13
  local reorderedCallbacksSetStageInternal = ____reorderedCallbacks.reorderedCallbacksSetStageInternal
12
14
  local ____cachedClasses = require("core.cachedClasses")
13
15
  local game = ____cachedClasses.game
14
- local ____entities = require("functions.entities")
15
- local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
16
+ local ____doors = require("functions.doors")
17
+ local doorSlotFlagsToDoorSlots = ____doors.doorSlotFlagsToDoorSlots
16
18
  local ____log = require("functions.log")
17
19
  local logError = ____log.logError
18
20
  local ____rng = require("functions.rng")
@@ -25,10 +27,10 @@ local setStage = ____stage.setStage
25
27
  local ____types = require("functions.types")
26
28
  local asNumber = ____types.asNumber
27
29
  local ____customStageUtils = require("features.customStage.customStageUtils")
30
+ local getRandomBossRoomFromPool = ____customStageUtils.getRandomBossRoomFromPool
28
31
  local getRandomCustomStageRoom = ____customStageUtils.getRandomCustomStageRoom
29
32
  local ____v = require("features.customStage.v")
30
33
  local v = ____v.default
31
- local customBossPNGPaths = ____v.customBossPNGPaths
32
34
  local customStageCachedRoomData = ____v.customStageCachedRoomData
33
35
  local customStagesMap = ____v.customStagesMap
34
36
  function setStageRoomsData(self, customStage, rng, verbose)
@@ -60,9 +62,31 @@ function setStageRoomsData(self, customStage, rng, verbose)
60
62
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
61
63
  if roomsMetadata == nil then
62
64
  logError((((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name)
65
+ local header = ("For reference, a DoorSlotFlags of " .. tostring(doorSlotFlags)) .. " is equal to the following doors being enabled:\n"
66
+ local doorSlots = doorSlotFlagsToDoorSlots(nil, doorSlotFlags)
67
+ local doorSlotLines = __TS__ArrayMap(
68
+ doorSlots,
69
+ function(____, doorSlot) return ((("- DoorSlot." .. tostring(DoorSlot[doorSlot])) .. " (") .. tostring(doorSlot)) .. ")" end
70
+ )
71
+ local explanation = header .. table.concat(doorSlotLines, "\n")
72
+ logError(explanation)
63
73
  goto __continue7
64
74
  end
65
- local randomRoom = getRandomCustomStageRoom(nil, roomsMetadata, rng, verbose)
75
+ local randomRoom
76
+ if roomType == RoomType.BOSS then
77
+ if customStage.bossPool == nil then
78
+ goto __continue7
79
+ end
80
+ randomRoom = getRandomBossRoomFromPool(
81
+ nil,
82
+ roomsMetadata,
83
+ customStage.bossPool,
84
+ rng,
85
+ verbose
86
+ )
87
+ else
88
+ randomRoom = getRandomCustomStageRoom(nil, roomsMetadata, rng, verbose)
89
+ end
66
90
  local newRoomData = customStageCachedRoomData:get(randomRoom.variant)
67
91
  if newRoomData == nil then
68
92
  newRoomData = getRoomDataForTypeVariant(nil, roomType, randomRoom.variant, false)
@@ -125,31 +149,6 @@ function ____exports.setCustomStage(self, name, firstFloor, verbose)
125
149
  level:SetStage(targetStage, targetStageType)
126
150
  reorderedCallbacksSetStageInternal(nil, targetStage, targetStageType)
127
151
  end
128
- --- By default, unknown bosses will be drawn on the boss "versus" screen as "???". If your custom
129
- -- stage has custom bosses, you can use this function to register the corresponding graphic file
130
- -- files for them.
131
- --
132
- -- For reference:
133
- -- - The vanilla name sprite for Monstro is located at:
134
- -- `resources/gfx/ui/boss/bossname_20.0_monstro.png`
135
- -- - The vanilla portrait sprite for Monstro is located at:
136
- -- `resources/gfx/ui/boss/portrait_20.0_monstro.png`
137
- --
138
- -- (Note that boss metadata like this cannot be specified with the rest of the custom stage metadata
139
- -- in the "tsconfig.json" file because there is not a way to retrieve the name of an entity at
140
- -- run-time.)
141
- --
142
- -- @param entityType The entity type of the custom boss.
143
- -- @param variant The variant of the custom boss.
144
- -- @param subType The sub-type of the custom boss.
145
- -- @param namePNGPath The full path to the PNG file that contains the name of the boss that will be
146
- -- displayed on the top of the boss "versus" screen.
147
- -- @param portraitPNGPath The full path to the PNG file that contains the portrait of the boss that
148
- -- will be displayed on the right side of the boss "versus" screen.
149
- function ____exports.registerCustomBoss(self, entityType, variant, subType, namePNGPath, portraitPNGPath)
150
- local entityID = getEntityIDFromConstituents(nil, entityType, variant, subType)
151
- customBossPNGPaths:set(entityID, {namePNGPath, portraitPNGPath})
152
- end
153
152
  --- Helper function to disable the custom stage. This is typically called before taking the player to
154
153
  -- a vanilla floor.
155
154
  function ____exports.disableCustomStage(self)
@@ -30,6 +30,4 @@ export default v;
30
30
  export declare const customStagesMap: Map<string, CustomStage>;
31
31
  /** Indexed by room variant. */
32
32
  export declare const customStageCachedRoomData: Map<number, Readonly<RoomConfig>>;
33
- /** Indexed by entity ID. */
34
- export declare const customBossPNGPaths: Map<string, [namePNGPath: string, portraitPNGPath: string]>;
35
33
  //# sourceMappingURL=v.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,CAAC;;;QAIH,iDAAiD;;;QAKjD,oFAAoF;;;;;;;;;;;;;;;;;CAqBvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC;AAE9E,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,6DAG5B,CAAC"}
1
+ {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,CAAC;;;QAIH,iDAAiD;;;QAKjD,oFAAoF;;;;;;;;;;;;;;;;;CAqBvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC"}
@@ -21,6 +21,4 @@ ____exports.default = v
21
21
  ____exports.customStagesMap = __TS__New(Map)
22
22
  --- Indexed by room variant.
23
23
  ____exports.customStageCachedRoomData = __TS__New(Map)
24
- --- Indexed by entity ID.
25
- ____exports.customBossPNGPaths = __TS__New(Map)
26
24
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA2EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAwExE;AAoFD,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA2EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CA2ExE;AAkGD,wBAAgB,sBAAsB,IAAI,IAAI,CAkC7C"}