isaacscript-common 1.0.313 → 1.0.317
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.
|
@@ -3,10 +3,13 @@ local ____exports = {}
|
|
|
3
3
|
local postGameStartedReordered = require("callbacks.subscriptions.postGameStartedReordered")
|
|
4
4
|
local postNewLevelReordered = require("callbacks.subscriptions.postNewLevelReordered")
|
|
5
5
|
local postNewRoomReordered = require("callbacks.subscriptions.postNewRoomReordered")
|
|
6
|
-
local currentStage, currentStageType, forceNewLevel, forceNewRoom, hasSubscriptions, postGameStartedVanilla, postNewLevelVanilla, postNewRoomVanilla, recordCurrentStage
|
|
6
|
+
local currentStage, currentStageType, usedGlowingHourGlass, forceNewLevel, forceNewRoom, hasSubscriptions, useItemGlowingHourGlass, postGameStartedVanilla, postNewLevelVanilla, postNewRoomVanilla, recordCurrentStage
|
|
7
7
|
function hasSubscriptions(self)
|
|
8
8
|
return (postGameStartedReordered:hasSubscriptions() or postNewLevelReordered:hasSubscriptions()) or postNewRoomReordered:hasSubscriptions()
|
|
9
9
|
end
|
|
10
|
+
function useItemGlowingHourGlass(self)
|
|
11
|
+
usedGlowingHourGlass = true
|
|
12
|
+
end
|
|
10
13
|
function postGameStartedVanilla(self, isContinued)
|
|
11
14
|
if not hasSubscriptions(nil) then
|
|
12
15
|
return
|
|
@@ -39,6 +42,12 @@ function postNewRoomVanilla(self)
|
|
|
39
42
|
local level = game:GetLevel()
|
|
40
43
|
local stage = level:GetStage()
|
|
41
44
|
local stageType = level:GetStageType()
|
|
45
|
+
if usedGlowingHourGlass and ((currentStage ~= stage) or (currentStageType ~= stageType)) then
|
|
46
|
+
recordCurrentStage(nil)
|
|
47
|
+
postNewLevelReordered:fire()
|
|
48
|
+
postNewRoomReordered:fire()
|
|
49
|
+
return
|
|
50
|
+
end
|
|
42
51
|
if (((gameFrameCount == 0) or (currentStage ~= stage)) or (currentStageType ~= stageType)) and (not forceNewRoom) then
|
|
43
52
|
return
|
|
44
53
|
end
|
|
@@ -53,11 +62,13 @@ function recordCurrentStage(self)
|
|
|
53
62
|
currentStage = stage
|
|
54
63
|
currentStageType = stageType
|
|
55
64
|
end
|
|
56
|
-
currentStage =
|
|
57
|
-
currentStageType =
|
|
65
|
+
currentStage = nil
|
|
66
|
+
currentStageType = nil
|
|
67
|
+
usedGlowingHourGlass = false
|
|
58
68
|
forceNewLevel = false
|
|
59
69
|
forceNewRoom = false
|
|
60
70
|
function ____exports.init(self, mod)
|
|
71
|
+
mod:AddCallback(ModCallbacks.MC_USE_ITEM, useItemGlowingHourGlass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS)
|
|
61
72
|
mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, postGameStartedVanilla)
|
|
62
73
|
mod:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, postNewLevelVanilla)
|
|
63
74
|
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoomVanilla)
|
|
@@ -151,7 +151,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
|
|
|
151
151
|
if ((serializationType == ____exports.SerializationType.SERIALIZE) and isTSTLObject) and (keyType == "number") then
|
|
152
152
|
convertNumberKeysToString = true
|
|
153
153
|
local newTable = newObject
|
|
154
|
-
newTable[TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND] =
|
|
154
|
+
newTable[TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND] = ""
|
|
155
155
|
if DEBUG then
|
|
156
156
|
log(nil, "deepCopy is converting a TSTL map with number keys to strings.")
|
|
157
157
|
end
|
|
@@ -167,8 +167,6 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
|
|
|
167
167
|
local ____table = value
|
|
168
168
|
traversalDescription = ____exports.addTraversalDescription(nil, key, traversalDescription)
|
|
169
169
|
newValue = ____exports.deepCopy(nil, ____table, serializationType, traversalDescription)
|
|
170
|
-
elseif convertNumberKeysToString then
|
|
171
|
-
newValue = tostring(value)
|
|
172
170
|
else
|
|
173
171
|
newValue = value
|
|
174
172
|
end
|
|
@@ -177,14 +175,15 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
|
|
|
177
175
|
elseif __TS__InstanceOf(newObject, Set) then
|
|
178
176
|
newObject:add(key)
|
|
179
177
|
else
|
|
180
|
-
|
|
178
|
+
local keyToUse = (convertNumberKeysToString and tostring(key)) or key
|
|
179
|
+
newObject[keyToUse] = newValue
|
|
181
180
|
end
|
|
182
181
|
end
|
|
183
182
|
function copyVector(self, vector, serializationType)
|
|
184
183
|
if serializationType == ____exports.SerializationType.SERIALIZE then
|
|
185
184
|
local vectorTable = {}
|
|
186
|
-
vectorTable.X =
|
|
187
|
-
vectorTable.Y =
|
|
185
|
+
vectorTable.X = vector.X
|
|
186
|
+
vectorTable.Y = vector.Y
|
|
188
187
|
vectorTable[VECTOR_BRAND] = ""
|
|
189
188
|
return vectorTable
|
|
190
189
|
end
|
|
@@ -8,8 +8,8 @@ export declare function changeRoom(roomIndex: int): void;
|
|
|
8
8
|
/**
|
|
9
9
|
* This function will not work properly for the Death Certificate dimension. When in the Death
|
|
10
10
|
* Certificate dimension, this function will randomly return either `Dimension.SECONDARY` or
|
|
11
|
-
* `Dimension.DEATH_CERTIFICATE`.
|
|
12
|
-
*
|
|
11
|
+
* `Dimension.DEATH_CERTIFICATE`. Use the `inDeathCertificateArea` function instead for that
|
|
12
|
+
* purpose.
|
|
13
13
|
*/
|
|
14
14
|
export declare function getCurrentDimension(): Dimension;
|
|
15
15
|
export declare function getRoomData(): RoomConfig | undefined;
|
|
@@ -76,6 +76,11 @@ export declare function inBlueBabyRoom(): boolean;
|
|
|
76
76
|
* being in The Beast room.
|
|
77
77
|
*/
|
|
78
78
|
export declare function inCrawlspace(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* We cannot use the `inDimension` function for this since it is bugged with the Death Certificate
|
|
81
|
+
* area.
|
|
82
|
+
*/
|
|
83
|
+
export declare function inDeathCertificateArea(): boolean;
|
|
79
84
|
export declare function inDimension(dimension: Dimension): boolean;
|
|
80
85
|
export declare function inLRoom(): boolean;
|
|
81
86
|
export declare function inLambRoom(): boolean;
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -132,6 +132,11 @@ function ____exports.inCrawlspace(self)
|
|
|
132
132
|
local roomSubType = ____exports.getRoomSubType(nil)
|
|
133
133
|
return (roomIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
|
|
134
134
|
end
|
|
135
|
+
function ____exports.inDeathCertificateArea(self)
|
|
136
|
+
local roomStageID = ____exports.getRoomStageID(nil)
|
|
137
|
+
local roomSubType = ____exports.getRoomSubType(nil)
|
|
138
|
+
return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
|
|
139
|
+
end
|
|
135
140
|
function ____exports.inDimension(self, dimension)
|
|
136
141
|
return dimension == ____exports.getCurrentDimension(nil)
|
|
137
142
|
end
|