isaacscript-common 33.3.1 → 33.4.1
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 +58 -19
- package/dist/isaacscript-common.lua +34 -13
- package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts +22 -6
- package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
- package/dist/src/classes/features/other/ExtraConsoleCommands.lua +27 -1
- package/dist/src/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
- 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/functions/run.d.ts +3 -0
- package/dist/src/functions/run.d.ts.map +1 -1
- package/dist/src/functions/run.lua +3 -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 +65 -9
- package/src/classes/features/other/extraConsoleCommands/commands.ts +9 -4
- package/src/functions/gridEntities.ts +34 -20
- package/src/functions/pressurePlate.ts +2 -0
- package/src/functions/run.ts +3 -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.
|
|
@@ -4144,7 +4144,19 @@ export declare type Expand<T> = T extends infer O ? {
|
|
|
4144
4144
|
[K in keyof O]: O[K];
|
|
4145
4145
|
} : never;
|
|
4146
4146
|
|
|
4147
|
+
/**
|
|
4148
|
+
* When you enable this feature, many custom commands will be added to the in-game console. See the
|
|
4149
|
+
* [dedicated command list](ExtraConsoleCommandsList) for more information about them.
|
|
4150
|
+
*
|
|
4151
|
+
* Note that in order to avoid conflicts, if two or more mods enable this feature, then the first
|
|
4152
|
+
* loaded one will control all of the command logic. When this occurs, a global variable of
|
|
4153
|
+
* `__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE` will be created and will automatically be
|
|
4154
|
+
* used by the non-main instances. For this reason, if you use multiple mods with
|
|
4155
|
+
* `isaacscript-common` and a custom command from the standard library is not working properly, then
|
|
4156
|
+
* you might need to get another mod author to update their version of `isaacscript-common`.
|
|
4157
|
+
*/
|
|
4147
4158
|
declare class ExtraConsoleCommands extends Feature {
|
|
4159
|
+
private readonly isMainFeature;
|
|
4148
4160
|
private readonly commandFunctionMap;
|
|
4149
4161
|
private readonly postUpdate;
|
|
4150
4162
|
private readonly evaluateCacheDamage;
|
|
@@ -4158,10 +4170,12 @@ declare class ExtraConsoleCommands extends Feature {
|
|
|
4158
4170
|
/**
|
|
4159
4171
|
* Helper function to add a custom console command.
|
|
4160
4172
|
*
|
|
4161
|
-
* The standard library comes with many existing console commands that
|
|
4162
|
-
* but you can also add your own commands that are useful for your
|
|
4163
|
-
* add commands to the existing command system than to add your own
|
|
4164
|
-
* `EXECUTE_CMD` callback.
|
|
4173
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
4174
|
+
* are useful for debugging, but you can also add your own commands that are useful for your
|
|
4175
|
+
* particular mod. It's easier to add commands to the existing command system than to add your own
|
|
4176
|
+
* logic manually to the `EXECUTE_CMD` callback.
|
|
4177
|
+
*
|
|
4178
|
+
* This function is intended to be called when your mod is first loading.
|
|
4165
4179
|
*
|
|
4166
4180
|
* In order to use this function, you must upgrade your mod with
|
|
4167
4181
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
@@ -4170,8 +4184,10 @@ declare class ExtraConsoleCommands extends Feature {
|
|
|
4170
4184
|
/**
|
|
4171
4185
|
* Helper function to remove a custom console command.
|
|
4172
4186
|
*
|
|
4173
|
-
* The standard library comes with many existing console commands that
|
|
4174
|
-
* If you want to disable one of them, use this function.
|
|
4187
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
4188
|
+
* are useful for debugging. If you want to disable one of them, use this function.
|
|
4189
|
+
*
|
|
4190
|
+
* This function is intended to be called when your mod is first loading.
|
|
4175
4191
|
*
|
|
4176
4192
|
* In order to use this function, you must upgrade your mod with
|
|
4177
4193
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
@@ -5454,7 +5470,10 @@ export declare function getGridEntitiesInRadius(targetPosition: Vector, radius:
|
|
|
5454
5470
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
5455
5471
|
|
|
5456
5472
|
/** Helper function to get the top left and bottom right corners of a given grid entity. */
|
|
5457
|
-
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity):
|
|
5473
|
+
export declare function getGridEntityCollisionPoints(gridEntity: GridEntity): {
|
|
5474
|
+
topLeft: Vector;
|
|
5475
|
+
bottomRight: Vector;
|
|
5476
|
+
};
|
|
5458
5477
|
|
|
5459
5478
|
/** Helper function to get a string containing the grid entity's type and variant. */
|
|
5460
5479
|
export declare function getGridEntityID(gridEntity: GridEntity): GridEntityID;
|
|
@@ -7030,6 +7049,12 @@ export declare function getStringsFromTable(luaMap: LuaMap<string, unknown>, obj
|
|
|
7030
7049
|
*/
|
|
7031
7050
|
export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPlayer | undefined;
|
|
7032
7051
|
|
|
7052
|
+
/**
|
|
7053
|
+
* Helper function to get the grid entities on the surrounding tiles from the provided grid entity.
|
|
7054
|
+
*
|
|
7055
|
+
* For example, if a rock was surrounded by rocks on all sides, this would return an array of 8
|
|
7056
|
+
* rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
|
|
7057
|
+
*/
|
|
7033
7058
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
7034
7059
|
|
|
7035
7060
|
/**
|
|
@@ -7103,11 +7128,18 @@ export declare function getTime(useSocketIfAvailable?: boolean): float;
|
|
|
7103
7128
|
/** Helper function to get all of the `GridEntityTNT` in the room. */
|
|
7104
7129
|
export declare function getTNT(variant?: number): GridEntityTNT[];
|
|
7105
7130
|
|
|
7131
|
+
/**
|
|
7132
|
+
* Helper function to get the top left wall in the current room.
|
|
7133
|
+
*
|
|
7134
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
7135
|
+
*/
|
|
7106
7136
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
7107
7137
|
|
|
7108
7138
|
/**
|
|
7109
7139
|
* Helper function to get the grid index of the top left wall. (This will depend on what the current
|
|
7110
7140
|
* room shape is.)
|
|
7141
|
+
*
|
|
7142
|
+
* This function can be useful in certain situations to determine if the room is currently loaded.
|
|
7111
7143
|
*/
|
|
7112
7144
|
export declare function getTopLeftWallGridIndex(): int;
|
|
7113
7145
|
|
|
@@ -7892,6 +7924,8 @@ export declare function isAliveExceptionNPC(npc: EntityNPC): boolean;
|
|
|
7892
7924
|
* order for the room to be cleared. This function ignores other types of pressure plates, such as
|
|
7893
7925
|
* the ones that you press to get a reward, the ones that you press to start a Greed Mode wave, and
|
|
7894
7926
|
* so on.
|
|
7927
|
+
*
|
|
7928
|
+
* Returns true if there are no pressure plates in the room.
|
|
7895
7929
|
*/
|
|
7896
7930
|
export declare function isAllPressurePlatesPushed(): boolean;
|
|
7897
7931
|
|
|
@@ -8415,18 +8449,19 @@ export declare function isGreedMode(): boolean;
|
|
|
8415
8449
|
export declare function isGridEntity(variable: unknown): variable is GridEntity;
|
|
8416
8450
|
|
|
8417
8451
|
/**
|
|
8418
|
-
* Helper function to
|
|
8419
|
-
*
|
|
8452
|
+
* Helper function to detect if a particular grid entity would "break" if it was touched by an
|
|
8453
|
+
* explosion.
|
|
8420
8454
|
*
|
|
8421
|
-
*
|
|
8422
|
-
* the actual collision for the entity is removed.
|
|
8455
|
+
* For example, rocks and pots are breakable by explosions, but blocks are not.
|
|
8423
8456
|
*/
|
|
8424
8457
|
export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity): boolean;
|
|
8425
8458
|
|
|
8426
8459
|
/**
|
|
8427
|
-
* Helper function to
|
|
8428
|
-
*
|
|
8429
|
-
*
|
|
8460
|
+
* Helper function to see if the provided grid entity is in its respective broken state. See the
|
|
8461
|
+
* `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
8462
|
+
*
|
|
8463
|
+
* Note that in the case of `GridEntityType.LOCK` (11), the state will turn to being broken before
|
|
8464
|
+
* the actual collision for the entity is removed.
|
|
8430
8465
|
*/
|
|
8431
8466
|
export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
|
|
8432
8467
|
|
|
@@ -8641,8 +8676,9 @@ export declare function isPoopGridEntityType(gridEntityXMLType: GridEntityXMLTyp
|
|
|
8641
8676
|
export declare function isPoopPickup(pickup: EntityPickup): pickup is EntityPickupPoop;
|
|
8642
8677
|
|
|
8643
8678
|
/**
|
|
8644
|
-
* Helper function to
|
|
8645
|
-
*
|
|
8679
|
+
* Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
|
|
8680
|
+
* defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
|
|
8681
|
+
* at the `VarData` of the entity.)
|
|
8646
8682
|
*/
|
|
8647
8683
|
export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
|
|
8648
8684
|
|
|
@@ -16170,6 +16206,9 @@ export declare function setTrinketSprite(trinket: EntityPickup, pngPath: string
|
|
|
16170
16206
|
*
|
|
16171
16207
|
* This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
16172
16208
|
* take you to a new seed.
|
|
16209
|
+
*
|
|
16210
|
+
* Under the hood, this function calls the `Seeds.Reset` method and the
|
|
16211
|
+
* `Seeds.Restart(Challenge.NULL)` method.
|
|
16173
16212
|
*/
|
|
16174
16213
|
export declare function setUnseeded(): void;
|
|
16175
16214
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.
|
|
3
|
+
isaacscript-common 33.4.1
|
|
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,
|
|
@@ -50598,6 +50602,8 @@ local addFlag = ____flag.addFlag
|
|
|
50598
50602
|
local bitFlags = ____flag.bitFlags
|
|
50599
50603
|
local ____map = require("src.functions.map")
|
|
50600
50604
|
local getMapPartialMatch = ____map.getMapPartialMatch
|
|
50605
|
+
local ____utils = require("src.functions.utils")
|
|
50606
|
+
local assertDefined = ____utils.assertDefined
|
|
50601
50607
|
local ____Feature = require("src.classes.private.Feature")
|
|
50602
50608
|
local Feature = ____Feature.Feature
|
|
50603
50609
|
local commands = require("src.classes.features.other.extraConsoleCommands.commands")
|
|
@@ -50694,6 +50700,11 @@ function ExtraConsoleCommands.prototype.____constructor(self)
|
|
|
50694
50700
|
end
|
|
50695
50701
|
return nil
|
|
50696
50702
|
end
|
|
50703
|
+
self.isMainFeature = __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE == nil
|
|
50704
|
+
if not self.isMainFeature then
|
|
50705
|
+
return
|
|
50706
|
+
end
|
|
50707
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE = self
|
|
50697
50708
|
self.callbacksUsed = {
|
|
50698
50709
|
{ModCallback.POST_UPDATE, self.postUpdate},
|
|
50699
50710
|
{ModCallback.EVALUATE_CACHE, self.evaluateCacheDamage, {CacheFlag.DAMAGE}},
|
|
@@ -50712,6 +50723,11 @@ function ExtraConsoleCommands.prototype.____constructor(self)
|
|
|
50712
50723
|
end
|
|
50713
50724
|
end
|
|
50714
50725
|
function ExtraConsoleCommands.prototype.addConsoleCommand(self, commandName, commandFunction)
|
|
50726
|
+
if not self.isMainFeature then
|
|
50727
|
+
assertDefined(nil, __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE, "Failed to find the non-main isaacscript-common extra console commands feature in the global variable.")
|
|
50728
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE:addConsoleCommand(commandName, commandFunction)
|
|
50729
|
+
return
|
|
50730
|
+
end
|
|
50715
50731
|
if isVanillaConsoleCommand(nil, commandName) then
|
|
50716
50732
|
error(("Failed to add a new console command of \"" .. commandName) .. "\" because that name already belongs to a vanilla command. You must pick a non-colliding name.")
|
|
50717
50733
|
end
|
|
@@ -50722,8 +50738,13 @@ function ExtraConsoleCommands.prototype.addConsoleCommand(self, commandName, com
|
|
|
50722
50738
|
end
|
|
50723
50739
|
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "addConsoleCommand", true)
|
|
50724
50740
|
function ExtraConsoleCommands.prototype.removeConsoleCommand(self, commandName)
|
|
50741
|
+
if not self.isMainFeature then
|
|
50742
|
+
assertDefined(nil, __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE, "Failed to find the non-main isaacscript-common extra console commands feature in the global variable.")
|
|
50743
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE:removeConsoleCommand(commandName)
|
|
50744
|
+
return
|
|
50745
|
+
end
|
|
50725
50746
|
if not self.commandFunctionMap:has(commandName) then
|
|
50726
|
-
error(("Failed to remove the console command of \"" .. commandName) .. "\", since it does not already exist in the map.")
|
|
50747
|
+
error(("Failed to remove the console command of \"" .. commandName) .. "\", since it does not already exist in the command map.")
|
|
50727
50748
|
end
|
|
50728
50749
|
self.commandFunctionMap:delete(commandName)
|
|
50729
50750
|
end
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { Feature } from "../../private/Feature";
|
|
2
|
+
/**
|
|
3
|
+
* When you enable this feature, many custom commands will be added to the in-game console. See the
|
|
4
|
+
* [dedicated command list](ExtraConsoleCommandsList) for more information about them.
|
|
5
|
+
*
|
|
6
|
+
* Note that in order to avoid conflicts, if two or more mods enable this feature, then the first
|
|
7
|
+
* loaded one will control all of the command logic. When this occurs, a global variable of
|
|
8
|
+
* `__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE` will be created and will automatically be
|
|
9
|
+
* used by the non-main instances. For this reason, if you use multiple mods with
|
|
10
|
+
* `isaacscript-common` and a custom command from the standard library is not working properly, then
|
|
11
|
+
* you might need to get another mod author to update their version of `isaacscript-common`.
|
|
12
|
+
*/
|
|
2
13
|
export declare class ExtraConsoleCommands extends Feature {
|
|
14
|
+
private readonly isMainFeature;
|
|
3
15
|
private readonly commandFunctionMap;
|
|
4
16
|
private readonly postUpdate;
|
|
5
17
|
private readonly evaluateCacheDamage;
|
|
@@ -13,10 +25,12 @@ export declare class ExtraConsoleCommands extends Feature {
|
|
|
13
25
|
/**
|
|
14
26
|
* Helper function to add a custom console command.
|
|
15
27
|
*
|
|
16
|
-
* The standard library comes with many existing console commands that
|
|
17
|
-
* but you can also add your own commands that are useful for your
|
|
18
|
-
* add commands to the existing command system than to add your own
|
|
19
|
-
* `EXECUTE_CMD` callback.
|
|
28
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
29
|
+
* are useful for debugging, but you can also add your own commands that are useful for your
|
|
30
|
+
* particular mod. It's easier to add commands to the existing command system than to add your own
|
|
31
|
+
* logic manually to the `EXECUTE_CMD` callback.
|
|
32
|
+
*
|
|
33
|
+
* This function is intended to be called when your mod is first loading.
|
|
20
34
|
*
|
|
21
35
|
* In order to use this function, you must upgrade your mod with
|
|
22
36
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
@@ -25,8 +39,10 @@ export declare class ExtraConsoleCommands extends Feature {
|
|
|
25
39
|
/**
|
|
26
40
|
* Helper function to remove a custom console command.
|
|
27
41
|
*
|
|
28
|
-
* The standard library comes with many existing console commands that
|
|
29
|
-
* If you want to disable one of them, use this function.
|
|
42
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
43
|
+
* are useful for debugging. If you want to disable one of them, use this function.
|
|
44
|
+
*
|
|
45
|
+
* This function is intended to be called when your mod is first loading.
|
|
30
46
|
*
|
|
31
47
|
* In order to use this function, you must upgrade your mod with
|
|
32
48
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtraConsoleCommands.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ExtraConsoleCommands.ts"],"names":[],"mappings":"
|
|
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;CAoBvD"}
|
|
@@ -23,11 +23,22 @@ local addFlag = ____flag.addFlag
|
|
|
23
23
|
local bitFlags = ____flag.bitFlags
|
|
24
24
|
local ____map = require("src.functions.map")
|
|
25
25
|
local getMapPartialMatch = ____map.getMapPartialMatch
|
|
26
|
+
local ____utils = require("src.functions.utils")
|
|
27
|
+
local assertDefined = ____utils.assertDefined
|
|
26
28
|
local ____Feature = require("src.classes.private.Feature")
|
|
27
29
|
local Feature = ____Feature.Feature
|
|
28
30
|
local commands = require("src.classes.features.other.extraConsoleCommands.commands")
|
|
29
31
|
local ____v = require("src.classes.features.other.extraConsoleCommands.v")
|
|
30
32
|
local v = ____v.v
|
|
33
|
+
--- When you enable this feature, many custom commands will be added to the in-game console. See the
|
|
34
|
+
-- [dedicated command list](ExtraConsoleCommandsList) for more information about them.
|
|
35
|
+
--
|
|
36
|
+
-- Note that in order to avoid conflicts, if two or more mods enable this feature, then the first
|
|
37
|
+
-- loaded one will control all of the command logic. When this occurs, a global variable of
|
|
38
|
+
-- `__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE` will be created and will automatically be
|
|
39
|
+
-- used by the non-main instances. For this reason, if you use multiple mods with
|
|
40
|
+
-- `isaacscript-common` and a custom command from the standard library is not working properly, then
|
|
41
|
+
-- you might need to get another mod author to update their version of `isaacscript-common`.
|
|
31
42
|
____exports.ExtraConsoleCommands = __TS__Class()
|
|
32
43
|
local ExtraConsoleCommands = ____exports.ExtraConsoleCommands
|
|
33
44
|
ExtraConsoleCommands.name = "ExtraConsoleCommands"
|
|
@@ -119,6 +130,11 @@ function ExtraConsoleCommands.prototype.____constructor(self)
|
|
|
119
130
|
end
|
|
120
131
|
return nil
|
|
121
132
|
end
|
|
133
|
+
self.isMainFeature = __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE == nil
|
|
134
|
+
if not self.isMainFeature then
|
|
135
|
+
return
|
|
136
|
+
end
|
|
137
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE = self
|
|
122
138
|
self.callbacksUsed = {
|
|
123
139
|
{ModCallback.POST_UPDATE, self.postUpdate},
|
|
124
140
|
{ModCallback.EVALUATE_CACHE, self.evaluateCacheDamage, {CacheFlag.DAMAGE}},
|
|
@@ -137,6 +153,11 @@ function ExtraConsoleCommands.prototype.____constructor(self)
|
|
|
137
153
|
end
|
|
138
154
|
end
|
|
139
155
|
function ExtraConsoleCommands.prototype.addConsoleCommand(self, commandName, commandFunction)
|
|
156
|
+
if not self.isMainFeature then
|
|
157
|
+
assertDefined(nil, __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE, "Failed to find the non-main isaacscript-common extra console commands feature in the global variable.")
|
|
158
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE:addConsoleCommand(commandName, commandFunction)
|
|
159
|
+
return
|
|
160
|
+
end
|
|
140
161
|
if isVanillaConsoleCommand(nil, commandName) then
|
|
141
162
|
error(("Failed to add a new console command of \"" .. commandName) .. "\" because that name already belongs to a vanilla command. You must pick a non-colliding name.")
|
|
142
163
|
end
|
|
@@ -147,8 +168,13 @@ function ExtraConsoleCommands.prototype.addConsoleCommand(self, commandName, com
|
|
|
147
168
|
end
|
|
148
169
|
__TS__DecorateLegacy({Exported}, ExtraConsoleCommands.prototype, "addConsoleCommand", true)
|
|
149
170
|
function ExtraConsoleCommands.prototype.removeConsoleCommand(self, commandName)
|
|
171
|
+
if not self.isMainFeature then
|
|
172
|
+
assertDefined(nil, __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE, "Failed to find the non-main isaacscript-common extra console commands feature in the global variable.")
|
|
173
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE:removeConsoleCommand(commandName)
|
|
174
|
+
return
|
|
175
|
+
end
|
|
150
176
|
if not self.commandFunctionMap:has(commandName) then
|
|
151
|
-
error(("Failed to remove the console command of \"" .. commandName) .. "\", since it does not already exist in the map.")
|
|
177
|
+
error(("Failed to remove the console command of \"" .. commandName) .. "\", since it does not already exist in the command map.")
|
|
152
178
|
end
|
|
153
179
|
self.commandFunctionMap:delete(commandName)
|
|
154
180
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/extraConsoleCommands/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/extraConsoleCommands/commands.ts"],"names":[],"mappings":"AAkJA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAA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,SAAS,IAAI,IAAI,CAEhC;AAED,+CAA+C;AAC/C,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAkB1C;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,IAAI,IAAI,CAE/B;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,IAAI,IAAI,CAG9B;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
|
|
@@ -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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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()
|
|
@@ -28,6 +28,9 @@ export declare function restart(character?: PlayerType): void;
|
|
|
28
28
|
*
|
|
29
29
|
* This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
30
30
|
* take you to a new seed.
|
|
31
|
+
*
|
|
32
|
+
* Under the hood, this function calls the `Seeds.Reset` method and the
|
|
33
|
+
* `Seeds.Restart(Challenge.NULL)` method.
|
|
31
34
|
*/
|
|
32
35
|
export declare function setUnseeded(): void;
|
|
33
36
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAOtC;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAOtC;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
|
|
@@ -59,6 +59,9 @@ end
|
|
|
59
59
|
--
|
|
60
60
|
-- This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
61
61
|
-- take you to a new seed.
|
|
62
|
+
--
|
|
63
|
+
-- Under the hood, this function calls the `Seeds.Reset` method and the
|
|
64
|
+
-- `Seeds.Restart(Challenge.NULL)` method.
|
|
62
65
|
function ____exports.setUnseeded(self)
|
|
63
66
|
local seeds = game:GetSeeds()
|
|
64
67
|
seeds:Reset()
|
|
@@ -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
|
@@ -11,14 +11,33 @@ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
|
|
|
11
11
|
import { isVanillaConsoleCommand } from "../../../functions/console";
|
|
12
12
|
import { addFlag, bitFlags } from "../../../functions/flag";
|
|
13
13
|
import { getMapPartialMatch } from "../../../functions/map";
|
|
14
|
+
import { assertDefined } from "../../../functions/utils";
|
|
14
15
|
import { Feature } from "../../private/Feature";
|
|
15
16
|
import * as commands from "./extraConsoleCommands/commands";
|
|
16
17
|
import { v } from "./extraConsoleCommands/v";
|
|
17
18
|
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
|
+
declare let __ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE:
|
|
21
|
+
| ExtraConsoleCommands
|
|
22
|
+
| undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* When you enable this feature, many custom commands will be added to the in-game console. See the
|
|
26
|
+
* [dedicated command list](ExtraConsoleCommandsList) for more information about them.
|
|
27
|
+
*
|
|
28
|
+
* Note that in order to avoid conflicts, if two or more mods enable this feature, then the first
|
|
29
|
+
* loaded one will control all of the command logic. When this occurs, a global variable of
|
|
30
|
+
* `__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE` will be created and will automatically be
|
|
31
|
+
* used by the non-main instances. For this reason, if you use multiple mods with
|
|
32
|
+
* `isaacscript-common` and a custom command from the standard library is not working properly, then
|
|
33
|
+
* you might need to get another mod author to update their version of `isaacscript-common`.
|
|
34
|
+
*/
|
|
18
35
|
export class ExtraConsoleCommands extends Feature {
|
|
19
36
|
/** @internal */
|
|
20
37
|
public override v = v;
|
|
21
38
|
|
|
39
|
+
private readonly isMainFeature: boolean;
|
|
40
|
+
|
|
22
41
|
private readonly commandFunctionMap = new Map<
|
|
23
42
|
string,
|
|
24
43
|
(params: string) => void
|
|
@@ -28,6 +47,16 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
28
47
|
constructor() {
|
|
29
48
|
super();
|
|
30
49
|
|
|
50
|
+
// Only one instance of this feature can be instantiated across all mods.
|
|
51
|
+
this.isMainFeature =
|
|
52
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE === undefined;
|
|
53
|
+
if (!this.isMainFeature) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this
|
|
58
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE = this;
|
|
59
|
+
|
|
31
60
|
this.callbacksUsed = [
|
|
32
61
|
// 1
|
|
33
62
|
[ModCallback.POST_UPDATE, this.postUpdate],
|
|
@@ -176,8 +205,8 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
176
205
|
private readonly executeCmd = (command: string, params: string) => {
|
|
177
206
|
const resultTuple = getMapPartialMatch(command, this.commandFunctionMap);
|
|
178
207
|
if (resultTuple === undefined) {
|
|
179
|
-
// We
|
|
180
|
-
//
|
|
208
|
+
// We opt to not print an error message because a non-IsaacScript mod may have configured a
|
|
209
|
+
// custom console command.
|
|
181
210
|
return;
|
|
182
211
|
}
|
|
183
212
|
|
|
@@ -211,10 +240,12 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
211
240
|
/**
|
|
212
241
|
* Helper function to add a custom console command.
|
|
213
242
|
*
|
|
214
|
-
* The standard library comes with many existing console commands that
|
|
215
|
-
* but you can also add your own commands that are useful for your
|
|
216
|
-
* add commands to the existing command system than to add your own
|
|
217
|
-
* `EXECUTE_CMD` callback.
|
|
243
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
244
|
+
* are useful for debugging, but you can also add your own commands that are useful for your
|
|
245
|
+
* particular mod. It's easier to add commands to the existing command system than to add your own
|
|
246
|
+
* logic manually to the `EXECUTE_CMD` callback.
|
|
247
|
+
*
|
|
248
|
+
* This function is intended to be called when your mod is first loading.
|
|
218
249
|
*
|
|
219
250
|
* In order to use this function, you must upgrade your mod with
|
|
220
251
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
@@ -224,6 +255,18 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
224
255
|
commandName: string,
|
|
225
256
|
commandFunction: (params: string) => void,
|
|
226
257
|
): void {
|
|
258
|
+
if (!this.isMainFeature) {
|
|
259
|
+
assertDefined(
|
|
260
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE,
|
|
261
|
+
"Failed to find the non-main isaacscript-common extra console commands feature in the global variable.",
|
|
262
|
+
);
|
|
263
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE.addConsoleCommand(
|
|
264
|
+
commandName,
|
|
265
|
+
commandFunction,
|
|
266
|
+
);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
227
270
|
if (isVanillaConsoleCommand(commandName)) {
|
|
228
271
|
error(
|
|
229
272
|
`Failed to add a new console command of "${commandName}" because that name already belongs to a vanilla command. You must pick a non-colliding name.`,
|
|
@@ -242,17 +285,30 @@ export class ExtraConsoleCommands extends Feature {
|
|
|
242
285
|
/**
|
|
243
286
|
* Helper function to remove a custom console command.
|
|
244
287
|
*
|
|
245
|
-
* The standard library comes with many existing console commands that
|
|
246
|
-
* If you want to disable one of them, use this function.
|
|
288
|
+
* The standard library comes with [many existing console commands](ExtraConsoleCommandsList) that
|
|
289
|
+
* are useful for debugging. If you want to disable one of them, use this function.
|
|
290
|
+
*
|
|
291
|
+
* This function is intended to be called when your mod is first loading.
|
|
247
292
|
*
|
|
248
293
|
* In order to use this function, you must upgrade your mod with
|
|
249
294
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`.
|
|
250
295
|
*/
|
|
251
296
|
@Exported
|
|
252
297
|
public removeConsoleCommand(commandName: string): void {
|
|
298
|
+
if (!this.isMainFeature) {
|
|
299
|
+
assertDefined(
|
|
300
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE,
|
|
301
|
+
"Failed to find the non-main isaacscript-common extra console commands feature in the global variable.",
|
|
302
|
+
);
|
|
303
|
+
__ISAACSCRIPT_COMMON_EXTRA_CONSOLE_COMMANDS_FEATURE.removeConsoleCommand(
|
|
304
|
+
commandName,
|
|
305
|
+
);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
253
309
|
if (!this.commandFunctionMap.has(commandName)) {
|
|
254
310
|
error(
|
|
255
|
-
`Failed to remove the console command of "${commandName}", since it does not already exist in the map.`,
|
|
311
|
+
`Failed to remove the console command of "${commandName}", since it does not already exist in the command map.`,
|
|
256
312
|
);
|
|
257
313
|
}
|
|
258
314
|
|
|
@@ -10,7 +10,12 @@ eslint "sort-exports/sort-exports": [
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* __DOCS_LINE_THAT_WILL_BE_AUTOMATICALLY_REMOVED__
|
|
14
|
+
*
|
|
15
|
+
* This is a list of custom console commands that are included with the standard library. By
|
|
16
|
+
* default, they will not be enabled. You can enable them by upgrading your mod with
|
|
17
|
+
* `ISCFeature.EXTRA_CONSOLE_COMMANDS`. (Also see the [Extra Console Commands](ExtraConsoleCommands)
|
|
18
|
+
* feature documentation.)
|
|
14
19
|
*
|
|
15
20
|
* As a quality of life feature, you do not have to match the casing of the command. For example,
|
|
16
21
|
* you can type the "addCharges" command as "addcharges", and it will still work the same.
|
|
@@ -22,9 +27,9 @@ eslint "sort-exports/sort-exports": [
|
|
|
22
27
|
* `ISCFeature.EXTRA_CONSOLE_COMMANDS` when upgrading your mod. (See the "Extra Console Commands
|
|
23
28
|
* (Init)" page for more details.)
|
|
24
29
|
*
|
|
25
|
-
* Each command has a corresponding function of the same name, but these functions are not
|
|
26
|
-
*
|
|
27
|
-
*
|
|
30
|
+
* Each command has a corresponding function of the same name, but these functions are not exported
|
|
31
|
+
* for end-user consumption. (This is to cut down on namespace conflicts and because the names of
|
|
32
|
+
* the functions are not very descriptive.)
|
|
28
33
|
*
|
|
29
34
|
* @module
|
|
30
35
|
*/
|
|
@@ -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();
|
package/src/functions/run.ts
CHANGED
|
@@ -81,6 +81,9 @@ export function restart(character?: PlayerType): void {
|
|
|
81
81
|
*
|
|
82
82
|
* This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
83
83
|
* take you to a new seed.
|
|
84
|
+
*
|
|
85
|
+
* Under the hood, this function calls the `Seeds.Reset` method and the
|
|
86
|
+
* `Seeds.Restart(Challenge.NULL)` method.
|
|
84
87
|
*/
|
|
85
88
|
export function setUnseeded(): void {
|
|
86
89
|
const seeds = game.GetSeeds();
|
|
@@ -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
|