isaacscript-common 9.13.1 → 9.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/callbacks/customRevive.lua +5 -2
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/features/customPickup.d.ts +1 -1
- package/dist/features/customPickup.d.ts.map +1 -1
- package/dist/features/customPickup.lua +2 -2
- package/dist/features/customStage/customStageUtils.lua +16 -4
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +17 -5
- package/dist/features/deployJSONRoom.lua +15 -9
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -2
- package/dist/features/extraConsoleCommands/listCommands.lua +4 -4
- package/dist/features/pause.lua +2 -2
- package/dist/features/saveDataManager/load.lua +7 -4
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +3 -3
- package/dist/features/saveDataManager/save.lua +1 -1
- package/dist/features/taintedLazarusPlayers.lua +1 -1
- package/dist/functions/benchmark.lua +8 -2
- package/dist/functions/debug.lua +1 -1
- package/dist/functions/deepCopy.lua +8 -8
- package/dist/functions/deepCopyTests.lua +1 -1
- package/dist/functions/globals.lua +6 -3
- package/dist/functions/hex.lua +7 -4
- package/dist/functions/jsonHelpers.lua +1 -1
- package/dist/functions/jsonRoom.lua +8 -2
- package/dist/functions/levelGrid.d.ts +3 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +11 -3
- package/dist/functions/log.d.ts +26 -26
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +209 -98
- package/dist/functions/logEntities.d.ts +8 -8
- package/dist/functions/logEntities.d.ts.map +1 -1
- package/dist/functions/logEntities.lua +21 -18
- package/dist/functions/mergeTests.lua +1 -1
- package/dist/functions/run.lua +5 -2
- package/dist/index.d.ts +38 -36
- package/package.json +2 -2
- package/src/features/customPickup.ts +5 -4
- package/src/features/customStage/exports.ts +0 -1
- package/src/functions/levelGrid.ts +12 -4
- package/src/functions/log.ts +23 -48
- package/src/functions/logEntities.ts +6 -8
- package/src/lib/jsonLua.d.ts +4 -2
|
@@ -116,14 +116,17 @@ function playerIsAboutToDie(self, player)
|
|
|
116
116
|
if futurePlayer:IsDead() then
|
|
117
117
|
return
|
|
118
118
|
end
|
|
119
|
-
logError("The player is still alive after initializing a custom revive. Explicitly killing the player.")
|
|
119
|
+
logError(nil, "The player is still alive after initializing a custom revive. Explicitly killing the player.")
|
|
120
120
|
futurePlayer:Kill()
|
|
121
121
|
end
|
|
122
122
|
)
|
|
123
123
|
end
|
|
124
124
|
function logStateChanged(self)
|
|
125
125
|
if DEBUG then
|
|
126
|
-
log(
|
|
126
|
+
log(
|
|
127
|
+
nil,
|
|
128
|
+
((("Custom revive state changed: " .. tostring(CustomReviveState[v.run.state])) .. " (") .. tostring(v.run.state)) .. ")"
|
|
129
|
+
)
|
|
127
130
|
end
|
|
128
131
|
end
|
|
129
132
|
DEBUG = false
|
|
@@ -38,14 +38,14 @@ function checkRoomChanged(self)
|
|
|
38
38
|
if topLeftWall == nil then
|
|
39
39
|
topLeftWall = spawnGridEntity(nil, GridEntityType.WALL, topLeftWallGridIndex)
|
|
40
40
|
if topLeftWall == nil then
|
|
41
|
-
logError("Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.")
|
|
41
|
+
logError(nil, "Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.")
|
|
42
42
|
return
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
if topLeftWall2 == nil then
|
|
46
46
|
topLeftWall2 = spawnGridEntity(nil, GridEntityType.WALL, rightOfTopWallGridIndex)
|
|
47
47
|
if topLeftWall2 == nil then
|
|
48
|
-
logError("Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.")
|
|
48
|
+
logError(nil, "Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.")
|
|
49
49
|
return
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -22,5 +22,5 @@ import { PickupVariant } from "isaac-typescript-definitions";
|
|
|
22
22
|
* this function if your pickup should only be able to be collected under
|
|
23
23
|
* certain conditions.
|
|
24
24
|
*/
|
|
25
|
-
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (player: EntityPlayer) => void, collisionFunc?: (player: EntityPlayer) => boolean): void;
|
|
25
|
+
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void;
|
|
26
26
|
//# sourceMappingURL=customPickup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customPickup.d.ts","sourceRoot":"","sources":["../../src/features/customPickup.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"customPickup.d.ts","sourceRoot":"","sources":["../../src/features/customPickup.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACd,MAAM,8BAA8B,CAAC;AA6FtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,aAAa,EAClC,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,EACvD,aAAa,GAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,KAAK,OAAoB,GACxE,IAAI,CAaN"}
|
|
@@ -24,7 +24,7 @@ function prePickupCollision(self, pickup, collider)
|
|
|
24
24
|
if player == nil then
|
|
25
25
|
return nil
|
|
26
26
|
end
|
|
27
|
-
local shouldPickup = customPickupFunctions
|
|
27
|
+
local shouldPickup = customPickupFunctions.collisionFunc(player)
|
|
28
28
|
if not shouldPickup then
|
|
29
29
|
return nil
|
|
30
30
|
end
|
|
@@ -35,7 +35,7 @@ function prePickupCollision(self, pickup, collider)
|
|
|
35
35
|
local effectSprite = effect:GetSprite()
|
|
36
36
|
effectSprite:Load(fileName, true)
|
|
37
37
|
effectSprite:Play("Collect", true)
|
|
38
|
-
customPickupFunctions
|
|
38
|
+
customPickupFunctions.collectFunc(player)
|
|
39
39
|
return nil
|
|
40
40
|
end
|
|
41
41
|
function postEffectRenderPickupEffect(self, effect)
|
|
@@ -57,11 +57,17 @@ function ____exports.getRandomCustomStageRoom(self, roomsMetadata, seedOrRNG, ve
|
|
|
57
57
|
end
|
|
58
58
|
local totalWeight = getTotalWeightOfCustomStageRooms(nil, roomsMetadata)
|
|
59
59
|
if verbose then
|
|
60
|
-
log(
|
|
60
|
+
log(
|
|
61
|
+
nil,
|
|
62
|
+
"Total weight of the custom stage rooms provided: " .. tostring(totalWeight)
|
|
63
|
+
)
|
|
61
64
|
end
|
|
62
65
|
local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
63
66
|
if verbose then
|
|
64
|
-
log(
|
|
67
|
+
log(
|
|
68
|
+
nil,
|
|
69
|
+
"Randomly chose weight for custom stage room: " .. tostring(chosenWeight)
|
|
70
|
+
)
|
|
65
71
|
end
|
|
66
72
|
return getCustomStageRoomWithChosenWeight(nil, roomsMetadata, chosenWeight)
|
|
67
73
|
end
|
|
@@ -74,11 +80,17 @@ function ____exports.getRandomBossRoomFromPool(self, roomsMetadata, bossPool, se
|
|
|
74
80
|
end
|
|
75
81
|
local totalWeight = getTotalWeightOfBossPool(nil, bossPool)
|
|
76
82
|
if verbose then
|
|
77
|
-
log(
|
|
83
|
+
log(
|
|
84
|
+
nil,
|
|
85
|
+
"Total weight of the custom stage boss pool provided: " .. tostring(totalWeight)
|
|
86
|
+
)
|
|
78
87
|
end
|
|
79
88
|
local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
80
89
|
if verbose then
|
|
81
|
-
log(
|
|
90
|
+
log(
|
|
91
|
+
nil,
|
|
92
|
+
"Randomly chose weight for custom stage boss pool: " .. tostring(chosenWeight)
|
|
93
|
+
)
|
|
82
94
|
end
|
|
83
95
|
local bossEntry = getBossEntryWithChosenWeight(nil, bossPool, chosenWeight)
|
|
84
96
|
local roomsMetadataForBoss = __TS__ArrayFilter(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/exports.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,UAAU,EAGV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAoBtC,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,YAAmB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI,CAqDN;AAkGD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
|
@@ -48,20 +48,29 @@ function setStageRoomsData(self, customStage, rng, verbose)
|
|
|
48
48
|
local roomShapeMap = customStage.roomTypeMap:get(roomType)
|
|
49
49
|
if roomShapeMap == nil then
|
|
50
50
|
if roomType == RoomType.DEFAULT then
|
|
51
|
-
logError(
|
|
51
|
+
logError(
|
|
52
|
+
nil,
|
|
53
|
+
(((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name
|
|
54
|
+
)
|
|
52
55
|
end
|
|
53
56
|
goto __continue7
|
|
54
57
|
end
|
|
55
58
|
local roomShape = room.Data.Shape
|
|
56
59
|
local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
|
|
57
60
|
if roomDoorSlotFlagMap == nil then
|
|
58
|
-
logError(
|
|
61
|
+
logError(
|
|
62
|
+
nil,
|
|
63
|
+
(((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name
|
|
64
|
+
)
|
|
59
65
|
goto __continue7
|
|
60
66
|
end
|
|
61
67
|
local doorSlotFlags = room.Data.Doors
|
|
62
68
|
local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
|
|
63
69
|
if roomsMetadata == nil then
|
|
64
|
-
logError(
|
|
70
|
+
logError(
|
|
71
|
+
nil,
|
|
72
|
+
(((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name
|
|
73
|
+
)
|
|
65
74
|
local header = ("For reference, a DoorSlotFlags of " .. tostring(doorSlotFlags)) .. " is equal to the following doors being enabled:\n"
|
|
66
75
|
local doorSlots = doorSlotFlagsToDoorSlots(nil, doorSlotFlags)
|
|
67
76
|
local doorSlotLines = __TS__ArrayMap(
|
|
@@ -69,7 +78,7 @@ function setStageRoomsData(self, customStage, rng, verbose)
|
|
|
69
78
|
function(____, doorSlot) return ((("- DoorSlot." .. tostring(DoorSlot[doorSlot])) .. " (") .. tostring(doorSlot)) .. ")" end
|
|
70
79
|
)
|
|
71
80
|
local explanation = header .. table.concat(doorSlotLines, "\n")
|
|
72
|
-
logError(explanation)
|
|
81
|
+
logError(nil, explanation)
|
|
73
82
|
goto __continue7
|
|
74
83
|
end
|
|
75
84
|
local randomRoom
|
|
@@ -91,7 +100,10 @@ function setStageRoomsData(self, customStage, rng, verbose)
|
|
|
91
100
|
if newRoomData == nil then
|
|
92
101
|
newRoomData = getRoomDataForTypeVariant(nil, roomType, randomRoom.variant, false)
|
|
93
102
|
if newRoomData == nil then
|
|
94
|
-
logError(
|
|
103
|
+
logError(
|
|
104
|
+
nil,
|
|
105
|
+
(("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name
|
|
106
|
+
)
|
|
95
107
|
goto __continue7
|
|
96
108
|
end
|
|
97
109
|
customStageCachedRoomData:set(randomRoom.variant, newRoomData)
|
|
@@ -244,7 +244,10 @@ function spawnAllEntities(self, jsonRoom, rng, verbose)
|
|
|
244
244
|
if entityTypeNumber >= 1000 then
|
|
245
245
|
local gridEntityXMLType = entityTypeNumber
|
|
246
246
|
if verbose then
|
|
247
|
-
log(
|
|
247
|
+
log(
|
|
248
|
+
nil,
|
|
249
|
+
((((((("Spawning grid entity " .. tostring(gridEntityXMLType)) .. ".") .. tostring(variant)) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")"
|
|
250
|
+
)
|
|
248
251
|
end
|
|
249
252
|
spawnGridEntityForJSONRoom(
|
|
250
253
|
nil,
|
|
@@ -257,7 +260,10 @@ function spawnAllEntities(self, jsonRoom, rng, verbose)
|
|
|
257
260
|
local entityType = entityTypeNumber
|
|
258
261
|
if verbose then
|
|
259
262
|
local entityID = getEntityIDFromConstituents(nil, entityType, variant, subType)
|
|
260
|
-
log(
|
|
263
|
+
log(
|
|
264
|
+
nil,
|
|
265
|
+
((((("Spawning normal entity " .. entityID) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")"
|
|
266
|
+
)
|
|
261
267
|
end
|
|
262
268
|
local entity = spawnNormalEntityForJSONRoom(
|
|
263
269
|
nil,
|
|
@@ -276,11 +282,11 @@ function spawnAllEntities(self, jsonRoom, rng, verbose)
|
|
|
276
282
|
end
|
|
277
283
|
if shouldUnclearRoom then
|
|
278
284
|
if verbose then
|
|
279
|
-
log("Setting the room to be uncleared since there were one or more battle NPCs spawned.")
|
|
285
|
+
log(nil, "Setting the room to be uncleared since there were one or more battle NPCs spawned.")
|
|
280
286
|
end
|
|
281
287
|
setRoomUncleared(nil)
|
|
282
288
|
elseif verbose then
|
|
283
|
-
log("Leaving the room cleared since there were no battle NPCs spawned.")
|
|
289
|
+
log(nil, "Leaving the room cleared since there were no battle NPCs spawned.")
|
|
284
290
|
end
|
|
285
291
|
end
|
|
286
292
|
function spawnGridEntityForJSONRoom(self, gridEntityXMLType, gridEntityXMLVariant, x, y)
|
|
@@ -511,18 +517,18 @@ function ____exports.deployJSONRoom(self, jsonRoom, seedOrRNG, verbose)
|
|
|
511
517
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
512
518
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
513
519
|
if verbose then
|
|
514
|
-
log("Starting to empty the room of entities and grid entities.")
|
|
520
|
+
log(nil, "Starting to empty the room of entities and grid entities.")
|
|
515
521
|
end
|
|
516
522
|
____exports.emptyRoom(nil, false)
|
|
517
523
|
if verbose then
|
|
518
|
-
log("Finished emptying the room of entities and grid entities.")
|
|
524
|
+
log(nil, "Finished emptying the room of entities and grid entities.")
|
|
519
525
|
end
|
|
520
526
|
if verbose then
|
|
521
|
-
log("Starting to spawn all of the new entities and grid entities.")
|
|
527
|
+
log(nil, "Starting to spawn all of the new entities and grid entities.")
|
|
522
528
|
end
|
|
523
529
|
spawnAllEntities(nil, jsonRoom, rng, verbose)
|
|
524
530
|
if verbose then
|
|
525
|
-
log("Finished spawning all of the new entities and grid entities.")
|
|
531
|
+
log(nil, "Finished spawning all of the new entities and grid entities.")
|
|
526
532
|
end
|
|
527
533
|
fixPitGraphics(nil)
|
|
528
534
|
fillRoomWithDecorations(nil)
|
|
@@ -563,7 +569,7 @@ function ____exports.deployRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
|
563
569
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
564
570
|
local randomJSONRoom = getRandomJSONRoom(nil, jsonRooms, rng, verbose)
|
|
565
571
|
if verbose then
|
|
566
|
-
log((((((("Randomly chose JSON room " .. randomJSONRoom["$"].type) .. ".") .. randomJSONRoom["$"].variant) .. ".") .. randomJSONRoom["$"].subtype) .. " with name: ") .. randomJSONRoom["$"].name)
|
|
572
|
+
log(nil, (((((("Randomly chose JSON room " .. randomJSONRoom["$"].type) .. ".") .. randomJSONRoom["$"].variant) .. ".") .. randomJSONRoom["$"].subtype) .. " with name: ") .. randomJSONRoom["$"].name)
|
|
567
573
|
end
|
|
568
574
|
return ____exports.deployJSONRoom(nil, randomJSONRoom, rng, verbose)
|
|
569
575
|
end
|
|
@@ -72,7 +72,7 @@ function ____exports.listEntities(self, params, includeBackgroundEffects)
|
|
|
72
72
|
return
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
|
-
logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
75
|
+
logAllEntities(nil, includeBackgroundEffects, entityTypeFilter)
|
|
76
76
|
printConsole(nil, "Logged the entities in the room to the \"log.txt\" file.")
|
|
77
77
|
end
|
|
78
78
|
function ____exports.listGridEntities(self, params, includeWalls)
|
|
@@ -84,7 +84,7 @@ function ____exports.listGridEntities(self, params, includeWalls)
|
|
|
84
84
|
return
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
-
logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
87
|
+
logAllGridEntities(nil, includeWalls, gridEntityTypeFilter)
|
|
88
88
|
printConsole(nil, "Logged the grid entities in the room to the \"log.txt\" file.")
|
|
89
89
|
end
|
|
90
90
|
function ____exports.movePlayer(self, params, direction)
|
|
@@ -550,7 +550,7 @@ end
|
|
|
550
550
|
--- Logs the player's current temporary effects to the "log.txt" file.
|
|
551
551
|
function ____exports.effects(self)
|
|
552
552
|
local player = Isaac.GetPlayer()
|
|
553
|
-
logPlayerEffects(player)
|
|
553
|
+
logPlayerEffects(nil, player)
|
|
554
554
|
printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
|
|
555
555
|
end
|
|
556
556
|
--- Alias for the "iAmError" command.
|
|
@@ -900,7 +900,7 @@ function ____exports.right(self, params)
|
|
|
900
900
|
end
|
|
901
901
|
--- Logs information about the room to the "log.txt" file.
|
|
902
902
|
function ____exports.room(self)
|
|
903
|
-
logRoom()
|
|
903
|
+
logRoom(nil)
|
|
904
904
|
printConsole(nil, "Logged room information to the \"log.txt\" file.")
|
|
905
905
|
end
|
|
906
906
|
--- Gives a rotten heart. Provide a number to give a custom amount of hearts. (You can use negative
|
|
@@ -970,7 +970,7 @@ function ____exports.seedStick(self)
|
|
|
970
970
|
end
|
|
971
971
|
--- Logs all of the current run's seed effects to the "log.txt" file.
|
|
972
972
|
function ____exports.seeds(self)
|
|
973
|
-
logSeedEffects()
|
|
973
|
+
logSeedEffects(nil)
|
|
974
974
|
printConsole(nil, "Logged the seed effects to the \"log.txt\" file.")
|
|
975
975
|
end
|
|
976
976
|
--- Sets a charge to the player's specified active item. You must provide the active slot number and
|
|
@@ -1090,7 +1090,7 @@ function ____exports.soulHearts(self, params)
|
|
|
1090
1090
|
end
|
|
1091
1091
|
--- Logs all of the currently playing sound effects to the "log.txt" file.
|
|
1092
1092
|
function ____exports.sounds(self)
|
|
1093
|
-
logSounds()
|
|
1093
|
+
logSounds(nil)
|
|
1094
1094
|
printConsole(nil, "Logged the currently playing sound effects to the \"log.txt\" file.")
|
|
1095
1095
|
end
|
|
1096
1096
|
--- Toggles spamming Blood Rights on every frame. Useful for killing enemies very fast without using
|
package/dist/features/pause.lua
CHANGED
|
@@ -99,7 +99,7 @@ end
|
|
|
99
99
|
-- - disables any player inputs (except for `ButtonAction.MENU_CONFIRM` and `ButtonAction.CONSOLE`)
|
|
100
100
|
function ____exports.pause(self)
|
|
101
101
|
if v.run.isPseudoPaused then
|
|
102
|
-
logError("Failed to pseudo-pause the game, since it was already pseudo-paused.")
|
|
102
|
+
logError(nil, "Failed to pseudo-pause the game, since it was already pseudo-paused.")
|
|
103
103
|
return
|
|
104
104
|
end
|
|
105
105
|
v.run.isPseudoPaused = true
|
|
@@ -135,7 +135,7 @@ end
|
|
|
135
135
|
--- Helper function to put things back to normal after the `pause` function was used.
|
|
136
136
|
function ____exports.unpause(self)
|
|
137
137
|
if not v.run.isPseudoPaused then
|
|
138
|
-
logError("Failed to pseudo-unpause the game, since it was not already pseudo-paused.")
|
|
138
|
+
logError(nil, "Failed to pseudo-unpause the game, since it was not already pseudo-paused.")
|
|
139
139
|
return
|
|
140
140
|
end
|
|
141
141
|
v.run.isPseudoPaused = false
|
|
@@ -21,7 +21,10 @@ function readSaveDatFile(self, mod)
|
|
|
21
21
|
local renderFrameCount = Isaac.GetFrameCount()
|
|
22
22
|
local ok, jsonStringOrErrMsg = pcall(tryLoadModData, mod)
|
|
23
23
|
if not ok then
|
|
24
|
-
logError(
|
|
24
|
+
logError(
|
|
25
|
+
nil,
|
|
26
|
+
(("Failed to read from the \"save#.dat\" file on render frame " .. tostring(renderFrameCount)) .. ": ") .. jsonStringOrErrMsg
|
|
27
|
+
)
|
|
25
28
|
return DEFAULT_MOD_DATA
|
|
26
29
|
end
|
|
27
30
|
if jsonStringOrErrMsg == nil then
|
|
@@ -44,7 +47,7 @@ function ____exports.loadFromDisk(self, mod, oldSaveData)
|
|
|
44
47
|
local jsonString = readSaveDatFile(nil, mod)
|
|
45
48
|
local newSaveData = jsonDecode(nil, jsonString)
|
|
46
49
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
47
|
-
log("Converted data from the \"save#.dat\" to a Lua table.")
|
|
50
|
+
log(nil, "Converted data from the \"save#.dat\" to a Lua table.")
|
|
48
51
|
end
|
|
49
52
|
iterateTableInOrder(
|
|
50
53
|
nil,
|
|
@@ -61,12 +64,12 @@ function ____exports.loadFromDisk(self, mod, oldSaveData)
|
|
|
61
64
|
return
|
|
62
65
|
end
|
|
63
66
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
64
|
-
log("Merging in stored data for feature: " .. key)
|
|
67
|
+
log(nil, "Merging in stored data for feature: " .. key)
|
|
65
68
|
end
|
|
66
69
|
merge(nil, oldSaveDataForSubscriber, value, key)
|
|
67
70
|
end,
|
|
68
71
|
SAVE_DATA_MANAGER_DEBUG
|
|
69
72
|
)
|
|
70
|
-
log(("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " loaded data from the \"save#.dat\" file.")
|
|
73
|
+
log(nil, ("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " loaded data from the \"save#.dat\" file.")
|
|
71
74
|
end
|
|
72
75
|
return ____exports
|
|
@@ -93,12 +93,12 @@ function ____exports.restoreDefaultSaveData(self, subscriberName, saveData, save
|
|
|
93
93
|
end
|
|
94
94
|
local saveDataDefaults = saveDataDefaultsMap[subscriberName]
|
|
95
95
|
if saveDataDefaults == nil then
|
|
96
|
-
logError("Failed to find the default copy of the save data for subscriber: " .. subscriberName)
|
|
96
|
+
logError(nil, "Failed to find the default copy of the save data for subscriber: " .. subscriberName)
|
|
97
97
|
return
|
|
98
98
|
end
|
|
99
99
|
local childTableDefaults = saveDataDefaults[saveDataKey]
|
|
100
100
|
if childTableDefaults == nil then
|
|
101
|
-
logError(((("Failed to find the default copy of the child table \"" .. saveDataKey) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your save data is out of date. You can try purging all of your save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
|
|
101
|
+
logError(nil, ((("Failed to find the default copy of the child table \"" .. saveDataKey) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your save data is out of date. You can try purging all of your save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
|
|
102
102
|
return
|
|
103
103
|
end
|
|
104
104
|
local childTableDefaultsCopy = deepCopy(nil, childTableDefaults, SerializationType.NONE, (subscriberName .. " --> ") .. saveDataKey)
|
|
@@ -54,7 +54,7 @@ local isSerializationBrand = ____serializationBrands.isSerializationBrand
|
|
|
54
54
|
-- run-time errors. In such cases, users will have to manually delete their save data.
|
|
55
55
|
function ____exports.merge(self, oldObject, newTable, traversalDescription)
|
|
56
56
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
57
|
-
log("merge is traversing: " .. traversalDescription)
|
|
57
|
+
log(nil, "merge is traversing: " .. traversalDescription)
|
|
58
58
|
end
|
|
59
59
|
if not isTable(nil, oldObject) then
|
|
60
60
|
error("The first argument given to the merge function is not a table.")
|
|
@@ -123,14 +123,14 @@ function mergeTable(self, oldTable, newTable, traversalDescription)
|
|
|
123
123
|
function(____, key, value)
|
|
124
124
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
125
125
|
local valueToPrint = value == "" and "(empty string)" or tostring(value)
|
|
126
|
-
log((("merge is merging: " .. traversalDescription) .. " --> ") .. valueToPrint)
|
|
126
|
+
log(nil, (("merge is merging: " .. traversalDescription) .. " --> ") .. valueToPrint)
|
|
127
127
|
end
|
|
128
128
|
if isSerializationBrand(nil, key) then
|
|
129
129
|
return
|
|
130
130
|
end
|
|
131
131
|
if isSerializedIsaacAPIClass(nil, value) then
|
|
132
132
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
133
|
-
log("merge found a serialized Isaac API class.")
|
|
133
|
+
log(nil, "merge found a serialized Isaac API class.")
|
|
134
134
|
end
|
|
135
135
|
local deserializedObject = deserializeIsaacAPIClass(nil, value)
|
|
136
136
|
oldTable[key] = deserializedObject
|
|
@@ -43,6 +43,6 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
|
|
|
43
43
|
local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
|
|
44
44
|
local jsonString = jsonEncode(nil, allSaveData)
|
|
45
45
|
mod:SaveData(jsonString)
|
|
46
|
-
log(("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " wrote data to the \"save#.dat\" file.")
|
|
46
|
+
log(nil, ("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " wrote data to the \"save#.dat\" file.")
|
|
47
47
|
end
|
|
48
48
|
return ____exports
|
|
@@ -37,7 +37,7 @@ function checkDequeue(self)
|
|
|
37
37
|
local taintedLazarusPtrHash = GetPtrHash(taintedLazarus)
|
|
38
38
|
local deadTaintedLazarusPtrHash = GetPtrHash(deadTaintedLazarus)
|
|
39
39
|
if taintedLazarusPtrHash == deadTaintedLazarusPtrHash then
|
|
40
|
-
logError("Failed to cache the Tainted Lazarus player objects, since the hash for Tainted Lazarus and Dead Tainted Lazarus were the same.")
|
|
40
|
+
logError(nil, "Failed to cache the Tainted Lazarus player objects, since the hash for Tainted Lazarus and Dead Tainted Lazarus were the same.")
|
|
41
41
|
return
|
|
42
42
|
end
|
|
43
43
|
v.run.subPlayerMap:set(taintedLazarusPtrHash, deadTaintedLazarus)
|
|
@@ -16,7 +16,10 @@ local log = ____log.log
|
|
|
16
16
|
-- be printed to the log.)
|
|
17
17
|
function ____exports.benchmark(self, numTrials, ...)
|
|
18
18
|
local functions = {...}
|
|
19
|
-
log(
|
|
19
|
+
log(
|
|
20
|
+
nil,
|
|
21
|
+
((("Benchmarking " .. tostring(#functions)) .. " function(s) with ") .. tostring(numTrials)) .. " trials."
|
|
22
|
+
)
|
|
20
23
|
local averages = {}
|
|
21
24
|
__TS__ArrayForEach(
|
|
22
25
|
functions,
|
|
@@ -34,7 +37,10 @@ function ____exports.benchmark(self, numTrials, ...)
|
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
local averageTimeMilliseconds = totalTimeMilliseconds / numTrials
|
|
37
|
-
log(
|
|
40
|
+
log(
|
|
41
|
+
nil,
|
|
42
|
+
((("The average time of the function at index " .. tostring(i)) .. " is: ") .. tostring(averageTimeMilliseconds)) .. " milliseconds"
|
|
43
|
+
)
|
|
38
44
|
averages[#averages + 1] = averageTimeMilliseconds
|
|
39
45
|
end
|
|
40
46
|
)
|
package/dist/functions/debug.lua
CHANGED
|
@@ -83,7 +83,7 @@ end
|
|
|
83
83
|
-- enabled.
|
|
84
84
|
function ____exports.traceback(self)
|
|
85
85
|
local tracebackOutput = ____exports.getTraceback(nil)
|
|
86
|
-
log(tracebackOutput)
|
|
86
|
+
log(nil, tracebackOutput)
|
|
87
87
|
end
|
|
88
88
|
local function setDebugFunctionsGlobal(self)
|
|
89
89
|
if _G.debug == nil and sandboxGetTraceback == nil then
|
|
@@ -96,7 +96,7 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
|
|
|
96
96
|
logString = logString .. " (deserializing)"
|
|
97
97
|
end
|
|
98
98
|
logString = logString .. ": " .. tostring(value)
|
|
99
|
-
log(logString)
|
|
99
|
+
log(nil, logString)
|
|
100
100
|
end
|
|
101
101
|
local valueType = type(value)
|
|
102
102
|
repeat
|
|
@@ -204,7 +204,7 @@ function deepCopyTable(self, luaMap, serializationType, traversalDescription, in
|
|
|
204
204
|
end
|
|
205
205
|
function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription, insideMap)
|
|
206
206
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
207
|
-
log("deepCopy is copying a DefaultMap.")
|
|
207
|
+
log(nil, "deepCopy is copying a DefaultMap.")
|
|
208
208
|
end
|
|
209
209
|
local ____isDefaultMap_result_0
|
|
210
210
|
if isDefaultMap(nil, defaultMap) then
|
|
@@ -297,7 +297,7 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
|
|
|
297
297
|
end
|
|
298
298
|
function deepCopyMap(self, map, serializationType, traversalDescription, insideMap)
|
|
299
299
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
300
|
-
log("deepCopy is copying a Map.")
|
|
300
|
+
log(nil, "deepCopy is copying a Map.")
|
|
301
301
|
end
|
|
302
302
|
local newMap
|
|
303
303
|
if serializationType == SerializationType.SERIALIZE then
|
|
@@ -337,7 +337,7 @@ function deepCopyMap(self, map, serializationType, traversalDescription, insideM
|
|
|
337
337
|
end
|
|
338
338
|
function deepCopySet(self, set, serializationType, traversalDescription, insideMap)
|
|
339
339
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
340
|
-
log("deepCopy is copying a Set.")
|
|
340
|
+
log(nil, "deepCopy is copying a Set.")
|
|
341
341
|
end
|
|
342
342
|
local newSet
|
|
343
343
|
if serializationType == SerializationType.SERIALIZE then
|
|
@@ -374,7 +374,7 @@ function deepCopySet(self, set, serializationType, traversalDescription, insideM
|
|
|
374
374
|
end
|
|
375
375
|
function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescription, insideMap)
|
|
376
376
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
377
|
-
log("deepCopy is copying a TSTL class.")
|
|
377
|
+
log(nil, "deepCopy is copying a TSTL class.")
|
|
378
378
|
end
|
|
379
379
|
local newClass
|
|
380
380
|
if serializationType == SerializationType.SERIALIZE then
|
|
@@ -403,7 +403,7 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
|
|
|
403
403
|
end
|
|
404
404
|
function deepCopyArray(self, array, serializationType, traversalDescription, insideMap)
|
|
405
405
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
406
|
-
log("deepCopy is copying an array.")
|
|
406
|
+
log(nil, "deepCopy is copying an array.")
|
|
407
407
|
end
|
|
408
408
|
local newArray = {}
|
|
409
409
|
for ____, value in ipairs(array) do
|
|
@@ -420,7 +420,7 @@ function deepCopyArray(self, array, serializationType, traversalDescription, ins
|
|
|
420
420
|
end
|
|
421
421
|
function deepCopyNormalLuaTable(self, luaMap, serializationType, traversalDescription, insideMap)
|
|
422
422
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
423
|
-
log("deepCopy is copying a normal Lua table.")
|
|
423
|
+
log(nil, "deepCopy is copying a normal Lua table.")
|
|
424
424
|
end
|
|
425
425
|
local newTable = {}
|
|
426
426
|
local ____getCopiedEntries_result_5 = getCopiedEntries(
|
|
@@ -517,7 +517,7 @@ function checkMetatable(self, luaMap, traversalDescription)
|
|
|
517
517
|
end
|
|
518
518
|
function deepCopyUserdata(self, value, serializationType, traversalDescription)
|
|
519
519
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
520
|
-
log("deepCopy is copying userdata.")
|
|
520
|
+
log(nil, "deepCopy is copying userdata.")
|
|
521
521
|
end
|
|
522
522
|
local classType = getIsaacAPIClassName(nil, value)
|
|
523
523
|
if classType == nil then
|
|
@@ -373,7 +373,7 @@ function ____exports.runDeepCopyTests(self)
|
|
|
373
373
|
copiedSerializedDefaultMapHasStringKey(nil)
|
|
374
374
|
copiedSerializedDefaultMapHasNumberKey(nil)
|
|
375
375
|
local successText = "All deep copy tests passed!"
|
|
376
|
-
log(successText)
|
|
376
|
+
log(nil, successText)
|
|
377
377
|
printConsole(nil, successText)
|
|
378
378
|
end
|
|
379
379
|
return ____exports
|
|
@@ -216,9 +216,9 @@ function ____exports.getNewGlobals(self)
|
|
|
216
216
|
end
|
|
217
217
|
function ____exports.logNewGlobals(self)
|
|
218
218
|
local newGlobals = ____exports.getNewGlobals(nil)
|
|
219
|
-
log("List of added global variables in the Isaac environment:")
|
|
219
|
+
log(nil, "List of added global variables in the Isaac environment:")
|
|
220
220
|
if #newGlobals == 0 then
|
|
221
|
-
log("- n/a (no extra global variables found)")
|
|
221
|
+
log(nil, "- n/a (no extra global variables found)")
|
|
222
222
|
end
|
|
223
223
|
__TS__ArrayForEach(
|
|
224
224
|
newGlobals,
|
|
@@ -227,7 +227,10 @@ function ____exports.logNewGlobals(self)
|
|
|
227
227
|
local key
|
|
228
228
|
key = ____bindingPattern0[1]
|
|
229
229
|
value = ____bindingPattern0[2]
|
|
230
|
-
log(
|
|
230
|
+
log(
|
|
231
|
+
nil,
|
|
232
|
+
(((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value)
|
|
233
|
+
)
|
|
231
234
|
end
|
|
232
235
|
)
|
|
233
236
|
end
|
package/dist/functions/hex.lua
CHANGED
|
@@ -8,25 +8,28 @@ local logError = ____log.logError
|
|
|
8
8
|
function hexToRGB(self, hexString)
|
|
9
9
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
10
10
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
11
|
-
logError(
|
|
11
|
+
logError(
|
|
12
|
+
nil,
|
|
13
|
+
"Hex strings must be of length: " .. tostring(HEX_STRING_LENGTH)
|
|
14
|
+
)
|
|
12
15
|
return {0, 0, 0}
|
|
13
16
|
end
|
|
14
17
|
local rString = __TS__StringSubstring(hexString, 0, 2)
|
|
15
18
|
local r = tonumber("0x" .. rString)
|
|
16
19
|
if r == nil then
|
|
17
|
-
logError(("Failed to convert `0x" .. rString) .. "` to a number.")
|
|
20
|
+
logError(nil, ("Failed to convert `0x" .. rString) .. "` to a number.")
|
|
18
21
|
return {0, 0, 0}
|
|
19
22
|
end
|
|
20
23
|
local gString = __TS__StringSubstring(hexString, 2, 4)
|
|
21
24
|
local g = tonumber("0x" .. gString)
|
|
22
25
|
if g == nil then
|
|
23
|
-
logError(("Failed to convert `0x" .. gString) .. "` to a number.")
|
|
26
|
+
logError(nil, ("Failed to convert `0x" .. gString) .. "` to a number.")
|
|
24
27
|
return {0, 0, 0}
|
|
25
28
|
end
|
|
26
29
|
local bString = __TS__StringSubstring(hexString, 4, 6)
|
|
27
30
|
local b = tonumber("0x" .. bString)
|
|
28
31
|
if b == nil then
|
|
29
|
-
logError(("Failed to convert `0x" .. bString) .. "` to a number.")
|
|
32
|
+
logError(nil, ("Failed to convert `0x" .. bString) .. "` to a number.")
|
|
30
33
|
return {0, 0, 0}
|
|
31
34
|
end
|
|
32
35
|
return {r, g, b}
|
|
@@ -20,7 +20,7 @@ end
|
|
|
20
20
|
function ____exports.jsonDecode(self, jsonString)
|
|
21
21
|
local ok, luaTableOrErrMsg = pcall(tryDecode, jsonString)
|
|
22
22
|
if not ok then
|
|
23
|
-
logError("Failed to convert the JSON string to a Lua table: " .. jsonString)
|
|
23
|
+
logError(nil, "Failed to convert the JSON string to a Lua table: " .. jsonString)
|
|
24
24
|
return {}
|
|
25
25
|
end
|
|
26
26
|
return luaTableOrErrMsg
|
|
@@ -142,11 +142,17 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
|
142
142
|
end
|
|
143
143
|
local totalWeight = getTotalWeightOfJSONRooms(nil, jsonRooms)
|
|
144
144
|
if verbose then
|
|
145
|
-
log(
|
|
145
|
+
log(
|
|
146
|
+
nil,
|
|
147
|
+
"Total weight of the JSON rooms provided: " .. tostring(totalWeight)
|
|
148
|
+
)
|
|
146
149
|
end
|
|
147
150
|
local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
148
151
|
if verbose then
|
|
149
|
-
log(
|
|
152
|
+
log(
|
|
153
|
+
nil,
|
|
154
|
+
"Randomly chose weight for JSON room: " .. tostring(chosenWeight)
|
|
155
|
+
)
|
|
150
156
|
end
|
|
151
157
|
return getJSONRoomWithChosenWeight(nil, jsonRooms, chosenWeight)
|
|
152
158
|
end
|
|
@@ -165,10 +165,12 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
|
|
|
165
165
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
166
166
|
* you want to modify this, use the `setRoomData` helper function.
|
|
167
167
|
*
|
|
168
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
169
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
168
170
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
169
171
|
* place a room.
|
|
170
172
|
*/
|
|
171
|
-
export declare function newRoom(): int | undefined;
|
|
173
|
+
export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
|
|
172
174
|
/**
|
|
173
175
|
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
174
176
|
* has non-undefined data in the room descriptor.)
|