isaacscript-common 13.1.0 → 13.1.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.d.ts CHANGED
@@ -6628,15 +6628,6 @@ export declare function isVanillaTrinketType(trinketType: TrinketType): boolean;
6628
6628
  */
6629
6629
  export declare function isVanillaTSTLClass(object: unknown): boolean;
6630
6630
 
6631
- /**
6632
- * Helper function to determine if a given wall is a "real" wall generated by the vanilla game. This
6633
- * is useful because mods can use custom spawned walls as a stand-in for custom grid entities.
6634
- *
6635
- * This function checks for identity via a combination of `StageAPI.IsCustomGrid` and the
6636
- * `isVanillaWallGridIndex` function.
6637
- */
6638
- export declare function isVanillaWall(gridEntity: GridEntity): boolean;
6639
-
6640
6631
  /**
6641
6632
  * Helper function to determine if a given grid index should have a wall generated by the vanilla
6642
6633
  * game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 13.1.0
3
+ isaacscript-common 13.1.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -40874,6 +40874,302 @@ function ____exports.customTrapdoorInit(self, mod)
40874
40874
  mod:AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate)
40875
40875
  mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE, postGridEntityCustomUpdateTrapdoor, GridEntityTypeCustom.TRAPDOOR_CUSTOM)
40876
40876
  end
40877
+ return ____exports
40878
+ end,
40879
+ ["src.functions.gridIndex"] = function(...)
40880
+ local ____exports = {}
40881
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
40882
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
40883
+ local ____roomShape = require("src.functions.roomShape")
40884
+ local getRoomShapeWidth = ____roomShape.getRoomShapeWidth
40885
+ local ____utils = require("src.functions.utils")
40886
+ local iRange = ____utils.iRange
40887
+ function ____exports.getGridIndexesBetween(self, gridIndex1, gridIndex2, roomShape)
40888
+ if gridIndex1 > gridIndex2 then
40889
+ local oldGridIndex1 = gridIndex1
40890
+ local oldGridIndex2 = gridIndex2
40891
+ gridIndex1 = oldGridIndex2
40892
+ gridIndex2 = oldGridIndex1
40893
+ end
40894
+ local delta = gridIndex2 - gridIndex1
40895
+ local gridWidth = getRoomShapeWidth(nil, roomShape)
40896
+ local isOnHorizontalLine = delta <= gridWidth
40897
+ if isOnHorizontalLine then
40898
+ return iRange(nil, gridIndex1, gridIndex2)
40899
+ end
40900
+ local isOnVerticalLine = delta % gridWidth == 0
40901
+ if isOnVerticalLine then
40902
+ return iRange(nil, gridIndex1, gridIndex2, gridWidth)
40903
+ end
40904
+ error(((((((("Failed to get the grid indexes between " .. tostring(gridIndex1)) .. " and ") .. tostring(gridIndex2)) .. " for RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") since they are not on the same horizontal or vertical line.")
40905
+ end
40906
+ return ____exports
40907
+ end,
40908
+ ["src.functions.roomShapeWalls"] = function(...)
40909
+ local ____lualib = require("lualib_bundle")
40910
+ local Map = ____lualib.Map
40911
+ local __TS__New = ____lualib.__TS__New
40912
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
40913
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
40914
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
40915
+ local Set = ____lualib.Set
40916
+ local ____exports = {}
40917
+ local getRoomShapeToWallGridIndexSet, getVanillaWallGridIndexSetForRoomShape, getWallGridIndexSetForRectangleRoomShape
40918
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
40919
+ local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
40920
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
40921
+ local ____cachedClasses = require("src.core.cachedClasses")
40922
+ local game = ____cachedClasses.game
40923
+ local ____CornerType = require("src.enums.CornerType")
40924
+ local CornerType = ____CornerType.CornerType
40925
+ local ____enums = require("src.functions.enums")
40926
+ local getEnumValues = ____enums.getEnumValues
40927
+ local ____gridIndex = require("src.functions.gridIndex")
40928
+ local getGridIndexesBetween = ____gridIndex.getGridIndexesBetween
40929
+ local ____rooms = require("src.functions.rooms")
40930
+ local inBossRoomOf = ____rooms.inBossRoomOf
40931
+ local inHomeCloset = ____rooms.inHomeCloset
40932
+ local ____roomShape = require("src.functions.roomShape")
40933
+ local getRoomShapeCorners = ____roomShape.getRoomShapeCorners
40934
+ local isLRoom = ____roomShape.isLRoom
40935
+ function getRoomShapeToWallGridIndexSet(self)
40936
+ local roomShapeToWallGridIndexSet = __TS__New(Map)
40937
+ for ____, roomShape in ipairs(getEnumValues(nil, RoomShape)) do
40938
+ local gridIndexSet = getVanillaWallGridIndexSetForRoomShape(nil, roomShape)
40939
+ roomShapeToWallGridIndexSet:set(roomShape, gridIndexSet)
40940
+ end
40941
+ return roomShapeToWallGridIndexSet
40942
+ end
40943
+ function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
40944
+ local corners = getRoomShapeCorners(nil, roomShape)
40945
+ local lRoom = isLRoom(nil, roomShape)
40946
+ if lRoom and #corners ~= 6 then
40947
+ error(((("Failed to get the correct amount of corners for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
40948
+ end
40949
+ repeat
40950
+ local ____switch7 = roomShape
40951
+ local ____cond7 = ____switch7 == RoomShape.LTL
40952
+ if ____cond7 then
40953
+ do
40954
+ local topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight = table.unpack(corners)
40955
+ local ____Set_1 = Set
40956
+ local ____array_0 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, topRight.gridIndex, roomShape)))
40957
+ __TS__SparseArrayPush(
40958
+ ____array_0,
40959
+ table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, middle.gridIndex, roomShape))
40960
+ )
40961
+ __TS__SparseArrayPush(
40962
+ ____array_0,
40963
+ table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
40964
+ )
40965
+ __TS__SparseArrayPush(
40966
+ ____array_0,
40967
+ table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, bottomLeft.gridIndex, roomShape))
40968
+ )
40969
+ __TS__SparseArrayPush(
40970
+ ____array_0,
40971
+ table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, middle.gridIndex, roomShape))
40972
+ )
40973
+ __TS__SparseArrayPush(
40974
+ ____array_0,
40975
+ table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
40976
+ )
40977
+ return __TS__New(
40978
+ ____Set_1,
40979
+ {__TS__SparseArraySpread(____array_0)}
40980
+ )
40981
+ end
40982
+ end
40983
+ ____cond7 = ____cond7 or ____switch7 == RoomShape.LTR
40984
+ if ____cond7 then
40985
+ do
40986
+ local topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight = table.unpack(corners)
40987
+ local ____Set_3 = Set
40988
+ local ____array_2 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topMiddle.gridIndex, roomShape)))
40989
+ __TS__SparseArrayPush(
40990
+ ____array_2,
40991
+ table.unpack(getGridIndexesBetween(nil, middle.gridIndex, middleRight.gridIndex, roomShape))
40992
+ )
40993
+ __TS__SparseArrayPush(
40994
+ ____array_2,
40995
+ table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
40996
+ )
40997
+ __TS__SparseArrayPush(
40998
+ ____array_2,
40999
+ table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
41000
+ )
41001
+ __TS__SparseArrayPush(
41002
+ ____array_2,
41003
+ table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, middle.gridIndex, roomShape))
41004
+ )
41005
+ __TS__SparseArrayPush(
41006
+ ____array_2,
41007
+ table.unpack(getGridIndexesBetween(nil, middleRight.gridIndex, bottomRight.gridIndex, roomShape))
41008
+ )
41009
+ return __TS__New(
41010
+ ____Set_3,
41011
+ {__TS__SparseArraySpread(____array_2)}
41012
+ )
41013
+ end
41014
+ end
41015
+ ____cond7 = ____cond7 or ____switch7 == RoomShape.LBL
41016
+ if ____cond7 then
41017
+ do
41018
+ local topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight = table.unpack(corners)
41019
+ local ____Set_5 = Set
41020
+ local ____array_4 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
41021
+ __TS__SparseArrayPush(
41022
+ ____array_4,
41023
+ table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, middle.gridIndex, roomShape))
41024
+ )
41025
+ __TS__SparseArrayPush(
41026
+ ____array_4,
41027
+ table.unpack(getGridIndexesBetween(nil, bottomMiddle.gridIndex, bottomRight.gridIndex, roomShape))
41028
+ )
41029
+ __TS__SparseArrayPush(
41030
+ ____array_4,
41031
+ table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, middleLeft.gridIndex, roomShape))
41032
+ )
41033
+ __TS__SparseArrayPush(
41034
+ ____array_4,
41035
+ table.unpack(getGridIndexesBetween(nil, middle.gridIndex, bottomMiddle.gridIndex, roomShape))
41036
+ )
41037
+ __TS__SparseArrayPush(
41038
+ ____array_4,
41039
+ table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
41040
+ )
41041
+ return __TS__New(
41042
+ ____Set_5,
41043
+ {__TS__SparseArraySpread(____array_4)}
41044
+ )
41045
+ end
41046
+ end
41047
+ ____cond7 = ____cond7 or ____switch7 == RoomShape.LBR
41048
+ if ____cond7 then
41049
+ do
41050
+ local topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle = table.unpack(corners)
41051
+ local ____Set_7 = Set
41052
+ local ____array_6 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
41053
+ __TS__SparseArrayPush(
41054
+ ____array_6,
41055
+ table.unpack(getGridIndexesBetween(nil, middle.gridIndex, middleRight.gridIndex, roomShape))
41056
+ )
41057
+ __TS__SparseArrayPush(
41058
+ ____array_6,
41059
+ table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomMiddle.gridIndex, roomShape))
41060
+ )
41061
+ __TS__SparseArrayPush(
41062
+ ____array_6,
41063
+ table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
41064
+ )
41065
+ __TS__SparseArrayPush(
41066
+ ____array_6,
41067
+ table.unpack(getGridIndexesBetween(nil, middle.gridIndex, bottomMiddle.gridIndex, roomShape))
41068
+ )
41069
+ __TS__SparseArrayPush(
41070
+ ____array_6,
41071
+ table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, middleRight.gridIndex, roomShape))
41072
+ )
41073
+ return __TS__New(
41074
+ ____Set_7,
41075
+ {__TS__SparseArraySpread(____array_6)}
41076
+ )
41077
+ end
41078
+ end
41079
+ do
41080
+ do
41081
+ return getWallGridIndexSetForRectangleRoomShape(nil, roomShape, corners)
41082
+ end
41083
+ end
41084
+ until true
41085
+ end
41086
+ function getWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
41087
+ if #corners ~= 4 then
41088
+ error("Failed to get the correct amount of corners for rectangular room shape.")
41089
+ end
41090
+ local topLeft, topRight, bottomLeft, bottomRight = table.unpack(corners)
41091
+ local ____Set_9 = Set
41092
+ local ____array_8 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
41093
+ __TS__SparseArrayPush(
41094
+ ____array_8,
41095
+ table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
41096
+ )
41097
+ __TS__SparseArrayPush(
41098
+ ____array_8,
41099
+ table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
41100
+ )
41101
+ __TS__SparseArrayPush(
41102
+ ____array_8,
41103
+ table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
41104
+ )
41105
+ return __TS__New(
41106
+ ____Set_9,
41107
+ {__TS__SparseArraySpread(____array_8)}
41108
+ )
41109
+ end
41110
+ local ROOM_SHAPE_TO_WALL_GRID_INDEX_SET = getRoomShapeToWallGridIndexSet(nil)
41111
+ local HOME_CLOSET_CORNERS = {
41112
+ {
41113
+ type = CornerType.TOP_LEFT,
41114
+ gridIndex = 30,
41115
+ position = Vector(60, 220)
41116
+ },
41117
+ {
41118
+ type = CornerType.TOP_RIGHT,
41119
+ gridIndex = 38,
41120
+ position = Vector(340, 220)
41121
+ },
41122
+ {
41123
+ type = CornerType.BOTTOM_LEFT,
41124
+ gridIndex = 90,
41125
+ position = Vector(60, 340)
41126
+ },
41127
+ {
41128
+ type = CornerType.BOTTOM_RIGHT,
41129
+ gridIndex = 98,
41130
+ position = Vector(340, 340)
41131
+ }
41132
+ }
41133
+ local HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
41134
+ local MOTHER_ROOM_CORNERS = {
41135
+ {
41136
+ type = CornerType.TOP_LEFT,
41137
+ gridIndex = 0,
41138
+ position = Vector(60, 140)
41139
+ },
41140
+ {
41141
+ type = CornerType.TOP_RIGHT,
41142
+ gridIndex = 14,
41143
+ position = Vector(580, 140)
41144
+ },
41145
+ {
41146
+ type = CornerType.BOTTOM_LEFT,
41147
+ gridIndex = 150,
41148
+ position = Vector(60, 500)
41149
+ },
41150
+ {
41151
+ type = CornerType.BOTTOM_RIGHT,
41152
+ gridIndex = 164,
41153
+ position = Vector(580, 500)
41154
+ }
41155
+ }
41156
+ local MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
41157
+ function ____exports.isVanillaWallGridIndex(self, gridIndex)
41158
+ local room = game:GetRoom()
41159
+ local roomShape = room:GetRoomShape()
41160
+ local wallGridIndexSet
41161
+ if inHomeCloset(nil) then
41162
+ wallGridIndexSet = HOME_CLOSET_CORNERS_SET
41163
+ elseif inBossRoomOf(nil, BossID.MOTHER) then
41164
+ wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
41165
+ else
41166
+ wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
41167
+ end
41168
+ if wallGridIndexSet == nil then
41169
+ error(((("Failed to find the wall grid index set for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
41170
+ end
41171
+ return wallGridIndexSet:has(gridIndex)
41172
+ end
40877
41173
  return ____exports
40878
41174
  end,
40879
41175
  ["src.functions.emptyRoom"] = function(...)
@@ -40881,7 +41177,7 @@ local ____lualib = require("lualib_bundle")
40881
41177
  local Set = ____lualib.Set
40882
41178
  local __TS__New = ____lualib.__TS__New
40883
41179
  local ____exports = {}
40884
- local emptyRoomEntities, emptyRoomGridEntities, EMPTY_ROOM_BLACKLIST_ENTITY_SET, EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET
41180
+ local emptyRoomEntities, emptyRoomGridEntities, EMPTY_ROOM_BLACKLIST_ENTITY_SET
40885
41181
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
40886
41182
  local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
40887
41183
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
@@ -40895,6 +41191,8 @@ local getGridEntities = ____gridEntities.getGridEntities
40895
41191
  local removeGridEntity = ____gridEntities.removeGridEntity
40896
41192
  local ____rooms = require("src.functions.rooms")
40897
41193
  local roomUpdateSafe = ____rooms.roomUpdateSafe
41194
+ local ____roomShapeWalls = require("src.functions.roomShapeWalls")
41195
+ local isVanillaWallGridIndex = ____roomShapeWalls.isVanillaWallGridIndex
40898
41196
  function emptyRoomEntities(self)
40899
41197
  local room = game:GetRoom()
40900
41198
  for ____, entity in ipairs(getEntities(nil)) do
@@ -40920,7 +41218,11 @@ function emptyRoomGridEntities(self)
40920
41218
  for ____, gridEntity in ipairs(getGridEntities(nil)) do
40921
41219
  do
40922
41220
  local gridEntityType = gridEntity:GetType()
40923
- if EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET:has(gridEntityType) then
41221
+ local gridIndex = gridEntity:GetGridIndex()
41222
+ if gridEntityType == GridEntityType.WALL and isVanillaWallGridIndex(nil, gridIndex) then
41223
+ goto __continue10
41224
+ end
41225
+ if gridEntityType == GridEntityType.DOOR then
40924
41226
  goto __continue10
40925
41227
  end
40926
41228
  removeGridEntity(nil, gridEntity, false)
@@ -40941,7 +41243,6 @@ EMPTY_ROOM_BLACKLIST_ENTITY_SET = __TS__New(Set, {
40941
41243
  EntityType.PROJECTILE,
40942
41244
  EntityType.DARK_ESAU
40943
41245
  })
40944
- EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET = __TS__New(Set, {GridEntityType.WALL, GridEntityType.DOOR})
40945
41246
  function ____exports.emptyRoom(self)
40946
41247
  emptyRoomEntities(nil)
40947
41248
  emptyRoomGridEntities(nil)
@@ -48579,35 +48880,6 @@ function ____exports.logNewGlobals(self)
48579
48880
  end
48580
48881
  )
48581
48882
  end
48582
- return ____exports
48583
- end,
48584
- ["src.functions.gridIndex"] = function(...)
48585
- local ____exports = {}
48586
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
48587
- local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
48588
- local ____roomShape = require("src.functions.roomShape")
48589
- local getRoomShapeWidth = ____roomShape.getRoomShapeWidth
48590
- local ____utils = require("src.functions.utils")
48591
- local iRange = ____utils.iRange
48592
- function ____exports.getGridIndexesBetween(self, gridIndex1, gridIndex2, roomShape)
48593
- if gridIndex1 > gridIndex2 then
48594
- local oldGridIndex1 = gridIndex1
48595
- local oldGridIndex2 = gridIndex2
48596
- gridIndex1 = oldGridIndex2
48597
- gridIndex2 = oldGridIndex1
48598
- end
48599
- local delta = gridIndex2 - gridIndex1
48600
- local gridWidth = getRoomShapeWidth(nil, roomShape)
48601
- local isOnHorizontalLine = delta <= gridWidth
48602
- if isOnHorizontalLine then
48603
- return iRange(nil, gridIndex1, gridIndex2)
48604
- end
48605
- local isOnVerticalLine = delta % gridWidth == 0
48606
- if isOnVerticalLine then
48607
- return iRange(nil, gridIndex1, gridIndex2, gridWidth)
48608
- end
48609
- error(((((((("Failed to get the grid indexes between " .. tostring(gridIndex1)) .. " and ") .. tostring(gridIndex2)) .. " for RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") since they are not on the same horizontal or vertical line.")
48610
- end
48611
48883
  return ____exports
48612
48884
  end,
48613
48885
  ["src.functions.hex"] = function(...)
@@ -49676,280 +49948,6 @@ function ____exports.spawnRockAltReward(self, position, rockAltType, seedOrRNG)
49676
49948
  end
49677
49949
  until true
49678
49950
  end
49679
- return ____exports
49680
- end,
49681
- ["src.functions.roomShapeWalls"] = function(...)
49682
- local ____lualib = require("lualib_bundle")
49683
- local Map = ____lualib.Map
49684
- local __TS__New = ____lualib.__TS__New
49685
- local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
49686
- local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
49687
- local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
49688
- local Set = ____lualib.Set
49689
- local ____exports = {}
49690
- local getRoomShapeToWallGridIndexSet, getVanillaWallGridIndexSetForRoomShape, getWallGridIndexSetForRectangleRoomShape, ROOM_SHAPE_TO_WALL_GRID_INDEX_SET, HOME_CLOSET_CORNERS_SET, MOTHER_ROOM_CORNERS_SET
49691
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
49692
- local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
49693
- local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
49694
- local ____cachedClasses = require("src.core.cachedClasses")
49695
- local game = ____cachedClasses.game
49696
- local ____CornerType = require("src.enums.CornerType")
49697
- local CornerType = ____CornerType.CornerType
49698
- local ____enums = require("src.functions.enums")
49699
- local getEnumValues = ____enums.getEnumValues
49700
- local ____gridIndex = require("src.functions.gridIndex")
49701
- local getGridIndexesBetween = ____gridIndex.getGridIndexesBetween
49702
- local ____rooms = require("src.functions.rooms")
49703
- local inBossRoomOf = ____rooms.inBossRoomOf
49704
- local inHomeCloset = ____rooms.inHomeCloset
49705
- local ____roomShape = require("src.functions.roomShape")
49706
- local getRoomShapeCorners = ____roomShape.getRoomShapeCorners
49707
- local isLRoom = ____roomShape.isLRoom
49708
- function getRoomShapeToWallGridIndexSet(self)
49709
- local roomShapeToWallGridIndexSet = __TS__New(Map)
49710
- for ____, roomShape in ipairs(getEnumValues(nil, RoomShape)) do
49711
- local gridIndexSet = getVanillaWallGridIndexSetForRoomShape(nil, roomShape)
49712
- roomShapeToWallGridIndexSet:set(roomShape, gridIndexSet)
49713
- end
49714
- return roomShapeToWallGridIndexSet
49715
- end
49716
- function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
49717
- local corners = getRoomShapeCorners(nil, roomShape)
49718
- local lRoom = isLRoom(nil, roomShape)
49719
- if lRoom and #corners ~= 6 then
49720
- error(((("Failed to get the correct amount of corners for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
49721
- end
49722
- repeat
49723
- local ____switch7 = roomShape
49724
- local ____cond7 = ____switch7 == RoomShape.LTL
49725
- if ____cond7 then
49726
- do
49727
- local topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight = table.unpack(corners)
49728
- local ____Set_1 = Set
49729
- local ____array_0 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, topRight.gridIndex, roomShape)))
49730
- __TS__SparseArrayPush(
49731
- ____array_0,
49732
- table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, middle.gridIndex, roomShape))
49733
- )
49734
- __TS__SparseArrayPush(
49735
- ____array_0,
49736
- table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
49737
- )
49738
- __TS__SparseArrayPush(
49739
- ____array_0,
49740
- table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, bottomLeft.gridIndex, roomShape))
49741
- )
49742
- __TS__SparseArrayPush(
49743
- ____array_0,
49744
- table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, middle.gridIndex, roomShape))
49745
- )
49746
- __TS__SparseArrayPush(
49747
- ____array_0,
49748
- table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
49749
- )
49750
- return __TS__New(
49751
- ____Set_1,
49752
- {__TS__SparseArraySpread(____array_0)}
49753
- )
49754
- end
49755
- end
49756
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LTR
49757
- if ____cond7 then
49758
- do
49759
- local topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight = table.unpack(corners)
49760
- local ____Set_3 = Set
49761
- local ____array_2 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topMiddle.gridIndex, roomShape)))
49762
- __TS__SparseArrayPush(
49763
- ____array_2,
49764
- table.unpack(getGridIndexesBetween(nil, middle.gridIndex, middleRight.gridIndex, roomShape))
49765
- )
49766
- __TS__SparseArrayPush(
49767
- ____array_2,
49768
- table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
49769
- )
49770
- __TS__SparseArrayPush(
49771
- ____array_2,
49772
- table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
49773
- )
49774
- __TS__SparseArrayPush(
49775
- ____array_2,
49776
- table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, middle.gridIndex, roomShape))
49777
- )
49778
- __TS__SparseArrayPush(
49779
- ____array_2,
49780
- table.unpack(getGridIndexesBetween(nil, middleRight.gridIndex, bottomRight.gridIndex, roomShape))
49781
- )
49782
- return __TS__New(
49783
- ____Set_3,
49784
- {__TS__SparseArraySpread(____array_2)}
49785
- )
49786
- end
49787
- end
49788
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LBL
49789
- if ____cond7 then
49790
- do
49791
- local topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight = table.unpack(corners)
49792
- local ____Set_5 = Set
49793
- local ____array_4 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
49794
- __TS__SparseArrayPush(
49795
- ____array_4,
49796
- table.unpack(getGridIndexesBetween(nil, middleLeft.gridIndex, middle.gridIndex, roomShape))
49797
- )
49798
- __TS__SparseArrayPush(
49799
- ____array_4,
49800
- table.unpack(getGridIndexesBetween(nil, bottomMiddle.gridIndex, bottomRight.gridIndex, roomShape))
49801
- )
49802
- __TS__SparseArrayPush(
49803
- ____array_4,
49804
- table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, middleLeft.gridIndex, roomShape))
49805
- )
49806
- __TS__SparseArrayPush(
49807
- ____array_4,
49808
- table.unpack(getGridIndexesBetween(nil, middle.gridIndex, bottomMiddle.gridIndex, roomShape))
49809
- )
49810
- __TS__SparseArrayPush(
49811
- ____array_4,
49812
- table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
49813
- )
49814
- return __TS__New(
49815
- ____Set_5,
49816
- {__TS__SparseArraySpread(____array_4)}
49817
- )
49818
- end
49819
- end
49820
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LBR
49821
- if ____cond7 then
49822
- do
49823
- local topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle = table.unpack(corners)
49824
- local ____Set_7 = Set
49825
- local ____array_6 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
49826
- __TS__SparseArrayPush(
49827
- ____array_6,
49828
- table.unpack(getGridIndexesBetween(nil, middle.gridIndex, middleRight.gridIndex, roomShape))
49829
- )
49830
- __TS__SparseArrayPush(
49831
- ____array_6,
49832
- table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomMiddle.gridIndex, roomShape))
49833
- )
49834
- __TS__SparseArrayPush(
49835
- ____array_6,
49836
- table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
49837
- )
49838
- __TS__SparseArrayPush(
49839
- ____array_6,
49840
- table.unpack(getGridIndexesBetween(nil, middle.gridIndex, bottomMiddle.gridIndex, roomShape))
49841
- )
49842
- __TS__SparseArrayPush(
49843
- ____array_6,
49844
- table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, middleRight.gridIndex, roomShape))
49845
- )
49846
- return __TS__New(
49847
- ____Set_7,
49848
- {__TS__SparseArraySpread(____array_6)}
49849
- )
49850
- end
49851
- end
49852
- do
49853
- do
49854
- return getWallGridIndexSetForRectangleRoomShape(nil, roomShape, corners)
49855
- end
49856
- end
49857
- until true
49858
- end
49859
- function getWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
49860
- if #corners ~= 4 then
49861
- error("Failed to get the correct amount of corners for rectangular room shape.")
49862
- end
49863
- local topLeft, topRight, bottomLeft, bottomRight = table.unpack(corners)
49864
- local ____Set_9 = Set
49865
- local ____array_8 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
49866
- __TS__SparseArrayPush(
49867
- ____array_8,
49868
- table.unpack(getGridIndexesBetween(nil, bottomLeft.gridIndex, bottomRight.gridIndex, roomShape))
49869
- )
49870
- __TS__SparseArrayPush(
49871
- ____array_8,
49872
- table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, bottomLeft.gridIndex, roomShape))
49873
- )
49874
- __TS__SparseArrayPush(
49875
- ____array_8,
49876
- table.unpack(getGridIndexesBetween(nil, topRight.gridIndex, bottomRight.gridIndex, roomShape))
49877
- )
49878
- return __TS__New(
49879
- ____Set_9,
49880
- {__TS__SparseArraySpread(____array_8)}
49881
- )
49882
- end
49883
- function ____exports.isVanillaWallGridIndex(self, gridIndex)
49884
- local room = game:GetRoom()
49885
- local roomShape = room:GetRoomShape()
49886
- local wallGridIndexSet
49887
- if inHomeCloset(nil) then
49888
- wallGridIndexSet = HOME_CLOSET_CORNERS_SET
49889
- elseif inBossRoomOf(nil, BossID.MOTHER) then
49890
- wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
49891
- else
49892
- wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
49893
- end
49894
- if wallGridIndexSet == nil then
49895
- error(((("Failed to find the wall grid index set for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
49896
- end
49897
- return wallGridIndexSet:has(gridIndex)
49898
- end
49899
- ROOM_SHAPE_TO_WALL_GRID_INDEX_SET = getRoomShapeToWallGridIndexSet(nil)
49900
- local HOME_CLOSET_CORNERS = {
49901
- {
49902
- type = CornerType.TOP_LEFT,
49903
- gridIndex = 30,
49904
- position = Vector(60, 220)
49905
- },
49906
- {
49907
- type = CornerType.TOP_RIGHT,
49908
- gridIndex = 38,
49909
- position = Vector(340, 220)
49910
- },
49911
- {
49912
- type = CornerType.BOTTOM_LEFT,
49913
- gridIndex = 90,
49914
- position = Vector(60, 340)
49915
- },
49916
- {
49917
- type = CornerType.BOTTOM_RIGHT,
49918
- gridIndex = 98,
49919
- position = Vector(340, 340)
49920
- }
49921
- }
49922
- HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
49923
- local MOTHER_ROOM_CORNERS = {
49924
- {
49925
- type = CornerType.TOP_LEFT,
49926
- gridIndex = 0,
49927
- position = Vector(60, 140)
49928
- },
49929
- {
49930
- type = CornerType.TOP_RIGHT,
49931
- gridIndex = 14,
49932
- position = Vector(580, 140)
49933
- },
49934
- {
49935
- type = CornerType.BOTTOM_LEFT,
49936
- gridIndex = 150,
49937
- position = Vector(60, 500)
49938
- },
49939
- {
49940
- type = CornerType.BOTTOM_RIGHT,
49941
- gridIndex = 164,
49942
- position = Vector(580, 500)
49943
- }
49944
- }
49945
- MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
49946
- function ____exports.isVanillaWall(self, gridEntity)
49947
- local gridIndex = gridEntity:GetGridIndex()
49948
- if StageAPI ~= nil and StageAPI.IsCustomGrid(gridIndex) then
49949
- return false
49950
- end
49951
- return ____exports.isVanillaWallGridIndex(nil, gridIndex)
49952
- end
49953
49951
  return ____exports
49954
49952
  end,
49955
49953
  ["src.functions.saveFile"] = function(...)
@@ -1 +1 @@
1
- {"version":3,"file":"emptyRoom.d.ts","sourceRoot":"","sources":["../../../src/functions/emptyRoom.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAGhC"}
1
+ {"version":3,"file":"emptyRoom.d.ts","sourceRoot":"","sources":["../../../src/functions/emptyRoom.ts"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAGhC"}
@@ -2,7 +2,7 @@ local ____lualib = require("lualib_bundle")
2
2
  local Set = ____lualib.Set
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
- local emptyRoomEntities, emptyRoomGridEntities, EMPTY_ROOM_BLACKLIST_ENTITY_SET, EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET
5
+ local emptyRoomEntities, emptyRoomGridEntities, EMPTY_ROOM_BLACKLIST_ENTITY_SET
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
7
  local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
8
8
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
@@ -16,6 +16,8 @@ local getGridEntities = ____gridEntities.getGridEntities
16
16
  local removeGridEntity = ____gridEntities.removeGridEntity
17
17
  local ____rooms = require("src.functions.rooms")
18
18
  local roomUpdateSafe = ____rooms.roomUpdateSafe
19
+ local ____roomShapeWalls = require("src.functions.roomShapeWalls")
20
+ local isVanillaWallGridIndex = ____roomShapeWalls.isVanillaWallGridIndex
19
21
  function emptyRoomEntities(self)
20
22
  local room = game:GetRoom()
21
23
  for ____, entity in ipairs(getEntities(nil)) do
@@ -41,7 +43,11 @@ function emptyRoomGridEntities(self)
41
43
  for ____, gridEntity in ipairs(getGridEntities(nil)) do
42
44
  do
43
45
  local gridEntityType = gridEntity:GetType()
44
- if EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET:has(gridEntityType) then
46
+ local gridIndex = gridEntity:GetGridIndex()
47
+ if gridEntityType == GridEntityType.WALL and isVanillaWallGridIndex(nil, gridIndex) then
48
+ goto __continue10
49
+ end
50
+ if gridEntityType == GridEntityType.DOOR then
45
51
  goto __continue10
46
52
  end
47
53
  removeGridEntity(nil, gridEntity, false)
@@ -62,7 +68,6 @@ EMPTY_ROOM_BLACKLIST_ENTITY_SET = __TS__New(Set, {
62
68
  EntityType.PROJECTILE,
63
69
  EntityType.DARK_ESAU
64
70
  })
65
- EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET = __TS__New(Set, {GridEntityType.WALL, GridEntityType.DOOR})
66
71
  --- Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
67
72
  -- this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8), projectiles
68
73
  -- (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent NPCs, most
@@ -1,13 +1,4 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /**
4
- * Helper function to determine if a given wall is a "real" wall generated by the vanilla game. This
5
- * is useful because mods can use custom spawned walls as a stand-in for custom grid entities.
6
- *
7
- * This function checks for identity via a combination of `StageAPI.IsCustomGrid` and the
8
- * `isVanillaWallGridIndex` function.
9
- */
10
- export declare function isVanillaWall(gridEntity: GridEntity): boolean;
11
2
  /**
12
3
  * Helper function to determine if a given grid index should have a wall generated by the vanilla
13
4
  * game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
@@ -1 +1 @@
1
- {"version":3,"file":"roomShapeWalls.d.ts","sourceRoot":"","sources":["../../../src/functions/roomShapeWalls.ts"],"names":[],"mappings":";;AAwTA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAQ7D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAqB9D"}
1
+ {"version":3,"file":"roomShapeWalls.d.ts","sourceRoot":"","sources":["../../../src/functions/roomShapeWalls.ts"],"names":[],"mappings":";AAwTA;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAqB9D"}
@@ -6,7 +6,7 @@ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
6
6
  local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
7
7
  local Set = ____lualib.Set
8
8
  local ____exports = {}
9
- local getRoomShapeToWallGridIndexSet, getVanillaWallGridIndexSetForRoomShape, getWallGridIndexSetForRectangleRoomShape, ROOM_SHAPE_TO_WALL_GRID_INDEX_SET, HOME_CLOSET_CORNERS_SET, MOTHER_ROOM_CORNERS_SET
9
+ local getRoomShapeToWallGridIndexSet, getVanillaWallGridIndexSetForRoomShape, getWallGridIndexSetForRectangleRoomShape
10
10
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
11
11
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
12
12
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
@@ -199,29 +199,7 @@ function getWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
199
199
  {__TS__SparseArraySpread(____array_8)}
200
200
  )
201
201
  end
202
- --- Helper function to determine if a given grid index should have a wall generated by the vanilla
203
- -- game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
204
- -- mods.
205
- --
206
- -- This function properly handles the special cases of the Mother boss room and the Home closet
207
- -- rooms, which are both non-standard room shapes.
208
- function ____exports.isVanillaWallGridIndex(self, gridIndex)
209
- local room = game:GetRoom()
210
- local roomShape = room:GetRoomShape()
211
- local wallGridIndexSet
212
- if inHomeCloset(nil) then
213
- wallGridIndexSet = HOME_CLOSET_CORNERS_SET
214
- elseif inBossRoomOf(nil, BossID.MOTHER) then
215
- wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
216
- else
217
- wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
218
- end
219
- if wallGridIndexSet == nil then
220
- error(((("Failed to find the wall grid index set for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
221
- end
222
- return wallGridIndexSet:has(gridIndex)
223
- end
224
- ROOM_SHAPE_TO_WALL_GRID_INDEX_SET = getRoomShapeToWallGridIndexSet(nil)
202
+ local ROOM_SHAPE_TO_WALL_GRID_INDEX_SET = getRoomShapeToWallGridIndexSet(nil)
225
203
  --- The Home closet is is 9x3, which is different from `RoomShape.IH` (which is 13x3).
226
204
  local HOME_CLOSET_CORNERS = {
227
205
  {
@@ -245,7 +223,7 @@ local HOME_CLOSET_CORNERS = {
245
223
  position = Vector(340, 340)
246
224
  }
247
225
  }
248
- HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
226
+ local HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
249
227
  --- The Mother Boss Room is 15x11, which is different from `RoomShape.SHAPE_1x2` (which is 15x16).
250
228
  local MOTHER_ROOM_CORNERS = {
251
229
  {
@@ -269,17 +247,27 @@ local MOTHER_ROOM_CORNERS = {
269
247
  position = Vector(580, 500)
270
248
  }
271
249
  }
272
- MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
273
- --- Helper function to determine if a given wall is a "real" wall generated by the vanilla game. This
274
- -- is useful because mods can use custom spawned walls as a stand-in for custom grid entities.
250
+ local MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
251
+ --- Helper function to determine if a given grid index should have a wall generated by the vanilla
252
+ -- game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
253
+ -- mods.
275
254
  --
276
- -- This function checks for identity via a combination of `StageAPI.IsCustomGrid` and the
277
- -- `isVanillaWallGridIndex` function.
278
- function ____exports.isVanillaWall(self, gridEntity)
279
- local gridIndex = gridEntity:GetGridIndex()
280
- if StageAPI ~= nil and StageAPI.IsCustomGrid(gridIndex) then
281
- return false
255
+ -- This function properly handles the special cases of the Mother boss room and the Home closet
256
+ -- rooms, which are both non-standard room shapes.
257
+ function ____exports.isVanillaWallGridIndex(self, gridIndex)
258
+ local room = game:GetRoom()
259
+ local roomShape = room:GetRoomShape()
260
+ local wallGridIndexSet
261
+ if inHomeCloset(nil) then
262
+ wallGridIndexSet = HOME_CLOSET_CORNERS_SET
263
+ elseif inBossRoomOf(nil, BossID.MOTHER) then
264
+ wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
265
+ else
266
+ wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
282
267
  end
283
- return ____exports.isVanillaWallGridIndex(nil, gridIndex)
268
+ if wallGridIndexSet == nil then
269
+ error(((("Failed to find the wall grid index set for: RoomShape." .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ")")
270
+ end
271
+ return wallGridIndexSet:has(gridIndex)
284
272
  end
285
273
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "13.1.0",
3
+ "version": "13.1.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -7,6 +7,7 @@ import { game } from "../core/cachedClasses";
7
7
  import { getEntities } from "./entities";
8
8
  import { getGridEntities, removeGridEntity } from "./gridEntities";
9
9
  import { roomUpdateSafe } from "./rooms";
10
+ import { isVanillaWallGridIndex } from "./roomShapeWalls";
10
11
 
11
12
  const EMPTY_ROOM_BLACKLIST_ENTITY_SET: ReadonlySet<EntityType> = new Set([
12
13
  EntityType.PLAYER, // 1
@@ -18,12 +19,6 @@ const EMPTY_ROOM_BLACKLIST_ENTITY_SET: ReadonlySet<EntityType> = new Set([
18
19
  EntityType.DARK_ESAU, // 866
19
20
  ]);
20
21
 
21
- const EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET: ReadonlySet<GridEntityType> =
22
- new Set([
23
- GridEntityType.WALL, // 15
24
- GridEntityType.DOOR, // 16
25
- ]);
26
-
27
22
  /**
28
23
  * Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
29
24
  * this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8), projectiles
@@ -68,11 +63,23 @@ function emptyRoomEntities() {
68
63
  }
69
64
  }
70
65
 
66
+ /** We want to remove all grid entities except for walls and doors. */
71
67
  function emptyRoomGridEntities() {
72
68
  let removedOneOrMoreGridEntities = false;
73
69
  for (const gridEntity of getGridEntities()) {
74
70
  const gridEntityType = gridEntity.GetType();
75
- if (EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET.has(gridEntityType)) {
71
+ const gridIndex = gridEntity.GetGridIndex();
72
+
73
+ // We cannot simply check if the grid entity type is equal to a wall because other mods use
74
+ // walls as a base for custom grid entities.
75
+ if (
76
+ gridEntityType === GridEntityType.WALL &&
77
+ isVanillaWallGridIndex(gridIndex)
78
+ ) {
79
+ continue;
80
+ }
81
+
82
+ if (gridEntityType === GridEntityType.DOOR) {
76
83
  continue;
77
84
  }
78
85
 
@@ -310,23 +310,6 @@ const MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(
310
310
  MOTHER_ROOM_CORNERS,
311
311
  );
312
312
 
313
- /**
314
- * Helper function to determine if a given wall is a "real" wall generated by the vanilla game. This
315
- * is useful because mods can use custom spawned walls as a stand-in for custom grid entities.
316
- *
317
- * This function checks for identity via a combination of `StageAPI.IsCustomGrid` and the
318
- * `isVanillaWallGridIndex` function.
319
- */
320
- export function isVanillaWall(gridEntity: GridEntity): boolean {
321
- const gridIndex = gridEntity.GetGridIndex();
322
-
323
- if (StageAPI !== undefined && StageAPI.IsCustomGrid(gridIndex)) {
324
- return false;
325
- }
326
-
327
- return isVanillaWallGridIndex(gridIndex);
328
- }
329
-
330
313
  /**
331
314
  * Helper function to determine if a given grid index should have a wall generated by the vanilla
332
315
  * game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by