isaacscript-common 6.20.2 → 6.21.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 (91) hide show
  1. package/dist/constantsFirstLast.d.ts +2 -2
  2. package/dist/constantsFirstLast.lua +2 -2
  3. package/dist/enums/RockAltType.d.ts +12 -1
  4. package/dist/enums/RockAltType.d.ts.map +1 -1
  5. package/dist/enums/RockAltType.lua +4 -2
  6. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  7. package/dist/features/customStage/backdrop.lua +3 -2
  8. package/dist/features/customStage/customStageConstants.d.ts +11 -0
  9. package/dist/features/customStage/customStageConstants.d.ts.map +1 -1
  10. package/dist/features/customStage/customStageConstants.lua +10 -0
  11. package/dist/features/customStage/customStageGridEntities.d.ts +1 -0
  12. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  13. package/dist/features/customStage/customStageGridEntities.lua +58 -23
  14. package/dist/features/customStage/exports.d.ts +4 -5
  15. package/dist/features/customStage/exports.d.ts.map +1 -1
  16. package/dist/features/customStage/exports.lua +49 -51
  17. package/dist/features/customStage/init.d.ts.map +1 -1
  18. package/dist/features/customStage/init.lua +7 -12
  19. package/dist/features/customStage/shadows.d.ts.map +1 -1
  20. package/dist/features/customStage/shadows.lua +2 -1
  21. package/dist/features/customStage/streakText.d.ts +0 -7
  22. package/dist/features/customStage/streakText.d.ts.map +1 -1
  23. package/dist/features/customStage/streakText.lua +51 -84
  24. package/dist/features/customStage/v.d.ts +13 -0
  25. package/dist/features/customStage/v.d.ts.map +1 -1
  26. package/dist/features/customStage/v.lua +6 -1
  27. package/dist/features/customTrapdoor/exports.d.ts +7 -6
  28. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  29. package/dist/features/customTrapdoor/exports.lua +6 -5
  30. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  31. package/dist/features/customTrapdoor/init.lua +11 -6
  32. package/dist/features/customTrapdoor/touched.lua +0 -1
  33. package/dist/features/customTrapdoor/v.d.ts +1 -1
  34. package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
  35. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  36. package/dist/features/saveDataManager/exports.d.ts +3 -0
  37. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  38. package/dist/features/saveDataManager/exports.lua +3 -0
  39. package/dist/functions/collectibleSet.d.ts +1 -1
  40. package/dist/functions/collectibleSet.lua +1 -1
  41. package/dist/functions/doors.d.ts +10 -0
  42. package/dist/functions/doors.d.ts.map +1 -1
  43. package/dist/functions/doors.lua +6 -0
  44. package/dist/functions/log.d.ts +1 -15
  45. package/dist/functions/log.d.ts.map +1 -1
  46. package/dist/functions/log.lua +3 -218
  47. package/dist/functions/logEntities.d.ts +16 -0
  48. package/dist/functions/logEntities.d.ts.map +1 -0
  49. package/dist/functions/logEntities.lua +220 -0
  50. package/dist/functions/rockAlt.d.ts +6 -5
  51. package/dist/functions/rockAlt.d.ts.map +1 -1
  52. package/dist/functions/rockAlt.lua +147 -18
  53. package/dist/functions/roomTransition.d.ts +26 -0
  54. package/dist/functions/roomTransition.d.ts.map +1 -0
  55. package/dist/functions/roomTransition.lua +75 -0
  56. package/dist/functions/rooms.d.ts +1 -18
  57. package/dist/functions/rooms.d.ts.map +1 -1
  58. package/dist/functions/rooms.lua +3 -52
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.lua +8 -0
  62. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +1 -1
  63. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  64. package/dist/objects/backdropTypeToRockAltType.lua +3 -3
  65. package/package.json +1 -1
  66. package/src/constantsFirstLast.ts +2 -2
  67. package/src/enums/RockAltType.ts +14 -1
  68. package/src/features/customStage/backdrop.ts +2 -1
  69. package/src/features/customStage/customStageConstants.ts +16 -0
  70. package/src/features/customStage/customStageGridEntities.ts +47 -0
  71. package/src/features/customStage/exports.ts +44 -40
  72. package/src/features/customStage/init.ts +7 -18
  73. package/src/features/customStage/shadows.ts +2 -1
  74. package/src/features/customStage/streakText.ts +58 -95
  75. package/src/features/customStage/v.ts +17 -0
  76. package/src/features/customTrapdoor/exports.ts +9 -6
  77. package/src/features/customTrapdoor/init.ts +16 -5
  78. package/src/features/customTrapdoor/touched.ts +0 -2
  79. package/src/features/customTrapdoor/v.ts +1 -1
  80. package/src/features/extraConsoleCommands/commandsSubroutines.ts +4 -1
  81. package/src/features/saveDataManager/exports.ts +3 -0
  82. package/src/functions/collectibleSet.ts +1 -1
  83. package/src/functions/doors.ts +10 -0
  84. package/src/functions/log.ts +1 -279
  85. package/src/functions/logEntities.ts +276 -0
  86. package/src/functions/rockAlt.ts +147 -19
  87. package/src/functions/roomTransition.ts +78 -0
  88. package/src/functions/rooms.ts +2 -60
  89. package/src/index.ts +1 -0
  90. package/src/interfaces/private/CustomTrapdoorDescription.ts +3 -1
  91. package/src/objects/backdropTypeToRockAltType.ts +3 -3
