isaacscript-common 33.4.0 → 33.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.rollup.d.ts +44 -13
- package/dist/isaacscript-common.lua +20 -12
- package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts +11 -0
- package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
- package/dist/src/classes/features/other/ExtraConsoleCommands.lua +4 -0
- package/dist/src/functions/gridEntities.d.ts +31 -13
- package/dist/src/functions/gridEntities.d.ts.map +1 -1
- package/dist/src/functions/gridEntities.lua +38 -23
- package/dist/src/functions/pressurePlate.d.ts +2 -0
- package/dist/src/functions/pressurePlate.d.ts.map +1 -1
- package/dist/src/functions/pressurePlate.lua +2 -0
- package/dist/src/maps/gridEntityTypeToBrokenStateMap.d.ts +1 -0
- package/dist/src/maps/gridEntityTypeToBrokenStateMap.d.ts.map +1 -1
- package/dist/src/maps/gridEntityTypeToBrokenStateMap.lua +1 -0
- package/package.json +1 -1
- package/src/classes/features/other/ExtraConsoleCommands.ts +17 -2
- package/src/functions/gridEntities.ts +34 -20
- package/src/functions/pressurePlate.ts +2 -0
- package/src/maps/gridEntityTypeToBrokenStateMap.ts +1 -1
package/dist/index.rollup.d.ts
CHANGED
|
@@ -1669,8 +1669,8 @@ export declare function convertDecimalToBinary(number: number, minLength?: int):
|
|
|
1669
1669
|
|
|
1670
1670
|
/**
|
|
1671
1671
|
* Helper function to convert the grid entity type found in a room XML file to the corresponding
|
|
1672
|
-
* grid entity type and variant normally used by the game. For example,
|
|
1673
|
-
* 1000
|
|
1672
|
+
* grid entity type and variant normally used by the game. For example, `GridEntityXMLType.ROCK` is
|
|
1673
|
+
* 1000 (in a room XML file), but `GridEntityType.ROCK` is equal to 2 (in-game).
|
|
1674
1674
|
*/
|
|
1675
1675
|
export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
|
|
1676
1676
|
|
|
@@ -3739,7 +3739,7 @@ export declare function doesEntityExist(entityType?: EntityType | -1, variant?:
|
|
|
3739
3739
|
|
|
3740
3740
|
/**
|
|
3741
3741
|
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
3742
|
-
* current room.
|
|
3742
|
+
* current room.
|
|
3743
3743
|
*
|
|
3744
3744
|
* @param gridEntityType The grid entity type to match.
|
|
3745
3745
|
* @param variant Optional. Default is -1, which matches every variant.
|
|
@@ -4193,6 +4193,17 @@ declare class ExtraConsoleCommands extends Feature {
|
|
|
4193
4193
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
4194
4194
|
*/
|
|
4195
4195
|
removeConsoleCommand(commandName: string): void;
|
|
4196
|
+
/**
|
|
4197
|
+
* Helper function to remove all custom console commands.
|
|
4198
|
+
*
|
|
4199
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
4200
|
+
* are useful for debugging. If you want to disable all of them after this feature has already
|
|
4201
|
+
* been initialized, use this function.
|
|
4202
|
+
*
|
|
4203
|
+
* In order to use this function, you must upgrade your mod with
|
|
4204
|
+
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
4205
|
+
*/
|
|
4206
|
+
removeAllConsoleCommands(): void;
|
|
4196
4207
|
}
|
|
4197
4208
|
|
|
4198
4209
|
/**
|
|
@@ -5470,7 +5481,10 @@ export declare function getGridEntitiesInRadius(targetPosition: Vector, radius:
|
|
|
5470
5481
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
5471
5482
|
|
|
5472
5483
|
/** Helper function to get the top left and bottom right corners of a given grid entity. */
|
|
5473
|
-
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity):
|
|
5484
|
+
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity): {
|
|
5485
|
+
topLeft: Vector;
|
|
5486
|
+
bottomRight: Vector;
|
|
5487
|
+
};
|
|
5474
5488
|
|
|
5475
5489
|
/** Helper function to get a string containing the grid entity's type and variant. */
|
|
5476
5490
|
export declare function getGridEntityID(gridEntity: GridEntity): GridEntityID;
|
|
@@ -7046,6 +7060,12 @@ export declare function getStringsFromTable(luaMap: LuaMap<string, unknown>, obj
|
|
|
7046
7060
|
*/
|
|
7047
7061
|
export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPlayer | undefined;
|
|
7048
7062
|
|
|
7063
|
+
/**
|
|
7064
|
+
* Helper function to get the grid entities on the surrounding tiles from the provided grid entity.
|
|
7065
|
+
*
|
|
7066
|
+
* For example, if a rock was surrounded by rocks on all sides, this would return an array of 8
|
|
7067
|
+
* rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
|
|
7068
|
+
*/
|
|
7049
7069
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
7050
7070
|
|
|
7051
7071
|
/**
|
|
@@ -7119,11 +7139,18 @@ export declare function getTime(useSocketIfAvailable?: boolean): float;
|
|
|
7119
7139
|
/** Helper function to get all of the `GridEntityTNT` in the room. */
|
|
7120
7140
|
export declare function getTNT(variant?: number): GridEntityTNT[];
|
|
7121
7141
|
|
|
7142
|
+
/**
|
|
7143
|
+
* Helper function to get the top left wall in the current room.
|
|
7144
|
+
*
|
|
7145
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
7146
|
+
*/
|
|
7122
7147
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
7123
7148
|
|
|
7124
7149
|
/**
|
|
7125
7150
|
* Helper function to get the grid index of the top left wall. (This will depend on what the current
|
|
7126
7151
|
* room shape is.)
|
|
7152
|
+
*
|
|
7153
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
7127
7154
|
*/
|
|
7128
7155
|
export declare function getTopLeftWallGridIndex(): int;
|
|
7129
7156
|
|
|
@@ -7908,6 +7935,8 @@ export declare function isAliveExceptionNPC(npc: EntityNPC): boolean;
|
|
|
7908
7935
|
* order for the room to be cleared. This function ignores other types of pressure plates, such as
|
|
7909
7936
|
* the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and
|
|
7910
7937
|
* so on.
|
|
7938
|
+
*
|
|
7939
|
+
* Returns true if there are no pressure plates in the room.
|
|
7911
7940
|
*/
|
|
7912
7941
|
export declare function isAllPressurePlatesPushed(): boolean;
|
|
7913
7942
|
|
|
@@ -8431,18 +8460,19 @@ export declare function isGreedMode(): boolean;
|
|
|
8431
8460
|
export declare function isGridEntity(variable: unknown): variable is GridEntity;
|
|
8432
8461
|
|
|
8433
8462
|
/**
|
|
8434
|
-
* Helper function to
|
|
8435
|
-
*
|
|
8463
|
+
* Helper function to detect if a particular grid entity would "break" if it was touched by an
|
|
8464
|
+
* explosion.
|
|
8436
8465
|
*
|
|
8437
|
-
*
|
|
8438
|
-
* the actual collision for the entity is removed.
|
|
8466
|
+
* For example, rocks and pots are breakable by explosions, but blocks are not.
|
|
8439
8467
|
*/
|
|
8440
8468
|
export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity): boolean;
|
|
8441
8469
|
|
|
8442
8470
|
/**
|
|
8443
|
-
* Helper function to
|
|
8444
|
-
*
|
|
8445
|
-
*
|
|
8471
|
+
* Helper function to see if the provided grid entity is in its respective broken state. See the
|
|
8472
|
+
* `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
8473
|
+
*
|
|
8474
|
+
* Note that in the case of `GridEntityType.LOCK` (11), the state will turn to being broken before
|
|
8475
|
+
* the actual collision for the entity is removed.
|
|
8446
8476
|
*/
|
|
8447
8477
|
export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
|
|
8448
8478
|
|
|
@@ -8657,8 +8687,9 @@ export declare function isPoopGridEntityType(gridEntityXMLType: GridEntityXMLTyp
|
|
|
8657
8687
|
export declare function isPoopPickup(pickup: EntityPickup): pickup is EntityPickupPoop;
|
|
8658
8688
|
|
|
8659
8689
|
/**
|
|
8660
|
-
* Helper function to
|
|
8661
|
-
*
|
|
8690
|
+
* Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
|
|
8691
|
+
* defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
|
|
8692
|
+
* at the `VarData` of the entity.)
|
|
8662
8693
|
*/
|
|
8663
8694
|
export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
|
|
8664
8695
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.
|
|
3
|
+
isaacscript-common 33.5.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -27996,7 +27996,7 @@ end
|
|
|
27996
27996
|
function ____exports.getGridEntityCollisionPoints(self, gridEntity)
|
|
27997
27997
|
local topLeft = Vector(gridEntity.Position.X - DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y - DISTANCE_OF_GRID_TILE / 2)
|
|
27998
27998
|
local bottomRight = Vector(gridEntity.Position.X + DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y + DISTANCE_OF_GRID_TILE / 2)
|
|
27999
|
-
return {topLeft, bottomRight}
|
|
27999
|
+
return {topLeft = topLeft, bottomRight = bottomRight}
|
|
28000
28000
|
end
|
|
28001
28001
|
function ____exports.getTopLeftWallGridIndex(self)
|
|
28002
28002
|
local room = game:GetRoom()
|
|
@@ -28006,13 +28006,13 @@ function ____exports.getTopLeftWallGridIndex(self)
|
|
|
28006
28006
|
end
|
|
28007
28007
|
function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
|
|
28008
28008
|
local room = game:GetRoom()
|
|
28009
|
-
local
|
|
28009
|
+
local ____isNumber_result_2
|
|
28010
28010
|
if isNumber(nil, gridEntityOrGridIndex) then
|
|
28011
|
-
|
|
28011
|
+
____isNumber_result_2 = room:GetGridEntity(gridEntityOrGridIndex)
|
|
28012
28012
|
else
|
|
28013
|
-
|
|
28013
|
+
____isNumber_result_2 = gridEntityOrGridIndex
|
|
28014
28014
|
end
|
|
28015
|
-
local gridEntity =
|
|
28015
|
+
local gridEntity = ____isNumber_result_2
|
|
28016
28016
|
if gridEntity == nil then
|
|
28017
28017
|
return
|
|
28018
28018
|
end
|
|
@@ -28036,13 +28036,13 @@ function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
|
|
|
28036
28036
|
end
|
|
28037
28037
|
function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition)
|
|
28038
28038
|
local room = game:GetRoom()
|
|
28039
|
-
local
|
|
28039
|
+
local ____isVector_result_3
|
|
28040
28040
|
if isVector(nil, gridIndexOrPosition) then
|
|
28041
|
-
|
|
28041
|
+
____isVector_result_3 = room:GetGridEntityFromPos(gridIndexOrPosition)
|
|
28042
28042
|
else
|
|
28043
|
-
|
|
28043
|
+
____isVector_result_3 = room:GetGridEntity(gridIndexOrPosition)
|
|
28044
28044
|
end
|
|
28045
|
-
local existingGridEntity =
|
|
28045
|
+
local existingGridEntity = ____isVector_result_3
|
|
28046
28046
|
if existingGridEntity ~= nil then
|
|
28047
28047
|
____exports.removeGridEntity(nil, existingGridEntity, true)
|
|
28048
28048
|
end
|
|
@@ -28112,7 +28112,9 @@ function ____exports.doesGridEntityExist(self, gridEntityType, variant)
|
|
|
28112
28112
|
)
|
|
28113
28113
|
end
|
|
28114
28114
|
function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
28115
|
-
local
|
|
28115
|
+
local ____exports_getGridEntityCollisionPoints_result_0 = ____exports.getGridEntityCollisionPoints(nil, gridEntity)
|
|
28116
|
+
local topLeft = ____exports_getGridEntityCollisionPoints_result_0.topLeft
|
|
28117
|
+
local bottomRight = ____exports_getGridEntityCollisionPoints_result_0.bottomRight
|
|
28116
28118
|
local closeEntities = Isaac.FindInRadius(gridEntity.Position, DISTANCE_OF_GRID_TILE * 2)
|
|
28117
28119
|
return __TS__ArrayFilter(
|
|
28118
28120
|
closeEntities,
|
|
@@ -28195,7 +28197,9 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
28195
28197
|
goto __continue24
|
|
28196
28198
|
end
|
|
28197
28199
|
registeredGridIndexes:add(gridIndex)
|
|
28198
|
-
local
|
|
28200
|
+
local ____exports_getGridEntityCollisionPoints_result_1 = ____exports.getGridEntityCollisionPoints(nil, gridEntity)
|
|
28201
|
+
local topLeft = ____exports_getGridEntityCollisionPoints_result_1.topLeft
|
|
28202
|
+
local bottomRight = ____exports_getGridEntityCollisionPoints_result_1.bottomRight
|
|
28199
28203
|
if isCircleIntersectingRectangle(
|
|
28200
28204
|
nil,
|
|
28201
28205
|
targetPosition,
|
|
@@ -50745,6 +50749,10 @@ function ExtraConsoleCommands.prototype.removeConsoleCommand(self, commandName)
|
|
|
50745
50749
|
self.commandFunctionMap:delete(commandName)
|
|
50746
50750
|
end
|
|
50747
50751
|
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "removeConsoleCommand", true)
|
|
50752
|
+
function ExtraConsoleCommands.prototype.removeAllConsoleCommands(self)
|
|
50753
|
+
self.commandFunctionMap:clear()
|
|
50754
|
+
end
|
|
50755
|
+
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "removeAllConsoleCommands", true)
|
|
50748
50756
|
return ____exports
|
|
50749
50757
|
end,
|
|
50750
50758
|
["src.classes.features.other.FadeInRemover"] = function(...)
|
|
@@ -48,5 +48,16 @@ export declare class ExtraConsoleCommands extends Feature {
|
|
|
48
48
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
49
49
|
*/
|
|
50
50
|
removeConsoleCommand(commandName: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to remove all custom console commands.
|
|
53
|
+
*
|
|
54
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
55
|
+
* are useful for debugging. If you want to disable all of them after this feature has already
|
|
56
|
+
* been initialized, use this function.
|
|
57
|
+
*
|
|
58
|
+
* In order to use this function, you must upgrade your mod with
|
|
59
|
+
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
60
|
+
*/
|
|
61
|
+
removeAllConsoleCommands(): void;
|
|
51
62
|
}
|
|
52
63
|
//# sourceMappingURL=ExtraConsoleCommands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtraConsoleCommands.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ExtraConsoleCommands.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAShD;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,OAAO;IAI/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IAExC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAG/B;IAoEJ,OAAO,CAAC,QAAQ,CAAC,UAAU,CAKzB;IAIF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIlC;IAIF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAIrC;IAIF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAIjC;IAIF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIlC;IAGF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAkD5B;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAWzB;IAGF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAI3B;IAGF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAYlC;IAEF;;;;;;;;;;;;OAYG;IAEI,iBAAiB,CACtB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACxC,IAAI;IA4BP;;;;;;;;;;OAUG;IAEI,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"ExtraConsoleCommands.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ExtraConsoleCommands.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAShD;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,OAAO;IAI/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IAExC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAG/B;IAoEJ,OAAO,CAAC,QAAQ,CAAC,UAAU,CAKzB;IAIF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIlC;IAIF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAIrC;IAIF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAIjC;IAIF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIlC;IAGF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAkD5B;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAWzB;IAGF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAI3B;IAGF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAYlC;IAEF;;;;;;;;;;;;OAYG;IAEI,iBAAiB,CACtB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACxC,IAAI;IA4BP;;;;;;;;;;OAUG;IAEI,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAqBtD;;;;;;;;;OASG;IAEI,wBAAwB,IAAI,IAAI;CAGxC"}
|
|
@@ -179,4 +179,8 @@ function ExtraConsoleCommands.prototype.removeConsoleCommand(self, commandName)
|
|
|
179
179
|
self.commandFunctionMap:delete(commandName)
|
|
180
180
|
end
|
|
181
181
|
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "removeConsoleCommand", true)
|
|
182
|
+
function ExtraConsoleCommands.prototype.removeAllConsoleCommands(self)
|
|
183
|
+
self.commandFunctionMap:clear()
|
|
184
|
+
end
|
|
185
|
+
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "removeAllConsoleCommands", true)
|
|
182
186
|
return ____exports
|
|
@@ -4,13 +4,13 @@ import type { AnyGridEntity } from "../types/AnyGridEntity";
|
|
|
4
4
|
import type { GridEntityID } from "../types/GridEntityID";
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to convert the grid entity type found in a room XML file to the corresponding
|
|
7
|
-
* grid entity type and variant normally used by the game. For example,
|
|
8
|
-
* 1000
|
|
7
|
+
* grid entity type and variant normally used by the game. For example, `GridEntityXMLType.ROCK` is
|
|
8
|
+
* 1000 (in a room XML file), but `GridEntityType.ROCK` is equal to 2 (in-game).
|
|
9
9
|
*/
|
|
10
10
|
export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
13
|
-
* current room.
|
|
13
|
+
* current room.
|
|
14
14
|
*
|
|
15
15
|
* @param gridEntityType The grid entity type to match.
|
|
16
16
|
* @param variant Optional. Default is -1, which matches every variant.
|
|
@@ -82,7 +82,10 @@ export declare function getGridEntitiesInRadius(targetPosition: Vector, radius:
|
|
|
82
82
|
*/
|
|
83
83
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
84
84
|
/** Helper function to get the top left and bottom right corners of a given grid entity. */
|
|
85
|
-
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity):
|
|
85
|
+
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity): {
|
|
86
|
+
topLeft: Vector;
|
|
87
|
+
bottomRight: Vector;
|
|
88
|
+
};
|
|
86
89
|
/** Helper function to get a string containing the grid entity's type and variant. */
|
|
87
90
|
export declare function getGridEntityID(gridEntity: GridEntity): GridEntityID;
|
|
88
91
|
/**
|
|
@@ -97,32 +100,47 @@ export declare function getGridEntityIDFromConstituents(gridEntityType: GridEnti
|
|
|
97
100
|
* If you want to match every variant, use the `getGridEntities` function instead.
|
|
98
101
|
*/
|
|
99
102
|
export declare function getMatchingGridEntities(gridEntityType: GridEntityType, variant: int): GridEntity[];
|
|
103
|
+
/**
|
|
104
|
+
* Helper function to get the grid entities on the surrounding tiles from the provided grid entity.
|
|
105
|
+
*
|
|
106
|
+
* For example, if a rock was surrounded by rocks on all sides, this would return an array of 8
|
|
107
|
+
* rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
|
|
108
|
+
*/
|
|
100
109
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
110
|
+
/**
|
|
111
|
+
* Helper function to get the top left wall in the current room.
|
|
112
|
+
*
|
|
113
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
114
|
+
*/
|
|
101
115
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
102
116
|
/**
|
|
103
117
|
* Helper function to get the grid index of the top left wall. (This will depend on what the current
|
|
104
118
|
* room shape is.)
|
|
119
|
+
*
|
|
120
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
105
121
|
*/
|
|
106
122
|
export declare function getTopLeftWallGridIndex(): int;
|
|
107
123
|
/**
|
|
108
|
-
* Helper function to
|
|
109
|
-
*
|
|
124
|
+
* Helper function to detect if a particular grid entity would "break" if it was touched by an
|
|
125
|
+
* explosion.
|
|
110
126
|
*
|
|
111
|
-
*
|
|
112
|
-
* the actual collision for the entity is removed.
|
|
127
|
+
* For example, rocks and pots are breakable by explosions, but blocks are not.
|
|
113
128
|
*/
|
|
114
129
|
export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity): boolean;
|
|
115
130
|
/**
|
|
116
|
-
* Helper function to
|
|
117
|
-
*
|
|
118
|
-
*
|
|
131
|
+
* Helper function to see if the provided grid entity is in its respective broken state. See the
|
|
132
|
+
* `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
133
|
+
*
|
|
134
|
+
* Note that in the case of `GridEntityType.LOCK` (11), the state will turn to being broken before
|
|
135
|
+
* the actual collision for the entity is removed.
|
|
119
136
|
*/
|
|
120
137
|
export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
|
|
121
138
|
/** Helper function to see if a `GridEntityXMLType` is some kind of poop. */
|
|
122
139
|
export declare function isPoopGridEntityType(gridEntityXMLType: GridEntityXMLType): boolean;
|
|
123
140
|
/**
|
|
124
|
-
* Helper function to
|
|
125
|
-
*
|
|
141
|
+
* Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
|
|
142
|
+
* defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
|
|
143
|
+
* at the `VarData` of the entity.)
|
|
126
144
|
*/
|
|
127
145
|
export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
|
|
128
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAGL,cAAc,EAIf,MAAM,8BAA8B,CAAC;AAUtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"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"}
|
|
@@ -71,10 +71,12 @@ end
|
|
|
71
71
|
function ____exports.getGridEntityCollisionPoints(self, gridEntity)
|
|
72
72
|
local topLeft = Vector(gridEntity.Position.X - DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y - DISTANCE_OF_GRID_TILE / 2)
|
|
73
73
|
local bottomRight = Vector(gridEntity.Position.X + DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y + DISTANCE_OF_GRID_TILE / 2)
|
|
74
|
-
return {topLeft, bottomRight}
|
|
74
|
+
return {topLeft = topLeft, bottomRight = bottomRight}
|
|
75
75
|
end
|
|
76
76
|
--- Helper function to get the grid index of the top left wall. (This will depend on what the current
|
|
77
77
|
-- room shape is.)
|
|
78
|
+
--
|
|
79
|
+
-- This function can be useful in certain situations to determine if the room is currently loaded.
|
|
78
80
|
function ____exports.getTopLeftWallGridIndex(self)
|
|
79
81
|
local room = game:GetRoom()
|
|
80
82
|
local roomShape = room:GetRoomShape()
|
|
@@ -95,13 +97,13 @@ end
|
|
|
95
97
|
-- this to false if you need to run this function multiple times.
|
|
96
98
|
function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
|
|
97
99
|
local room = game:GetRoom()
|
|
98
|
-
local
|
|
100
|
+
local ____isNumber_result_2
|
|
99
101
|
if isNumber(nil, gridEntityOrGridIndex) then
|
|
100
|
-
|
|
102
|
+
____isNumber_result_2 = room:GetGridEntity(gridEntityOrGridIndex)
|
|
101
103
|
else
|
|
102
|
-
|
|
104
|
+
____isNumber_result_2 = gridEntityOrGridIndex
|
|
103
105
|
end
|
|
104
|
-
local gridEntity =
|
|
106
|
+
local gridEntity = ____isNumber_result_2
|
|
105
107
|
if gridEntity == nil then
|
|
106
108
|
return
|
|
107
109
|
end
|
|
@@ -131,13 +133,13 @@ end
|
|
|
131
133
|
-- - allows you to specify the grid index or the position
|
|
132
134
|
function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition)
|
|
133
135
|
local room = game:GetRoom()
|
|
134
|
-
local
|
|
136
|
+
local ____isVector_result_3
|
|
135
137
|
if isVector(nil, gridIndexOrPosition) then
|
|
136
|
-
|
|
138
|
+
____isVector_result_3 = room:GetGridEntityFromPos(gridIndexOrPosition)
|
|
137
139
|
else
|
|
138
|
-
|
|
140
|
+
____isVector_result_3 = room:GetGridEntity(gridIndexOrPosition)
|
|
139
141
|
end
|
|
140
|
-
local existingGridEntity =
|
|
142
|
+
local existingGridEntity = ____isVector_result_3
|
|
141
143
|
if existingGridEntity ~= nil then
|
|
142
144
|
____exports.removeGridEntity(nil, existingGridEntity, true)
|
|
143
145
|
end
|
|
@@ -174,8 +176,8 @@ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
|
|
|
174
176
|
{(tostring(GridEntityType.STATUE) .. ".") .. tostring(StatueVariant.ANGEL)}
|
|
175
177
|
)
|
|
176
178
|
--- Helper function to convert the grid entity type found in a room XML file to the corresponding
|
|
177
|
-
-- grid entity type and variant normally used by the game. For example,
|
|
178
|
-
-- 1000
|
|
179
|
+
-- grid entity type and variant normally used by the game. For example, `GridEntityXMLType.ROCK` is
|
|
180
|
+
-- 1000 (in a room XML file), but `GridEntityType.ROCK` is equal to 2 (in-game).
|
|
179
181
|
function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
|
|
180
182
|
local gridEntityArray = GRID_ENTITY_XML_MAP:get(gridEntityXMLType)
|
|
181
183
|
assertDefined(
|
|
@@ -191,7 +193,7 @@ function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntit
|
|
|
191
193
|
return {gridEntityType, variant}
|
|
192
194
|
end
|
|
193
195
|
--- Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
194
|
-
-- current room.
|
|
196
|
+
-- current room.
|
|
195
197
|
--
|
|
196
198
|
-- @param gridEntityType The grid entity type to match.
|
|
197
199
|
-- @param variant Optional. Default is -1, which matches every variant.
|
|
@@ -223,7 +225,9 @@ end
|
|
|
223
225
|
-- Note that this function will not work properly in the `POST_NEW_ROOM` callback since entities do
|
|
224
226
|
-- not have collision yet in that callback.
|
|
225
227
|
function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
226
|
-
local
|
|
228
|
+
local ____exports_getGridEntityCollisionPoints_result_0 = ____exports.getGridEntityCollisionPoints(nil, gridEntity)
|
|
229
|
+
local topLeft = ____exports_getGridEntityCollisionPoints_result_0.topLeft
|
|
230
|
+
local bottomRight = ____exports_getGridEntityCollisionPoints_result_0.bottomRight
|
|
227
231
|
local closeEntities = Isaac.FindInRadius(gridEntity.Position, DISTANCE_OF_GRID_TILE * 2)
|
|
228
232
|
return __TS__ArrayFilter(
|
|
229
233
|
closeEntities,
|
|
@@ -336,7 +340,9 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
336
340
|
goto __continue24
|
|
337
341
|
end
|
|
338
342
|
registeredGridIndexes:add(gridIndex)
|
|
339
|
-
local
|
|
343
|
+
local ____exports_getGridEntityCollisionPoints_result_1 = ____exports.getGridEntityCollisionPoints(nil, gridEntity)
|
|
344
|
+
local topLeft = ____exports_getGridEntityCollisionPoints_result_1.topLeft
|
|
345
|
+
local bottomRight = ____exports_getGridEntityCollisionPoints_result_1.bottomRight
|
|
340
346
|
if isCircleIntersectingRectangle(
|
|
341
347
|
nil,
|
|
342
348
|
targetPosition,
|
|
@@ -390,6 +396,10 @@ function ____exports.getMatchingGridEntities(self, gridEntityType, variant)
|
|
|
390
396
|
function(____, gridEntity) return gridEntity:GetVariant() == variant end
|
|
391
397
|
)
|
|
392
398
|
end
|
|
399
|
+
--- Helper function to get the grid entities on the surrounding tiles from the provided grid entity.
|
|
400
|
+
--
|
|
401
|
+
-- For example, if a rock was surrounded by rocks on all sides, this would return an array of 8
|
|
402
|
+
-- rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
|
|
393
403
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
394
404
|
local room = game:GetRoom()
|
|
395
405
|
local gridWidth = room:GetGridWidth()
|
|
@@ -413,25 +423,29 @@ function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
|
413
423
|
end
|
|
414
424
|
return surroundingGridEntities
|
|
415
425
|
end
|
|
426
|
+
--- Helper function to get the top left wall in the current room.
|
|
427
|
+
--
|
|
428
|
+
-- This function can be useful in certain situations to determine if the room is currently loaded.
|
|
416
429
|
function ____exports.getTopLeftWall(self)
|
|
417
430
|
local room = game:GetRoom()
|
|
418
431
|
local topLeftWallGridIndex = ____exports.getTopLeftWallGridIndex(nil)
|
|
419
432
|
return room:GetGridEntity(topLeftWallGridIndex)
|
|
420
433
|
end
|
|
421
|
-
--- Helper function to
|
|
422
|
-
--
|
|
434
|
+
--- Helper function to detect if a particular grid entity would "break" if it was touched by an
|
|
435
|
+
-- explosion.
|
|
423
436
|
--
|
|
424
|
-
--
|
|
425
|
-
-- the actual collision for the entity is removed.
|
|
437
|
+
-- For example, rocks and pots are breakable by explosions, but blocks are not.
|
|
426
438
|
function ____exports.isGridEntityBreakableByExplosion(self, gridEntity)
|
|
427
439
|
local gridEntityType = gridEntity:GetType()
|
|
428
440
|
local variant = gridEntity:GetVariant()
|
|
429
441
|
local gridEntityTypeVariant = (tostring(gridEntityType) .. ".") .. tostring(variant)
|
|
430
442
|
return BREAKABLE_GRID_ENTITY_TYPES_BY_EXPLOSIONS:has(gridEntityType) or BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS:has(gridEntityTypeVariant)
|
|
431
443
|
end
|
|
432
|
-
--- Helper function to
|
|
433
|
-
--
|
|
434
|
-
--
|
|
444
|
+
--- Helper function to see if the provided grid entity is in its respective broken state. See the
|
|
445
|
+
-- `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
446
|
+
--
|
|
447
|
+
-- Note that in the case of `GridEntityType.LOCK` (11), the state will turn to being broken before
|
|
448
|
+
-- the actual collision for the entity is removed.
|
|
435
449
|
function ____exports.isGridEntityBroken(self, gridEntity)
|
|
436
450
|
local gridEntityType = gridEntity:GetType()
|
|
437
451
|
local brokenState = GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP:get(gridEntityType)
|
|
@@ -441,8 +455,9 @@ end
|
|
|
441
455
|
function ____exports.isPoopGridEntityType(self, gridEntityXMLType)
|
|
442
456
|
return POOP_GRID_ENTITY_XML_TYPES_SET:has(gridEntityXMLType)
|
|
443
457
|
end
|
|
444
|
-
--- Helper function to
|
|
445
|
-
--
|
|
458
|
+
--- Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
|
|
459
|
+
-- defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
|
|
460
|
+
-- at the `VarData` of the entity.)
|
|
446
461
|
function ____exports.isPostBossVoidPortal(self, gridEntity)
|
|
447
462
|
local saveState = gridEntity:GetSaveState()
|
|
448
463
|
return saveState.VarData == 1
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* order for the room to be cleared. This function ignores other types of pressure plates, such as
|
|
6
6
|
* the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and
|
|
7
7
|
* so on.
|
|
8
|
+
*
|
|
9
|
+
* Returns true if there are no pressure plates in the room.
|
|
8
10
|
*/
|
|
9
11
|
export declare function isAllPressurePlatesPushed(): boolean;
|
|
10
12
|
//# sourceMappingURL=pressurePlate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressurePlate.d.ts","sourceRoot":"","sources":["../../../src/functions/pressurePlate.ts"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"pressurePlate.d.ts","sourceRoot":"","sources":["../../../src/functions/pressurePlate.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAanD"}
|
|
@@ -14,6 +14,8 @@ local getPressurePlates = ____gridEntitiesSpecific.getPressurePlates
|
|
|
14
14
|
-- order for the room to be cleared. This function ignores other types of pressure plates, such as
|
|
15
15
|
-- the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and
|
|
16
16
|
-- so on.
|
|
17
|
+
--
|
|
18
|
+
-- Returns true if there are no pressure plates in the room.
|
|
17
19
|
function ____exports.isAllPressurePlatesPushed(self)
|
|
18
20
|
local room = game:GetRoom()
|
|
19
21
|
local hasPressurePlates = room:HasTriggerPressurePlates()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
+
/** Not every grid entity can be broken. Thus use a map to represent this. */
|
|
2
3
|
export declare const GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP: ReadonlyMap<GridEntityType, int>;
|
|
3
4
|
//# sourceMappingURL=gridEntityTypeToBrokenStateMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridEntityTypeToBrokenStateMap.d.ts","sourceRoot":"","sources":["../../../src/maps/gridEntityTypeToBrokenStateMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAMf,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"gridEntityTypeToBrokenStateMap.d.ts","sourceRoot":"","sources":["../../../src/maps/gridEntityTypeToBrokenStateMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAMf,MAAM,8BAA8B,CAAC;AAGtC,6EAA6E;AAC7E,eAAO,MAAM,oCAAoC,kCAuC/C,CAAC"}
|
|
@@ -10,6 +10,7 @@ local SpiderWebState = ____isaac_2Dtypescript_2Ddefinitions.SpiderWebState
|
|
|
10
10
|
local TNTState = ____isaac_2Dtypescript_2Ddefinitions.TNTState
|
|
11
11
|
local ____ReadonlyMap = require("src.types.ReadonlyMap")
|
|
12
12
|
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
|
|
13
|
+
--- Not every grid entity can be broken. Thus use a map to represent this.
|
|
13
14
|
____exports.GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP = __TS__New(ReadonlyMap, {
|
|
14
15
|
{GridEntityType.ROCK, RockState.BROKEN},
|
|
15
16
|
{GridEntityType.ROCK_TINTED, RockState.BROKEN},
|
package/package.json
CHANGED
|
@@ -205,8 +205,8 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
205
205
|
private readonly executeCmd = (command: string, params: string) => {
|
|
206
206
|
const resultTuple = getMapPartialMatch(command, this.commandFunctionMap);
|
|
207
207
|
if (resultTuple === undefined) {
|
|
208
|
-
// We
|
|
209
|
-
//
|
|
208
|
+
// We opt to not print an error message because a non-IsaacScript mod may have configured a
|
|
209
|
+
// custom console command.
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -314,4 +314,19 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
314
314
|
|
|
315
315
|
this.commandFunctionMap.delete(commandName);
|
|
316
316
|
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Helper function to remove all custom console commands.
|
|
320
|
+
*
|
|
321
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
322
|
+
* are useful for debugging. If you want to disable all of them after this feature has already
|
|
323
|
+
* been initialized, use this function.
|
|
324
|
+
*
|
|
325
|
+
* In order to use this function, you must upgrade your mod with
|
|
326
|
+
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
327
|
+
*/
|
|
328
|
+
@Exported
|
|
329
|
+
public removeAllConsoleCommands(): void {
|
|
330
|
+
this.commandFunctionMap.clear();
|
|
331
|
+
}
|
|
317
332
|
}
|
|
@@ -35,10 +35,8 @@ const BREAKABLE_GRID_ENTITY_TYPES_BY_EXPLOSIONS =
|
|
|
35
35
|
GridEntityType.ROCK_ALT, // 6
|
|
36
36
|
GridEntityType.SPIDER_WEB, // 10
|
|
37
37
|
GridEntityType.TNT, // 12
|
|
38
|
-
|
|
39
38
|
// GridEntityType.FIREPLACE (13) does not count since it is turned into a non-grid entity upon
|
|
40
39
|
// spawning.
|
|
41
|
-
|
|
42
40
|
GridEntityType.POOP, // 14
|
|
43
41
|
GridEntityType.ROCK_SUPER_SPECIAL, // 22
|
|
44
42
|
GridEntityType.ROCK_SPIKED, // 25
|
|
@@ -51,8 +49,8 @@ const BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS =
|
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* Helper function to convert the grid entity type found in a room XML file to the corresponding
|
|
54
|
-
* grid entity type and variant normally used by the game. For example,
|
|
55
|
-
* 1000
|
|
52
|
+
* grid entity type and variant normally used by the game. For example, `GridEntityXMLType.ROCK` is
|
|
53
|
+
* 1000 (in a room XML file), but `GridEntityType.ROCK` is equal to 2 (in-game).
|
|
56
54
|
*/
|
|
57
55
|
export function convertXMLGridEntityType(
|
|
58
56
|
gridEntityXMLType: GridEntityXMLType,
|
|
@@ -82,7 +80,7 @@ export function convertXMLGridEntityType(
|
|
|
82
80
|
|
|
83
81
|
/**
|
|
84
82
|
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
85
|
-
* current room.
|
|
83
|
+
* current room.
|
|
86
84
|
*
|
|
87
85
|
* @param gridEntityType The grid entity type to match.
|
|
88
86
|
* @param variant Optional. Default is -1, which matches every variant.
|
|
@@ -134,7 +132,7 @@ export function getAllGridIndexes(): int[] {
|
|
|
134
132
|
export function getCollidingEntitiesWithGridEntity(
|
|
135
133
|
gridEntity: GridEntity,
|
|
136
134
|
): Entity[] {
|
|
137
|
-
const
|
|
135
|
+
const { topLeft, bottomRight } = getGridEntityCollisionPoints(gridEntity);
|
|
138
136
|
|
|
139
137
|
const closeEntities = Isaac.FindInRadius(
|
|
140
138
|
gridEntity.Position,
|
|
@@ -290,7 +288,7 @@ export function getGridEntitiesInRadius(
|
|
|
290
288
|
}
|
|
291
289
|
|
|
292
290
|
registeredGridIndexes.add(gridIndex);
|
|
293
|
-
const
|
|
291
|
+
const { topLeft, bottomRight } = getGridEntityCollisionPoints(gridEntity);
|
|
294
292
|
|
|
295
293
|
if (
|
|
296
294
|
isCircleIntersectingRectangle(
|
|
@@ -332,9 +330,10 @@ export function getGridEntitiesMap(
|
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
/** Helper function to get the top left and bottom right corners of a given grid entity. */
|
|
335
|
-
export function getGridEntityCollisionPoints(
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
export function getGridEntityCollisionPoints(gridEntity: GridEntity): {
|
|
334
|
+
topLeft: Vector;
|
|
335
|
+
bottomRight: Vector;
|
|
336
|
+
} {
|
|
338
337
|
const topLeft = Vector(
|
|
339
338
|
gridEntity.Position.X - DISTANCE_OF_GRID_TILE / 2,
|
|
340
339
|
gridEntity.Position.Y - DISTANCE_OF_GRID_TILE / 2,
|
|
@@ -344,7 +343,7 @@ export function getGridEntityCollisionPoints(
|
|
|
344
343
|
gridEntity.Position.Y + DISTANCE_OF_GRID_TILE / 2,
|
|
345
344
|
);
|
|
346
345
|
|
|
347
|
-
return
|
|
346
|
+
return { topLeft, bottomRight };
|
|
348
347
|
}
|
|
349
348
|
|
|
350
349
|
/** Helper function to get a string containing the grid entity's type and variant. */
|
|
@@ -381,6 +380,12 @@ export function getMatchingGridEntities(
|
|
|
381
380
|
);
|
|
382
381
|
}
|
|
383
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Helper function to get the grid entities on the surrounding tiles from the provided grid entity.
|
|
385
|
+
*
|
|
386
|
+
* For example, if a rock was surrounded by rocks on all sides, this would return an array of 8
|
|
387
|
+
* rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
|
|
388
|
+
*/
|
|
384
389
|
export function getSurroundingGridEntities(
|
|
385
390
|
gridEntity: GridEntity,
|
|
386
391
|
): GridEntity[] {
|
|
@@ -412,6 +417,11 @@ export function getSurroundingGridEntities(
|
|
|
412
417
|
return surroundingGridEntities;
|
|
413
418
|
}
|
|
414
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Helper function to get the top left wall in the current room.
|
|
422
|
+
*
|
|
423
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
424
|
+
*/
|
|
415
425
|
export function getTopLeftWall(): GridEntity | undefined {
|
|
416
426
|
const room = game.GetRoom();
|
|
417
427
|
const topLeftWallGridIndex = getTopLeftWallGridIndex();
|
|
@@ -421,6 +431,8 @@ export function getTopLeftWall(): GridEntity | undefined {
|
|
|
421
431
|
/**
|
|
422
432
|
* Helper function to get the grid index of the top left wall. (This will depend on what the current
|
|
423
433
|
* room shape is.)
|
|
434
|
+
*
|
|
435
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
424
436
|
*/
|
|
425
437
|
export function getTopLeftWallGridIndex(): int {
|
|
426
438
|
const room = game.GetRoom();
|
|
@@ -432,11 +444,10 @@ export function getTopLeftWallGridIndex(): int {
|
|
|
432
444
|
}
|
|
433
445
|
|
|
434
446
|
/**
|
|
435
|
-
* Helper function to
|
|
436
|
-
*
|
|
447
|
+
* Helper function to detect if a particular grid entity would "break" if it was touched by an
|
|
448
|
+
* explosion.
|
|
437
449
|
*
|
|
438
|
-
*
|
|
439
|
-
* the actual collision for the entity is removed.
|
|
450
|
+
* For example, rocks and pots are breakable by explosions, but blocks are not.
|
|
440
451
|
*/
|
|
441
452
|
export function isGridEntityBreakableByExplosion(
|
|
442
453
|
gridEntity: GridEntity,
|
|
@@ -454,9 +465,11 @@ export function isGridEntityBreakableByExplosion(
|
|
|
454
465
|
}
|
|
455
466
|
|
|
456
467
|
/**
|
|
457
|
-
* Helper function to
|
|
458
|
-
*
|
|
459
|
-
*
|
|
468
|
+
* Helper function to see if the provided grid entity is in its respective broken state. See the
|
|
469
|
+
* `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
470
|
+
*
|
|
471
|
+
* Note that in the case of `GridEntityType.LOCK` (11), the state will turn to being broken before
|
|
472
|
+
* the actual collision for the entity is removed.
|
|
460
473
|
*/
|
|
461
474
|
export function isGridEntityBroken(gridEntity: GridEntity): boolean {
|
|
462
475
|
const gridEntityType = gridEntity.GetType();
|
|
@@ -472,8 +485,9 @@ export function isPoopGridEntityType(
|
|
|
472
485
|
}
|
|
473
486
|
|
|
474
487
|
/**
|
|
475
|
-
* Helper function to
|
|
476
|
-
*
|
|
488
|
+
* Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
|
|
489
|
+
* defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
|
|
490
|
+
* at the `VarData` of the entity.)
|
|
477
491
|
*/
|
|
478
492
|
export function isPostBossVoidPortal(gridEntity: GridEntity): boolean {
|
|
479
493
|
// - The VarData of Void Portals that are spawned after bosses will be equal to 1.
|
|
@@ -12,6 +12,8 @@ import { getPressurePlates } from "./gridEntitiesSpecific";
|
|
|
12
12
|
* order for the room to be cleared. This function ignores other types of pressure plates, such as
|
|
13
13
|
* the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and
|
|
14
14
|
* so on.
|
|
15
|
+
*
|
|
16
|
+
* Returns true if there are no pressure plates in the room.
|
|
15
17
|
*/
|
|
16
18
|
export function isAllPressurePlatesPushed(): boolean {
|
|
17
19
|
const room = game.GetRoom();
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "isaac-typescript-definitions";
|
|
9
9
|
import { ReadonlyMap } from "../types/ReadonlyMap";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** Not every grid entity can be broken. Thus use a map to represent this. */
|
|
12
12
|
export const GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP = new ReadonlyMap<
|
|
13
13
|
GridEntityType,
|
|
14
14
|
int
|