isaacscript-common 9.13.0 → 9.13.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/callbacks/customRevive.lua +5 -2
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/features/customPickup.d.ts +1 -1
- package/dist/features/customPickup.d.ts.map +1 -1
- package/dist/features/customPickup.lua +2 -2
- package/dist/features/customStage/customStageUtils.lua +16 -4
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +17 -5
- package/dist/features/deployJSONRoom.lua +15 -9
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -2
- package/dist/features/extraConsoleCommands/listCommands.lua +4 -4
- package/dist/features/pause.lua +2 -2
- package/dist/features/saveDataManager/load.lua +7 -4
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +3 -3
- package/dist/features/saveDataManager/save.lua +1 -1
- package/dist/features/taintedLazarusPlayers.lua +1 -1
- package/dist/functions/benchmark.lua +8 -2
- package/dist/functions/debug.lua +1 -1
- package/dist/functions/deepCopy.lua +8 -8
- package/dist/functions/deepCopyTests.lua +1 -1
- package/dist/functions/globals.lua +6 -3
- package/dist/functions/hex.lua +7 -4
- package/dist/functions/jsonHelpers.lua +1 -1
- package/dist/functions/jsonRoom.lua +8 -2
- package/dist/functions/log.d.ts +26 -26
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +209 -98
- package/dist/functions/logEntities.d.ts +8 -8
- package/dist/functions/logEntities.d.ts.map +1 -1
- package/dist/functions/logEntities.lua +21 -18
- package/dist/functions/mergeTests.lua +1 -1
- package/dist/functions/run.lua +5 -2
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.lua +9 -0
- package/dist/index.d.ts +35 -35
- package/package.json +2 -2
- package/src/features/customPickup.ts +5 -4
- package/src/features/customStage/exports.ts +0 -1
- package/src/functions/log.ts +23 -48
- package/src/functions/logEntities.ts +6 -8
- package/src/functions/set.ts +13 -0
- package/src/lib/jsonLua.d.ts +4 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { EntityType, GridEntityType } from "isaac-typescript-definitions";
|
|
2
2
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
3
|
-
export declare function logAllEntities(
|
|
3
|
+
export declare function logAllEntities(includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
|
|
4
4
|
/**
|
|
5
5
|
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
6
6
|
*/
|
|
7
|
-
export declare function logAllGridEntities(
|
|
7
|
+
export declare function logAllGridEntities(includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
|
|
8
8
|
/** Helper function for logging an array of specific entities. */
|
|
9
|
-
export declare function logEntities(
|
|
9
|
+
export declare function logEntities(entities: Entity[]): void;
|
|
10
10
|
/** Helper function to log information about a specific entity. */
|
|
11
|
-
export declare function logEntity(
|
|
11
|
+
export declare function logEntity(entity: Entity): void;
|
|
12
12
|
/** Helper function for logging an array of specific grid entities. */
|
|
13
|
-
export declare function logGridEntities(
|
|
13
|
+
export declare function logGridEntities(gridEntities: GridEntity[]): void;
|
|
14
14
|
/** Helper function for log information about a specific grid entity. */
|
|
15
|
-
export declare function logGridEntity(
|
|
15
|
+
export declare function logGridEntity(gridEntity: GridEntity): void;
|
|
16
16
|
/**
|
|
17
17
|
* Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
18
18
|
* use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
19
19
|
*/
|
|
20
|
-
export declare function logPtrHash(
|
|
20
|
+
export declare function logPtrHash(ptrHash: PtrHash): void;
|
|
21
21
|
/**
|
|
22
22
|
* Helper function to log information about the entity that corresponding to one or more pointer
|
|
23
23
|
* hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
24
24
|
*/
|
|
25
|
-
export declare function logPtrHashes(
|
|
25
|
+
export declare function logPtrHashes(ptrHashes: PtrHash[]): void;
|
|
26
26
|
//# sourceMappingURL=logEntities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,MAAM,8BAA8B,CAAC;AAiBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,
|
|
1
|
+
{"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,MAAM,8BAA8B,CAAC;AAiBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CAuCN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,OAAO,EACrB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA6CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIpD;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG9C;AA2ED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAIhE;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAG1D;AA2DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAQjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAIvD"}
|
|
@@ -17,9 +17,9 @@ local getGridEntityID = ____gridEntities.getGridEntityID
|
|
|
17
17
|
local ____log = require("functions.log")
|
|
18
18
|
local log = ____log.log
|
|
19
19
|
--- Helper function to log information about a specific entity.
|
|
20
|
-
function ____exports.logEntity(entity)
|
|
20
|
+
function ____exports.logEntity(self, entity)
|
|
21
21
|
local msg = getEntityLogLine(nil, entity)
|
|
22
|
-
log(msg)
|
|
22
|
+
log(nil, msg)
|
|
23
23
|
end
|
|
24
24
|
function getEntityLogLine(self, entity, num)
|
|
25
25
|
local msg = num == nil and "" or tostring(num) .. ") "
|
|
@@ -81,9 +81,9 @@ function getEntityLogLine(self, entity, num)
|
|
|
81
81
|
return msg
|
|
82
82
|
end
|
|
83
83
|
--- Helper function for log information about a specific grid entity.
|
|
84
|
-
function ____exports.logGridEntity(gridEntity)
|
|
84
|
+
function ____exports.logGridEntity(self, gridEntity)
|
|
85
85
|
local msg = getGridEntityLogLine(nil, gridEntity)
|
|
86
|
-
log(msg)
|
|
86
|
+
log(nil, msg)
|
|
87
87
|
end
|
|
88
88
|
function getGridEntityLogLine(self, gridEntity, num)
|
|
89
89
|
local gridEntityDesc = gridEntity:GetSaveState()
|
|
@@ -142,7 +142,7 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
|
142
142
|
EffectVariant.TADPOLE
|
|
143
143
|
})
|
|
144
144
|
--- Helper function for printing out every entity (or filtered entity) in the current room.
|
|
145
|
-
function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
145
|
+
function ____exports.logAllEntities(self, includeBackgroundEffects, entityTypeFilter)
|
|
146
146
|
local msg = "Entities in the room"
|
|
147
147
|
if entityTypeFilter ~= nil then
|
|
148
148
|
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
@@ -171,10 +171,10 @@ function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
|
171
171
|
else
|
|
172
172
|
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
173
173
|
end
|
|
174
|
-
log(msg)
|
|
174
|
+
log(nil, msg)
|
|
175
175
|
end
|
|
176
176
|
--- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
177
|
-
function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
177
|
+
function ____exports.logAllGridEntities(self, includeWalls, gridEntityTypeFilter)
|
|
178
178
|
local msg = "Grid entities in the room"
|
|
179
179
|
if gridEntityTypeFilter ~= nil then
|
|
180
180
|
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
@@ -204,36 +204,39 @@ function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
|
204
204
|
else
|
|
205
205
|
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
206
206
|
end
|
|
207
|
-
log(msg)
|
|
207
|
+
log(nil, msg)
|
|
208
208
|
end
|
|
209
209
|
--- Helper function for logging an array of specific entities.
|
|
210
|
-
function ____exports.logEntities(entities)
|
|
210
|
+
function ____exports.logEntities(self, entities)
|
|
211
211
|
for ____, entity in ipairs(entities) do
|
|
212
|
-
____exports.logEntity(entity)
|
|
212
|
+
____exports.logEntity(nil, entity)
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
--- Helper function for logging an array of specific grid entities.
|
|
216
|
-
function ____exports.logGridEntities(gridEntities)
|
|
216
|
+
function ____exports.logGridEntities(self, gridEntities)
|
|
217
217
|
for ____, gridEntity in ipairs(gridEntities) do
|
|
218
|
-
____exports.logGridEntity(gridEntity)
|
|
218
|
+
____exports.logGridEntity(nil, gridEntity)
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
--- Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
222
222
|
-- use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
223
|
-
function ____exports.logPtrHash(ptrHash)
|
|
224
|
-
log(
|
|
223
|
+
function ____exports.logPtrHash(self, ptrHash)
|
|
224
|
+
log(
|
|
225
|
+
nil,
|
|
226
|
+
"PtrHash: " .. tostring(ptrHash)
|
|
227
|
+
)
|
|
225
228
|
local entity = getEntityFromPtrHash(nil, ptrHash)
|
|
226
229
|
if entity == nil then
|
|
227
|
-
log("No corresponding entity found.")
|
|
230
|
+
log(nil, "No corresponding entity found.")
|
|
228
231
|
else
|
|
229
|
-
____exports.logEntity(entity)
|
|
232
|
+
____exports.logEntity(nil, entity)
|
|
230
233
|
end
|
|
231
234
|
end
|
|
232
235
|
--- Helper function to log information about the entity that corresponding to one or more pointer
|
|
233
236
|
-- hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
234
|
-
function ____exports.logPtrHashes(ptrHashes)
|
|
237
|
+
function ____exports.logPtrHashes(self, ptrHashes)
|
|
235
238
|
for ____, ptrHash in ipairs(ptrHashes) do
|
|
236
|
-
____exports.logPtrHash(ptrHash)
|
|
239
|
+
____exports.logPtrHash(nil, ptrHash)
|
|
237
240
|
end
|
|
238
241
|
end
|
|
239
242
|
return ____exports
|
|
@@ -255,7 +255,7 @@ function ____exports.runMergeTests(self)
|
|
|
255
255
|
oldTableHasRNG(nil)
|
|
256
256
|
oldTableHasRNGSerialized(nil)
|
|
257
257
|
local successText = "All merge tests passed!"
|
|
258
|
-
log(successText)
|
|
258
|
+
log(nil, successText)
|
|
259
259
|
printConsole(nil, successText)
|
|
260
260
|
end
|
|
261
261
|
return ____exports
|
package/dist/functions/run.lua
CHANGED
|
@@ -40,7 +40,7 @@ end
|
|
|
40
40
|
function ____exports.restart(self, character)
|
|
41
41
|
if character == nil then
|
|
42
42
|
local command = "restart"
|
|
43
|
-
log("Restarting the run with a console command of: " .. command)
|
|
43
|
+
log(nil, "Restarting the run with a console command of: " .. command)
|
|
44
44
|
Isaac.ExecuteCommand(command)
|
|
45
45
|
return
|
|
46
46
|
end
|
|
@@ -48,7 +48,10 @@ function ____exports.restart(self, character)
|
|
|
48
48
|
error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
|
|
49
49
|
end
|
|
50
50
|
local command = "restart " .. tostring(character)
|
|
51
|
-
log(
|
|
51
|
+
log(
|
|
52
|
+
nil,
|
|
53
|
+
(((("Restarting the run as PlayerType." .. tostring(PlayerType[character])) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command
|
|
54
|
+
)
|
|
52
55
|
Isaac.ExecuteCommand(command)
|
|
53
56
|
end
|
|
54
57
|
--- Helper function to restart on the next render frame. Useful because it is impossible to restart
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":";;AAIA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC3C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GACtC,GAAG,CAAC,CAAC,CAAC,CASR;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAOlE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC9C,IAAI,CAMN;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAO,GAClC,CAAC,CAGH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,iBAAiB,EAAE,OAAO,GACzB,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAK/B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAkBvE;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGrE"}
|
package/dist/functions/set.lua
CHANGED
|
@@ -12,6 +12,8 @@ local getRandomArrayElement = ____array.getRandomArrayElement
|
|
|
12
12
|
local sumArray = ____array.sumArray
|
|
13
13
|
local ____rng = require("functions.rng")
|
|
14
14
|
local getRandomSeed = ____rng.getRandomSeed
|
|
15
|
+
local ____types = require("functions.types")
|
|
16
|
+
local isPrimitive = ____types.isPrimitive
|
|
15
17
|
--- Helper function to get a sorted array based on the contents of a set.
|
|
16
18
|
--
|
|
17
19
|
-- Normally, set values are returned in a random order, so use this function when the ordering of
|
|
@@ -19,6 +21,13 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
19
21
|
function ____exports.getSortedSetValues(self, set)
|
|
20
22
|
local values = set:values()
|
|
21
23
|
local array = {__TS__Spread(values)}
|
|
24
|
+
local firstElement = array[1]
|
|
25
|
+
if firstElement ~= nil then
|
|
26
|
+
local arrayType = type(firstElement)
|
|
27
|
+
if not isPrimitive(nil, arrayType) then
|
|
28
|
+
error(("Failed to get the sorted set values because the provided set was of type \"" .. tostring(arrayType)) .. "\". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
22
31
|
__TS__ArraySort(array)
|
|
23
32
|
return array
|
|
24
33
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -6585,35 +6585,35 @@ export declare function lockDoor(door: GridEntityDoor): void;
|
|
|
6585
6585
|
* If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
|
|
6586
6586
|
* function will also prepend the function name and the line number before the string.
|
|
6587
6587
|
*/
|
|
6588
|
-
export declare function log(
|
|
6588
|
+
export declare function log(msg: string): void;
|
|
6589
6589
|
|
|
6590
6590
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
6591
|
-
export declare function logAllEntities(
|
|
6591
|
+
export declare function logAllEntities(includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
|
|
6592
6592
|
|
|
6593
6593
|
/**
|
|
6594
6594
|
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
6595
6595
|
*/
|
|
6596
|
-
export declare function logAllGridEntities(
|
|
6596
|
+
export declare function logAllGridEntities(includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
|
|
6597
6597
|
|
|
6598
|
-
export declare function logArray<T>(
|
|
6598
|
+
export declare function logArray<T>(array: T[] | readonly T[]): void;
|
|
6599
6599
|
|
|
6600
|
-
export declare function logCollectibleTypes(
|
|
6600
|
+
export declare function logCollectibleTypes(collectibleTypes: CollectibleType[]): void;
|
|
6601
6601
|
|
|
6602
|
-
export declare function logColor(
|
|
6602
|
+
export declare function logColor(color: Color): void;
|
|
6603
6603
|
|
|
6604
6604
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
6605
|
-
export declare function logDamageFlags(
|
|
6605
|
+
export declare function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
6606
6606
|
|
|
6607
6607
|
/** Helper function for logging an array of specific entities. */
|
|
6608
|
-
export declare function logEntities(
|
|
6608
|
+
export declare function logEntities(entities: Entity[]): void;
|
|
6609
6609
|
|
|
6610
6610
|
/** Helper function to log information about a specific entity. */
|
|
6611
|
-
export declare function logEntity(
|
|
6611
|
+
export declare function logEntity(entity: Entity): void;
|
|
6612
6612
|
|
|
6613
6613
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
6614
|
-
export declare function logEntityFlags(
|
|
6614
|
+
export declare function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void;
|
|
6615
6615
|
|
|
6616
|
-
export declare function logEntityID(
|
|
6616
|
+
export declare function logEntityID(entity: Entity): void;
|
|
6617
6617
|
|
|
6618
6618
|
/**
|
|
6619
6619
|
* Helper function to log an error message and also print it to the console for better visibility.
|
|
@@ -6621,67 +6621,67 @@ export declare function logEntityID(this: void, entity: Entity): void;
|
|
|
6621
6621
|
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
6622
6622
|
* prevents all of the subsequent code in the callback from running).
|
|
6623
6623
|
*/
|
|
6624
|
-
export declare function logError(
|
|
6624
|
+
export declare function logError(msg: string): void;
|
|
6625
6625
|
|
|
6626
6626
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
6627
|
-
export declare function logFlags<T extends BitFlag | BitFlag128>(
|
|
6627
|
+
export declare function logFlags<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
|
|
6628
6628
|
|
|
6629
6629
|
/**
|
|
6630
6630
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
6631
6631
|
*/
|
|
6632
|
-
export declare function logGameStateFlags(
|
|
6632
|
+
export declare function logGameStateFlags(): void;
|
|
6633
6633
|
|
|
6634
6634
|
/** Helper function for logging an array of specific grid entities. */
|
|
6635
|
-
export declare function logGridEntities(
|
|
6635
|
+
export declare function logGridEntities(gridEntities: GridEntity[]): void;
|
|
6636
6636
|
|
|
6637
6637
|
/** Helper function for log information about a specific grid entity. */
|
|
6638
|
-
export declare function logGridEntity(
|
|
6638
|
+
export declare function logGridEntity(gridEntity: GridEntity): void;
|
|
6639
6639
|
|
|
6640
|
-
export declare function logKColor(
|
|
6640
|
+
export declare function logKColor(kColor: KColor): void;
|
|
6641
6641
|
|
|
6642
6642
|
/**
|
|
6643
6643
|
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
6644
6644
|
*/
|
|
6645
|
-
export declare function logLevelStateFlags(
|
|
6645
|
+
export declare function logLevelStateFlags(): void;
|
|
6646
6646
|
|
|
6647
|
-
export declare function logMap(
|
|
6647
|
+
export declare function logMap(map: Map<AnyNotNil, unknown>): void;
|
|
6648
6648
|
|
|
6649
6649
|
export declare function logNewGlobals(): void;
|
|
6650
6650
|
|
|
6651
|
-
export declare function logPlayerEffects(
|
|
6651
|
+
export declare function logPlayerEffects(player: EntityPlayer): void;
|
|
6652
6652
|
|
|
6653
|
-
export declare function logPlayerHealth(
|
|
6653
|
+
export declare function logPlayerHealth(player: EntityPlayer): void;
|
|
6654
6654
|
|
|
6655
6655
|
/**
|
|
6656
6656
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
6657
6657
|
*/
|
|
6658
|
-
export declare function logProjectileFlags(
|
|
6658
|
+
export declare function logProjectileFlags(flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
|
|
6659
6659
|
|
|
6660
6660
|
/**
|
|
6661
6661
|
* Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
6662
6662
|
* use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
6663
6663
|
*/
|
|
6664
|
-
export declare function logPtrHash(
|
|
6664
|
+
export declare function logPtrHash(ptrHash: PtrHash): void;
|
|
6665
6665
|
|
|
6666
6666
|
/**
|
|
6667
6667
|
* Helper function to log information about the entity that corresponding to one or more pointer
|
|
6668
6668
|
* hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
6669
6669
|
*/
|
|
6670
|
-
export declare function logPtrHashes(
|
|
6670
|
+
export declare function logPtrHashes(ptrHashes: PtrHash[]): void;
|
|
6671
6671
|
|
|
6672
6672
|
/** Helper function for logging information about the current room. */
|
|
6673
|
-
export declare function logRoom(
|
|
6673
|
+
export declare function logRoom(): void;
|
|
6674
6674
|
|
|
6675
6675
|
/**
|
|
6676
6676
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
6677
6677
|
* particular run.
|
|
6678
6678
|
*/
|
|
6679
|
-
export declare function logSeedEffects(
|
|
6679
|
+
export declare function logSeedEffects(): void;
|
|
6680
6680
|
|
|
6681
|
-
export declare function logSet(
|
|
6681
|
+
export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
|
|
6682
6682
|
|
|
6683
6683
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
6684
|
-
export declare function logSounds(
|
|
6684
|
+
export declare function logSounds(): void;
|
|
6685
6685
|
|
|
6686
6686
|
/**
|
|
6687
6687
|
* Helper function for logging every key and value of a table. This is a deep log; the function will
|
|
@@ -6690,27 +6690,27 @@ export declare function logSounds(this: void): void;
|
|
|
6690
6690
|
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
6691
6691
|
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
6692
6692
|
*/
|
|
6693
|
-
export declare function logTable(
|
|
6693
|
+
export declare function logTable(luaTable: unknown, parentTables?: number): void;
|
|
6694
6694
|
|
|
6695
6695
|
/**
|
|
6696
6696
|
* Helper function to print out the differences between the entries of two tables. Note that this
|
|
6697
6697
|
* will only do a shallow comparison.
|
|
6698
6698
|
*/
|
|
6699
|
-
export declare function logTableDifferences<K, V>(
|
|
6699
|
+
export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
|
|
6700
6700
|
|
|
6701
6701
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
6702
|
-
export declare function logTearFlags(
|
|
6702
|
+
export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
|
|
6703
6703
|
|
|
6704
6704
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
6705
|
-
export declare function logUseFlags(
|
|
6705
|
+
export declare function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void;
|
|
6706
6706
|
|
|
6707
6707
|
/**
|
|
6708
6708
|
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
6709
6709
|
* the Isaac API).
|
|
6710
6710
|
*/
|
|
6711
|
-
export declare function logUserdata(
|
|
6711
|
+
export declare function logUserdata(userdata: unknown): void;
|
|
6712
6712
|
|
|
6713
|
-
export declare function logVector(
|
|
6713
|
+
export declare function logVector(vector: Vector, round?: boolean): void;
|
|
6714
6714
|
|
|
6715
6715
|
/**
|
|
6716
6716
|
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
@@ -9164,7 +9164,7 @@ export declare function registerCharacterStats(playerType: PlayerType, statMap:
|
|
|
9164
9164
|
* this function if your pickup should only be able to be collected under
|
|
9165
9165
|
* certain conditions.
|
|
9166
9166
|
*/
|
|
9167
|
-
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (player: EntityPlayer) => void, collisionFunc?: (player: EntityPlayer) => boolean): void;
|
|
9167
|
+
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void;
|
|
9168
9168
|
|
|
9169
9169
|
/**
|
|
9170
9170
|
* Helper function to run arbitrary code when you press and release a specific keyboard key.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "9.13.
|
|
3
|
+
"version": "9.13.3",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^4.0.
|
|
25
|
+
"isaac-typescript-definitions": "^4.0.5"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -13,9 +13,10 @@ import { spawnEffect } from "../functions/entitiesSpecific";
|
|
|
13
13
|
|
|
14
14
|
const FEATURE_NAME = "customPickup";
|
|
15
15
|
|
|
16
|
+
/** We must specify "this: void" to prevent compiler errors. */
|
|
16
17
|
interface CustomPickupFunctions {
|
|
17
|
-
collectFunc: (player: EntityPlayer) => void;
|
|
18
|
-
collisionFunc: (player: EntityPlayer) => boolean;
|
|
18
|
+
collectFunc: (this: void, player: EntityPlayer) => void;
|
|
19
|
+
collisionFunc: (this: void, player: EntityPlayer) => boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -121,8 +122,8 @@ function postEffectRenderPickupEffect(effect: EntityEffect) {
|
|
|
121
122
|
export function registerCustomPickup(
|
|
122
123
|
pickupVariantCustom: PickupVariant,
|
|
123
124
|
subType: int,
|
|
124
|
-
collectFunc: (player: EntityPlayer) => void,
|
|
125
|
-
collisionFunc: (player: EntityPlayer) => boolean = () => true,
|
|
125
|
+
collectFunc: (this: void, player: EntityPlayer) => void,
|
|
126
|
+
collisionFunc: (this: void, player: EntityPlayer) => boolean = () => true,
|
|
126
127
|
): void {
|
|
127
128
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
128
129
|
|
package/src/functions/log.ts
CHANGED
|
@@ -64,20 +64,17 @@ export function getDebugPrependString(
|
|
|
64
64
|
* If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
|
|
65
65
|
* function will also prepend the function name and the line number before the string.
|
|
66
66
|
*/
|
|
67
|
-
export function log(
|
|
67
|
+
export function log(msg: string): void {
|
|
68
68
|
const debugMsg = getDebugPrependString(msg);
|
|
69
69
|
Isaac.DebugString(debugMsg);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function logArray<T>(
|
|
72
|
+
export function logArray<T>(array: T[] | readonly T[]): void {
|
|
73
73
|
const arrayString = arrayToString(array);
|
|
74
74
|
log(`Array: ${arrayString}`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export function logCollectibleTypes(
|
|
78
|
-
this: void,
|
|
79
|
-
collectibleTypes: CollectibleType[],
|
|
80
|
-
): void {
|
|
77
|
+
export function logCollectibleTypes(collectibleTypes: CollectibleType[]): void {
|
|
81
78
|
log("Collectibles:");
|
|
82
79
|
|
|
83
80
|
let i = 1;
|
|
@@ -88,29 +85,23 @@ export function logCollectibleTypes(
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
export function logColor(
|
|
88
|
+
export function logColor(color: Color): void {
|
|
92
89
|
log(
|
|
93
90
|
`Color: R${color.R}, G${color.G}, B${color.B}, A${color.A}, RO${color.RO}, BO${color.BO}, GO${color.GO}`,
|
|
94
91
|
);
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
98
|
-
export function logDamageFlags(
|
|
99
|
-
this: void,
|
|
100
|
-
flags: DamageFlag | BitFlags<DamageFlag>,
|
|
101
|
-
): void {
|
|
95
|
+
export function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void {
|
|
102
96
|
logFlags(flags, DamageFlag, "damage");
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
106
|
-
export function logEntityFlags(
|
|
107
|
-
this: void,
|
|
108
|
-
flags: EntityFlag | BitFlags<EntityFlag>,
|
|
109
|
-
): void {
|
|
100
|
+
export function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void {
|
|
110
101
|
logFlags(flags, EntityFlag, "entity");
|
|
111
102
|
}
|
|
112
103
|
|
|
113
|
-
export function logEntityID(
|
|
104
|
+
export function logEntityID(entity: Entity): void {
|
|
114
105
|
const entityID = getEntityID(entity);
|
|
115
106
|
log(`Entity: ${entityID}`);
|
|
116
107
|
}
|
|
@@ -121,7 +112,7 @@ export function logEntityID(this: void, entity: Entity): void {
|
|
|
121
112
|
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
122
113
|
* prevents all of the subsequent code in the callback from running).
|
|
123
114
|
*/
|
|
124
|
-
export function logError(
|
|
115
|
+
export function logError(msg: string): void {
|
|
125
116
|
const errorMsg = `Error: ${msg}`;
|
|
126
117
|
log(errorMsg);
|
|
127
118
|
printConsole(errorMsg);
|
|
@@ -129,7 +120,6 @@ export function logError(this: void, msg: string): void {
|
|
|
129
120
|
|
|
130
121
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
131
122
|
export function logFlags<T extends BitFlag | BitFlag128>(
|
|
132
|
-
this: void,
|
|
133
123
|
flags: T | BitFlags<T>,
|
|
134
124
|
flagEnum: Record<string, T>,
|
|
135
125
|
description = "",
|
|
@@ -157,7 +147,7 @@ export function logFlags<T extends BitFlag | BitFlag128>(
|
|
|
157
147
|
/**
|
|
158
148
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
159
149
|
*/
|
|
160
|
-
export function logGameStateFlags(
|
|
150
|
+
export function logGameStateFlags(): void {
|
|
161
151
|
log("Logging game state flags:");
|
|
162
152
|
|
|
163
153
|
const gameStateFlagEntries = getEnumEntries(GameStateFlag);
|
|
@@ -176,7 +166,7 @@ export function logGameStateFlags(this: void): void {
|
|
|
176
166
|
}
|
|
177
167
|
}
|
|
178
168
|
|
|
179
|
-
export function logKColor(
|
|
169
|
+
export function logKColor(kColor: KColor): void {
|
|
180
170
|
log(
|
|
181
171
|
`Color: R${kColor.Red}, G${kColor.Green}, B${kColor.Blue}, A${kColor.Alpha}`,
|
|
182
172
|
);
|
|
@@ -185,7 +175,7 @@ export function logKColor(this: void, kColor: KColor): void {
|
|
|
185
175
|
/**
|
|
186
176
|
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
187
177
|
*/
|
|
188
|
-
export function logLevelStateFlags(
|
|
178
|
+
export function logLevelStateFlags(): void {
|
|
189
179
|
const level = game.GetLevel();
|
|
190
180
|
|
|
191
181
|
const levelStateFlagEntries = getEnumEntries(LevelStateFlag);
|
|
@@ -205,7 +195,7 @@ export function logLevelStateFlags(this: void): void {
|
|
|
205
195
|
}
|
|
206
196
|
}
|
|
207
197
|
|
|
208
|
-
export function logMap(
|
|
198
|
+
export function logMap(map: Map<AnyNotNil, unknown>): void {
|
|
209
199
|
log("Printing out a TSTL Map:");
|
|
210
200
|
|
|
211
201
|
const mapKeys = [...map.keys()];
|
|
@@ -220,7 +210,7 @@ export function logMap(this: void, map: Map<AnyNotNil, unknown>): void {
|
|
|
220
210
|
log(` The size of the map was: ${map.size}`);
|
|
221
211
|
}
|
|
222
212
|
|
|
223
|
-
export function logPlayerEffects(
|
|
213
|
+
export function logPlayerEffects(player: EntityPlayer): void {
|
|
224
214
|
const effects = getEffectsList(player);
|
|
225
215
|
|
|
226
216
|
log("Logging player effects:");
|
|
@@ -248,7 +238,7 @@ export function logPlayerEffects(this: void, player: EntityPlayer): void {
|
|
|
248
238
|
});
|
|
249
239
|
}
|
|
250
240
|
|
|
251
|
-
export function logPlayerHealth(
|
|
241
|
+
export function logPlayerHealth(player: EntityPlayer): void {
|
|
252
242
|
const playerName = getPlayerName(player);
|
|
253
243
|
const playerHealth = getPlayerHealth(player);
|
|
254
244
|
|
|
@@ -274,14 +264,13 @@ export function logPlayerHealth(this: void, player: EntityPlayer): void {
|
|
|
274
264
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
275
265
|
*/
|
|
276
266
|
export function logProjectileFlags(
|
|
277
|
-
this: void,
|
|
278
267
|
flags: ProjectileFlag | BitFlags<ProjectileFlag>,
|
|
279
268
|
): void {
|
|
280
269
|
logFlags(flags, ProjectileFlag, "projectile");
|
|
281
270
|
}
|
|
282
271
|
|
|
283
272
|
/** Helper function for logging information about the current room. */
|
|
284
|
-
export function logRoom(
|
|
273
|
+
export function logRoom(): void {
|
|
285
274
|
const room = game.GetRoom();
|
|
286
275
|
const bossID = room.GetBossID();
|
|
287
276
|
const roomGridIndex = getRoomGridIndex();
|
|
@@ -315,7 +304,7 @@ export function logRoom(this: void): void {
|
|
|
315
304
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
316
305
|
* particular run.
|
|
317
306
|
*/
|
|
318
|
-
export function logSeedEffects(
|
|
307
|
+
export function logSeedEffects(): void {
|
|
319
308
|
const seeds = game.GetSeeds();
|
|
320
309
|
|
|
321
310
|
const seedEffectEntries = getEnumEntries(SeedEffect);
|
|
@@ -334,10 +323,7 @@ export function logSeedEffects(this: void): void {
|
|
|
334
323
|
}
|
|
335
324
|
}
|
|
336
325
|
|
|
337
|
-
export function logSet(
|
|
338
|
-
this: void,
|
|
339
|
-
set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>,
|
|
340
|
-
): void {
|
|
326
|
+
export function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void {
|
|
341
327
|
log("Printing out a TSTL Set:");
|
|
342
328
|
|
|
343
329
|
const setValues = getSortedSetValues(set);
|
|
@@ -350,7 +336,7 @@ export function logSet(
|
|
|
350
336
|
}
|
|
351
337
|
|
|
352
338
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
353
|
-
export function logSounds(
|
|
339
|
+
export function logSounds(): void {
|
|
354
340
|
const soundEffects = getEnumEntries(SoundEffect);
|
|
355
341
|
|
|
356
342
|
for (const [key, soundEffect] of soundEffects) {
|
|
@@ -367,11 +353,7 @@ export function logSounds(this: void): void {
|
|
|
367
353
|
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
368
354
|
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
369
355
|
*/
|
|
370
|
-
export function logTable(
|
|
371
|
-
this: void,
|
|
372
|
-
luaTable: unknown,
|
|
373
|
-
parentTables = 0,
|
|
374
|
-
): void {
|
|
356
|
+
export function logTable(luaTable: unknown, parentTables = 0): void {
|
|
375
357
|
if (parentTables === 0) {
|
|
376
358
|
log("Printing out a Lua table:");
|
|
377
359
|
}
|
|
@@ -421,7 +403,6 @@ export function logTable(
|
|
|
421
403
|
* will only do a shallow comparison.
|
|
422
404
|
*/
|
|
423
405
|
export function logTableDifferences<K, V>(
|
|
424
|
-
this: void,
|
|
425
406
|
table1: LuaMap<K, V>,
|
|
426
407
|
table2: LuaMap<K, V>,
|
|
427
408
|
): void {
|
|
@@ -453,18 +434,12 @@ export function logTableDifferences<K, V>(
|
|
|
453
434
|
}
|
|
454
435
|
|
|
455
436
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
456
|
-
export function logTearFlags(
|
|
457
|
-
this: void,
|
|
458
|
-
flags: TearFlag | BitFlags<TearFlag>,
|
|
459
|
-
): void {
|
|
437
|
+
export function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void {
|
|
460
438
|
logFlags(flags, TearFlag, "tear");
|
|
461
439
|
}
|
|
462
440
|
|
|
463
441
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
464
|
-
export function logUseFlags(
|
|
465
|
-
this: void,
|
|
466
|
-
flags: UseFlag | BitFlags<UseFlag>,
|
|
467
|
-
): void {
|
|
442
|
+
export function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void {
|
|
468
443
|
logFlags(flags, UseFlag, "use");
|
|
469
444
|
}
|
|
470
445
|
|
|
@@ -472,7 +447,7 @@ export function logUseFlags(
|
|
|
472
447
|
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
473
448
|
* the Isaac API).
|
|
474
449
|
*/
|
|
475
|
-
export function logUserdata(
|
|
450
|
+
export function logUserdata(userdata: unknown): void {
|
|
476
451
|
if (!isUserdata(userdata)) {
|
|
477
452
|
log("Userdata: [not userdata]");
|
|
478
453
|
return;
|
|
@@ -496,7 +471,7 @@ export function logUserdata(this: void, userdata: unknown): void {
|
|
|
496
471
|
logTable(metatable);
|
|
497
472
|
}
|
|
498
473
|
|
|
499
|
-
export function logVector(
|
|
474
|
+
export function logVector(vector: Vector, round = false): void {
|
|
500
475
|
const vectorString = vectorToString(vector, round);
|
|
501
476
|
log(`Vector: ${vectorString}`);
|
|
502
477
|
}
|