@@ -1,20 +1,17 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Set = ____lualib.Set
3
- local __TS__New = ____lualib.__TS__New
4
- local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
5
2
  local Map = ____lualib.Map
6
3
  local __TS__Spread = ____lualib.__TS__Spread
7
4
  local __TS__ArraySort = ____lualib.__TS__ArraySort
5
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
8
6
  local __TS__TypeOf = ____lualib.__TS__TypeOf
9
7
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
8
+ local Set = ____lualib.Set
9
+ local __TS__New = ____lualib.__TS__New
10
10
  local ____exports = {}
11
- local getEntityLogLine, getGridEntityLogLine
12
11
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
13
12
  local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
14
- local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
15
13
  local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
16
14
  local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
17
- local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
18
15
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
19
16
  local HeartSubType = ____isaac_2Dtypescript_2Ddefinitions.HeartSubType
20
17
  local LevelStateFlag = ____isaac_2Dtypescript_2Ddefinitions.LevelStateFlag
@@ -31,15 +28,11 @@ local arrayToString = ____array.arrayToString
31
28
  local ____collectibles = require("functions.collectibles")
32
29
  local getCollectibleName = ____collectibles.getCollectibleName
33
30
  local ____entities = require("functions.entities")
34
- local getEntities = ____entities.getEntities
35
31
  local getEntityID = ____entities.getEntityID
36
32
  local ____enums = require("functions.enums")
37
33
  local getEnumEntries = ____enums.getEnumEntries
38
34
  local ____flag = require("functions.flag")
39
35
  local hasFlag = ____flag.hasFlag
40
- local ____gridEntities = require("functions.gridEntities")
41
- local getGridEntities = ____gridEntities.getGridEntities
42
- local getGridEntityID = ____gridEntities.getGridEntityID
43
36
  local ____isaacAPIClass = require("functions.isaacAPIClass")
44
37
  local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
45
38
  local ____playerHealth = require("functions.playerHealth")
@@ -89,70 +82,6 @@ function ____exports.log(msg)
89
82
  local debugMsg = ____exports.getDebugPrependString(nil, msg)
90
83
  Isaac.DebugString(debugMsg)
91
84
  end
