isaacscript-common 20.12.2 → 20.12.3
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/index.d.ts +44 -40
- package/dist/isaacscript-common.lua +262 -416
- package/dist/src/classes/ModFeature.lua +0 -4
- package/dist/src/classes/ModUpgradedBase.lua +3 -9
- package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
- package/dist/src/classes/features/callbackLogic/CustomRevive.lua +2 -5
- package/dist/src/classes/features/other/CustomStages.lua +4 -16
- package/dist/src/classes/features/other/CustomTrapdoors.lua +1 -4
- package/dist/src/classes/features/other/DeployJSONRoom.lua +8 -14
- package/dist/src/classes/features/other/Pause.lua +2 -2
- package/dist/src/classes/features/other/TaintedLazarusPlayers.lua +1 -1
- package/dist/src/classes/features/other/customStages/utils.lua +4 -16
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -4
- package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +2 -2
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.lua +4 -7
- package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +2 -2
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.lua +1 -1
- package/dist/src/functions/benchmark.lua +2 -8
- package/dist/src/functions/debugFunctions.d.ts +2 -2
- package/dist/src/functions/debugFunctions.d.ts.map +1 -1
- package/dist/src/functions/debugFunctions.lua +4 -4
- package/dist/src/functions/deepCopy.lua +7 -7
- package/dist/src/functions/deepCopyTests.lua +1 -1
- package/dist/src/functions/globals.lua +3 -6
- package/dist/src/functions/hex.lua +4 -7
- package/dist/src/functions/jsonHelpers.lua +1 -1
- package/dist/src/functions/jsonRoom.lua +4 -16
- package/dist/src/functions/log.d.ts +8 -4
- package/dist/src/functions/log.d.ts.map +1 -1
- package/dist/src/functions/log.lua +18 -5
- package/dist/src/functions/logEntities.d.ts +8 -8
- package/dist/src/functions/logEntities.d.ts.map +1 -1
- package/dist/src/functions/logEntities.lua +24 -27
- package/dist/src/functions/logMisc.d.ts +26 -26
- package/dist/src/functions/logMisc.d.ts.map +1 -1
- package/dist/src/functions/logMisc.lua +114 -226
- package/dist/src/functions/merge.lua +6 -6
- package/dist/src/functions/run.lua +2 -5
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +20 -1
- package/dist/src/lib/jsonLua.lua +16 -7
- package/dist/src/patchErrorFunctions.lua +1 -1
- package/package.json +1 -1
- package/src/classes/ModFeature.ts +0 -6
- package/src/classes/features/other/saveDataManager/saveToDisk.ts +3 -4
- package/src/functions/debugFunctions.ts +2 -2
- package/src/functions/deepCopy.ts +2 -0
- package/src/functions/log.ts +15 -4
- package/src/functions/logEntities.ts +14 -8
- package/src/functions/logMisc.ts +56 -39
- package/src/functions/utils.ts +30 -0
- package/src/lib/jsonLua.lua +16 -7
|
@@ -64,84 +64,72 @@ local isUserdata = ____types.isUserdata
|
|
|
64
64
|
local ____vector = require("src.functions.vector")
|
|
65
65
|
local vectorToString = ____vector.vectorToString
|
|
66
66
|
--- Helper function for printing out every flag that is turned on. Useful when debugging.
|
|
67
|
-
function ____exports.logFlags(
|
|
67
|
+
function ____exports.logFlags(flags, flagEnum, description)
|
|
68
68
|
if description == nil then
|
|
69
69
|
description = ""
|
|
70
70
|
end
|
|
71
71
|
if description ~= "" then
|
|
72
72
|
description = "flag"
|
|
73
73
|
end
|
|
74
|
-
log(
|
|
75
|
-
nil,
|
|
76
|
-
(("Logging " .. description) .. " values for: ") .. tostring(flags)
|
|
77
|
-
)
|
|
74
|
+
log((("Logging " .. description) .. " values for: ") .. tostring(flags))
|
|
78
75
|
local hasNoFlags = true
|
|
79
76
|
for ____, ____value in ipairs(getEnumEntries(nil, flagEnum)) do
|
|
80
77
|
local key = ____value[1]
|
|
81
78
|
local value = ____value[2]
|
|
82
79
|
if hasFlag(nil, flags, value) then
|
|
83
|
-
log(
|
|
84
|
-
nil,
|
|
85
|
-
(((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")"
|
|
86
|
-
)
|
|
80
|
+
log((((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")")
|
|
87
81
|
hasNoFlags = false
|
|
88
82
|
end
|
|
89
83
|
end
|
|
90
84
|
if hasNoFlags then
|
|
91
|
-
log(
|
|
85
|
+
log(" n/a (no flags)")
|
|
92
86
|
end
|
|
93
87
|
end
|
|
94
88
|
--- Helper function to enumerate all of the values in an array.
|
|
95
|
-
function ____exports.logArray(
|
|
89
|
+
function ____exports.logArray(array)
|
|
96
90
|
if not isArray(nil, array, false) then
|
|
97
|
-
log(
|
|
91
|
+
log("Tried to log an array, but the given object was not an array.")
|
|
98
92
|
return
|
|
99
93
|
end
|
|
100
94
|
local arrayString = arrayToString(nil, array)
|
|
101
|
-
log(
|
|
95
|
+
log("Array: " .. arrayString)
|
|
102
96
|
end
|
|
103
|
-
function ____exports.logCollectibleTypes(
|
|
104
|
-
log(
|
|
97
|
+
function ____exports.logCollectibleTypes(collectibleTypes)
|
|
98
|
+
log("Collectibles:")
|
|
105
99
|
local i = 1
|
|
106
100
|
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
107
101
|
local collectibleName = getCollectibleName(nil, collectibleType)
|
|
108
|
-
log(
|
|
109
|
-
nil,
|
|
110
|
-
((((tostring(i) .. ") ") .. collectibleName) .. " (") .. tostring(collectibleType)) .. ")"
|
|
111
|
-
)
|
|
102
|
+
log(((((tostring(i) .. ") ") .. collectibleName) .. " (") .. tostring(collectibleType)) .. ")")
|
|
112
103
|
i = i + 1
|
|
113
104
|
end
|
|
114
105
|
end
|
|
115
|
-
function ____exports.logColor(
|
|
116
|
-
log(
|
|
117
|
-
nil,
|
|
118
|
-
(((((((((((("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)
|
|
119
|
-
)
|
|
106
|
+
function ____exports.logColor(color)
|
|
107
|
+
log((((((((((((("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))
|
|
120
108
|
end
|
|
121
109
|
--- Helper function for printing out every damage flag that is turned on. Useful when debugging.
|
|
122
|
-
function ____exports.logDamageFlags(
|
|
123
|
-
____exports.logFlags(
|
|
110
|
+
function ____exports.logDamageFlags(flags)
|
|
111
|
+
____exports.logFlags(flags, DamageFlag, "damage")
|
|
124
112
|
end
|
|
125
113
|
--- Helper function for printing out every entity flag that is turned on. Useful when debugging.
|
|
126
|
-
function ____exports.logEntityFlags(
|
|
127
|
-
____exports.logFlags(
|
|
114
|
+
function ____exports.logEntityFlags(flags)
|
|
115
|
+
____exports.logFlags(flags, EntityFlag, "entity")
|
|
128
116
|
end
|
|
129
|
-
function ____exports.logEntityID(
|
|
117
|
+
function ____exports.logEntityID(entity)
|
|
130
118
|
local entityID = getEntityID(nil, entity)
|
|
131
|
-
log(
|
|
119
|
+
log("Entity: " .. entityID)
|
|
132
120
|
end
|
|
133
121
|
--- Helper function to log an error message and also print it to the console for better visibility.
|
|
134
122
|
--
|
|
135
123
|
-- This is useful in situations where using the `error` function would be dangerous (since it
|
|
136
124
|
-- prevents all of the subsequent code in the callback from running).
|
|
137
|
-
function ____exports.logError(
|
|
125
|
+
function ____exports.logError(msg)
|
|
138
126
|
local errorMsg = "Error: " .. msg
|
|
139
|
-
log(
|
|
127
|
+
log(errorMsg)
|
|
140
128
|
print(errorMsg)
|
|
141
129
|
end
|
|
142
130
|
--- Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
143
|
-
function ____exports.logGameStateFlags(
|
|
144
|
-
log(
|
|
131
|
+
function ____exports.logGameStateFlags()
|
|
132
|
+
log("Logging game state flags:")
|
|
145
133
|
local gameStateFlagEntries = getEnumEntries(nil, GameStateFlag)
|
|
146
134
|
local hasNoFlags = true
|
|
147
135
|
for ____, ____value in ipairs(gameStateFlagEntries) do
|
|
@@ -149,70 +137,55 @@ function ____exports.logGameStateFlags(self)
|
|
|
149
137
|
local gameStateFlag = ____value[2]
|
|
150
138
|
local flagValue = game:GetStateFlag(gameStateFlag)
|
|
151
139
|
if flagValue then
|
|
152
|
-
log(
|
|
153
|
-
nil,
|
|
154
|
-
(((" Has flag: " .. key) .. " (") .. tostring(gameStateFlag)) .. ")"
|
|
155
|
-
)
|
|
140
|
+
log((((" Has flag: " .. key) .. " (") .. tostring(gameStateFlag)) .. ")")
|
|
156
141
|
hasNoFlags = false
|
|
157
142
|
end
|
|
158
143
|
end
|
|
159
144
|
if hasNoFlags then
|
|
160
|
-
log(
|
|
145
|
+
log(" n/a (no flags)")
|
|
161
146
|
end
|
|
162
147
|
end
|
|
163
|
-
function ____exports.logKColor(
|
|
164
|
-
log(
|
|
165
|
-
nil,
|
|
166
|
-
(((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha)
|
|
167
|
-
)
|
|
148
|
+
function ____exports.logKColor(kColor)
|
|
149
|
+
log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|
|
168
150
|
end
|
|
169
151
|
--- Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
170
|
-
function ____exports.logLevelStateFlags(
|
|
152
|
+
function ____exports.logLevelStateFlags()
|
|
171
153
|
local level = game:GetLevel()
|
|
172
154
|
local levelStateFlagEntries = getEnumEntries(nil, LevelStateFlag)
|
|
173
|
-
log(
|
|
155
|
+
log("Logging level state flags:")
|
|
174
156
|
local hasNoFlags = true
|
|
175
157
|
for ____, ____value in ipairs(levelStateFlagEntries) do
|
|
176
158
|
local key = ____value[1]
|
|
177
159
|
local levelStateFlag = ____value[2]
|
|
178
160
|
local flagValue = level:GetStateFlag(levelStateFlag)
|
|
179
161
|
if flagValue then
|
|
180
|
-
log(
|
|
181
|
-
nil,
|
|
182
|
-
(((" Has flag: " .. key) .. " (") .. tostring(levelStateFlag)) .. ")"
|
|
183
|
-
)
|
|
162
|
+
log((((" Has flag: " .. key) .. " (") .. tostring(levelStateFlag)) .. ")")
|
|
184
163
|
hasNoFlags = false
|
|
185
164
|
end
|
|
186
165
|
end
|
|
187
166
|
if hasNoFlags then
|
|
188
|
-
log(
|
|
167
|
+
log(" n/a (no flags)")
|
|
189
168
|
end
|
|
190
169
|
end
|
|
191
|
-
function ____exports.logMap(
|
|
170
|
+
function ____exports.logMap(map)
|
|
192
171
|
if not isTSTLMap(nil, map) and not isDefaultMap(nil, map) then
|
|
193
|
-
log(
|
|
172
|
+
log("Tried to log a TSTL map, but the given object was not a TSTL map.")
|
|
194
173
|
return
|
|
195
174
|
end
|
|
196
|
-
log(
|
|
175
|
+
log("Printing out a TSTL map:")
|
|
197
176
|
local mapKeys = {__TS__Spread(map:keys())}
|
|
198
177
|
__TS__ArraySort(mapKeys)
|
|
199
178
|
for ____, key in ipairs(mapKeys) do
|
|
200
179
|
local value = map:get(key)
|
|
201
|
-
log(
|
|
202
|
-
nil,
|
|
203
|
-
((" " .. tostring(key)) .. " --> ") .. tostring(value)
|
|
204
|
-
)
|
|
180
|
+
log(((" " .. tostring(key)) .. " --> ") .. tostring(value))
|
|
205
181
|
end
|
|
206
|
-
log(
|
|
207
|
-
nil,
|
|
208
|
-
" The size of the map was: " .. tostring(map.size)
|
|
209
|
-
)
|
|
182
|
+
log(" The size of the map was: " .. tostring(map.size))
|
|
210
183
|
end
|
|
211
|
-
function ____exports.logPlayerEffects(
|
|
184
|
+
function ____exports.logPlayerEffects(player)
|
|
212
185
|
local effects = getEffectsList(nil, player)
|
|
213
|
-
log(
|
|
186
|
+
log("Logging player effects:")
|
|
214
187
|
if #effects == 0 then
|
|
215
|
-
log(
|
|
188
|
+
log(" n/a (no effects)")
|
|
216
189
|
return
|
|
217
190
|
end
|
|
218
191
|
__TS__ArrayForEach(
|
|
@@ -230,160 +203,97 @@ function ____exports.logPlayerEffects(self, player)
|
|
|
230
203
|
else
|
|
231
204
|
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
232
205
|
end
|
|
233
|
-
log(
|
|
234
|
-
nil,
|
|
235
|
-
(((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")"
|
|
236
|
-
)
|
|
206
|
+
log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
237
207
|
end
|
|
238
208
|
)
|
|
239
209
|
end
|
|
240
|
-
function ____exports.logPlayerHealth(
|
|
210
|
+
function ____exports.logPlayerHealth(player)
|
|
241
211
|
local playerName = getPlayerName(nil, player)
|
|
242
212
|
local playerHealth = getPlayerHealth(nil, player)
|
|
243
|
-
log(
|
|
244
|
-
log(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
)
|
|
248
|
-
log(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)
|
|
252
|
-
log(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
256
|
-
log(
|
|
257
|
-
nil,
|
|
258
|
-
" Soul hearts: " .. tostring(playerHealth.soulHearts)
|
|
259
|
-
)
|
|
260
|
-
log(
|
|
261
|
-
nil,
|
|
262
|
-
" Bone hearts: " .. tostring(playerHealth.boneHearts)
|
|
263
|
-
)
|
|
264
|
-
log(
|
|
265
|
-
nil,
|
|
266
|
-
" Golden hearts: " .. tostring(playerHealth.goldenHearts)
|
|
267
|
-
)
|
|
268
|
-
log(
|
|
269
|
-
nil,
|
|
270
|
-
" Rotten hearts: " .. tostring(playerHealth.rottenHearts)
|
|
271
|
-
)
|
|
272
|
-
log(
|
|
273
|
-
nil,
|
|
274
|
-
" Broken hearts: " .. tostring(playerHealth.brokenHearts)
|
|
275
|
-
)
|
|
276
|
-
log(
|
|
277
|
-
nil,
|
|
278
|
-
" Soul charges: " .. tostring(playerHealth.soulCharges)
|
|
279
|
-
)
|
|
280
|
-
log(
|
|
281
|
-
nil,
|
|
282
|
-
" Blood charges: " .. tostring(playerHealth.bloodCharges)
|
|
283
|
-
)
|
|
284
|
-
log(nil, " Soul heart types: [")
|
|
213
|
+
log(("Player health for " .. playerName) .. ":")
|
|
214
|
+
log(" Max hearts: " .. tostring(playerHealth.maxHearts))
|
|
215
|
+
log(" Hearts: " .. tostring(playerHealth.hearts))
|
|
216
|
+
log(" Eternal hearts: " .. tostring(playerHealth.eternalHearts))
|
|
217
|
+
log(" Soul hearts: " .. tostring(playerHealth.soulHearts))
|
|
218
|
+
log(" Bone hearts: " .. tostring(playerHealth.boneHearts))
|
|
219
|
+
log(" Golden hearts: " .. tostring(playerHealth.goldenHearts))
|
|
220
|
+
log(" Rotten hearts: " .. tostring(playerHealth.rottenHearts))
|
|
221
|
+
log(" Broken hearts: " .. tostring(playerHealth.brokenHearts))
|
|
222
|
+
log(" Soul charges: " .. tostring(playerHealth.soulCharges))
|
|
223
|
+
log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
|
|
224
|
+
log(" Soul heart types: [")
|
|
285
225
|
for ____, soulHeartType in ipairs(playerHealth.soulHeartTypes) do
|
|
286
|
-
log(
|
|
226
|
+
log(" HeartSubType." .. HeartSubType[soulHeartType])
|
|
287
227
|
end
|
|
288
|
-
log(
|
|
228
|
+
log(" ]")
|
|
289
229
|
end
|
|
290
230
|
--- Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
291
|
-
function ____exports.logProjectileFlags(
|
|
292
|
-
____exports.logFlags(
|
|
231
|
+
function ____exports.logProjectileFlags(flags)
|
|
232
|
+
____exports.logFlags(flags, ProjectileFlag, "projectile")
|
|
293
233
|
end
|
|
294
234
|
--- Helper function for logging information about the current room.
|
|
295
|
-
function ____exports.logRoom(
|
|
235
|
+
function ____exports.logRoom()
|
|
296
236
|
local room = game:GetRoom()
|
|
297
237
|
local bossID = room:GetBossID()
|
|
298
238
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
299
239
|
local roomListIndex = getRoomListIndex(nil)
|
|
300
240
|
local roomData = getRoomData(nil)
|
|
301
|
-
log(
|
|
241
|
+
log("Current room information:")
|
|
302
242
|
if roomData == nil then
|
|
303
|
-
log(
|
|
243
|
+
log("- Room data is undefined.")
|
|
304
244
|
else
|
|
305
|
-
log(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
)
|
|
309
|
-
log(
|
|
310
|
-
nil,
|
|
311
|
-
(((("- Type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype)
|
|
312
|
-
)
|
|
313
|
-
log(nil, "- Name: " .. roomData.Name)
|
|
245
|
+
log("- Room stage ID: " .. tostring(roomData.StageID))
|
|
246
|
+
log((((("- Type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
|
|
247
|
+
log("- Name: " .. roomData.Name)
|
|
314
248
|
end
|
|
315
249
|
local roomGridIndexName = GridRoom[roomGridIndex]
|
|
316
250
|
if roomGridIndexName == nil then
|
|
317
|
-
log(
|
|
318
|
-
nil,
|
|
319
|
-
"- Grid index: " .. tostring(roomGridIndex)
|
|
320
|
-
)
|
|
251
|
+
log("- Grid index: " .. tostring(roomGridIndex))
|
|
321
252
|
else
|
|
322
|
-
log(
|
|
323
|
-
nil,
|
|
324
|
-
((("- Grid index: GridRoom." .. roomGridIndexName) .. " (") .. tostring(roomGridIndex)) .. ")"
|
|
325
|
-
)
|
|
253
|
+
log(((("- Grid index: GridRoom." .. roomGridIndexName) .. " (") .. tostring(roomGridIndex)) .. ")")
|
|
326
254
|
end
|
|
327
|
-
log(
|
|
328
|
-
|
|
329
|
-
"- List index: " .. tostring(roomListIndex)
|
|
330
|
-
)
|
|
331
|
-
log(
|
|
332
|
-
nil,
|
|
333
|
-
"- Boss ID: " .. tostring(bossID)
|
|
334
|
-
)
|
|
255
|
+
log("- List index: " .. tostring(roomListIndex))
|
|
256
|
+
log("- Boss ID: " .. tostring(bossID))
|
|
335
257
|
end
|
|
336
258
|
--- Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
337
259
|
-- particular run.
|
|
338
|
-
function ____exports.logSeedEffects(
|
|
260
|
+
function ____exports.logSeedEffects()
|
|
339
261
|
local seeds = game:GetSeeds()
|
|
340
262
|
local seedEffectEntries = getEnumEntries(nil, SeedEffect)
|
|
341
|
-
log(
|
|
263
|
+
log("Logging seed effects:")
|
|
342
264
|
local hasNoSeedEffects = true
|
|
343
265
|
for ____, ____value in ipairs(seedEffectEntries) do
|
|
344
266
|
local key = ____value[1]
|
|
345
267
|
local seedEffect = ____value[2]
|
|
346
268
|
if seeds:HasSeedEffect(seedEffect) then
|
|
347
|
-
log(
|
|
348
|
-
nil,
|
|
349
|
-
(((" " .. key) .. " (") .. tostring(seedEffect)) .. ")"
|
|
350
|
-
)
|
|
269
|
+
log((((" " .. key) .. " (") .. tostring(seedEffect)) .. ")")
|
|
351
270
|
hasNoSeedEffects = false
|
|
352
271
|
end
|
|
353
272
|
end
|
|
354
273
|
if hasNoSeedEffects then
|
|
355
|
-
log(
|
|
274
|
+
log(" n/a (no seed effects)")
|
|
356
275
|
end
|
|
357
276
|
end
|
|
358
|
-
function ____exports.logSet(
|
|
277
|
+
function ____exports.logSet(set)
|
|
359
278
|
if not isTSTLSet(nil, set) then
|
|
360
|
-
log(
|
|
279
|
+
log("Tried to log a TSTL set, but the given object was not a TSTL set.")
|
|
361
280
|
return
|
|
362
281
|
end
|
|
363
|
-
log(
|
|
282
|
+
log("Printing out a TSTL set:")
|
|
364
283
|
local setValues = getSortedSetValues(nil, set)
|
|
365
284
|
for ____, value in ipairs(setValues) do
|
|
366
|
-
log(
|
|
367
|
-
nil,
|
|
368
|
-
" Value: " .. tostring(value)
|
|
369
|
-
)
|
|
285
|
+
log(" Value: " .. tostring(value))
|
|
370
286
|
end
|
|
371
|
-
log(
|
|
372
|
-
nil,
|
|
373
|
-
" The size of the set was: " .. tostring(set.size)
|
|
374
|
-
)
|
|
287
|
+
log(" The size of the set was: " .. tostring(set.size))
|
|
375
288
|
end
|
|
376
289
|
--- Helper function for logging every sound effect that is currently playing.
|
|
377
|
-
function ____exports.logSounds(
|
|
290
|
+
function ____exports.logSounds()
|
|
378
291
|
local soundEffects = getEnumEntries(nil, SoundEffect)
|
|
379
292
|
for ____, ____value in ipairs(soundEffects) do
|
|
380
293
|
local key = ____value[1]
|
|
381
294
|
local soundEffect = ____value[2]
|
|
382
295
|
if sfxManager:IsPlaying(soundEffect) then
|
|
383
|
-
log(
|
|
384
|
-
nil,
|
|
385
|
-
((("Currently playing sound effect: " .. key) .. " (") .. tostring(soundEffect)) .. ")"
|
|
386
|
-
)
|
|
296
|
+
log(((("Currently playing sound effect: " .. key) .. " (") .. tostring(soundEffect)) .. ")")
|
|
387
297
|
end
|
|
388
298
|
end
|
|
389
299
|
end
|
|
@@ -395,12 +305,12 @@ end
|
|
|
395
305
|
--
|
|
396
306
|
-- In order to prevent infinite recursion, this function will not log a sub-table when there are 10
|
|
397
307
|
-- or more parent tables.
|
|
398
|
-
function ____exports.logTable(
|
|
308
|
+
function ____exports.logTable(luaTable, parentTables)
|
|
399
309
|
if parentTables == nil then
|
|
400
310
|
parentTables = 0
|
|
401
311
|
end
|
|
402
312
|
if parentTables == 0 then
|
|
403
|
-
log(
|
|
313
|
+
log("Printing out a Lua table:", false)
|
|
404
314
|
elseif parentTables > 10 then
|
|
405
315
|
return
|
|
406
316
|
end
|
|
@@ -410,12 +320,10 @@ function ____exports.logTable(self, luaTable, parentTables)
|
|
|
410
320
|
math.floor(numSpaces)
|
|
411
321
|
)
|
|
412
322
|
if not isTable(nil, luaTable) then
|
|
413
|
-
(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
)
|
|
418
|
-
end)(nil)
|
|
323
|
+
log(
|
|
324
|
+
((indentation .. "n/a (encountered a variable of type \"") .. __TS__TypeOf(luaTable)) .. "\" instead of a table)",
|
|
325
|
+
false
|
|
326
|
+
)
|
|
419
327
|
return
|
|
420
328
|
end
|
|
421
329
|
local numElements = 0
|
|
@@ -424,30 +332,28 @@ function ____exports.logTable(self, luaTable, parentTables)
|
|
|
424
332
|
luaTable,
|
|
425
333
|
function(____, key, value)
|
|
426
334
|
log(
|
|
427
|
-
|
|
428
|
-
|
|
335
|
+
((indentation .. tostring(key)) .. " --> ") .. tostring(value),
|
|
336
|
+
false
|
|
429
337
|
)
|
|
430
338
|
if isTable(nil, value) then
|
|
431
339
|
if key == "__class" then
|
|
432
|
-
log(
|
|
340
|
+
log(indentation .. " (skipping enumerating this key to avoid infinite recursion)", false)
|
|
433
341
|
else
|
|
434
|
-
____exports.logTable(
|
|
342
|
+
____exports.logTable(value, parentTables + 1)
|
|
435
343
|
end
|
|
436
344
|
end
|
|
437
345
|
numElements = numElements + 1
|
|
438
346
|
end
|
|
439
|
-
)
|
|
440
|
-
(
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
)
|
|
445
|
-
end)(nil)
|
|
347
|
+
)
|
|
348
|
+
log(
|
|
349
|
+
(indentation .. "The size of the table was: ") .. tostring(numElements),
|
|
350
|
+
false
|
|
351
|
+
)
|
|
446
352
|
end
|
|
447
353
|
--- Helper function to print out the differences between the entries of two tables. Note that this
|
|
448
354
|
-- will only do a shallow comparison.
|
|
449
|
-
function ____exports.logTableDifferences(
|
|
450
|
-
log(
|
|
355
|
+
function ____exports.logTableDifferences(table1, table2)
|
|
356
|
+
log("Comparing two Lua tables:")
|
|
451
357
|
local table1Keys = __TS__ObjectKeys(table1)
|
|
452
358
|
local table1KeysSet = __TS__New(Set, table1Keys)
|
|
453
359
|
local table2Keys = __TS__ObjectKeys(table2)
|
|
@@ -457,23 +363,14 @@ function ____exports.logTableDifferences(self, table1, table2)
|
|
|
457
363
|
__TS__ArraySort(keys)
|
|
458
364
|
for ____, key in ipairs(keys) do
|
|
459
365
|
if not table1KeysSet:has(key) then
|
|
460
|
-
log(
|
|
461
|
-
nil,
|
|
462
|
-
" Table 1 is missing key: " .. tostring(key)
|
|
463
|
-
)
|
|
366
|
+
log(" Table 1 is missing key: " .. tostring(key))
|
|
464
367
|
elseif not table2KeysSet:has(key) then
|
|
465
|
-
log(
|
|
466
|
-
nil,
|
|
467
|
-
" Table 2 is missing key: " .. tostring(key)
|
|
468
|
-
)
|
|
368
|
+
log(" Table 2 is missing key: " .. tostring(key))
|
|
469
369
|
else
|
|
470
370
|
local value1 = table1[key]
|
|
471
371
|
local value2 = table2[key]
|
|
472
372
|
if value1 ~= value2 then
|
|
473
|
-
log(
|
|
474
|
-
nil,
|
|
475
|
-
(((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\""
|
|
476
|
-
)
|
|
373
|
+
log((((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\"")
|
|
477
374
|
end
|
|
478
375
|
end
|
|
479
376
|
end
|
|
@@ -482,13 +379,10 @@ end
|
|
|
482
379
|
-- top-most table will be logged.
|
|
483
380
|
--
|
|
484
381
|
-- This function is useful for tables that have recursive references.
|
|
485
|
-
function ____exports.logTableKeys(
|
|
486
|
-
log(
|
|
382
|
+
function ____exports.logTableKeys(luaTable)
|
|
383
|
+
log("Printing out the keys of a Lua table:")
|
|
487
384
|
if not isTable(nil, luaTable) then
|
|
488
|
-
log(
|
|
489
|
-
nil,
|
|
490
|
-
(" n/a (encountered a variable of type \"" .. __TS__TypeOf(luaTable)) .. "\" instead of a table)"
|
|
491
|
-
)
|
|
385
|
+
log((" n/a (encountered a variable of type \"" .. __TS__TypeOf(luaTable)) .. "\" instead of a table)")
|
|
492
386
|
return
|
|
493
387
|
end
|
|
494
388
|
local numElements = 0
|
|
@@ -496,51 +390,45 @@ function ____exports.logTableKeys(self, luaTable)
|
|
|
496
390
|
nil,
|
|
497
391
|
luaTable,
|
|
498
392
|
function(____, key)
|
|
499
|
-
log(
|
|
500
|
-
nil,
|
|
501
|
-
tostring(key)
|
|
502
|
-
)
|
|
393
|
+
log(tostring(key))
|
|
503
394
|
numElements = numElements + 1
|
|
504
395
|
end
|
|
505
396
|
)
|
|
506
|
-
log(
|
|
507
|
-
nil,
|
|
508
|
-
" The size of the table was: " .. tostring(numElements)
|
|
509
|
-
)
|
|
397
|
+
log(" The size of the table was: " .. tostring(numElements))
|
|
510
398
|
end
|
|
511
399
|
--- Helper function for printing out every tear flag that is turned on. Useful when debugging.
|
|
512
|
-
function ____exports.logTearFlags(
|
|
513
|
-
____exports.logFlags(
|
|
400
|
+
function ____exports.logTearFlags(flags)
|
|
401
|
+
____exports.logFlags(flags, TearFlag, "tear")
|
|
514
402
|
end
|
|
515
403
|
--- Helper function for printing out every use flag that is turned on. Useful when debugging.
|
|
516
|
-
function ____exports.logUseFlags(
|
|
517
|
-
____exports.logFlags(
|
|
404
|
+
function ____exports.logUseFlags(flags)
|
|
405
|
+
____exports.logFlags(flags, UseFlag, "use")
|
|
518
406
|
end
|
|
519
407
|
--- Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
520
408
|
-- the Isaac API).
|
|
521
|
-
function ____exports.logUserdata(
|
|
409
|
+
function ____exports.logUserdata(userdata)
|
|
522
410
|
if not isUserdata(nil, userdata) then
|
|
523
|
-
log(
|
|
411
|
+
log("Userdata: [not userdata]")
|
|
524
412
|
return
|
|
525
413
|
end
|
|
526
414
|
local metatable = getmetatable(userdata)
|
|
527
415
|
if metatable == nil then
|
|
528
|
-
log(
|
|
416
|
+
log("Userdata: [no metatable]")
|
|
529
417
|
return
|
|
530
418
|
end
|
|
531
419
|
local classType = getIsaacAPIClassName(nil, userdata)
|
|
532
420
|
if classType == nil then
|
|
533
|
-
log(
|
|
421
|
+
log("Userdata: [no class type]")
|
|
534
422
|
else
|
|
535
|
-
log(
|
|
423
|
+
log("Userdata: " .. classType)
|
|
536
424
|
end
|
|
537
|
-
____exports.logTable(
|
|
425
|
+
____exports.logTable(metatable)
|
|
538
426
|
end
|
|
539
|
-
function ____exports.logVector(
|
|
427
|
+
function ____exports.logVector(vector, round)
|
|
540
428
|
if round == nil then
|
|
541
429
|
round = false
|
|
542
430
|
end
|
|
543
431
|
local vectorString = vectorToString(nil, vector, round)
|
|
544
|
-
log(
|
|
432
|
+
log("Vector: " .. vectorString)
|
|
545
433
|
end
|
|
546
434
|
return ____exports
|
|
@@ -69,7 +69,7 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription, clas
|
|
|
69
69
|
classConstructors = {}
|
|
70
70
|
end
|
|
71
71
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
72
|
-
log(
|
|
72
|
+
log("merge is traversing: " .. traversalDescription)
|
|
73
73
|
end
|
|
74
74
|
if not isTable(nil, oldObject) then
|
|
75
75
|
error("The first argument given to the merge function is not a table.")
|
|
@@ -107,7 +107,7 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription, clas
|
|
|
107
107
|
end
|
|
108
108
|
function mergeSerializedArray(self, oldArray, newArray, traversalDescription, classConstructors)
|
|
109
109
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
110
|
-
log(
|
|
110
|
+
log("merge encountered an array: " .. traversalDescription)
|
|
111
111
|
end
|
|
112
112
|
clearTable(nil, oldArray)
|
|
113
113
|
iterateTableInOrder(
|
|
@@ -128,7 +128,7 @@ function mergeSerializedArray(self, oldArray, newArray, traversalDescription, cl
|
|
|
128
128
|
end
|
|
129
129
|
function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescription, classConstructors)
|
|
130
130
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
131
|
-
log(
|
|
131
|
+
log("merge encountered a TSTL object: " .. traversalDescription)
|
|
132
132
|
end
|
|
133
133
|
oldObject:clear()
|
|
134
134
|
local convertStringKeysToNumbers = newTable[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] ~= nil
|
|
@@ -165,7 +165,7 @@ function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescripti
|
|
|
165
165
|
end
|
|
166
166
|
function mergeSerializedTable(self, oldTable, newTable, traversalDescription, classConstructors)
|
|
167
167
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
168
|
-
log(
|
|
168
|
+
log("merge encountered a Lua table: " .. traversalDescription)
|
|
169
169
|
end
|
|
170
170
|
iterateTableInOrder(
|
|
171
171
|
nil,
|
|
@@ -173,14 +173,14 @@ function mergeSerializedTable(self, oldTable, newTable, traversalDescription, cl
|
|
|
173
173
|
function(____, key, value)
|
|
174
174
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
175
175
|
local valueToPrint = value == "" and "(empty string)" or tostring(value)
|
|
176
|
-
log(
|
|
176
|
+
log((("merge is merging: " .. traversalDescription) .. " --> ") .. valueToPrint)
|
|
177
177
|
end
|
|
178
178
|
if isSerializationBrand(nil, key) then
|
|
179
179
|
return
|
|
180
180
|
end
|
|
181
181
|
if isSerializedIsaacAPIClass(nil, value) then
|
|
182
182
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
183
|
-
log(
|
|
183
|
+
log("merge found a serialized Isaac API class.")
|
|
184
184
|
end
|
|
185
185
|
local deserializedObject = deserializeIsaacAPIClass(nil, value)
|
|
186
186
|
oldTable[key] = deserializedObject
|
|
@@ -44,7 +44,7 @@ end
|
|
|
44
44
|
function ____exports.restart(self, character)
|
|
45
45
|
if character == nil then
|
|
46
46
|
local command = "restart"
|
|
47
|
-
log(
|
|
47
|
+
log("Restarting the run with a console command of: " .. command)
|
|
48
48
|
Isaac.ExecuteCommand(command)
|
|
49
49
|
return
|
|
50
50
|
end
|
|
@@ -52,10 +52,7 @@ function ____exports.restart(self, character)
|
|
|
52
52
|
error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
|
|
53
53
|
end
|
|
54
54
|
local command = "restart " .. tostring(character)
|
|
55
|
-
log(
|
|
56
|
-
nil,
|
|
57
|
-
(((("Restarting the run as PlayerType." .. PlayerType[character]) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command
|
|
58
|
-
)
|
|
55
|
+
log((((("Restarting the run as PlayerType." .. PlayerType[character]) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
|
|
59
56
|
Isaac.ExecuteCommand(command)
|
|
60
57
|
end
|
|
61
58
|
--- Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAWlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAOlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG7C;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAWlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAOlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG7C;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAmD1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
|