isaacscript-common 1.2.174 → 1.2.175
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/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -5
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -3
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +43 -0
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -22
- package/dist/features/extraConsoleCommands/init.lua +6 -6
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +51 -15
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -4
- package/dist/features/saveDataManager/merge.lua +5 -3
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -79
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -7
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -22
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -16
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -34
- package/dist/functions/gridEntity.d.ts +1 -1
- package/dist/functions/gridEntity.lua +5 -5
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -74
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -3
- package/dist/functions/player.d.ts +6 -8
- package/dist/functions/player.lua +22 -29
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -20
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -5
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -75
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -7
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -2
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -0
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +8 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
|
|
4
4
|
local ____cachedClasses = require("cachedClasses")
|
|
5
|
+
local game = ____cachedClasses.game
|
|
5
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
6
7
|
local ____constants = require("constants")
|
|
7
8
|
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
@@ -17,6 +18,8 @@ local hasFlag = ____flag.hasFlag
|
|
|
17
18
|
local ____pickups = require("functions.pickups")
|
|
18
19
|
local getPickups = ____pickups.getPickups
|
|
19
20
|
local removeAllPickups = ____pickups.removeAllPickups
|
|
21
|
+
local ____roomData = require("functions.roomData")
|
|
22
|
+
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
20
23
|
local ____sprite = require("functions.sprite")
|
|
21
24
|
local clearSprite = ____sprite.clearSprite
|
|
22
25
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
@@ -34,13 +37,6 @@ end
|
|
|
34
37
|
COLLECTIBLE_SPRITE_LAYER = 1
|
|
35
38
|
COLLECTIBLE_SHADOW_LAYER = 4
|
|
36
39
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
37
|
-
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
38
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
39
|
-
if itemConfigItem == nil then
|
|
40
|
-
return false
|
|
41
|
-
end
|
|
42
|
-
return itemConfigItem:HasTags(tag)
|
|
43
|
-
end
|
|
44
40
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
45
41
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
46
42
|
end
|
|
@@ -51,6 +47,13 @@ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
|
|
|
51
47
|
end
|
|
52
48
|
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
53
49
|
end
|
|
50
|
+
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
51
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
52
|
+
if itemConfigItem == nil then
|
|
53
|
+
return false
|
|
54
|
+
end
|
|
55
|
+
return itemConfigItem:HasTags(tag)
|
|
56
|
+
end
|
|
54
57
|
function ____exports.getCollectibleDescription(self, collectibleType)
|
|
55
58
|
local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
|
|
56
59
|
if collectibleDescription ~= nil then
|
|
@@ -85,19 +88,28 @@ function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
|
85
88
|
end
|
|
86
89
|
return itemConfigItem.GfxFileName
|
|
87
90
|
end
|
|
88
|
-
function ____exports.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return 0
|
|
91
|
+
function ____exports.getCollectibleIndex(self, collectible)
|
|
92
|
+
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
93
|
+
error("You cannot get a collectible index for pickups of variant: " .. tostring(collectible.Variant))
|
|
92
94
|
end
|
|
93
|
-
|
|
95
|
+
local level = game:GetLevel()
|
|
96
|
+
local stage = level:GetStage()
|
|
97
|
+
local stageType = level:GetStageType()
|
|
98
|
+
local room = game:GetRoom()
|
|
99
|
+
local roomType = room:GetType()
|
|
100
|
+
local gridIndex = room:GetGridIndex(collectible.Position)
|
|
101
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
102
|
+
if roomType == RoomType.ROOM_TREASURE then
|
|
103
|
+
return (((((tostring(stage) .. ",") .. tostring(stageType)) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
|
|
104
|
+
end
|
|
105
|
+
return (((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
|
|
94
106
|
end
|
|
95
|
-
function ____exports.
|
|
107
|
+
function ____exports.getCollectibleInitCharge(self, collectibleType)
|
|
96
108
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
97
109
|
if itemConfigItem == nil then
|
|
98
110
|
return 0
|
|
99
111
|
end
|
|
100
|
-
return itemConfigItem.
|
|
112
|
+
return itemConfigItem.InitCharge
|
|
101
113
|
end
|
|
102
114
|
function ____exports.getCollectibleItemType(self, collectibleType)
|
|
103
115
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
@@ -131,6 +143,13 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
131
143
|
local sprite = collectible:GetSprite()
|
|
132
144
|
return sprite:GetOverlayFrame()
|
|
133
145
|
end
|
|
146
|
+
function ____exports.getCollectibleQuality(self, collectibleType)
|
|
147
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
148
|
+
if itemConfigItem == nil then
|
|
149
|
+
return 0
|
|
150
|
+
end
|
|
151
|
+
return itemConfigItem.Quality
|
|
152
|
+
end
|
|
134
153
|
function ____exports.getCollectibles(self, matchingSubType)
|
|
135
154
|
if matchingSubType == nil then
|
|
136
155
|
matchingSubType = -1
|
|
@@ -140,6 +159,10 @@ end
|
|
|
140
159
|
function ____exports.getMaxCollectibleType(self)
|
|
141
160
|
return itemConfig:GetCollectibles().Size - 1
|
|
142
161
|
end
|
|
162
|
+
function ____exports.isActiveCollectible(self, collectibleType)
|
|
163
|
+
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
164
|
+
return itemType == ItemType.ITEM_ACTIVE
|
|
165
|
+
end
|
|
143
166
|
function ____exports.isGlitchedCollectible(self, pickup)
|
|
144
167
|
return pickup.Variant == PickupVariant.PICKUP_COLLECTIBLE and pickup.SubType > GLITCHED_ITEM_THRESHOLD
|
|
145
168
|
end
|
|
@@ -156,19 +179,16 @@ end
|
|
|
156
179
|
function ____exports.removeAllCollectibles(self, collectibleType, cap)
|
|
157
180
|
return removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
|
|
158
181
|
end
|
|
182
|
+
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
183
|
+
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
184
|
+
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
185
|
+
end
|
|
159
186
|
function ____exports.removeCollectiblePickupDelay(self, collectible)
|
|
160
187
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
161
188
|
error("You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant))
|
|
162
189
|
end
|
|
163
190
|
collectible.Wait = 0
|
|
164
191
|
end
|
|
165
|
-
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
166
|
-
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
167
|
-
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
168
|
-
end
|
|
169
|
-
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
170
|
-
Isaac.DebugString("Added 3 Collectibles")
|
|
171
|
-
end
|
|
172
192
|
function ____exports.setCollectibleBlind(self, collectible)
|
|
173
193
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
174
194
|
error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
|
|
@@ -199,4 +219,7 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
199
219
|
true
|
|
200
220
|
)
|
|
201
221
|
end
|
|
222
|
+
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
223
|
+
Isaac.DebugString("Added 3 Collectibles")
|
|
224
|
+
end
|
|
202
225
|
return ____exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare function getDefaultColor(): Color;
|
|
3
|
-
export declare function getDefaultKColor(): KColor;
|
|
4
2
|
export declare function copyColor(color: Color): Color;
|
|
5
3
|
export declare function copyKColor(kColor: KColor): KColor;
|
|
4
|
+
export declare function getDefaultColor(): Color;
|
|
5
|
+
export declare function getDefaultKColor(): KColor;
|
package/dist/functions/color.lua
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
function ____exports.getDefaultColor(self)
|
|
4
|
-
return Color(1, 1, 1)
|
|
5
|
-
end
|
|
6
|
-
function ____exports.getDefaultKColor(self)
|
|
7
|
-
return KColor(1, 1, 1, 1)
|
|
8
|
-
end
|
|
9
3
|
function ____exports.copyColor(self, color)
|
|
10
4
|
return Color(
|
|
11
5
|
color.R,
|
|
@@ -20,4 +14,10 @@ end
|
|
|
20
14
|
function ____exports.copyKColor(self, kColor)
|
|
21
15
|
return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
|
|
22
16
|
end
|
|
17
|
+
function ____exports.getDefaultColor(self)
|
|
18
|
+
return Color(1, 1, 1)
|
|
19
|
+
end
|
|
20
|
+
function ____exports.getDefaultKColor(self)
|
|
21
|
+
return KColor(1, 1, 1, 1)
|
|
22
|
+
end
|
|
23
23
|
return ____exports
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
3
2
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
3
|
/**
|
|
5
4
|
* deepCopy is a semi-generic deep cloner. It will recursively copy all of the values so that none
|
|
@@ -21,8 +20,6 @@ import { SerializationType } from "../enums/SerializationType";
|
|
|
21
20
|
* @param traversalDescription Used to track the current key that we are operating on.
|
|
22
21
|
*/
|
|
23
22
|
export declare function deepCopy(oldObject: LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>, serializationType?: SerializationType, traversalDescription?: string): LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>;
|
|
24
|
-
export declare function deserializeVector(vectorTable: LuaTable): Vector;
|
|
25
|
-
export declare function addTraversalDescription(key: AnyNotNil, traversalDescription: string): string;
|
|
26
23
|
/**
|
|
27
24
|
* Used to determine is the given table is a serialized Vector created by the save data manager
|
|
28
25
|
* and/or the `deepCopy` function.
|
|
@@ -18,7 +18,10 @@ local ____constants = require("features.saveDataManager.constants")
|
|
|
18
18
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
19
19
|
local ____log = require("functions.log")
|
|
20
20
|
local log = ____log.log
|
|
21
|
+
local ____utils = require("functions.utils")
|
|
22
|
+
local getTraversalDescription = ____utils.getTraversalDescription
|
|
21
23
|
local ____vector = require("functions.vector")
|
|
24
|
+
local deserializeVector = ____vector.deserializeVector
|
|
22
25
|
local isVector = ____vector.isVector
|
|
23
26
|
function ____exports.deepCopy(self, oldObject, serializationType, traversalDescription)
|
|
24
27
|
if serializationType == nil then
|
|
@@ -205,10 +208,10 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
|
|
|
205
208
|
newValue = copyVector(nil, vector, serializationType)
|
|
206
209
|
elseif ____exports.isSerializedVector(nil, value) and serializationType == SerializationType.DESERIALIZE then
|
|
207
210
|
local serializedVector = value
|
|
208
|
-
newValue =
|
|
211
|
+
newValue = deserializeVector(nil, serializedVector)
|
|
209
212
|
elseif valueType == "table" then
|
|
210
213
|
local ____table = value
|
|
211
|
-
traversalDescription =
|
|
214
|
+
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
212
215
|
newValue = ____exports.deepCopy(nil, ____table, serializationType, traversalDescription)
|
|
213
216
|
else
|
|
214
217
|
newValue = value
|
|
@@ -233,19 +236,6 @@ function copyVector(self, vector, serializationType)
|
|
|
233
236
|
local newVector = Vector(vector.X, vector.Y)
|
|
234
237
|
return newVector
|
|
235
238
|
end
|
|
236
|
-
function ____exports.deserializeVector(self, vectorTable)
|
|
237
|
-
local xString = vectorTable.X
|
|
238
|
-
local x = tonumber(xString)
|
|
239
|
-
if x == nil then
|
|
240
|
-
error("Failed to read the X value of a serialized vector.")
|
|
241
|
-
end
|
|
242
|
-
local yString = vectorTable.Y
|
|
243
|
-
local y = tonumber(yString)
|
|
244
|
-
if y == nil then
|
|
245
|
-
error("Failed to read the Y value of a serialized vector.")
|
|
246
|
-
end
|
|
247
|
-
return Vector(x, y)
|
|
248
|
-
end
|
|
249
239
|
function checkMetatable(self, ____table, traversalDescription)
|
|
250
240
|
local metatable = getmetatable(____table)
|
|
251
241
|
if metatable == nil then
|
|
@@ -262,13 +252,6 @@ function validateValue(self, value, valueType, traversalDescription)
|
|
|
262
252
|
error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" is type ") .. valueType) .. ", which is not supported.")
|
|
263
253
|
end
|
|
264
254
|
end
|
|
265
|
-
function ____exports.addTraversalDescription(self, key, traversalDescription)
|
|
266
|
-
if traversalDescription ~= "" then
|
|
267
|
-
traversalDescription = traversalDescription .. " --> "
|
|
268
|
-
end
|
|
269
|
-
traversalDescription = traversalDescription .. tostring(key)
|
|
270
|
-
return traversalDescription
|
|
271
|
-
end
|
|
272
255
|
function ____exports.isSerializedVector(self, object)
|
|
273
256
|
local objectType = type(object)
|
|
274
257
|
if objectType ~= "table" then
|
|
@@ -6,6 +6,13 @@ export declare function closeAllDoors(): void;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function closeDoorFast(door: GridEntityDoor): void;
|
|
8
8
|
export declare function doorSlotToDirection(doorSlot: DoorSlot): Direction;
|
|
9
|
+
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
10
|
+
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* If there is both a Devil Room and an Angel Room door, this function will return door with the
|
|
13
|
+
* lowest slot number.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefined;
|
|
9
16
|
/**
|
|
10
17
|
* Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
11
18
|
* can optionally specify one or more room types to return only the doors that match the specified
|
|
@@ -19,17 +26,9 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
|
19
26
|
* that match any of the N room grid indexes.
|
|
20
27
|
*/
|
|
21
28
|
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
22
|
-
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
23
|
-
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* If there is both a Devil Room and an Angel Room door, this function will return door with the
|
|
26
|
-
* lowest slot number.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefined;
|
|
29
29
|
export declare function getRepentanceDoor(): GridEntityDoor | undefined;
|
|
30
30
|
export declare function isAngelRoomDoor(door: GridEntityDoor): boolean;
|
|
31
31
|
export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
|
|
32
|
-
export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
33
32
|
/**
|
|
34
33
|
* This refers to the Repentance door that spawns in a boss room after defeating the boss.
|
|
35
34
|
* You have to spend one key to open it.
|
|
@@ -60,6 +59,7 @@ export declare function isDoorToMines(door: GridEntityDoor): boolean;
|
|
|
60
59
|
* It has a sprite filename of "gfx/grid/Door_MomsHeart.anm2".
|
|
61
60
|
*/
|
|
62
61
|
export declare function isDoorToMomsHeart(door: GridEntityDoor): boolean;
|
|
62
|
+
export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
63
63
|
export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
|
|
64
64
|
export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
65
65
|
/**
|
package/dist/functions/doors.lua
CHANGED
|
@@ -23,13 +23,13 @@ function ____exports.getDoors(self, ...)
|
|
|
23
23
|
do
|
|
24
24
|
local door = room:GetDoor(i)
|
|
25
25
|
if door == nil then
|
|
26
|
-
goto
|
|
26
|
+
goto __continue11
|
|
27
27
|
end
|
|
28
28
|
if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
29
29
|
__TS__ArrayPush(doors, door)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
|
-
::
|
|
32
|
+
::__continue11::
|
|
33
33
|
i = i + 1
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -66,15 +66,6 @@ end
|
|
|
66
66
|
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
67
67
|
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
68
68
|
end
|
|
69
|
-
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
70
|
-
local roomGridIndex = {...}
|
|
71
|
-
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
72
|
-
local doors = ____exports.getDoors(nil)
|
|
73
|
-
return __TS__ArrayFilter(
|
|
74
|
-
doors,
|
|
75
|
-
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
69
|
function ____exports.getAngelRoomDoor(self)
|
|
79
70
|
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_ANGEL)
|
|
80
71
|
local ____temp_0
|
|
@@ -105,6 +96,15 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
|
105
96
|
end
|
|
106
97
|
return ____temp_2
|
|
107
98
|
end
|
|
99
|
+
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
100
|
+
local roomGridIndex = {...}
|
|
101
|
+
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
102
|
+
local doors = ____exports.getDoors(nil)
|
|
103
|
+
return __TS__ArrayFilter(
|
|
104
|
+
doors,
|
|
105
|
+
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
108
|
function ____exports.getRepentanceDoor(self)
|
|
109
109
|
local doors = ____exports.getDoors(nil)
|
|
110
110
|
return __TS__ArrayFind(
|
|
@@ -118,11 +118,6 @@ end
|
|
|
118
118
|
function ____exports.isDevilRoomDoor(self, door)
|
|
119
119
|
return door.TargetRoomType == RoomType.ROOM_DEVIL
|
|
120
120
|
end
|
|
121
|
-
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
122
|
-
local sprite = door:GetSprite()
|
|
123
|
-
local animation = sprite:GetAnimation()
|
|
124
|
-
return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
|
|
125
|
-
end
|
|
126
121
|
function ____exports.isDoorToDownpour(self, door)
|
|
127
122
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
128
123
|
return false
|
|
@@ -163,6 +158,11 @@ function ____exports.isDoorToMomsHeart(self, door)
|
|
|
163
158
|
local filename = sprite:GetFilename()
|
|
164
159
|
return filename == "gfx/grid/Door_MomsHeart.anm2"
|
|
165
160
|
end
|
|
161
|
+
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
162
|
+
local sprite = door:GetSprite()
|
|
163
|
+
local animation = sprite:GetAnimation()
|
|
164
|
+
return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
|
|
165
|
+
end
|
|
166
166
|
function ____exports.lockDoor(self, door)
|
|
167
167
|
local level = game:GetLevel()
|
|
168
168
|
local roomDescriptor = level:GetRoomByIdx(door.TargetRoomIndex)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { AnyEntity } from "../types/AnyEntity";
|
|
3
|
-
export declare function anyEntityCloserThan(entities: Entity[], position: Vector, distance: int): boolean;
|
|
4
3
|
/**
|
|
5
4
|
* Helper function to count the number of entities in room. Use this over the vanilla
|
|
6
5
|
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
@@ -24,11 +23,6 @@ export declare function countEntities(entityType?: EntityType | int, variant?: n
|
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
25
|
export declare function getClosestEntityTo<T extends AnyEntity>(referenceEntity: Entity, entities: T[]): T;
|
|
27
|
-
/**
|
|
28
|
-
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
29
|
-
* second array but not in the first array.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities: T[], newEntities: T[]): T[];
|
|
32
26
|
/**
|
|
33
27
|
* Helper function to get all of the entities in the room or all of the entities that match a
|
|
34
28
|
* specific entity type / variant / sub-type.
|
|
@@ -55,6 +49,11 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
|
|
|
55
49
|
export declare function getEntities(matchingEntityType?: EntityType | int, matchingVariant?: number, matchingSubType?: number, ignoreFriendly?: boolean): Entity[];
|
|
56
50
|
/** Helper function to return a string containing an entity's type, variant, and sub-type. */
|
|
57
51
|
export declare function getEntityID(entity: Entity): string;
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
54
|
+
* second array but not in the first array.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities: T[], newEntities: T[]): T[];
|
|
58
57
|
/**
|
|
59
58
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
60
59
|
*
|
|
@@ -68,14 +67,6 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
|
|
|
68
67
|
* to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
69
68
|
*/
|
|
70
69
|
export declare function isStoryBoss(entity: Entity): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Helper function to remove all of the entities in the supplied array.
|
|
73
|
-
*
|
|
74
|
-
* @param entities The array of entities to remove.
|
|
75
|
-
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
76
|
-
* @returns True if one or more entities was removed, false otherwise.
|
|
77
|
-
*/
|
|
78
|
-
export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
79
70
|
/**
|
|
80
71
|
* Helper function to remove all of the matching entities in the room.
|
|
81
72
|
*
|
|
@@ -88,6 +79,14 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
|
88
79
|
* @returns True if one or more entities was removed, false otherwise.
|
|
89
80
|
*/
|
|
90
81
|
export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to remove all of the entities in the supplied array.
|
|
84
|
+
*
|
|
85
|
+
* @param entities The array of entities to remove.
|
|
86
|
+
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
87
|
+
* @returns True if one or more entities was removed, false otherwise.
|
|
88
|
+
*/
|
|
89
|
+
export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
91
90
|
/**
|
|
92
91
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
93
92
|
* if you want the rerolled enemy to be returned.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
4
3
|
local Set = ____lualib.Set
|
|
5
4
|
local __TS__New = ____lualib.__TS__New
|
|
6
5
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
@@ -15,11 +14,19 @@ local getRandom = ____random.getRandom
|
|
|
15
14
|
local nextSeed = ____random.nextSeed
|
|
16
15
|
local ____utils = require("functions.utils")
|
|
17
16
|
local ____repeat = ____utils["repeat"]
|
|
18
|
-
function ____exports.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
function ____exports.removeEntities(self, entities, cap)
|
|
18
|
+
if #entities == 0 then
|
|
19
|
+
return false
|
|
20
|
+
end
|
|
21
|
+
local numEntitiesRemoved = 0
|
|
22
|
+
for ____, entity in ipairs(entities) do
|
|
23
|
+
entity:Remove()
|
|
24
|
+
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
25
|
+
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
26
|
+
return true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
return true
|
|
23
30
|
end
|
|
24
31
|
function ____exports.countEntities(self, entityType, variant, subType, ignoreFriendly)
|
|
25
32
|
if entityType == nil then
|
|
@@ -61,20 +68,6 @@ function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
|
61
68
|
end
|
|
62
69
|
return closestEntity
|
|
63
70
|
end
|
|
64
|
-
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
65
|
-
local oldEntitiesSet = __TS__New(Set)
|
|
66
|
-
for ____, entity in ipairs(oldEntities) do
|
|
67
|
-
local ptrHash = GetPtrHash(entity)
|
|
68
|
-
oldEntitiesSet:add(ptrHash)
|
|
69
|
-
end
|
|
70
|
-
return __TS__ArrayFilter(
|
|
71
|
-
newEntities,
|
|
72
|
-
function(____, entity)
|
|
73
|
-
local ptrHash = GetPtrHash(entity)
|
|
74
|
-
return not oldEntitiesSet:has(ptrHash)
|
|
75
|
-
end
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
71
|
function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
79
72
|
if matchingVariant == nil then
|
|
80
73
|
matchingVariant = -1
|
|
@@ -93,6 +86,20 @@ end
|
|
|
93
86
|
function ____exports.getEntityID(self, entity)
|
|
94
87
|
return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
|
|
95
88
|
end
|
|
89
|
+
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
90
|
+
local oldEntitiesSet = __TS__New(Set)
|
|
91
|
+
for ____, entity in ipairs(oldEntities) do
|
|
92
|
+
local ptrHash = GetPtrHash(entity)
|
|
93
|
+
oldEntitiesSet:add(ptrHash)
|
|
94
|
+
end
|
|
95
|
+
return __TS__ArrayFilter(
|
|
96
|
+
newEntities,
|
|
97
|
+
function(____, entity)
|
|
98
|
+
local ptrHash = GetPtrHash(entity)
|
|
99
|
+
return not oldEntitiesSet:has(ptrHash)
|
|
100
|
+
end
|
|
101
|
+
)
|
|
102
|
+
end
|
|
96
103
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
97
104
|
if threshold == nil then
|
|
98
105
|
threshold = 0.01
|
|
@@ -102,20 +109,6 @@ end
|
|
|
102
109
|
function ____exports.isStoryBoss(self, entity)
|
|
103
110
|
return STORY_BOSSES:has(entity.Type)
|
|
104
111
|
end
|
|
105
|
-
function ____exports.removeEntities(self, entities, cap)
|
|
106
|
-
if #entities == 0 then
|
|
107
|
-
return false
|
|
108
|
-
end
|
|
109
|
-
local numEntitiesRemoved = 0
|
|
110
|
-
for ____, entity in ipairs(entities) do
|
|
111
|
-
entity:Remove()
|
|
112
|
-
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
113
|
-
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
114
|
-
return true
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
return true
|
|
118
|
-
end
|
|
119
112
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
120
113
|
if entityVariant == nil then
|
|
121
114
|
entityVariant = -1
|
|
@@ -44,13 +44,13 @@ export declare function getGridEntities(...gridEntityTypes: GridEntityType[]): G
|
|
|
44
44
|
* arguments to match specific grid entity types.
|
|
45
45
|
*/
|
|
46
46
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
47
|
+
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
47
48
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
48
49
|
/**
|
|
49
50
|
* Helper function to get the grid index of the top left wall.
|
|
50
51
|
* (This will depend on what the current room shape is.)
|
|
51
52
|
*/
|
|
52
53
|
export declare function getTopLeftWallGridIndex(): int;
|
|
53
|
-
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
54
54
|
/**
|
|
55
55
|
* Helper function to determine if all of the pressure plates in the current room are pushed.
|
|
56
56
|
* Returns true if there are no pressure plates in the room.
|
|
@@ -147,11 +147,6 @@ function ____exports.getGridEntitiesMap(self, ...)
|
|
|
147
147
|
end
|
|
148
148
|
return gridEntityMap
|
|
149
149
|
end
|
|
150
|
-
function ____exports.getTopLeftWall(self)
|
|
151
|
-
local room = game:GetRoom()
|
|
152
|
-
local topLeftWallGridIndex = ____exports.getTopLeftWallGridIndex(nil)
|
|
153
|
-
return room:GetGridEntity(topLeftWallGridIndex)
|
|
154
|
-
end
|
|
155
150
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
156
151
|
local room = game:GetRoom()
|
|
157
152
|
local gridWidth = room:GetGridWidth()
|
|
@@ -175,6 +170,11 @@ function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
|
175
170
|
end
|
|
176
171
|
return surroundingGridEntities
|
|
177
172
|
end
|
|
173
|
+
function ____exports.getTopLeftWall(self)
|
|
174
|
+
local room = game:GetRoom()
|
|
175
|
+
local topLeftWallGridIndex = ____exports.getTopLeftWallGridIndex(nil)
|
|
176
|
+
return room:GetGridEntity(topLeftWallGridIndex)
|
|
177
|
+
end
|
|
178
178
|
function ____exports.isAllPressurePlatesPushed(self)
|
|
179
179
|
local room = game:GetRoom()
|
|
180
180
|
local hasPressurePlates = room:HasTriggerPressurePlates()
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
/**
|
|
3
|
-
* Converts a Lua table to a JSON string.
|
|
4
|
-
* In most cases, this function will be used for writing data to a "save#.dat" file.
|
|
5
|
-
* If encoding fails, it will throw an error to prevent writing a blank string or corrupted data to
|
|
6
|
-
* a user's "save#.dat" file.
|
|
7
|
-
*/
|
|
8
|
-
export declare function jsonEncode(table: unknown): string;
|
|
9
2
|
/**
|
|
10
3
|
* Converts a JSON string to a Lua table.
|
|
11
4
|
* In most cases, this function will be used for reading data from a "save#.dat" file.
|
|
@@ -14,3 +7,10 @@ export declare function jsonEncode(table: unknown): string;
|
|
|
14
7
|
* manually removed their existing save data.)
|
|
15
8
|
*/
|
|
16
9
|
export declare function jsonDecode(jsonString: string): LuaTable;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a Lua table to a JSON string.
|
|
12
|
+
* In most cases, this function will be used for writing data to a "save#.dat" file.
|
|
13
|
+
* If encoding fails, it will throw an error to prevent writing a blank string or corrupted data to
|
|
14
|
+
* a user's "save#.dat" file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function jsonEncode(table: unknown): string;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local tryEncode, tryDecode
|
|
4
3
|
local json = require("@NoResolution:json")
|
|
5
4
|
local ____log = require("functions.log")
|
|
6
5
|
local log = ____log.log
|
|
7
|
-
function
|
|
8
|
-
return json.encode(____table)
|
|
9
|
-
end
|
|
10
|
-
function tryDecode(jsonString)
|
|
6
|
+
local function tryDecode(jsonString)
|
|
11
7
|
return json.decode(jsonString)
|
|
12
8
|
end
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
if not ok then
|
|
16
|
-
error("Failed to convert the Lua table to JSON: " .. jsonStringOrErrMsg)
|
|
17
|
-
end
|
|
18
|
-
return jsonStringOrErrMsg
|
|
9
|
+
local function tryEncode(____table)
|
|
10
|
+
return json.encode(____table)
|
|
19
11
|
end
|
|
20
12
|
function ____exports.jsonDecode(self, jsonString)
|
|
21
13
|
local ok, luaTableOrErrMsg = pcall(tryDecode, jsonString)
|
|
@@ -25,4 +17,11 @@ function ____exports.jsonDecode(self, jsonString)
|
|
|
25
17
|
end
|
|
26
18
|
return luaTableOrErrMsg
|
|
27
19
|
end
|
|
20
|
+
function ____exports.jsonEncode(self, ____table)
|
|
21
|
+
local ok, jsonStringOrErrMsg = pcall(tryEncode, ____table)
|
|
22
|
+
if not ok then
|
|
23
|
+
error("Failed to convert the Lua table to JSON: " .. jsonStringOrErrMsg)
|
|
24
|
+
end
|
|
25
|
+
return jsonStringOrErrMsg
|
|
26
|
+
end
|
|
28
27
|
return ____exports
|