92
- --- Helper function to log information about a specific entity.
93
- function ____exports.logEntity(entity)
94
- local msg = getEntityLogLine(nil, entity)
95
- ____exports.log(msg)
96
- end
97
- function getEntityLogLine(self, entity, num)
98
- local msg = num == nil and "" or tostring(num) .. ") "
99
- msg = msg .. getEntityID(nil, entity)
100
- local bomb = entity:ToBomb()
101
- if bomb ~= nil then
102
- msg = msg .. " (bomb)"
103
- end
104
- local effect = entity:ToEffect()
105
- if effect ~= nil then
106
- msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
107
- end
108
- local familiar = entity:ToFamiliar()
109
- if familiar ~= nil then
110
- msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
111
- end
112
- local knife = entity:ToKnife()
113
- if knife ~= nil then
114
- msg = msg .. " (knife)"
115
- end
116
- local laser = entity:ToLaser()
117
- if laser ~= nil then
118
- msg = msg .. " (laser)"
119
- end
120
- local npc = entity:ToNPC()
121
- if npc ~= nil then
122
- msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
123
- end
124
- local pickup = entity:ToPickup()
125
- if pickup ~= nil then
126
- msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
127
- end
128
- local player = entity:ToPlayer()
129
- if player ~= nil then
130
- msg = msg .. " (player)"
131
- end
132
- local projectile = entity:ToProjectile()
133
- if projectile ~= nil then
134
- msg = msg .. " (projectile)"
135
- end
136
- local tear = entity:ToTear()
137
- if tear ~= nil then
138
- msg = msg .. " (tear)"
139
- end
140
- msg = msg .. "\n"
141
- msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
142
- msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
143
- msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
144
- msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
145
- msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
146
- msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
147
- msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
148
- msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
149
- msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
150
- msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
151
- if npc ~= nil then
152
- msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
153
- end
154
- return msg
155
- end
156
85
  --- Helper function for printing out every flag that is turned on. Useful when debugging.
157
86
  function ____exports.logFlags(flags, flagEnum, description)
158
87
  if description == nil then
@@ -175,132 +104,6 @@ function ____exports.logFlags(flags, flagEnum, description)
175
104
  ____exports.log(" n/a (no flags)")
176
105
  end
177
106
  end
