isaacscript-common 1.2.277 → 1.2.278
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/functions/log.lua +61 -49
- package/package.json +1 -1
package/dist/functions/log.lua
CHANGED
|
@@ -82,14 +82,14 @@ function ____exports.logFlags(flags, flagEnum, description)
|
|
|
82
82
|
for key, value in pairs(flagEnum) do
|
|
83
83
|
do
|
|
84
84
|
if type(value) ~= "number" then
|
|
85
|
-
goto
|
|
85
|
+
goto __continue43
|
|
86
86
|
end
|
|
87
87
|
if hasFlag(nil, flags, value) then
|
|
88
88
|
____exports.log((((" Has flag: " .. tostring(key)) .. " (") .. tostring(value)) .. ")")
|
|
89
89
|
hasNoFlags = false
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
|
-
::
|
|
92
|
+
::__continue43::
|
|
93
93
|
end
|
|
94
94
|
if hasNoFlags then
|
|
95
95
|
____exports.log(" n/a (no flags)")
|
|
@@ -143,15 +143,13 @@ function ____exports.logEffects(player)
|
|
|
143
143
|
)
|
|
144
144
|
end
|
|
145
145
|
function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
146
|
-
local
|
|
146
|
+
local msg = "Entities in the room"
|
|
147
147
|
if entityTypeFilter ~= nil then
|
|
148
|
-
|
|
148
|
+
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
149
|
+
elseif not includeBackgroundEffects then
|
|
150
|
+
msg = msg .. " (not including background effects)"
|
|
149
151
|
end
|
|
150
|
-
|
|
151
|
-
headerMsg = headerMsg .. " (not excluding background effects)"
|
|
152
|
-
end
|
|
153
|
-
headerMsg = headerMsg .. ":"
|
|
154
|
-
____exports.log(headerMsg)
|
|
152
|
+
msg = msg .. ":\n"
|
|
155
153
|
local entities = getEntities(nil)
|
|
156
154
|
local numMatchedEntities = 0
|
|
157
155
|
__TS__ArrayForEach(
|
|
@@ -164,62 +162,70 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
|
164
162
|
return
|
|
165
163
|
end
|
|
166
164
|
local entityID = getEntityID(nil, entity)
|
|
167
|
-
|
|
165
|
+
msg = msg .. (tostring(i + 1) .. ") ") .. entityID
|
|
168
166
|
local bomb = entity:ToBomb()
|
|
169
167
|
if bomb ~= nil then
|
|
170
|
-
|
|
168
|
+
msg = msg .. " (bomb)"
|
|
171
169
|
end
|
|
172
170
|
local effect = entity:ToEffect()
|
|
173
171
|
if effect ~= nil then
|
|
174
|
-
|
|
172
|
+
msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
|
|
175
173
|
end
|
|
176
174
|
local familiar = entity:ToFamiliar()
|
|
177
175
|
if familiar ~= nil then
|
|
178
|
-
|
|
176
|
+
msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
|
|
179
177
|
end
|
|
180
178
|
local knife = entity:ToKnife()
|
|
181
179
|
if knife ~= nil then
|
|
182
|
-
|
|
180
|
+
msg = msg .. " (knife)"
|
|
183
181
|
end
|
|
184
182
|
local laser = entity:ToLaser()
|
|
185
183
|
if laser ~= nil then
|
|
186
|
-
|
|
184
|
+
msg = msg .. " (laser)"
|
|
187
185
|
end
|
|
188
186
|
local npc = entity:ToNPC()
|
|
189
187
|
if npc ~= nil then
|
|
190
|
-
|
|
188
|
+
msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
|
|
191
189
|
end
|
|
192
190
|
local pickup = entity:ToPickup()
|
|
193
191
|
if pickup ~= nil then
|
|
194
|
-
|
|
192
|
+
msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
|
|
195
193
|
end
|
|
196
194
|
local player = entity:ToPlayer()
|
|
197
195
|
if player ~= nil then
|
|
198
|
-
|
|
196
|
+
msg = msg .. " (player)"
|
|
199
197
|
end
|
|
200
198
|
local projectile = entity:ToProjectile()
|
|
201
199
|
if projectile ~= nil then
|
|
202
|
-
|
|
200
|
+
msg = msg .. " (projectile)"
|
|
203
201
|
end
|
|
204
202
|
local tear = entity:ToTear()
|
|
205
203
|
if tear ~= nil then
|
|
206
|
-
|
|
204
|
+
msg = msg .. " (tear)"
|
|
205
|
+
end
|
|
206
|
+
msg = msg .. "\n"
|
|
207
|
+
msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
|
|
208
|
+
msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
|
|
209
|
+
msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
|
|
210
|
+
msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
|
|
211
|
+
msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
|
|
212
|
+
msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
|
|
213
|
+
msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
|
|
214
|
+
msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
|
|
215
|
+
msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
|
|
216
|
+
msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
|
|
217
|
+
if npc ~= nil then
|
|
218
|
+
msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
|
|
207
219
|
end
|
|
208
|
-
debugString = debugString .. (" (Index: " .. tostring(entity.Index)) .. ")"
|
|
209
|
-
debugString = debugString .. (" (InitSeed: " .. tostring(entity.InitSeed)) .. ")"
|
|
210
|
-
debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
|
|
211
|
-
debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
|
|
212
|
-
debugString = debugString .. (((" (Velocity: " .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")"
|
|
213
|
-
debugString = debugString .. (((" (HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. ")"
|
|
214
|
-
____exports.log(debugString)
|
|
215
220
|
numMatchedEntities = numMatchedEntities + 1
|
|
216
221
|
end
|
|
217
222
|
)
|
|
218
223
|
if numMatchedEntities == 0 then
|
|
219
|
-
|
|
224
|
+
msg = msg .. "(no entities matched)\n"
|
|
220
225
|
else
|
|
221
|
-
|
|
226
|
+
msg = msg .. ("(" .. tostring(numMatchedEntities)) .. " total entities)\n"
|
|
222
227
|
end
|
|
228
|
+
____exports.log(msg)
|
|
223
229
|
end
|
|
224
230
|
function ____exports.logEntityFlags(flags)
|
|
225
231
|
____exports.logFlags(flags, EntityFlag, "entity")
|
|
@@ -248,14 +254,13 @@ function ____exports.logGameStateFlags()
|
|
|
248
254
|
end
|
|
249
255
|
end
|
|
250
256
|
function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
|
|
251
|
-
local
|
|
257
|
+
local msg = "Grid entities in the room"
|
|
252
258
|
if gridEntityTypeFilter ~= nil then
|
|
253
|
-
|
|
259
|
+
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
260
|
+
elseif not includeWalls then
|
|
261
|
+
msg = msg .. " (not including walls)"
|
|
254
262
|
end
|
|
255
|
-
|
|
256
|
-
headerMsg = headerMsg .. " (not including walls)"
|
|
257
|
-
end
|
|
258
|
-
____exports.log(headerMsg)
|
|
263
|
+
msg = msg .. ":\n"
|
|
259
264
|
local gridEntities = getGridEntities(nil)
|
|
260
265
|
local numMatchedEntities = 0
|
|
261
266
|
__TS__ArrayForEach(
|
|
@@ -271,47 +276,54 @@ function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
|
|
|
271
276
|
if not includeWalls and gridEntityType == GridEntityType.GRID_WALL and gridEntityTypeFilter ~= GridEntityType.GRID_WALL then
|
|
272
277
|
return
|
|
273
278
|
end
|
|
274
|
-
|
|
279
|
+
msg = msg .. (((((tostring(gridEntityIndex) .. ") ") .. tostring(gridEntityType)) .. ".") .. tostring(gridEntityVariant)) .. ".") .. tostring(gridEntity.State)
|
|
275
280
|
local door = gridEntity:ToDoor()
|
|
276
281
|
if door ~= nil then
|
|
277
|
-
|
|
282
|
+
msg = msg .. " (door)"
|
|
278
283
|
end
|
|
279
284
|
local pit = gridEntity:ToPit()
|
|
280
285
|
if pit ~= nil then
|
|
281
|
-
|
|
286
|
+
msg = msg .. " (pit)"
|
|
282
287
|
end
|
|
283
288
|
local poop = gridEntity:ToPoop()
|
|
284
289
|
if poop ~= nil then
|
|
285
|
-
|
|
290
|
+
msg = msg .. " (poop)"
|
|
286
291
|
end
|
|
287
292
|
local pressurePlate = gridEntity:ToPressurePlate()
|
|
288
293
|
if pressurePlate ~= nil then
|
|
289
|
-
|
|
294
|
+
msg = msg .. " (pressurePlate)"
|
|
290
295
|
end
|
|
291
296
|
local rock = gridEntity:ToRock()
|
|
292
297
|
if rock ~= nil then
|
|
293
|
-
|
|
298
|
+
msg = msg .. " (rock)"
|
|
294
299
|
end
|
|
295
300
|
local spikes = gridEntity:ToSpikes()
|
|
296
301
|
if spikes ~= nil then
|
|
297
|
-
|
|
302
|
+
msg = msg .. " (spikes)"
|
|
298
303
|
end
|
|
299
304
|
local tnt = gridEntity:ToTNT()
|
|
300
305
|
if tnt ~= nil then
|
|
301
|
-
|
|
306
|
+
msg = msg .. " (TNT)"
|
|
307
|
+
end
|
|
308
|
+
msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
|
|
309
|
+
msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
|
|
310
|
+
msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
|
|
311
|
+
msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
|
|
312
|
+
if door ~= nil then
|
|
313
|
+
msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
|
|
314
|
+
msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
|
|
315
|
+
msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
|
|
316
|
+
msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
|
|
302
317
|
end
|
|
303
|
-
debugString = debugString .. (" (VarData: " .. tostring(gridEntity.VarData)) .. ")"
|
|
304
|
-
debugString = debugString .. (((" (Position: " .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")"
|
|
305
|
-
debugString = debugString .. (((" (SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. ", VariableSeed: ") .. tostring(gridEntityDesc.VariableSeed)) .. ")"
|
|
306
|
-
____exports.log(debugString)
|
|
307
318
|
numMatchedEntities = numMatchedEntities + 1
|
|
308
319
|
end
|
|
309
320
|
)
|
|
310
321
|
if numMatchedEntities == 0 then
|
|
311
|
-
|
|
322
|
+
msg = msg .. "(no grid entities matched)\n"
|
|
312
323
|
else
|
|
313
|
-
|
|
324
|
+
msg = msg .. ("(" .. tostring(numMatchedEntities)) .. " total grid entities)\n"
|
|
314
325
|
end
|
|
326
|
+
____exports.log(msg)
|
|
315
327
|
end
|
|
316
328
|
function ____exports.logKColor(kColor)
|
|
317
329
|
____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|