isaacscript-common 6.7.1 → 6.8.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.
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +4 -4
- package/dist/functions/log.d.ts +14 -6
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +193 -155
- package/dist/functions/pickupsSpecific.d.ts +2 -2
- package/dist/functions/pickupsSpecific.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +3 -3
- package/src/functions/log.ts +225 -179
- package/src/functions/pickupsSpecific.ts +3 -3
|
@@ -12,8 +12,8 @@ local directionToVector = ____direction.directionToVector
|
|
|
12
12
|
local ____gridEntities = require("functions.gridEntities")
|
|
13
13
|
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
14
14
|
local ____log = require("functions.log")
|
|
15
|
-
local
|
|
16
|
-
local
|
|
15
|
+
local logAllEntities = ____log.logAllEntities
|
|
16
|
+
local logAllGridEntities = ____log.logAllGridEntities
|
|
17
17
|
local ____playerHealth = require("functions.playerHealth")
|
|
18
18
|
local addPlayerHealthType = ____playerHealth.addPlayerHealthType
|
|
19
19
|
local ____roomData = require("functions.roomData")
|
|
@@ -68,7 +68,7 @@ function ____exports.listEntities(self, params, includeBackgroundEffects)
|
|
|
68
68
|
return
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
|
-
|
|
71
|
+
logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
72
72
|
printConsole(nil, "Logged the entities in the room to the \"log.txt\" file.")
|
|
73
73
|
end
|
|
74
74
|
function ____exports.listGridEntities(self, params, includeWalls)
|
|
@@ -80,7 +80,7 @@ function ____exports.listGridEntities(self, params, includeWalls)
|
|
|
80
80
|
return
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
|
-
|
|
83
|
+
logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
84
84
|
printConsole(nil, "Logged the grid entities in the room to the \"log.txt\" file.")
|
|
85
85
|
end
|
|
86
86
|
function ____exports.movePlayer(self, params, direction)
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -11,13 +11,21 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
|
|
|
11
11
|
* function will also prepend the function name and the line number before the string.
|
|
12
12
|
*/
|
|
13
13
|
export declare function log(this: void, msg: string): void;
|
|
14
|
+
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
15
|
+
export declare function logAllEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
18
|
+
*/
|
|
19
|
+
export declare function logAllGridEntities(this: void, includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
|
|
14
20
|
export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
|
|
15
21
|
export declare function logColor(this: void, color: Color): void;
|
|
16
22
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
17
23
|
export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
18
24
|
export declare function logEffects(this: void, player: EntityPlayer): void;
|
|
19
|
-
/** Helper function for
|
|
20
|
-
export declare function logEntities(this: void,
|
|
25
|
+
/** Helper function for logging an array of specific entities. */
|
|
26
|
+
export declare function logEntities(this: void, entities: Entity[]): void;
|
|
27
|
+
/** Helper function to log information about a specific entity. */
|
|
28
|
+
export declare function logEntity(this: void, entity: Entity): void;
|
|
21
29
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
22
30
|
export declare function logEntityFlags(this: void, flags: EntityFlag | BitFlags<EntityFlag>): void;
|
|
23
31
|
export declare function logEntityID(this: void, entity: Entity): void;
|
|
@@ -34,10 +42,10 @@ export declare function logFlags<T extends BitFlag | BitFlag128>(this: void, fla
|
|
|
34
42
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
35
43
|
*/
|
|
36
44
|
export declare function logGameStateFlags(this: void): void;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
*/
|
|
40
|
-
export declare function
|
|
45
|
+
/** Helper function for logging an array of specific grid entities. */
|
|
46
|
+
export declare function logGridEntities(this: void, gridEntities: GridEntity[]): void;
|
|
47
|
+
/** Helper function for log information about a specific grid entity. */
|
|
48
|
+
export declare function logGridEntity(this: void, gridEntity: GridEntity): void;
|
|
41
49
|
export declare function logKColor(this: void, kColor: KColor): void;
|
|
42
50
|
/**
|
|
43
51
|
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,UAAU,EACV,UAAU,EAEV,cAAc,EAGd,cAAc,EAGd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AA+BtC;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EAKX,kBAAkB,SAAI,GACrB,MAAM,CAiBR;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAGjD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAGvE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAIvD;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GACvC,IAAI,CAEN;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,GAAG,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I,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAsB/D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAkC5C"}
|
package/dist/functions/log.lua
CHANGED
|
@@ -8,6 +8,7 @@ local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
|
8
8
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
9
9
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
10
10
|
local ____exports = {}
|
|
11
|
+
local getEntityLogLine, getGridEntityLogLine
|
|
11
12
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
12
13
|
local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
|
|
13
14
|
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
@@ -37,6 +38,7 @@ local ____flag = require("functions.flag")
|
|
|
37
38
|
local hasFlag = ____flag.hasFlag
|
|
38
39
|
local ____gridEntities = require("functions.gridEntities")
|
|
39
40
|
local getGridEntities = ____gridEntities.getGridEntities
|
|
41
|
+
local getGridEntityID = ____gridEntities.getGridEntityID
|
|
40
42
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
41
43
|
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
42
44
|
local ____playerHealth = require("functions.playerHealth")
|
|
@@ -86,6 +88,70 @@ function ____exports.log(msg)
|
|
|
86
88
|
local debugMsg = ____exports.getDebugPrependString(nil, msg)
|
|
87
89
|
Isaac.DebugString(debugMsg)
|
|
88
90
|
end
|
|
91
|
+
--- Helper function to log information about a specific entity.
|
|
92
|
+
function ____exports.logEntity(entity)
|
|
93
|
+
local msg = getEntityLogLine(nil, entity)
|
|
94
|
+
____exports.log(msg)
|
|
95
|
+
end
|
|
96
|
+
function getEntityLogLine(self, entity, num)
|
|
97
|
+
local msg = num == nil and "" or tostring(num) .. ") "
|
|
98
|
+
msg = msg .. getEntityID(nil, entity)
|
|
99
|
+
local bomb = entity:ToBomb()
|
|
100
|
+
if bomb ~= nil then
|
|
101
|
+
msg = msg .. " (bomb)"
|
|
102
|
+
end
|
|
103
|
+
local effect = entity:ToEffect()
|
|
104
|
+
if effect ~= nil then
|
|
105
|
+
msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
|
|
106
|
+
end
|
|
107
|
+
local familiar = entity:ToFamiliar()
|
|
108
|
+
if familiar ~= nil then
|
|
109
|
+
msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
|
|
110
|
+
end
|
|
111
|
+
local knife = entity:ToKnife()
|
|
112
|
+
if knife ~= nil then
|
|
113
|
+
msg = msg .. " (knife)"
|
|
114
|
+
end
|
|
115
|
+
local laser = entity:ToLaser()
|
|
116
|
+
if laser ~= nil then
|
|
117
|
+
msg = msg .. " (laser)"
|
|
118
|
+
end
|
|
119
|
+
local npc = entity:ToNPC()
|
|
120
|
+
if npc ~= nil then
|
|
121
|
+
msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
|
|
122
|
+
end
|
|
123
|
+
local pickup = entity:ToPickup()
|
|
124
|
+
if pickup ~= nil then
|
|
125
|
+
msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
|
|
126
|
+
end
|
|
127
|
+
local player = entity:ToPlayer()
|
|
128
|
+
if player ~= nil then
|
|
129
|
+
msg = msg .. " (player)"
|
|
130
|
+
end
|
|
131
|
+
local projectile = entity:ToProjectile()
|
|
132
|
+
if projectile ~= nil then
|
|
133
|
+
msg = msg .. " (projectile)"
|
|
134
|
+
end
|
|
135
|
+
local tear = entity:ToTear()
|
|
136
|
+
if tear ~= nil then
|
|
137
|
+
msg = msg .. " (tear)"
|
|
138
|
+
end
|
|
139
|
+
msg = msg .. "\n"
|
|
140
|
+
msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
|
|
141
|
+
msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
|
|
142
|
+
msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
|
|
143
|
+
msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
|
|
144
|
+
msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
|
|
145
|
+
msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
|
|
146
|
+
msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
|
|
147
|
+
msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
|
|
148
|
+
msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
|
|
149
|
+
msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
|
|
150
|
+
if npc ~= nil then
|
|
151
|
+
msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
|
|
152
|
+
end
|
|
153
|
+
return msg
|
|
154
|
+
end
|
|
89
155
|
--- Helper function for printing out every flag that is turned on. Useful when debugging.
|
|
90
156
|
function ____exports.logFlags(flags, flagEnum, description)
|
|
91
157
|
if description == nil then
|
|
@@ -108,6 +174,56 @@ function ____exports.logFlags(flags, flagEnum, description)
|
|
|
108
174
|
____exports.log(" n/a (no flags)")
|
|
109
175
|
end
|
|
110
176
|
end
|
|
177
|
+
--- Helper function for log information about a specific grid entity.
|
|
178
|
+
function ____exports.logGridEntity(gridEntity)
|
|
179
|
+
local msg = getGridEntityLogLine(nil, gridEntity)
|
|
180
|
+
____exports.log(msg)
|
|
181
|
+
end
|
|
182
|
+
function getGridEntityLogLine(self, gridEntity, num)
|
|
183
|
+
local gridEntityDesc = gridEntity:GetSaveState()
|
|
184
|
+
local msg = num == nil and "" or tostring(num) .. ") "
|
|
185
|
+
msg = msg .. getGridEntityID(nil, gridEntity)
|
|
186
|
+
local door = gridEntity:ToDoor()
|
|
187
|
+
if door ~= nil then
|
|
188
|
+
msg = msg .. " (door)"
|
|
189
|
+
end
|
|
190
|
+
local pit = gridEntity:ToPit()
|
|
191
|
+
if pit ~= nil then
|
|
192
|
+
msg = msg .. " (pit)"
|
|
193
|
+
end
|
|
194
|
+
local poop = gridEntity:ToPoop()
|
|
195
|
+
if poop ~= nil then
|
|
196
|
+
msg = msg .. " (poop)"
|
|
197
|
+
end
|
|
198
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
199
|
+
if pressurePlate ~= nil then
|
|
200
|
+
msg = msg .. " (pressurePlate)"
|
|
201
|
+
end
|
|
202
|
+
local rock = gridEntity:ToRock()
|
|
203
|
+
if rock ~= nil then
|
|
204
|
+
msg = msg .. " (rock)"
|
|
205
|
+
end
|
|
206
|
+
local spikes = gridEntity:ToSpikes()
|
|
207
|
+
if spikes ~= nil then
|
|
208
|
+
msg = msg .. " (spikes)"
|
|
209
|
+
end
|
|
210
|
+
local tnt = gridEntity:ToTNT()
|
|
211
|
+
if tnt ~= nil then
|
|
212
|
+
msg = msg .. " (TNT)"
|
|
213
|
+
end
|
|
214
|
+
msg = msg .. (" - State: " .. tostring(gridEntity.State)) .. "\n"
|
|
215
|
+
msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
|
|
216
|
+
msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
|
|
217
|
+
msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
|
|
218
|
+
msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
|
|
219
|
+
if door ~= nil then
|
|
220
|
+
msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
|
|
221
|
+
msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
|
|
222
|
+
msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
|
|
223
|
+
msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
|
|
224
|
+
end
|
|
225
|
+
return msg
|
|
226
|
+
end
|
|
111
227
|
local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
112
228
|
EffectVariant.BLOOD_EXPLOSION,
|
|
113
229
|
EffectVariant.BLOOD_PARTICLE,
|
|
@@ -119,6 +235,71 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
|
119
235
|
EffectVariant.LIGHT,
|
|
120
236
|
EffectVariant.TADPOLE
|
|
121
237
|
})
|
|
238
|
+
--- Helper function for printing out every entity (or filtered entity) in the current room.
|
|
239
|
+
function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
240
|
+
local msg = "Entities in the room"
|
|
241
|
+
if entityTypeFilter ~= nil then
|
|
242
|
+
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
243
|
+
elseif not includeBackgroundEffects then
|
|
244
|
+
msg = msg .. " (not including background effects)"
|
|
245
|
+
end
|
|
246
|
+
msg = msg .. ":\n"
|
|
247
|
+
local entities = getEntities(nil)
|
|
248
|
+
local numMatchedEntities = 0
|
|
249
|
+
__TS__ArrayForEach(
|
|
250
|
+
entities,
|
|
251
|
+
function(____, entity, i)
|
|
252
|
+
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
253
|
+
return
|
|
254
|
+
end
|
|
255
|
+
local effect = entity:ToEffect()
|
|
256
|
+
if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
|
|
257
|
+
return
|
|
258
|
+
end
|
|
259
|
+
msg = msg .. getEntityLogLine(nil, entity, i + 1)
|
|
260
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
261
|
+
end
|
|
262
|
+
)
|
|
263
|
+
if numMatchedEntities == 0 then
|
|
264
|
+
msg = msg .. "(no entities matched)\n"
|
|
265
|
+
else
|
|
266
|
+
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
267
|
+
end
|
|
268
|
+
____exports.log(msg)
|
|
269
|
+
end
|
|
270
|
+
--- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
271
|
+
function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
272
|
+
local msg = "Grid entities in the room"
|
|
273
|
+
if gridEntityTypeFilter ~= nil then
|
|
274
|
+
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
275
|
+
elseif not includeWalls then
|
|
276
|
+
msg = msg .. " (not including walls)"
|
|
277
|
+
end
|
|
278
|
+
msg = msg .. ":\n"
|
|
279
|
+
local gridEntities = getGridEntities(nil)
|
|
280
|
+
local numMatchedEntities = 0
|
|
281
|
+
__TS__ArrayForEach(
|
|
282
|
+
gridEntities,
|
|
283
|
+
function(____, gridEntity)
|
|
284
|
+
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
285
|
+
local gridEntityType = gridEntity:GetType()
|
|
286
|
+
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
287
|
+
return
|
|
288
|
+
end
|
|
289
|
+
if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
|
|
290
|
+
return
|
|
291
|
+
end
|
|
292
|
+
msg = msg .. getGridEntityLogLine(nil, gridEntity, gridEntityIndex)
|
|
293
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
294
|
+
end
|
|
295
|
+
)
|
|
296
|
+
if numMatchedEntities == 0 then
|
|
297
|
+
msg = msg .. "(no grid entities matched)\n"
|
|
298
|
+
else
|
|
299
|
+
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
300
|
+
end
|
|
301
|
+
____exports.log(msg)
|
|
302
|
+
end
|
|
122
303
|
function ____exports.logArray(array)
|
|
123
304
|
local arrayString = arrayToString(nil, array)
|
|
124
305
|
____exports.log("Array: " .. arrayString)
|
|
@@ -156,91 +337,11 @@ function ____exports.logEffects(player)
|
|
|
156
337
|
end
|
|
157
338
|
)
|
|
158
339
|
end
|
|
159
|
-
--- Helper function for
|
|
160
|
-
function ____exports.logEntities(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
164
|
-
elseif not includeBackgroundEffects then
|
|
165
|
-
msg = msg .. " (not including background effects)"
|
|
166
|
-
end
|
|
167
|
-
msg = msg .. ":\n"
|
|
168
|
-
local entities = getEntities(nil)
|
|
169
|
-
local numMatchedEntities = 0
|
|
170
|
-
__TS__ArrayForEach(
|
|
171
|
-
entities,
|
|
172
|
-
function(____, entity, i)
|
|
173
|
-
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
174
|
-
return
|
|
175
|
-
end
|
|
176
|
-
local effect = entity:ToEffect()
|
|
177
|
-
if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
|
|
178
|
-
return
|
|
179
|
-
end
|
|
180
|
-
local entityID = getEntityID(nil, entity)
|
|
181
|
-
msg = msg .. (tostring(i + 1) .. ") ") .. entityID
|
|
182
|
-
local bomb = entity:ToBomb()
|
|
183
|
-
if bomb ~= nil then
|
|
184
|
-
msg = msg .. " (bomb)"
|
|
185
|
-
end
|
|
186
|
-
if effect ~= nil then
|
|
187
|
-
msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
|
|
188
|
-
end
|
|
189
|
-
local familiar = entity:ToFamiliar()
|
|
190
|
-
if familiar ~= nil then
|
|
191
|
-
msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
|
|
192
|
-
end
|
|
193
|
-
local knife = entity:ToKnife()
|
|
194
|
-
if knife ~= nil then
|
|
195
|
-
msg = msg .. " (knife)"
|
|
196
|
-
end
|
|
197
|
-
local laser = entity:ToLaser()
|
|
198
|
-
if laser ~= nil then
|
|
199
|
-
msg = msg .. " (laser)"
|
|
200
|
-
end
|
|
201
|
-
local npc = entity:ToNPC()
|
|
202
|
-
if npc ~= nil then
|
|
203
|
-
msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
|
|
204
|
-
end
|
|
205
|
-
local pickup = entity:ToPickup()
|
|
206
|
-
if pickup ~= nil then
|
|
207
|
-
msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
|
|
208
|
-
end
|
|
209
|
-
local player = entity:ToPlayer()
|
|
210
|
-
if player ~= nil then
|
|
211
|
-
msg = msg .. " (player)"
|
|
212
|
-
end
|
|
213
|
-
local projectile = entity:ToProjectile()
|
|
214
|
-
if projectile ~= nil then
|
|
215
|
-
msg = msg .. " (projectile)"
|
|
216
|
-
end
|
|
217
|
-
local tear = entity:ToTear()
|
|
218
|
-
if tear ~= nil then
|
|
219
|
-
msg = msg .. " (tear)"
|
|
220
|
-
end
|
|
221
|
-
msg = msg .. "\n"
|
|
222
|
-
msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
|
|
223
|
-
msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
|
|
224
|
-
msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
|
|
225
|
-
msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
|
|
226
|
-
msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
|
|
227
|
-
msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
|
|
228
|
-
msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
|
|
229
|
-
msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
|
|
230
|
-
msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
|
|
231
|
-
msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
|
|
232
|
-
if npc ~= nil then
|
|
233
|
-
msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
|
|
234
|
-
end
|
|
235
|
-
numMatchedEntities = numMatchedEntities + 1
|
|
236
|
-
end
|
|
237
|
-
)
|
|
238
|
-
if numMatchedEntities == 0 then
|
|
239
|
-
msg = msg .. "(no entities matched)\n"
|
|
240
|
-
else
|
|
241
|
-
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
340
|
+
--- Helper function for logging an array of specific entities.
|
|
341
|
+
function ____exports.logEntities(entities)
|
|
342
|
+
for ____, entity in ipairs(entities) do
|
|
343
|
+
____exports.logEntity(entity)
|
|
242
344
|
end
|
|
243
|
-
____exports.log(msg)
|
|
244
345
|
end
|
|
245
346
|
--- Helper function for printing out every entity flag that is turned on. Useful when debugging.
|
|
246
347
|
function ____exports.logEntityFlags(flags)
|
|
@@ -277,78 +378,11 @@ function ____exports.logGameStateFlags()
|
|
|
277
378
|
____exports.log(" n/a (no flags)")
|
|
278
379
|
end
|
|
279
380
|
end
|
|
280
|
-
--- Helper function for
|
|
281
|
-
function ____exports.logGridEntities(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
285
|
-
elseif not includeWalls then
|
|
286
|
-
msg = msg .. " (not including walls)"
|
|
381
|
+
--- Helper function for logging an array of specific grid entities.
|
|
382
|
+
function ____exports.logGridEntities(gridEntities)
|
|
383
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
384
|
+
____exports.logGridEntity(gridEntity)
|
|
287
385
|
end
|
|
288
|
-
msg = msg .. ":\n"
|
|
289
|
-
local gridEntities = getGridEntities(nil)
|
|
290
|
-
local numMatchedEntities = 0
|
|
291
|
-
__TS__ArrayForEach(
|
|
292
|
-
gridEntities,
|
|
293
|
-
function(____, gridEntity)
|
|
294
|
-
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
295
|
-
local gridEntityType = gridEntity:GetType()
|
|
296
|
-
local gridEntityVariant = gridEntity:GetVariant()
|
|
297
|
-
local gridEntityDesc = gridEntity:GetSaveState()
|
|
298
|
-
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
299
|
-
return
|
|
300
|
-
end
|
|
301
|
-
if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
|
|
302
|
-
return
|
|
303
|
-
end
|
|
304
|
-
msg = msg .. (((((tostring(gridEntityIndex) .. ") ") .. tostring(gridEntityType)) .. ".") .. tostring(gridEntityVariant)) .. ".") .. tostring(gridEntity.State)
|
|
305
|
-
local door = gridEntity:ToDoor()
|
|
306
|
-
if door ~= nil then
|
|
307
|
-
msg = msg .. " (door)"
|
|
308
|
-
end
|
|
309
|
-
local pit = gridEntity:ToPit()
|
|
310
|
-
if pit ~= nil then
|
|
311
|
-
msg = msg .. " (pit)"
|
|
312
|
-
end
|
|
313
|
-
local poop = gridEntity:ToPoop()
|
|
314
|
-
if poop ~= nil then
|
|
315
|
-
msg = msg .. " (poop)"
|
|
316
|
-
end
|
|
317
|
-
local pressurePlate = gridEntity:ToPressurePlate()
|
|
318
|
-
if pressurePlate ~= nil then
|
|
319
|
-
msg = msg .. " (pressurePlate)"
|
|
320
|
-
end
|
|
321
|
-
local rock = gridEntity:ToRock()
|
|
322
|
-
if rock ~= nil then
|
|
323
|
-
msg = msg .. " (rock)"
|
|
324
|
-
end
|
|
325
|
-
local spikes = gridEntity:ToSpikes()
|
|
326
|
-
if spikes ~= nil then
|
|
327
|
-
msg = msg .. " (spikes)"
|
|
328
|
-
end
|
|
329
|
-
local tnt = gridEntity:ToTNT()
|
|
330
|
-
if tnt ~= nil then
|
|
331
|
-
msg = msg .. " (TNT)"
|
|
332
|
-
end
|
|
333
|
-
msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
|
|
334
|
-
msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
|
|
335
|
-
msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
|
|
336
|
-
msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
|
|
337
|
-
if door ~= nil then
|
|
338
|
-
msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
|
|
339
|
-
msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
|
|
340
|
-
msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
|
|
341
|
-
msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
|
|
342
|
-
end
|
|
343
|
-
numMatchedEntities = numMatchedEntities + 1
|
|
344
|
-
end
|
|
345
|
-
)
|
|
346
|
-
if numMatchedEntities == 0 then
|
|
347
|
-
msg = msg .. "(no grid entities matched)\n"
|
|
348
|
-
else
|
|
349
|
-
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
350
|
-
end
|
|
351
|
-
____exports.log(msg)
|
|
352
386
|
end
|
|
353
387
|
function ____exports.logKColor(kColor)
|
|
354
388
|
____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|
|
@@ -567,17 +601,21 @@ end
|
|
|
567
601
|
function ____exports.setLogFunctionsGlobal(self)
|
|
568
602
|
local globals = _G
|
|
569
603
|
globals.log = ____exports.log
|
|
604
|
+
globals.logAllEntities = ____exports.logAllEntities
|
|
605
|
+
globals.logAllGridEntities = ____exports.logAllGridEntities
|
|
570
606
|
globals.logArray = ____exports.logArray
|
|
571
607
|
globals.logColor = ____exports.logColor
|
|
572
608
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
573
609
|
globals.logEffects = ____exports.logEffects
|
|
574
610
|
globals.logEntities = ____exports.logEntities
|
|
611
|
+
globals.logEntity = ____exports.logEntity
|
|
575
612
|
globals.logEntityID = ____exports.logEntityID
|
|
576
613
|
globals.logEntityFlags = ____exports.logEntityFlags
|
|
577
614
|
globals.logError = ____exports.logError
|
|
578
615
|
globals.logFlags = ____exports.logFlags
|
|
579
616
|
globals.logGameStateFlags = ____exports.logGameStateFlags
|
|
580
617
|
globals.logGridEntities = ____exports.logGridEntities
|
|
618
|
+
globals.logGridEntity = ____exports.logGridEntity
|
|
581
619
|
globals.logKColor = ____exports.logKColor
|
|
582
620
|
globals.logLevelStateFlags = ____exports.logLevelStateFlags
|
|
583
621
|
globals.logMap = ____exports.logMap
|
|
@@ -171,12 +171,12 @@ export declare function spawnBattery(batterySubType: BatterySubType, position: V
|
|
|
171
171
|
*/
|
|
172
172
|
export declare function spawnBatteryWithSeed(batterySubType: BatterySubType, position: Vector, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityPickupBattery;
|
|
173
173
|
/** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.BOMB` (40). */
|
|
174
|
-
export declare function spawnBombPickup(bombSubType: BombSubType, position: Vector, velocity?: Vector, spawner?: Entity | undefined, seedOrRNG?: Seed | RNG | undefined):
|
|
174
|
+
export declare function spawnBombPickup(bombSubType: BombSubType, position: Vector, velocity?: Vector, spawner?: Entity | undefined, seedOrRNG?: Seed | RNG | undefined): EntityPickupBomb;
|
|
175
175
|
/**
|
|
176
176
|
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.BOMB` (40) and a
|
|
177
177
|
* specific seed.
|
|
178
178
|
*/
|
|
179
|
-
export declare function spawnBombPickupWithSeed(bombSubType: BombSubType, position: Vector, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined):
|
|
179
|
+
export declare function spawnBombPickupWithSeed(bombSubType: BombSubType, position: Vector, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityPickupBomb;
|
|
180
180
|
/**
|
|
181
181
|
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
|
|
182
182
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickupsSpecific.d.ts","sourceRoot":"","sources":["../../src/functions/pickupsSpecific.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,IAAI,EACJ,WAAW,EACX,eAAe,EACf,YAAY,EACZ,UAAU,EAEV,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAItC;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,cAAc,GAAE,cAAmB,GAClC,mBAAmB,EAAE,CAKvB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,WAAW,GAAE,WAAgB,GAC5B,gBAAgB,EAAE,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,IAAS,GAAG,gBAAgB,EAAE,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,WAAW,GAAE,WAAgB,GAAG,gBAAgB,EAAE,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,eAAe,GAAE,eAAoB,GACp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qB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,gBAAgB,CASlB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,gBAAgB,CAElB;AAED,iGAAiG;AACjG,wBAAgB,SAAS,CACvB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,gBAAgB,CASlB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,mBAAmB,CASrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,mBAAmB,CAErB"}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import { game } from "../../cachedClasses";
|
|
|
9
9
|
import { HealthType } from "../../enums/HealthType";
|
|
10
10
|
import { directionToVector } from "../../functions/direction";
|
|
11
11
|
import { spawnGridEntityWithVariant } from "../../functions/gridEntities";
|
|
12
|
-
import {
|
|
12
|
+
import { logAllEntities, logAllGridEntities } from "../../functions/log";
|
|
13
13
|
import { addPlayerHealthType } from "../../functions/playerHealth";
|
|
14
14
|
import { getRoomData, getRoomDescriptor } from "../../functions/roomData";
|
|
15
15
|
import { changeRoom, getRoomGridIndexesForType } from "../../functions/rooms";
|
|
@@ -73,7 +73,7 @@ export function listEntities(
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
logAllEntities(includeBackgroundEffects, entityTypeFilter);
|
|
77
77
|
printConsole('Logged the entities in the room to the "log.txt" file.');
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -87,7 +87,7 @@ export function listGridEntities(params: string, includeWalls: boolean): void {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
logAllGridEntities(includeWalls, gridEntityTypeFilter);
|
|
91
91
|
printConsole('Logged the grid entities in the room to the "log.txt" file.');
|
|
92
92
|
}
|
|
93
93
|
|
package/src/functions/log.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { getCollectibleName } from "./collectibles";
|
|
|
19
19
|
import { getEntities, getEntityID } from "./entities";
|
|
20
20
|
import { getEnumEntries } from "./enums";
|
|
21
21
|
import { hasFlag } from "./flag";
|
|
22
|
-
import { getGridEntities } from "./gridEntities";
|
|
22
|
+
import { getGridEntities, getGridEntityID } from "./gridEntities";
|
|
23
23
|
import { getIsaacAPIClassName } from "./isaacAPIClass";
|
|
24
24
|
import { getPlayerHealth } from "./playerHealth";
|
|
25
25
|
import { getEffectsList, getPlayerName } from "./players";
|
|
@@ -83,6 +83,106 @@ export function log(this: void, msg: string): void {
|
|
|
83
83
|
Isaac.DebugString(debugMsg);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
87
|
+
export function logAllEntities(
|
|
88
|
+
this: void,
|
|
89
|
+
includeBackgroundEffects: boolean,
|
|
90
|
+
entityTypeFilter?: EntityType,
|
|
91
|
+
): void {
|
|
92
|
+
let msg = "Entities in the room";
|
|
93
|
+
if (entityTypeFilter !== undefined) {
|
|
94
|
+
msg += ` (filtered to entity type ${entityTypeFilter})`;
|
|
95
|
+
} else if (!includeBackgroundEffects) {
|
|
96
|
+
msg += " (not including background effects)";
|
|
97
|
+
}
|
|
98
|
+
msg += ":\n";
|
|
99
|
+
|
|
100
|
+
const entities = getEntities();
|
|
101
|
+
let numMatchedEntities = 0;
|
|
102
|
+
entities.forEach((entity, i) => {
|
|
103
|
+
// If a filter was specified, exclude all entities outside of the filter.
|
|
104
|
+
if (entityTypeFilter !== undefined && entity.Type !== entityTypeFilter) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const effect = entity.ToEffect();
|
|
109
|
+
if (
|
|
110
|
+
!includeBackgroundEffects &&
|
|
111
|
+
effect !== undefined &&
|
|
112
|
+
IGNORE_EFFECT_VARIANTS.has(effect.Variant)
|
|
113
|
+
) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
msg += getEntityLogLine(entity, i + 1);
|
|
118
|
+
numMatchedEntities++;
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (numMatchedEntities === 0) {
|
|
122
|
+
msg += "(no entities matched)\n";
|
|
123
|
+
} else {
|
|
124
|
+
msg += `(${numMatchedEntities} total ${
|
|
125
|
+
numMatchedEntities === 1 ? "entity" : "entities"
|
|
126
|
+
})\n`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
log(msg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
134
|
+
*/
|
|
135
|
+
export function logAllGridEntities(
|
|
136
|
+
this: void,
|
|
137
|
+
includeWalls: boolean,
|
|
138
|
+
gridEntityTypeFilter?: GridEntityType,
|
|
139
|
+
): void {
|
|
140
|
+
let msg = "Grid entities in the room";
|
|
141
|
+
if (gridEntityTypeFilter !== undefined) {
|
|
142
|
+
msg += ` (filtered to grid entity type ${gridEntityTypeFilter})`;
|
|
143
|
+
} else if (!includeWalls) {
|
|
144
|
+
msg += " (not including walls)";
|
|
145
|
+
}
|
|
146
|
+
msg += ":\n";
|
|
147
|
+
|
|
148
|
+
const gridEntities = getGridEntities();
|
|
149
|
+
let numMatchedEntities = 0;
|
|
150
|
+
gridEntities.forEach((gridEntity) => {
|
|
151
|
+
const gridEntityIndex = gridEntity.GetGridIndex();
|
|
152
|
+
const gridEntityType = gridEntity.GetType();
|
|
153
|
+
|
|
154
|
+
// If a filter was specified, exclude all entities outside of the filter.
|
|
155
|
+
if (
|
|
156
|
+
gridEntityTypeFilter !== undefined &&
|
|
157
|
+
gridEntityType !== gridEntityTypeFilter
|
|
158
|
+
) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (
|
|
163
|
+
!includeWalls &&
|
|
164
|
+
gridEntityType === GridEntityType.WALL &&
|
|
165
|
+
gridEntityTypeFilter !== GridEntityType.WALL
|
|
166
|
+
) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
msg += getGridEntityLogLine(gridEntity, gridEntityIndex);
|
|
171
|
+
|
|
172
|
+
numMatchedEntities++;
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (numMatchedEntities === 0) {
|
|
176
|
+
msg += "(no grid entities matched)\n";
|
|
177
|
+
} else {
|
|
178
|
+
msg += `(${numMatchedEntities} total grid ${
|
|
179
|
+
numMatchedEntities === 1 ? "entity" : "entities"
|
|
180
|
+
})\n`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
log(msg);
|
|
184
|
+
}
|
|
185
|
+
|
|
86
186
|
export function logArray<T>(this: void, array: T[] | readonly T[]): void {
|
|
87
187
|
const arrayString = arrayToString(array);
|
|
88
188
|
log(`Array: ${arrayString}`);
|
|
@@ -130,116 +230,90 @@ export function logEffects(this: void, player: EntityPlayer): void {
|
|
|
130
230
|
});
|
|
131
231
|
}
|
|
132
232
|
|
|
133
|
-
/** Helper function for
|
|
134
|
-
export function logEntities(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
entityTypeFilter?: EntityType,
|
|
138
|
-
): void {
|
|
139
|
-
let msg = "Entities in the room";
|
|
140
|
-
if (entityTypeFilter !== undefined) {
|
|
141
|
-
msg += ` (filtered to entity type ${entityTypeFilter})`;
|
|
142
|
-
} else if (!includeBackgroundEffects) {
|
|
143
|
-
msg += " (not including background effects)";
|
|
233
|
+
/** Helper function for logging an array of specific entities. */
|
|
234
|
+
export function logEntities(this: void, entities: Entity[]): void {
|
|
235
|
+
for (const entity of entities) {
|
|
236
|
+
logEntity(entity);
|
|
144
237
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const entities = getEntities();
|
|
148
|
-
let numMatchedEntities = 0;
|
|
149
|
-
entities.forEach((entity, i) => {
|
|
150
|
-
// If a filter was specified, exclude all entities outside of the filter.
|
|
151
|
-
if (entityTypeFilter !== undefined && entity.Type !== entityTypeFilter) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const effect = entity.ToEffect();
|
|
156
|
-
if (
|
|
157
|
-
!includeBackgroundEffects &&
|
|
158
|
-
effect !== undefined &&
|
|
159
|
-
IGNORE_EFFECT_VARIANTS.has(effect.Variant)
|
|
160
|
-
) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
238
|
+
}
|
|
163
239
|
|
|
164
|
-
|
|
165
|
-
|
|
240
|
+
/** Helper function to log information about a specific entity. */
|
|
241
|
+
export function logEntity(this: void, entity: Entity): void {
|
|
242
|
+
const msg = getEntityLogLine(entity);
|
|
243
|
+
log(msg);
|
|
244
|
+
}
|
|
166
245
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
msg += " (bomb)";
|
|
170
|
-
}
|
|
246
|
+
function getEntityLogLine(entity: Entity, num?: int): string {
|
|
247
|
+
let msg = num === undefined ? "" : `${num}) `;
|
|
171
248
|
|
|
172
|
-
|
|
173
|
-
msg += ` (effect) (State: ${effect.State})`;
|
|
174
|
-
}
|
|
249
|
+
msg += getEntityID(entity);
|
|
175
250
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
251
|
+
const bomb = entity.ToBomb();
|
|
252
|
+
if (bomb !== undefined) {
|
|
253
|
+
msg += " (bomb)";
|
|
254
|
+
}
|
|
180
255
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
256
|
+
const effect = entity.ToEffect();
|
|
257
|
+
if (effect !== undefined) {
|
|
258
|
+
msg += ` (effect) (State: ${effect.State})`;
|
|
259
|
+
}
|
|
185
260
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
261
|
+
const familiar = entity.ToFamiliar();
|
|
262
|
+
if (familiar !== undefined) {
|
|
263
|
+
msg += ` (familiar) (State: ${familiar.State})`;
|
|
264
|
+
}
|
|
190
265
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
266
|
+
const knife = entity.ToKnife();
|
|
267
|
+
if (knife !== undefined) {
|
|
268
|
+
msg += " (knife)";
|
|
269
|
+
}
|
|
195
270
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
271
|
+
const laser = entity.ToLaser();
|
|
272
|
+
if (laser !== undefined) {
|
|
273
|
+
msg += " (laser)";
|
|
274
|
+
}
|
|
200
275
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
276
|
+
const npc = entity.ToNPC();
|
|
277
|
+
if (npc !== undefined) {
|
|
278
|
+
msg += ` (NPC) (State: ${npc.State})`;
|
|
279
|
+
}
|
|
205
280
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
281
|
+
const pickup = entity.ToPickup();
|
|
282
|
+
if (pickup !== undefined) {
|
|
283
|
+
msg += ` (pickup) (State: ${pickup.State})`;
|
|
284
|
+
}
|
|
210
285
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
286
|
+
const player = entity.ToPlayer();
|
|
287
|
+
if (player !== undefined) {
|
|
288
|
+
msg += " (player)";
|
|
289
|
+
}
|
|
215
290
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
msg +=
|
|
219
|
-
|
|
220
|
-
msg += ` - Position: (${entity.Position.X}, ${entity.Position.Y})\n`;
|
|
221
|
-
msg += ` - Velocity: (${entity.Velocity.X}, ${entity.Velocity.Y})\n`;
|
|
222
|
-
msg += ` - HP: ${entity.HitPoints} / ${entity.MaxHitPoints}\n`;
|
|
223
|
-
msg += ` - Parent: ${entity.Parent}\n`;
|
|
224
|
-
msg += ` - Child: ${entity.Child}\n`;
|
|
225
|
-
msg += ` - SpawnerEntity: ${entity.SpawnerEntity}\n`;
|
|
226
|
-
msg += ` - SpawnerType / SpawnerVariant: ${entity.SpawnerType}.${entity.SpawnerVariant}\n`;
|
|
227
|
-
if (npc !== undefined) {
|
|
228
|
-
msg += ` - CanShutDoors: ${npc.CanShutDoors}\n`;
|
|
229
|
-
}
|
|
291
|
+
const projectile = entity.ToProjectile();
|
|
292
|
+
if (projectile !== undefined) {
|
|
293
|
+
msg += " (projectile)";
|
|
294
|
+
}
|
|
230
295
|
|
|
231
|
-
|
|
232
|
-
|
|
296
|
+
const tear = entity.ToTear();
|
|
297
|
+
if (tear !== undefined) {
|
|
298
|
+
msg += " (tear)";
|
|
299
|
+
}
|
|
233
300
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
301
|
+
msg += "\n";
|
|
302
|
+
msg += ` - Index: ${entity.Index}\n`;
|
|
303
|
+
msg += ` - InitSeed: ${entity.InitSeed}\n`;
|
|
304
|
+
msg += ` - DropSeed: ${entity.DropSeed}\n`;
|
|
305
|
+
msg += ` - Position: (${entity.Position.X}, ${entity.Position.Y})\n`;
|
|
306
|
+
msg += ` - Velocity: (${entity.Velocity.X}, ${entity.Velocity.Y})\n`;
|
|
307
|
+
msg += ` - HP: ${entity.HitPoints} / ${entity.MaxHitPoints}\n`;
|
|
308
|
+
msg += ` - Parent: ${entity.Parent}\n`;
|
|
309
|
+
msg += ` - Child: ${entity.Child}\n`;
|
|
310
|
+
msg += ` - SpawnerEntity: ${entity.SpawnerEntity}\n`;
|
|
311
|
+
msg += ` - SpawnerType / SpawnerVariant: ${entity.SpawnerType}.${entity.SpawnerVariant}\n`;
|
|
312
|
+
if (npc !== undefined) {
|
|
313
|
+
msg += ` - CanShutDoors: ${npc.CanShutDoors}\n`;
|
|
240
314
|
}
|
|
241
315
|
|
|
242
|
-
|
|
316
|
+
return msg;
|
|
243
317
|
}
|
|
244
318
|
|
|
245
319
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
@@ -316,106 +390,74 @@ export function logGameStateFlags(this: void): void {
|
|
|
316
390
|
}
|
|
317
391
|
}
|
|
318
392
|
|
|
319
|
-
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this: void,
|
|
324
|
-
includeWalls: boolean,
|
|
325
|
-
gridEntityTypeFilter?: GridEntityType,
|
|
326
|
-
): void {
|
|
327
|
-
let msg = "Grid entities in the room";
|
|
328
|
-
if (gridEntityTypeFilter !== undefined) {
|
|
329
|
-
msg += ` (filtered to grid entity type ${gridEntityTypeFilter})`;
|
|
330
|
-
} else if (!includeWalls) {
|
|
331
|
-
msg += " (not including walls)";
|
|
393
|
+
/** Helper function for logging an array of specific grid entities. */
|
|
394
|
+
export function logGridEntities(this: void, gridEntities: GridEntity[]): void {
|
|
395
|
+
for (const gridEntity of gridEntities) {
|
|
396
|
+
logGridEntity(gridEntity);
|
|
332
397
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const gridEntities = getGridEntities();
|
|
336
|
-
let numMatchedEntities = 0;
|
|
337
|
-
gridEntities.forEach((gridEntity) => {
|
|
338
|
-
const gridEntityIndex = gridEntity.GetGridIndex();
|
|
339
|
-
const gridEntityType = gridEntity.GetType();
|
|
340
|
-
const gridEntityVariant = gridEntity.GetVariant();
|
|
341
|
-
const gridEntityDesc = gridEntity.GetSaveState();
|
|
342
|
-
|
|
343
|
-
// If a filter was specified, exclude all entities outside of the filter.
|
|
344
|
-
if (
|
|
345
|
-
gridEntityTypeFilter !== undefined &&
|
|
346
|
-
gridEntityType !== gridEntityTypeFilter
|
|
347
|
-
) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
398
|
+
}
|
|
350
399
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
400
|
+
/** Helper function for log information about a specific grid entity. */
|
|
401
|
+
export function logGridEntity(this: void, gridEntity: GridEntity): void {
|
|
402
|
+
const msg = getGridEntityLogLine(gridEntity);
|
|
403
|
+
log(msg);
|
|
404
|
+
}
|
|
358
405
|
|
|
359
|
-
|
|
406
|
+
function getGridEntityLogLine(gridEntity: GridEntity, num?: int): string {
|
|
407
|
+
const gridEntityDesc = gridEntity.GetSaveState();
|
|
360
408
|
|
|
361
|
-
|
|
362
|
-
if (door !== undefined) {
|
|
363
|
-
msg += " (door)";
|
|
364
|
-
}
|
|
409
|
+
let msg = num === undefined ? "" : `${num}) `;
|
|
365
410
|
|
|
366
|
-
|
|
367
|
-
if (pit !== undefined) {
|
|
368
|
-
msg += " (pit)";
|
|
369
|
-
}
|
|
411
|
+
msg += getGridEntityID(gridEntity);
|
|
370
412
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
413
|
+
const door = gridEntity.ToDoor();
|
|
414
|
+
if (door !== undefined) {
|
|
415
|
+
msg += " (door)";
|
|
416
|
+
}
|
|
375
417
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
418
|
+
const pit = gridEntity.ToPit();
|
|
419
|
+
if (pit !== undefined) {
|
|
420
|
+
msg += " (pit)";
|
|
421
|
+
}
|
|
380
422
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
423
|
+
const poop = gridEntity.ToPoop();
|
|
424
|
+
if (poop !== undefined) {
|
|
425
|
+
msg += " (poop)";
|
|
426
|
+
}
|
|
385
427
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
428
|
+
const pressurePlate = gridEntity.ToPressurePlate();
|
|
429
|
+
if (pressurePlate !== undefined) {
|
|
430
|
+
msg += " (pressurePlate)";
|
|
431
|
+
}
|
|
390
432
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
433
|
+
const rock = gridEntity.ToRock();
|
|
434
|
+
if (rock !== undefined) {
|
|
435
|
+
msg += " (rock)";
|
|
436
|
+
}
|
|
395
437
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
msg +=
|
|
399
|
-
|
|
400
|
-
if (door !== undefined) {
|
|
401
|
-
msg += ` - Slot: ${door.Slot}\n`;
|
|
402
|
-
msg += ` - Direction: ${door.Direction}\n`;
|
|
403
|
-
msg += ` - TargetRoomIndex: ${door.TargetRoomIndex}\n`;
|
|
404
|
-
msg += ` - TargetRoomType: ${door.TargetRoomType}\n`;
|
|
405
|
-
}
|
|
438
|
+
const spikes = gridEntity.ToSpikes();
|
|
439
|
+
if (spikes !== undefined) {
|
|
440
|
+
msg += " (spikes)";
|
|
441
|
+
}
|
|
406
442
|
|
|
407
|
-
|
|
408
|
-
|
|
443
|
+
const tnt = gridEntity.ToTNT();
|
|
444
|
+
if (tnt !== undefined) {
|
|
445
|
+
msg += " (TNT)";
|
|
446
|
+
}
|
|
409
447
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
448
|
+
msg += ` - State: ${gridEntity.State}\n`;
|
|
449
|
+
msg += ` - VarData: ${gridEntity.VarData}\n`;
|
|
450
|
+
msg += ` - Position: (${gridEntity.Position.X}, ${gridEntity.Position.Y})\n`;
|
|
451
|
+
msg += ` - SpawnSeed: ${gridEntityDesc.SpawnSeed}\n`;
|
|
452
|
+
msg += ` - VariableSeed: ${gridEntityDesc.VariableSeed})\n`;
|
|
453
|
+
if (door !== undefined) {
|
|
454
|
+
msg += ` - Slot: ${door.Slot}\n`;
|
|
455
|
+
msg += ` - Direction: ${door.Direction}\n`;
|
|
456
|
+
msg += ` - TargetRoomIndex: ${door.TargetRoomIndex}\n`;
|
|
457
|
+
msg += ` - TargetRoomType: ${door.TargetRoomType}\n`;
|
|
416
458
|
}
|
|
417
459
|
|
|
418
|
-
|
|
460
|
+
return msg;
|
|
419
461
|
}
|
|
420
462
|
|
|
421
463
|
export function logKColor(this: void, kColor: KColor): void {
|
|
@@ -714,17 +756,21 @@ export function setLogFunctionsGlobal(): void {
|
|
|
714
756
|
const globals = _G as Record<string, unknown>;
|
|
715
757
|
|
|
716
758
|
globals["log"] = log;
|
|
759
|
+
globals["logAllEntities"] = logAllEntities;
|
|
760
|
+
globals["logAllGridEntities"] = logAllGridEntities;
|
|
717
761
|
globals["logArray"] = logArray;
|
|
718
762
|
globals["logColor"] = logColor;
|
|
719
763
|
globals["logDamageFlags"] = logDamageFlags;
|
|
720
764
|
globals["logEffects"] = logEffects;
|
|
721
765
|
globals["logEntities"] = logEntities;
|
|
766
|
+
globals["logEntity"] = logEntity;
|
|
722
767
|
globals["logEntityID"] = logEntityID;
|
|
723
768
|
globals["logEntityFlags"] = logEntityFlags;
|
|
724
769
|
globals["logError"] = logError;
|
|
725
770
|
globals["logFlags"] = logFlags;
|
|
726
771
|
globals["logGameStateFlags"] = logGameStateFlags;
|
|
727
772
|
globals["logGridEntities"] = logGridEntities;
|
|
773
|
+
globals["logGridEntity"] = logGridEntity;
|
|
728
774
|
globals["logKColor"] = logKColor;
|
|
729
775
|
globals["logLevelStateFlags"] = logLevelStateFlags;
|
|
730
776
|
globals["logMap"] = logMap;
|
|
@@ -363,7 +363,7 @@ export function spawnBombPickup(
|
|
|
363
363
|
velocity: Vector = VectorZero,
|
|
364
364
|
spawner: Entity | undefined = undefined,
|
|
365
365
|
seedOrRNG: Seed | RNG | undefined = undefined,
|
|
366
|
-
):
|
|
366
|
+
): EntityPickupBomb {
|
|
367
367
|
return spawnPickup(
|
|
368
368
|
PickupVariant.BOMB,
|
|
369
369
|
bombSubType,
|
|
@@ -371,7 +371,7 @@ export function spawnBombPickup(
|
|
|
371
371
|
velocity,
|
|
372
372
|
spawner,
|
|
373
373
|
seedOrRNG,
|
|
374
|
-
) as
|
|
374
|
+
) as EntityPickupBomb;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
/**
|
|
@@ -384,7 +384,7 @@ export function spawnBombPickupWithSeed(
|
|
|
384
384
|
seedOrRNG: Seed | RNG,
|
|
385
385
|
velocity: Vector = VectorZero,
|
|
386
386
|
spawner: Entity | undefined = undefined,
|
|
387
|
-
):
|
|
387
|
+
): EntityPickupBomb {
|
|
388
388
|
return spawnBombPickup(bombSubType, position, velocity, spawner, seedOrRNG);
|
|
389
389
|
}
|
|
390
390
|
|