178
- --- Helper function for log information about a specific grid entity.
179
- function ____exports.logGridEntity(gridEntity)
180
- local msg = getGridEntityLogLine(nil, gridEntity)
181
- ____exports.log(msg)
182
- end
183
- function getGridEntityLogLine(self, gridEntity, num)
184
- local gridEntityDesc = gridEntity:GetSaveState()
185
- local msg = num == nil and "" or tostring(num) .. ") "
186
- msg = msg .. getGridEntityID(nil, gridEntity)
187
- local door = gridEntity:ToDoor()
188
- if door ~= nil then
189
- msg = msg .. " (door)"
190
- end
191
- local pit = gridEntity:ToPit()
192
- if pit ~= nil then
193
- msg = msg .. " (pit)"
194
- end
195
- local poop = gridEntity:ToPoop()
196
- if poop ~= nil then
197
- msg = msg .. " (poop)"
198
- end
199
- local pressurePlate = gridEntity:ToPressurePlate()
200
- if pressurePlate ~= nil then
201
- msg = msg .. " (pressurePlate)"
202
- end
203
- local rock = gridEntity:ToRock()
204
- if rock ~= nil then
205
- msg = msg .. " (rock)"
206
- end
207
- local spikes = gridEntity:ToSpikes()
208
- if spikes ~= nil then
209
- msg = msg .. " (spikes)"
210
- end
211
- local tnt = gridEntity:ToTNT()
212
- if tnt ~= nil then
213
- msg = msg .. " (TNT)"
214
- end
215
- msg = msg .. (" - State: " .. tostring(gridEntity.State)) .. "\n"
216
- msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
217
- msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
218
- msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
219
- msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
220
- if door ~= nil then
221
- msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
222
- msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
223
- msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
224
- msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
225
- end
226
- return msg
227
- end
228
- local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
229
- EffectVariant.BLOOD_EXPLOSION,
230
- EffectVariant.BLOOD_PARTICLE,
231
- EffectVariant.TINY_BUG,
232
- EffectVariant.TINY_FLY,
233
- EffectVariant.WATER_DROPLET,
234
- EffectVariant.WALL_BUG,
235
- EffectVariant.FALLING_EMBER,
236
- EffectVariant.LIGHT,
237
- EffectVariant.TADPOLE
238
- })
239
- --- Helper function for printing out every entity (or filtered entity) in the current room.
240
- function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
241
- local msg = "Entities in the room"
242
- if entityTypeFilter ~= nil then
243
- msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
244
- elseif not includeBackgroundEffects then
245
- msg = msg .. " (not including background effects)"
246
- end
247
- msg = msg .. ":\n"
248
- local entities = getEntities(nil)
249
- local numMatchedEntities = 0
250
- __TS__ArrayForEach(
251
- entities,
252
- function(____, entity, i)
253
- if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
254
- return
255
- end
256
- local effect = entity:ToEffect()
257
- if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
258
- return
259
- end
260
- msg = msg .. getEntityLogLine(nil, entity, i + 1)
261
- numMatchedEntities = numMatchedEntities + 1
262
- end
263
- )
264
- if numMatchedEntities == 0 then
265
- msg = msg .. "(no entities matched)\n"
266
- else
267
- msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
268
- end
269
- ____exports.log(msg)
270
- end
271
- --- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
272
- function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
273
- local msg = "Grid entities in the room"
274
- if gridEntityTypeFilter ~= nil then
275
- msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
276
- elseif not includeWalls then
277
- msg = msg .. " (not including walls)"
278
- end
279
- msg = msg .. ":\n"
280
- local gridEntities = getGridEntities(nil)
281
- local numMatchedEntities = 0
282
- __TS__ArrayForEach(
283
- gridEntities,
284
- function(____, gridEntity)
285
- local gridEntityIndex = gridEntity:GetGridIndex()
286
- local gridEntityType = gridEntity:GetType()
287
- if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
288
- return
289
- end
290
- if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
291
- return
292
- end
293
- msg = msg .. getGridEntityLogLine(nil, gridEntity, gridEntityIndex)
294
- numMatchedEntities = numMatchedEntities + 1
295
- end
296
- )
297
- if numMatchedEntities == 0 then
298
- msg = msg .. "(no grid entities matched)\n"
299
- else
300
- msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
301
- end
302
- ____exports.log(msg)
303
- end
304
107
  function ____exports.logArray(array)
305
108
  local arrayString = arrayToString(nil, array)
306
109
  ____exports.log("Array: " .. arrayString)
@@ -312,12 +115,6 @@ end
312
115
  function ____exports.logDamageFlags(flags)
313
116
  ____exports.logFlags(flags, DamageFlag, "damage")
314
117
  end
315
- --- Helper function for logging an array of specific entities.
316
- function ____exports.logEntities(entities)
317
- for ____, entity in ipairs(entities) do
318
- ____exports.logEntity(entity)
319
- end
320
- end
321
118
  --- Helper function for printing out every entity flag that is turned on. Useful when debugging.
322
119
  function ____exports.logEntityFlags(flags)
323
120
  ____exports.logFlags(flags, EntityFlag, "entity")
@@ -353,12 +150,6 @@ function ____exports.logGameStateFlags()
353
150
  ____exports.log(" n/a (no flags)")
354
151
  end
355
152
  end
356
- --- Helper function for logging an array of specific grid entities.
357
- function ____exports.logGridEntities(gridEntities)
358
- for ____, gridEntity in ipairs(gridEntities) do
359
- ____exports.logGridEntity(gridEntity)
360
- end
361
- end
362
153
  function ____exports.logKColor(kColor)
363
154
  ____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
364
155
  end
@@ -608,20 +399,14 @@ end
608
399
  function ____exports.setLogFunctionsGlobal(self)
609
400
  local globals = _G
610
401
  globals.log = ____exports.log
611
- globals.logAllEntities = ____exports.logAllEntities
612
- globals.logAllGridEntities = ____exports.logAllGridEntities
613
402
  globals.logArray = ____exports.logArray
614
403
  globals.logColor = ____exports.logColor
