isaacscript-common 9.13.1 → 9.13.4
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.
- package/dist/callbacks/customRevive.lua +5 -2
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/features/customPickup.d.ts +1 -1
- package/dist/features/customPickup.d.ts.map +1 -1
- package/dist/features/customPickup.lua +2 -2
- package/dist/features/customStage/customStageUtils.lua +16 -4
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +17 -5
- package/dist/features/deployJSONRoom.lua +15 -9
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -2
- package/dist/features/extraConsoleCommands/listCommands.lua +4 -4
- package/dist/features/pause.lua +2 -2
- package/dist/features/saveDataManager/load.lua +7 -4
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +3 -3
- package/dist/features/saveDataManager/save.lua +1 -1
- package/dist/features/taintedLazarusPlayers.lua +1 -1
- package/dist/functions/benchmark.lua +8 -2
- package/dist/functions/debug.lua +1 -1
- package/dist/functions/deepCopy.lua +8 -8
- package/dist/functions/deepCopyTests.lua +1 -1
- package/dist/functions/globals.lua +6 -3
- package/dist/functions/hex.lua +7 -4
- package/dist/functions/jsonHelpers.lua +1 -1
- package/dist/functions/jsonRoom.lua +8 -2
- package/dist/functions/levelGrid.d.ts +3 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +11 -3
- package/dist/functions/log.d.ts +26 -26
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +209 -98
- package/dist/functions/logEntities.d.ts +8 -8
- package/dist/functions/logEntities.d.ts.map +1 -1
- package/dist/functions/logEntities.lua +21 -18
- package/dist/functions/mergeTests.lua +1 -1
- package/dist/functions/run.lua +5 -2
- package/dist/index.d.ts +38 -36
- package/package.json +2 -2
- package/src/features/customPickup.ts +5 -4
- package/src/features/customStage/exports.ts +0 -1
- package/src/functions/levelGrid.ts +12 -4
- package/src/functions/log.ts +23 -48
- package/src/functions/logEntities.ts +6 -8
- package/src/lib/jsonLua.d.ts +4 -2
package/dist/functions/log.lua
CHANGED
|
@@ -78,72 +78,84 @@ end
|
|
|
78
78
|
--
|
|
79
79
|
-- If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
|
|
80
80
|
-- function will also prepend the function name and the line number before the string.
|
|
81
|
-
function ____exports.log(msg)
|
|
81
|
+
function ____exports.log(self, msg)
|
|
82
82
|
local debugMsg = ____exports.getDebugPrependString(nil, msg)
|
|
83
83
|
Isaac.DebugString(debugMsg)
|
|
84
84
|
end
|
|
85
85
|
--- Helper function for printing out every flag that is turned on. Useful when debugging.
|
|
86
|
-
function ____exports.logFlags(flags, flagEnum, description)
|
|
86
|
+
function ____exports.logFlags(self, flags, flagEnum, description)
|
|
87
87
|
if description == nil then
|
|
88
88
|
description = ""
|
|
89
89
|
end
|
|
90
90
|
if description ~= "" then
|
|
91
91
|
description = "flag"
|
|
92
92
|
end
|
|
93
|
-
____exports.log(
|
|
93
|
+
____exports.log(
|
|
94
|
+
nil,
|
|
95
|
+
(("Logging " .. description) .. " values for: ") .. tostring(flags)
|
|
96
|
+
)
|
|
94
97
|
local hasNoFlags = true
|
|
95
98
|
for ____, ____value in ipairs(getEnumEntries(nil, flagEnum)) do
|
|
96
99
|
local key = ____value[1]
|
|
97
100
|
local value = ____value[2]
|
|
98
101
|
if hasFlag(nil, flags, value) then
|
|
99
|
-
____exports.log(
|
|
102
|
+
____exports.log(
|
|
103
|
+
nil,
|
|
104
|
+
(((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")"
|
|
105
|
+
)
|
|
100
106
|
hasNoFlags = false
|
|
101
107
|
end
|
|
102
108
|
end
|
|
103
109
|
if hasNoFlags then
|
|
104
|
-
____exports.log(" n/a (no flags)")
|
|
110
|
+
____exports.log(nil, " n/a (no flags)")
|
|
105
111
|
end
|
|
106
112
|
end
|
|
107
|
-
function ____exports.logArray(array)
|
|
113
|
+
function ____exports.logArray(self, array)
|
|
108
114
|
local arrayString = arrayToString(nil, array)
|
|
109
|
-
____exports.log("Array: " .. arrayString)
|
|
115
|
+
____exports.log(nil, "Array: " .. arrayString)
|
|
110
116
|
end
|
|
111
|
-
function ____exports.logCollectibleTypes(collectibleTypes)
|
|
112
|
-
____exports.log("Collectibles:")
|
|
117
|
+
function ____exports.logCollectibleTypes(self, collectibleTypes)
|
|
118
|
+
____exports.log(nil, "Collectibles:")
|
|
113
119
|
local i = 1
|
|
114
120
|
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
115
121
|
local collectibleName = getCollectibleName(nil, collectibleType)
|
|
116
|
-
____exports.log(
|
|
122
|
+
____exports.log(
|
|
123
|
+
nil,
|
|
124
|
+
((((tostring(i) .. ") ") .. collectibleName) .. " (") .. tostring(collectibleType)) .. ")"
|
|
125
|
+
)
|
|
117
126
|
i = i + 1
|
|
118
127
|
end
|
|
119
128
|
end
|
|
120
|
-
function ____exports.logColor(color)
|
|
121
|
-
____exports.log(
|
|
129
|
+
function ____exports.logColor(self, color)
|
|
130
|
+
____exports.log(
|
|
131
|
+
nil,
|
|
132
|
+
(((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO)
|
|
133
|
+
)
|
|
122
134
|
end
|
|
123
135
|
--- Helper function for printing out every damage flag that is turned on. Useful when debugging.
|
|
124
|
-
function ____exports.logDamageFlags(flags)
|
|
125
|
-
____exports.logFlags(flags, DamageFlag, "damage")
|
|
136
|
+
function ____exports.logDamageFlags(self, flags)
|
|
137
|
+
____exports.logFlags(nil, flags, DamageFlag, "damage")
|
|
126
138
|
end
|
|
127
139
|
--- Helper function for printing out every entity flag that is turned on. Useful when debugging.
|
|
128
|
-
function ____exports.logEntityFlags(flags)
|
|
129
|
-
____exports.logFlags(flags, EntityFlag, "entity")
|
|
140
|
+
function ____exports.logEntityFlags(self, flags)
|
|
141
|
+
____exports.logFlags(nil, flags, EntityFlag, "entity")
|
|
130
142
|
end
|
|
131
|
-
function ____exports.logEntityID(entity)
|
|
143
|
+
function ____exports.logEntityID(self, entity)
|
|
132
144
|
local entityID = getEntityID(nil, entity)
|
|
133
|
-
____exports.log("Entity: " .. entityID)
|
|
145
|
+
____exports.log(nil, "Entity: " .. entityID)
|
|
134
146
|
end
|
|
135
147
|
--- Helper function to log an error message and also print it to the console for better visibility.
|
|
136
148
|
--
|
|
137
149
|
-- This is useful in situations where using the `error` function would be dangerous (since it
|
|
138
150
|
-- prevents all of the subsequent code in the callback from running).
|
|
139
|
-
function ____exports.logError(msg)
|
|
151
|
+
function ____exports.logError(self, msg)
|
|
140
152
|
local errorMsg = "Error: " .. msg
|
|
141
|
-
____exports.log(errorMsg)
|
|
153
|
+
____exports.log(nil, errorMsg)
|
|
142
154
|
printConsole(nil, errorMsg)
|
|
143
155
|
end
|
|
144
156
|
--- Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
145
|
-
function ____exports.logGameStateFlags()
|
|
146
|
-
____exports.log("Logging game state flags:")
|
|
157
|
+
function ____exports.logGameStateFlags(self)
|
|
158
|
+
____exports.log(nil, "Logging game state flags:")
|
|
147
159
|
local gameStateFlagEntries = getEnumEntries(nil, GameStateFlag)
|
|
148
160
|
local hasNoFlags = true
|
|
149
161
|
for ____, ____value in ipairs(gameStateFlagEntries) do
|
|
@@ -151,51 +163,66 @@ function ____exports.logGameStateFlags()
|
|
|
151
163
|
local gameStateFlag = ____value[2]
|
|
152
164
|
local flagValue = game:GetStateFlag(gameStateFlag)
|
|
153
165
|
if flagValue then
|
|
154
|
-
____exports.log(
|
|
166
|
+
____exports.log(
|
|
167
|
+
nil,
|
|
168
|
+
(((" Has flag: " .. key) .. " (") .. tostring(gameStateFlag)) .. ")"
|
|
169
|
+
)
|
|
155
170
|
hasNoFlags = false
|
|
156
171
|
end
|
|
157
172
|
end
|
|
158
173
|
if hasNoFlags then
|
|
159
|
-
____exports.log(" n/a (no flags)")
|
|
174
|
+
____exports.log(nil, " n/a (no flags)")
|
|
160
175
|
end
|
|
161
176
|
end
|
|
162
|
-
function ____exports.logKColor(kColor)
|
|
163
|
-
____exports.log(
|
|
177
|
+
function ____exports.logKColor(self, kColor)
|
|
178
|
+
____exports.log(
|
|
179
|
+
nil,
|
|
180
|
+
(((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha)
|
|
181
|
+
)
|
|
164
182
|
end
|
|
165
183
|
--- Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
166
|
-
function ____exports.logLevelStateFlags()
|
|
184
|
+
function ____exports.logLevelStateFlags(self)
|
|
167
185
|
local level = game:GetLevel()
|
|
168
186
|
local levelStateFlagEntries = getEnumEntries(nil, LevelStateFlag)
|
|
169
|
-
____exports.log("Logging level state flags:")
|
|
187
|
+
____exports.log(nil, "Logging level state flags:")
|
|
170
188
|
local hasNoFlags = true
|
|
171
189
|
for ____, ____value in ipairs(levelStateFlagEntries) do
|
|
172
190
|
local key = ____value[1]
|
|
173
191
|
local levelStateFlag = ____value[2]
|
|
174
192
|
local flagValue = level:GetStateFlag(levelStateFlag)
|
|
175
193
|
if flagValue then
|
|
176
|
-
____exports.log(
|
|
194
|
+
____exports.log(
|
|
195
|
+
nil,
|
|
196
|
+
(((" Has flag: " .. key) .. " (") .. tostring(levelStateFlag)) .. ")"
|
|
197
|
+
)
|
|
177
198
|
hasNoFlags = false
|
|
178
199
|
end
|
|
179
200
|
end
|
|
180
201
|
if hasNoFlags then
|
|
181
|
-
____exports.log(" n/a (no flags)")
|
|
202
|
+
____exports.log(nil, " n/a (no flags)")
|
|
182
203
|
end
|
|
183
204
|
end
|
|
184
|
-
function ____exports.logMap(map)
|
|
185
|
-
____exports.log("Printing out a TSTL Map:")
|
|
205
|
+
function ____exports.logMap(self, map)
|
|
206
|
+
____exports.log(nil, "Printing out a TSTL Map:")
|
|
186
207
|
local mapKeys = {__TS__Spread(map:keys())}
|
|
187
208
|
__TS__ArraySort(mapKeys)
|
|
188
209
|
for ____, key in ipairs(mapKeys) do
|
|
189
210
|
local value = map:get(key)
|
|
190
|
-
____exports.log(
|
|
211
|
+
____exports.log(
|
|
212
|
+
nil,
|
|
213
|
+
((" " .. tostring(key)) .. " --> ") .. tostring(value)
|
|
214
|
+
)
|
|
191
215
|
end
|
|
192
|
-
____exports.log(
|
|
216
|
+
____exports.log(
|
|
217
|
+
nil,
|
|
218
|
+
" The size of the map was: " .. tostring(map.size)
|
|
219
|
+
)
|
|
193
220
|
end
|
|
194
|
-
function ____exports.logPlayerEffects(player)
|
|
221
|
+
function ____exports.logPlayerEffects(self, player)
|
|
195
222
|
local effects = getEffectsList(nil, player)
|
|
196
|
-
____exports.log("Logging player effects:")
|
|
223
|
+
____exports.log(nil, "Logging player effects:")
|
|
197
224
|
if #effects == 0 then
|
|
198
|
-
____exports.log(" n/a (no effects)")
|
|
225
|
+
____exports.log(nil, " n/a (no effects)")
|
|
199
226
|
return
|
|
200
227
|
end
|
|
201
228
|
__TS__ArrayForEach(
|
|
@@ -213,92 +240,158 @@ function ____exports.logPlayerEffects(player)
|
|
|
213
240
|
else
|
|
214
241
|
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
215
242
|
end
|
|
216
|
-
____exports.log(
|
|
243
|
+
____exports.log(
|
|
244
|
+
nil,
|
|
245
|
+
(((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")"
|
|
246
|
+
)
|
|
217
247
|
end
|
|
218
248
|
)
|
|
219
249
|
end
|
|
220
|
-
function ____exports.logPlayerHealth(player)
|
|
250
|
+
function ____exports.logPlayerHealth(self, player)
|
|
221
251
|
local playerName = getPlayerName(nil, player)
|
|
222
252
|
local playerHealth = getPlayerHealth(nil, player)
|
|
223
|
-
____exports.log(("Player health for " .. playerName) .. ":")
|
|
224
|
-
____exports.log(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
____exports.log(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
____exports.log(
|
|
233
|
-
|
|
234
|
-
|
|
253
|
+
____exports.log(nil, ("Player health for " .. playerName) .. ":")
|
|
254
|
+
____exports.log(
|
|
255
|
+
nil,
|
|
256
|
+
" Max hearts: " .. tostring(playerHealth.maxHearts)
|
|
257
|
+
)
|
|
258
|
+
____exports.log(
|
|
259
|
+
nil,
|
|
260
|
+
" Hearts: " .. tostring(playerHealth.hearts)
|
|
261
|
+
)
|
|
262
|
+
____exports.log(
|
|
263
|
+
nil,
|
|
264
|
+
" Eternal hearts: " .. tostring(playerHealth.eternalHearts)
|
|
265
|
+
)
|
|
266
|
+
____exports.log(
|
|
267
|
+
nil,
|
|
268
|
+
" Soul hearts: " .. tostring(playerHealth.soulHearts)
|
|
269
|
+
)
|
|
270
|
+
____exports.log(
|
|
271
|
+
nil,
|
|
272
|
+
" Bone hearts: " .. tostring(playerHealth.boneHearts)
|
|
273
|
+
)
|
|
274
|
+
____exports.log(
|
|
275
|
+
nil,
|
|
276
|
+
" Golden hearts: " .. tostring(playerHealth.goldenHearts)
|
|
277
|
+
)
|
|
278
|
+
____exports.log(
|
|
279
|
+
nil,
|
|
280
|
+
" Rotten hearts: " .. tostring(playerHealth.rottenHearts)
|
|
281
|
+
)
|
|
282
|
+
____exports.log(
|
|
283
|
+
nil,
|
|
284
|
+
" Broken hearts: " .. tostring(playerHealth.brokenHearts)
|
|
285
|
+
)
|
|
286
|
+
____exports.log(
|
|
287
|
+
nil,
|
|
288
|
+
" Soul charges: " .. tostring(playerHealth.soulCharges)
|
|
289
|
+
)
|
|
290
|
+
____exports.log(
|
|
291
|
+
nil,
|
|
292
|
+
" Blood charges: " .. tostring(playerHealth.bloodCharges)
|
|
293
|
+
)
|
|
294
|
+
____exports.log(nil, " Soul heart types: [")
|
|
235
295
|
for ____, soulHeartType in ipairs(playerHealth.soulHeartTypes) do
|
|
236
|
-
____exports.log(
|
|
296
|
+
____exports.log(
|
|
297
|
+
nil,
|
|
298
|
+
" HeartSubType." .. tostring(HeartSubType[soulHeartType])
|
|
299
|
+
)
|
|
237
300
|
end
|
|
238
|
-
____exports.log(" ]")
|
|
301
|
+
____exports.log(nil, " ]")
|
|
239
302
|
end
|
|
240
303
|
--- Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
241
|
-
function ____exports.logProjectileFlags(flags)
|
|
242
|
-
____exports.logFlags(flags, ProjectileFlag, "projectile")
|
|
304
|
+
function ____exports.logProjectileFlags(self, flags)
|
|
305
|
+
____exports.logFlags(nil, flags, ProjectileFlag, "projectile")
|
|
243
306
|
end
|
|
244
307
|
--- Helper function for logging information about the current room.
|
|
245
|
-
function ____exports.logRoom()
|
|
308
|
+
function ____exports.logRoom(self)
|
|
246
309
|
local room = game:GetRoom()
|
|
247
310
|
local bossID = room:GetBossID()
|
|
248
311
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
249
312
|
local roomListIndex = getRoomListIndex(nil)
|
|
250
313
|
local roomData = getRoomData(nil)
|
|
251
314
|
if roomData == nil then
|
|
252
|
-
____exports.log("Current room data is undefined.")
|
|
315
|
+
____exports.log(nil, "Current room data is undefined.")
|
|
253
316
|
else
|
|
254
|
-
____exports.log(
|
|
255
|
-
|
|
256
|
-
|
|
317
|
+
____exports.log(
|
|
318
|
+
nil,
|
|
319
|
+
"Current room stage ID: " .. tostring(roomData.StageID)
|
|
320
|
+
)
|
|
321
|
+
____exports.log(
|
|
322
|
+
nil,
|
|
323
|
+
(((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype)
|
|
324
|
+
)
|
|
325
|
+
____exports.log(nil, "Current room name: " .. roomData.Name)
|
|
257
326
|
end
|
|
258
327
|
local roomGridIndexName = GridRoom[roomGridIndex]
|
|
259
328
|
if roomGridIndexName == nil then
|
|
260
|
-
____exports.log(
|
|
329
|
+
____exports.log(
|
|
330
|
+
nil,
|
|
331
|
+
"Current room grid index: " .. tostring(roomGridIndex)
|
|
332
|
+
)
|
|
261
333
|
else
|
|
262
|
-
____exports.log(
|
|
334
|
+
____exports.log(
|
|
335
|
+
nil,
|
|
336
|
+
((("Current room grid index: " .. tostring(roomGridIndex)) .. " (GridRoom.") .. roomGridIndexName) .. ")"
|
|
337
|
+
)
|
|
263
338
|
end
|
|
264
|
-
____exports.log(
|
|
265
|
-
|
|
339
|
+
____exports.log(
|
|
340
|
+
nil,
|
|
341
|
+
"Current room list index: " .. tostring(roomListIndex)
|
|
342
|
+
)
|
|
343
|
+
____exports.log(
|
|
344
|
+
nil,
|
|
345
|
+
"Current room boss ID: " .. tostring(bossID)
|
|
346
|
+
)
|
|
266
347
|
end
|
|
267
348
|
--- Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
268
349
|
-- particular run.
|
|
269
|
-
function ____exports.logSeedEffects()
|
|
350
|
+
function ____exports.logSeedEffects(self)
|
|
270
351
|
local seeds = game:GetSeeds()
|
|
271
352
|
local seedEffectEntries = getEnumEntries(nil, SeedEffect)
|
|
272
|
-
____exports.log("Logging seed effects:")
|
|
353
|
+
____exports.log(nil, "Logging seed effects:")
|
|
273
354
|
local hasNoSeedEffects = true
|
|
274
355
|
for ____, ____value in ipairs(seedEffectEntries) do
|
|
275
356
|
local key = ____value[1]
|
|
276
357
|
local seedEffect = ____value[2]
|
|
277
358
|
if seeds:HasSeedEffect(seedEffect) then
|
|
278
|
-
____exports.log(
|
|
359
|
+
____exports.log(
|
|
360
|
+
nil,
|
|
361
|
+
(((" " .. key) .. " (") .. tostring(seedEffect)) .. ")"
|
|
362
|
+
)
|
|
279
363
|
hasNoSeedEffects = false
|
|
280
364
|
end
|
|
281
365
|
end
|
|
282
366
|
if hasNoSeedEffects then
|
|
283
|
-
____exports.log(" n/a (no seed effects)")
|
|
367
|
+
____exports.log(nil, " n/a (no seed effects)")
|
|
284
368
|
end
|
|
285
369
|
end
|
|
286
|
-
function ____exports.logSet(set)
|
|
287
|
-
____exports.log("Printing out a TSTL Set:")
|
|
370
|
+
function ____exports.logSet(self, set)
|
|
371
|
+
____exports.log(nil, "Printing out a TSTL Set:")
|
|
288
372
|
local setValues = getSortedSetValues(nil, set)
|
|
289
373
|
for ____, value in ipairs(setValues) do
|
|
290
|
-
____exports.log(
|
|
374
|
+
____exports.log(
|
|
375
|
+
nil,
|
|
376
|
+
" Value: " .. tostring(value)
|
|
377
|
+
)
|
|
291
378
|
end
|
|
292
|
-
____exports.log(
|
|
379
|
+
____exports.log(
|
|
380
|
+
nil,
|
|
381
|
+
" The size of the set was: " .. tostring(set.size)
|
|
382
|
+
)
|
|
293
383
|
end
|
|
294
384
|
--- Helper function for logging every sound effect that is currently playing.
|
|
295
|
-
function ____exports.logSounds()
|
|
385
|
+
function ____exports.logSounds(self)
|
|
296
386
|
local soundEffects = getEnumEntries(nil, SoundEffect)
|
|
297
387
|
for ____, ____value in ipairs(soundEffects) do
|
|
298
388
|
local key = ____value[1]
|
|
299
389
|
local soundEffect = ____value[2]
|
|
300
390
|
if sfxManager:IsPlaying(soundEffect) then
|
|
301
|
-
____exports.log(
|
|
391
|
+
____exports.log(
|
|
392
|
+
nil,
|
|
393
|
+
((("Currently playing sound effect: " .. key) .. " (") .. tostring(soundEffect)) .. ")"
|
|
394
|
+
)
|
|
302
395
|
end
|
|
303
396
|
end
|
|
304
397
|
end
|
|
@@ -307,12 +400,12 @@ end
|
|
|
307
400
|
--
|
|
308
401
|
-- This function will only work on tables that have string keys (because it logs the keys in order,
|
|
309
402
|
-- instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
310
|
-
function ____exports.logTable(luaTable, parentTables)
|
|
403
|
+
function ____exports.logTable(self, luaTable, parentTables)
|
|
311
404
|
if parentTables == nil then
|
|
312
405
|
parentTables = 0
|
|
313
406
|
end
|
|
314
407
|
if parentTables == 0 then
|
|
315
|
-
____exports.log("Printing out a Lua table:")
|
|
408
|
+
____exports.log(nil, "Printing out a Lua table:")
|
|
316
409
|
end
|
|
317
410
|
local numSpaces = (parentTables + 1) * 2
|
|
318
411
|
local indentation = string.rep(
|
|
@@ -321,7 +414,10 @@ function ____exports.logTable(luaTable, parentTables)
|
|
|
321
414
|
)
|
|
322
415
|
if not isTable(nil, luaTable) then
|
|
323
416
|
(function()
|
|
324
|
-
____exports.log(
|
|
417
|
+
____exports.log(
|
|
418
|
+
nil,
|
|
419
|
+
((indentation .. "n/a (encountered a variable of type \"") .. __TS__TypeOf(luaTable)) .. "\" instead of a table)"
|
|
420
|
+
)
|
|
325
421
|
end)(nil)
|
|
326
422
|
return
|
|
327
423
|
end
|
|
@@ -330,25 +426,31 @@ function ____exports.logTable(luaTable, parentTables)
|
|
|
330
426
|
nil,
|
|
331
427
|
luaTable,
|
|
332
428
|
function(____, key, value)
|
|
333
|
-
____exports.log(
|
|
429
|
+
____exports.log(
|
|
430
|
+
nil,
|
|
431
|
+
((indentation .. tostring(key)) .. " --> ") .. tostring(value)
|
|
432
|
+
)
|
|
334
433
|
if isTable(nil, value) then
|
|
335
434
|
if key == "__class" then
|
|
336
|
-
____exports.log(indentation .. " (skipping enumerating this key to avoid infinite recursion)")
|
|
435
|
+
____exports.log(nil, indentation .. " (skipping enumerating this key to avoid infinite recursion)")
|
|
337
436
|
else
|
|
338
|
-
____exports.logTable(value, parentTables + 1)
|
|
437
|
+
____exports.logTable(nil, value, parentTables + 1)
|
|
339
438
|
end
|
|
340
439
|
end
|
|
341
440
|
numElements = numElements + 1
|
|
342
441
|
end
|
|
343
442
|
);
|
|
344
443
|
(function()
|
|
345
|
-
____exports.log(
|
|
444
|
+
____exports.log(
|
|
445
|
+
nil,
|
|
446
|
+
(indentation .. "The size of the table was: ") .. tostring(numElements)
|
|
447
|
+
)
|
|
346
448
|
end)(nil)
|
|
347
449
|
end
|
|
348
450
|
--- Helper function to print out the differences between the entries of two tables. Note that this
|
|
349
451
|
-- will only do a shallow comparison.
|
|
350
|
-
function ____exports.logTableDifferences(table1, table2)
|
|
351
|
-
____exports.log("Comparing two Lua tables:")
|
|
452
|
+
function ____exports.logTableDifferences(self, table1, table2)
|
|
453
|
+
____exports.log(nil, "Comparing two Lua tables:")
|
|
352
454
|
local table1Keys = __TS__ObjectKeys(table1)
|
|
353
455
|
local table1KeysSet = __TS__New(Set, table1Keys)
|
|
354
456
|
local table2Keys = __TS__ObjectKeys(table2)
|
|
@@ -358,51 +460,60 @@ function ____exports.logTableDifferences(table1, table2)
|
|
|
358
460
|
__TS__ArraySort(keys)
|
|
359
461
|
for ____, key in ipairs(keys) do
|
|
360
462
|
if not table1KeysSet:has(key) then
|
|
361
|
-
____exports.log(
|
|
463
|
+
____exports.log(
|
|
464
|
+
nil,
|
|
465
|
+
" Table 1 is missing key: " .. tostring(key)
|
|
466
|
+
)
|
|
362
467
|
elseif not table2KeysSet:has(key) then
|
|
363
|
-
____exports.log(
|
|
468
|
+
____exports.log(
|
|
469
|
+
nil,
|
|
470
|
+
" Table 2 is missing key: " .. tostring(key)
|
|
471
|
+
)
|
|
364
472
|
else
|
|
365
473
|
local value1 = table1[key]
|
|
366
474
|
local value2 = table2[key]
|
|
367
475
|
if value1 ~= value2 then
|
|
368
|
-
____exports.log(
|
|
476
|
+
____exports.log(
|
|
477
|
+
nil,
|
|
478
|
+
(((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\""
|
|
479
|
+
)
|
|
369
480
|
end
|
|
370
481
|
end
|
|
371
482
|
end
|
|
372
483
|
end
|
|
373
484
|
--- Helper function for printing out every tear flag that is turned on. Useful when debugging.
|
|
374
|
-
function ____exports.logTearFlags(flags)
|
|
375
|
-
____exports.logFlags(flags, TearFlag, "tear")
|
|
485
|
+
function ____exports.logTearFlags(self, flags)
|
|
486
|
+
____exports.logFlags(nil, flags, TearFlag, "tear")
|
|
376
487
|
end
|
|
377
488
|
--- Helper function for printing out every use flag that is turned on. Useful when debugging.
|
|
378
|
-
function ____exports.logUseFlags(flags)
|
|
379
|
-
____exports.logFlags(flags, UseFlag, "use")
|
|
489
|
+
function ____exports.logUseFlags(self, flags)
|
|
490
|
+
____exports.logFlags(nil, flags, UseFlag, "use")
|
|
380
491
|
end
|
|
381
492
|
--- Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
382
493
|
-- the Isaac API).
|
|
383
|
-
function ____exports.logUserdata(userdata)
|
|
494
|
+
function ____exports.logUserdata(self, userdata)
|
|
384
495
|
if not isUserdata(nil, userdata) then
|
|
385
|
-
____exports.log("Userdata: [not userdata]")
|
|
496
|
+
____exports.log(nil, "Userdata: [not userdata]")
|
|
386
497
|
return
|
|
387
498
|
end
|
|
388
499
|
local metatable = getmetatable(userdata)
|
|
389
500
|
if metatable == nil then
|
|
390
|
-
____exports.log("Userdata: [no metatable]")
|
|
501
|
+
____exports.log(nil, "Userdata: [no metatable]")
|
|
391
502
|
return
|
|
392
503
|
end
|
|
393
504
|
local classType = getIsaacAPIClassName(nil, userdata)
|
|
394
505
|
if classType == nil then
|
|
395
|
-
____exports.log("Userdata: [no class type]")
|
|
506
|
+
____exports.log(nil, "Userdata: [no class type]")
|
|
396
507
|
else
|
|
397
|
-
____exports.log("Userdata: " .. classType)
|
|
508
|
+
____exports.log(nil, "Userdata: " .. classType)
|
|
398
509
|
end
|
|
399
|
-
____exports.logTable(metatable)
|
|
510
|
+
____exports.logTable(nil, metatable)
|
|
400
511
|
end
|
|
401
|
-
function ____exports.logVector(vector, round)
|
|
512
|
+
function ____exports.logVector(self, vector, round)
|
|
402
513
|
if round == nil then
|
|
403
514
|
round = false
|
|
404
515
|
end
|
|
405
516
|
local vectorString = vectorToString(nil, vector, round)
|
|
406
|
-
____exports.log("Vector: " .. vectorString)
|
|
517
|
+
____exports.log(nil, "Vector: " .. vectorString)
|
|
407
518
|
end
|
|
408
519
|
return ____exports
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { EntityType, GridEntityType } from "isaac-typescript-definitions";
|
|
2
2
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
3
|
-
export declare function logAllEntities(
|
|
3
|
+
export declare function logAllEntities(includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
|
|
4
4
|
/**
|
|
5
5
|
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
6
6
|
*/
|
|
7
|
-
export declare function logAllGridEntities(
|
|
7
|
+
export declare function logAllGridEntities(includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
|
|
8
8
|
/** Helper function for logging an array of specific entities. */
|
|
9
|
-
export declare function logEntities(
|
|
9
|
+
export declare function logEntities(entities: Entity[]): void;
|
|
10
10
|
/** Helper function to log information about a specific entity. */
|
|
11
|
-
export declare function logEntity(
|
|
11
|
+
export declare function logEntity(entity: Entity): void;
|
|
12
12
|
/** Helper function for logging an array of specific grid entities. */
|
|
13
|
-
export declare function logGridEntities(
|
|
13
|
+
export declare function logGridEntities(gridEntities: GridEntity[]): void;
|
|
14
14
|
/** Helper function for log information about a specific grid entity. */
|
|
15
|
-
export declare function logGridEntity(
|
|
15
|
+
export declare function logGridEntity(gridEntity: GridEntity): void;
|
|
16
16
|
/**
|
|
17
17
|
* Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
18
18
|
* use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
19
19
|
*/
|
|
20
|
-
export declare function logPtrHash(
|
|
20
|
+
export declare function logPtrHash(ptrHash: PtrHash): void;
|
|
21
21
|
/**
|
|
22
22
|
* Helper function to log information about the entity that corresponding to one or more pointer
|
|
23
23
|
* hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
24
24
|
*/
|
|
25
|
-
export declare function logPtrHashes(
|
|
25
|
+
export declare function logPtrHashes(ptrHashes: PtrHash[]): void;
|
|
26
26
|
//# sourceMappingURL=logEntities.d.ts.map
|
|
@@ -1 +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,
|
|
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,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CAuCN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,OAAO,EACrB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA6CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIpD;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG9C;AA2ED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAIhE;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAG1D;AA2DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAQjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAIvD"}
|
|
@@ -17,9 +17,9 @@ local getGridEntityID = ____gridEntities.getGridEntityID
|
|
|
17
17
|
local ____log = require("functions.log")
|
|
18
18
|
local log = ____log.log
|
|
19
19
|
--- Helper function to log information about a specific entity.
|
|
20
|
-
function ____exports.logEntity(entity)
|
|
20
|
+
function ____exports.logEntity(self, entity)
|
|
21
21
|
local msg = getEntityLogLine(nil, entity)
|
|
22
|
-
log(msg)
|
|
22
|
+
log(nil, msg)
|
|
23
23
|
end
|
|
24
24
|
function getEntityLogLine(self, entity, num)
|
|
25
25
|
local msg = num == nil and "" or tostring(num) .. ") "
|
|
@@ -81,9 +81,9 @@ function getEntityLogLine(self, entity, num)
|
|
|
81
81
|
return msg
|
|
82
82
|
end
|
|
83
83
|
--- Helper function for log information about a specific grid entity.
|
|
84
|
-
function ____exports.logGridEntity(gridEntity)
|
|
84
|
+
function ____exports.logGridEntity(self, gridEntity)
|
|
85
85
|
local msg = getGridEntityLogLine(nil, gridEntity)
|
|
86
|
-
log(msg)
|
|
86
|
+
log(nil, msg)
|
|
87
87
|
end
|
|
88
88
|
function getGridEntityLogLine(self, gridEntity, num)
|
|
89
89
|
local gridEntityDesc = gridEntity:GetSaveState()
|
|
@@ -142,7 +142,7 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
|
142
142
|
EffectVariant.TADPOLE
|
|
143
143
|
})
|
|
144
144
|
--- Helper function for printing out every entity (or filtered entity) in the current room.
|
|
145
|
-
function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
145
|
+
function ____exports.logAllEntities(self, includeBackgroundEffects, entityTypeFilter)
|
|
146
146
|
local msg = "Entities in the room"
|
|
147
147
|
if entityTypeFilter ~= nil then
|
|
148
148
|
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
@@ -171,10 +171,10 @@ function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
|
171
171
|
else
|
|
172
172
|
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
173
173
|
end
|
|
174
|
-
log(msg)
|
|
174
|
+
log(nil, msg)
|
|
175
175
|
end
|
|
176
176
|
--- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
177
|
-
function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
177
|
+
function ____exports.logAllGridEntities(self, includeWalls, gridEntityTypeFilter)
|
|
178
178
|
local msg = "Grid entities in the room"
|
|
179
179
|
if gridEntityTypeFilter ~= nil then
|
|
180
180
|
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
@@ -204,36 +204,39 @@ function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
|
204
204
|
else
|
|
205
205
|
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
206
206
|
end
|
|
207
|
-
log(msg)
|
|
207
|
+
log(nil, msg)
|
|
208
208
|
end
|
|
209
209
|
--- Helper function for logging an array of specific entities.
|
|
210
|
-
function ____exports.logEntities(entities)
|
|
210
|
+
function ____exports.logEntities(self, entities)
|
|
211
211
|
for ____, entity in ipairs(entities) do
|
|
212
|
-
____exports.logEntity(entity)
|
|
212
|
+
____exports.logEntity(nil, entity)
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
--- Helper function for logging an array of specific grid entities.
|
|
216
|
-
function ____exports.logGridEntities(gridEntities)
|
|
216
|
+
function ____exports.logGridEntities(self, gridEntities)
|
|
217
217
|
for ____, gridEntity in ipairs(gridEntities) do
|
|
218
|
-
____exports.logGridEntity(gridEntity)
|
|
218
|
+
____exports.logGridEntity(nil, gridEntity)
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
--- Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
222
222
|
-- use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
223
|
-
function ____exports.logPtrHash(ptrHash)
|
|
224
|
-
log(
|
|
223
|
+
function ____exports.logPtrHash(self, ptrHash)
|
|
224
|
+
log(
|
|
225
|
+
nil,
|
|
226
|
+
"PtrHash: " .. tostring(ptrHash)
|
|
227
|
+
)
|
|
225
228
|
local entity = getEntityFromPtrHash(nil, ptrHash)
|
|
226
229
|
if entity == nil then
|
|
227
|
-
log("No corresponding entity found.")
|
|
230
|
+
log(nil, "No corresponding entity found.")
|
|
228
231
|
else
|
|
229
|
-
____exports.logEntity(entity)
|
|
232
|
+
____exports.logEntity(nil, entity)
|
|
230
233
|
end
|
|
231
234
|
end
|
|
232
235
|
--- Helper function to log information about the entity that corresponding to one or more pointer
|
|
233
236
|
-- hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
234
|
-
function ____exports.logPtrHashes(ptrHashes)
|
|
237
|
+
function ____exports.logPtrHashes(self, ptrHashes)
|
|
235
238
|
for ____, ptrHash in ipairs(ptrHashes) do
|
|
236
|
-
____exports.logPtrHash(ptrHash)
|
|
239
|
+
____exports.logPtrHash(nil, ptrHash)
|
|
237
240
|
end
|
|
238
241
|
end
|
|
239
242
|
return ____exports
|