615
404
  globals.logDamageFlags = ____exports.logDamageFlags
616
- globals.logEntities = ____exports.logEntities
617
- globals.logEntity = ____exports.logEntity
618
405
  globals.logEntityID = ____exports.logEntityID
619
406
  globals.logEntityFlags = ____exports.logEntityFlags
620
407
  globals.logError = ____exports.logError
621
408
  globals.logFlags = ____exports.logFlags
622
409
  globals.logGameStateFlags = ____exports.logGameStateFlags
623
- globals.logGridEntities = ____exports.logGridEntities
624
- globals.logGridEntity = ____exports.logGridEntity
625
410
  globals.logKColor = ____exports.logKColor
626
411
  globals.logLevelStateFlags = ____exports.logLevelStateFlags
627
412
  globals.logMap = ____exports.logMap
@@ -0,0 +1,16 @@
1
+ import { EntityType, GridEntityType } from "isaac-typescript-definitions";
2
+ /** Helper function for printing out every entity (or filtered entity) in the current room. */
3
+ export declare function logAllEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
4
+ /**
5
+ * Helper function for printing out every grid entity (or filtered grid entity) in the current room.
6
+ */
7
+ export declare function logAllGridEntities(this: void, includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
8
+ /** Helper function for logging an array of specific entities. */
9
+ export declare function logEntities(this: void, entities: Entity[]): void;
10
+ /** Helper function to log information about a specific entity. */
11
+ export declare function logEntity(this: void, entity: Entity): void;
12
+ /** Helper function for logging an array of specific grid entities. */
13
+ export declare function logGridEntities(this: void, gridEntities: GridEntity[]): void;
14
+ /** Helper function for log information about a specific grid entity. */
15
+ export declare function logGridEntity(this: void, gridEntity: GridEntity): void;
16
+ //# sourceMappingURL=logEntities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,MAAM,8BAA8B,CAAC;AAiBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CAuCN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,OAAO,EACrB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA6CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhE;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D;AA2ED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAI5E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAGtE"}
@@ -0,0 +1,220 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
5
+ local ____exports = {}
6
+ local getEntityLogLine, getGridEntityLogLine
7
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
8
+ local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
9
+ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
10
+ local ____entities = require("functions.entities")
11
+ local getEntities = ____entities.getEntities
12
+ local getEntityID = ____entities.getEntityID
13
+ local ____gridEntities = require("functions.gridEntities")
14
+ local getGridEntities = ____gridEntities.getGridEntities
15
+ local getGridEntityID = ____gridEntities.getGridEntityID
16
+ local ____log = require("functions.log")
17
+ local log = ____log.log
18
+ --- Helper function to log information about a specific entity.
19
+ function ____exports.logEntity(entity)
20
+ local msg = getEntityLogLine(nil, entity)
21
+ log(msg)
22
+ end
23
+ function getEntityLogLine(self, entity, num)
24
+ local msg = num == nil and "" or tostring(num) .. ") "
25
+ msg = msg .. getEntityID(nil, entity)
26
+ local bomb = entity:ToBomb()
27
+ if bomb ~= nil then
28
+ msg = msg .. " (bomb)"
29
+ end
30
+ local effect = entity:ToEffect()
31
+ if effect ~= nil then
32
+ msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
33
+ end
34
+ local familiar = entity:ToFamiliar()
35
+ if familiar ~= nil then
36
+ msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
37
+ end
38
+ local knife = entity:ToKnife()
39
+ if knife ~= nil then
40
+ msg = msg .. " (knife)"
41
+ end
42
+ local laser = entity:ToLaser()
43
+ if laser ~= nil then
44
+ msg = msg .. " (laser)"
45
+ end
46
+ local npc = entity:ToNPC()
47
+ if npc ~= nil then
48
+ msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
49
+ end
50
+ local pickup = entity:ToPickup()
51
+ if pickup ~= nil then
52
+ msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
53
+ end
54
+ local player = entity:ToPlayer()
55
+ if player ~= nil then
56
+ msg = msg .. " (player)"
57
+ end
58
+ local projectile = entity:ToProjectile()
59
+ if projectile ~= nil then
60
+ msg = msg .. " (projectile)"
61
+ end
62
+ local tear = entity:ToTear()
63
+ if tear ~= nil then
64
+ msg = msg .. " (tear)"
65
+ end
66
+ msg = msg .. "\n"
67
+ msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
68
+ msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
69
+ msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
70
+ msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
71
+ msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
72
+ msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
73
+ msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
74
+ msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
75
+ msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
76
+ msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
77
+ if npc ~= nil then
78
+ msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
79
+ end
80
+ return msg
81
+ end
82
+ --- Helper function for log information about a specific grid entity.
83
+ function ____exports.logGridEntity(gridEntity)
84
+ local msg = getGridEntityLogLine(nil, gridEntity)
85
+ log(msg)
86
+ end
87
+ function getGridEntityLogLine(self, gridEntity, num)
88
+ local gridEntityDesc = gridEntity:GetSaveState()
89
+ local msg = num == nil and "" or tostring(num) .. ") "
90
+ msg = msg .. getGridEntityID(nil, gridEntity)
91
+ local door = gridEntity:ToDoor()
92
+ if door ~= nil then
93
+ msg = msg .. " (door)"
94
+ end
95
+ local pit = gridEntity:ToPit()
96
+ if pit ~= nil then
97
+ msg = msg .. " (pit)"
98
+ end
99
+ local poop = gridEntity:ToPoop()
100
+ if poop ~= nil then
101
+ msg = msg .. " (poop)"
102
+ end
103
+ local pressurePlate = gridEntity:ToPressurePlate()
104
+ if pressurePlate ~= nil then
105
+ msg = msg .. " (pressurePlate)"
106
+ end
107
+ local rock = gridEntity:ToRock()
108
+ if rock ~= nil then
109
+ msg = msg .. " (rock)"
110
+ end
111
+ local spikes = gridEntity:ToSpikes()
112
+ if spikes ~= nil then
113
+ msg = msg .. " (spikes)"
114
+ end
115
+ local tnt = gridEntity:ToTNT()
116
+ if tnt ~= nil then
117
+ msg = msg .. " (TNT)"
118
+ end
119
+ msg = msg .. (" - State: " .. tostring(gridEntity.State)) .. "\n"
120
+ msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
121
+ msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
122
+ msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
123
+ msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
124
+ if door ~= nil then
125
+ msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
126
+ msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
127
+ msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
128
+ msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
129
+ end
130
+ return msg
131
+ end
132
+ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
133
+ EffectVariant.BLOOD_EXPLOSION,
134
+ EffectVariant.BLOOD_PARTICLE,
135
+ EffectVariant.TINY_BUG,
136
+ EffectVariant.TINY_FLY,
137
+ EffectVariant.WATER_DROPLET,
138
+ EffectVariant.WALL_BUG,
139
+ EffectVariant.FALLING_EMBER,
140
+ EffectVariant.LIGHT,
141
+ EffectVariant.TADPOLE
142
+ })
143
+ --- Helper function for printing out every entity (or filtered entity) in the current room.
144
+ function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
145
+ local msg = "Entities in the room"
146
+ if entityTypeFilter ~= nil then
147
+ msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
148
+ elseif not includeBackgroundEffects then
149
+ msg = msg .. " (not including background effects)"
150
+ end
151
+ msg = msg .. ":\n"
152
+ local entities = getEntities(nil)
153
+ local numMatchedEntities = 0
154
+ __TS__ArrayForEach(
155
+ entities,
156
+ function(____, entity, i)
157
+ if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
158
+ return
159
+ end
160
+ local effect = entity:ToEffect()
161
+ if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
162
+ return
163
+ end
164
+ msg = msg .. getEntityLogLine(nil, entity, i + 1)
165
+ numMatchedEntities = numMatchedEntities + 1
166
+ end
167
+ )
168
+ if numMatchedEntities == 0 then
169
+ msg = msg .. "(no entities matched)\n"
170
+ else
171
+ msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
172
+ end
173
+ log(msg)
174
+ end
175
+ --- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
176
+ function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
177
+ local msg = "Grid entities in the room"
178
+ if gridEntityTypeFilter ~= nil then
179
+ msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
180
+ elseif not includeWalls then
181
+ msg = msg .. " (not including walls)"
182
+ end
183
+ msg = msg .. ":\n"
184
+ local gridEntities = getGridEntities(nil)
185
+ local numMatchedEntities = 0
186
+ __TS__ArrayForEach(
187
+ gridEntities,
188
+ function(____, gridEntity)
189
+ local gridEntityIndex = gridEntity:GetGridIndex()
190
+ local gridEntityType = gridEntity:GetType()
191
+ if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
192
+ return
193
+ end
194
+ if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
195
+ return
196
+ end
197
+ msg = msg .. getGridEntityLogLine(nil, gridEntity, gridEntityIndex)
198
+ numMatchedEntities = numMatchedEntities + 1
199
+ end
200
+ )
201
+ if numMatchedEntities == 0 then
202
+ msg = msg .. "(no grid entities matched)\n"
203
+ else
204
+ msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
205
+ end
206
+ log(msg)
207
+ end
208
+ --- Helper function for logging an array of specific entities.
209
+ function ____exports.logEntities(entities)
210
+ for ____, entity in ipairs(entities) do
211
+ ____exports.logEntity(entity)
212
+ end
213
+ end
214
+ --- Helper function for logging an array of specific grid entities.
215
+ function ____exports.logGridEntities(gridEntities)
216
+ for ____, gridEntity in ipairs(gridEntities) do
217
+ ____exports.logGridEntity(gridEntity)
218
+ end
219
+ end
220
+ return ____exports
@@ -29,20 +29,21 @@ export declare function getRockAltType(): RockAltType;
29
29
  * trinket is still in the pool. Thus, it will always have a chance to spawn the respective trinket
30
30
  * (e.g. Swallowed Penny from urns).
31
31
  *
32
+ * When filled buckets are destroyed, 6 projectiles will always spawn in a random pattern (in
33
+ * addition to any other rewards that are spawned). This function does not account for this, so if
34
+ * you want to specifically emulate destroying a filled bucket, you have to account for the
35
+ * projectiles yourself.
36
+ *
32
37
  * The logic in this function is based on the rewards listed on the wiki:
33
38
  * https://bindingofisaacrebirth.fandom.com/wiki/Rocks
34
39
  *
35
40
  * @param position The place to spawn the reward.
36
41
  * @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
37
42
  * at spawning coins and spiders.
38
- * @param variant Optional. The variant of the grid entity to emulate. Default is 0, which
39
- * corresponds to a "normal" grid entity or an empty bucket. This only matters when
40
- * spawning the reward for buckets. (Empty buckets have different rewards than full
41
- * buckets.)
42
43
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
43
44
  * `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally, you
44
45
  * should pass the `InitSeed` of the grid entity that was broken.
45
46
  * @returns Whether or not this function spawned something.
46
47
  */
47
- export declare function spawnRockAltReward(position: Vector, rockAltType: RockAltType, variant?: number, seedOrRNG?: Seed | RNG): boolean;
48
+ export declare function spawnRockAltReward(position: Vector, rockAltType: RockAltType, seedOrRNG?: Seed | RNG): boolean;
48
49
  //# sourceMappingURL=rockAlt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rockAlt.d.ts","sourceRoot":"","sources":["../../src/functions/rockAlt.ts"],"names":[],"mappings":";;;AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA+BnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAK5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,EACxB,OAAO,SAAI,EACX,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,OAAO,CAwBT"}
1
+ {"version":3,"file":"rockAlt.d.ts","sourceRoot":"","sources":["../../src/functions/rockAlt.ts"],"names":[],"mappings":";;;AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAgCnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAK5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,OAAO,CA4BT"}