isaacscript-common 12.6.0 → 12.6.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 12.6.
|
|
3
|
+
isaacscript-common 12.6.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -41287,10 +41287,9 @@ local __TS__New = ____lualib.__TS__New
|
|
|
41287
41287
|
local Map = ____lualib.Map
|
|
41288
41288
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
41289
41289
|
local ____exports = {}
|
|
41290
|
-
local preUseItemWeNeedToGoDeeper, postNewRoomReordered, setDecorationsInvisible, respawnPersistentEntities,
|
|
41290
|
+
local preUseItemWeNeedToGoDeeper, postNewRoomReordered, setDecorationsInvisible, respawnPersistentEntities, emptyRoomEntities, emptyRoomGridEntities, fillRoomWithDecorations, spawnAllEntities, spawnGridEntityForJSONRoom, spawnNormalEntityForJSONRoom, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, PERSISTENT_ENTITY_TYPES, GRID_ENTITY_XML_TYPE_SET, EMPTY_ROOM_BLACKLIST_ENTITY_SET, EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET, v
|
|
41291
41291
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
41292
41292
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
41293
|
-
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
41294
41293
|
local EntityCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityCollisionClass
|
|
41295
41294
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
41296
41295
|
local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
|
|
@@ -41312,21 +41311,16 @@ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNot
|
|
|
41312
41311
|
local ____array = require("src.functions.array")
|
|
41313
41312
|
local emptyArray = ____array.emptyArray
|
|
41314
41313
|
local ____entities = require("src.functions.entities")
|
|
41314
|
+
local getEntities = ____entities.getEntities
|
|
41315
41315
|
local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
|
|
41316
|
-
local removeAllMatchingEntities = ____entities.removeAllMatchingEntities
|
|
41317
41316
|
local spawn = ____entities.spawn
|
|
41318
41317
|
local spawnWithSeed = ____entities.spawnWithSeed
|
|
41319
|
-
local ____entitiesSpecific = require("src.functions.entitiesSpecific")
|
|
41320
|
-
local getNPCs = ____entitiesSpecific.getNPCs
|
|
41321
|
-
local removeAllBombs = ____entitiesSpecific.removeAllBombs
|
|
41322
|
-
local removeAllPickups = ____entitiesSpecific.removeAllPickups
|
|
41323
41318
|
local ____enums = require("src.functions.enums")
|
|
41324
41319
|
local getEnumValues = ____enums.getEnumValues
|
|
41325
41320
|
local ____gridEntities = require("src.functions.gridEntities")
|
|
41326
41321
|
local convertXMLGridEntityType = ____gridEntities.convertXMLGridEntityType
|
|
41327
41322
|
local getAllGridIndexes = ____gridEntities.getAllGridIndexes
|
|
41328
41323
|
local getGridEntities = ____gridEntities.getGridEntities
|
|
41329
|
-
local removeAllGridEntitiesExcept = ____gridEntities.removeAllGridEntitiesExcept
|
|
41330
41324
|
local removeGridEntity = ____gridEntities.removeGridEntity
|
|
41331
41325
|
local setGridEntityInvisible = ____gridEntities.setGridEntityInvisible
|
|
41332
41326
|
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
@@ -41344,6 +41338,7 @@ local getRoomListIndex = ____roomData.getRoomListIndex
|
|
|
41344
41338
|
local ____roomGrid = require("src.functions.roomGrid")
|
|
41345
41339
|
local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
|
|
41346
41340
|
local ____rooms = require("src.functions.rooms")
|
|
41341
|
+
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
41347
41342
|
local setRoomCleared = ____rooms.setRoomCleared
|
|
41348
41343
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
41349
41344
|
local ____spawnCollectible = require("src.functions.spawnCollectible")
|
|
@@ -41430,38 +41425,50 @@ function ____exports.emptyRoom(self, fillWithDecorations)
|
|
|
41430
41425
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
41431
41426
|
local roomListIndex = getRoomListIndex(nil)
|
|
41432
41427
|
v.level.deployedRoomListIndexes:add(roomListIndex)
|
|
41433
|
-
|
|
41434
|
-
|
|
41435
|
-
removeAllMatchingEntities(nil, EntityType.SLOT)
|
|
41436
|
-
removeSpecificNPCs(nil)
|
|
41437
|
-
removeAllMatchingEntities(nil, EntityType.EFFECT, EffectVariant.DEVIL)
|
|
41438
|
-
removeAllMatchingEntities(nil, EntityType.EFFECT, EffectVariant.ANGEL)
|
|
41439
|
-
removeAllGridEntitiesExcept(nil, GridEntityType.WALL, GridEntityType.DOOR)
|
|
41428
|
+
emptyRoomEntities(nil)
|
|
41429
|
+
emptyRoomGridEntities(nil)
|
|
41440
41430
|
setRoomCleared(nil)
|
|
41441
41431
|
if fillWithDecorations then
|
|
41442
41432
|
fillRoomWithDecorations(nil)
|
|
41443
41433
|
end
|
|
41444
41434
|
end
|
|
41445
|
-
function
|
|
41435
|
+
function emptyRoomEntities(self)
|
|
41446
41436
|
local room = game:GetRoom()
|
|
41447
|
-
for ____,
|
|
41437
|
+
for ____, entity in ipairs(getEntities(nil)) do
|
|
41448
41438
|
do
|
|
41449
|
-
if
|
|
41439
|
+
if EMPTY_ROOM_BLACKLIST_ENTITY_SET:has(entity.Type) then
|
|
41450
41440
|
goto __continue33
|
|
41451
41441
|
end
|
|
41452
|
-
if
|
|
41442
|
+
if entity:HasEntityFlags(EntityFlag.CHARM) or entity:HasEntityFlags(EntityFlag.FRIENDLY) or entity:HasEntityFlags(EntityFlag.PERSISTENT) then
|
|
41453
41443
|
goto __continue33
|
|
41454
41444
|
end
|
|
41455
|
-
|
|
41456
|
-
|
|
41457
|
-
if
|
|
41458
|
-
local gridIndex = room:GetGridIndex(
|
|
41445
|
+
entity:ClearEntityFlags(EntityFlag.APPEAR)
|
|
41446
|
+
entity:Remove()
|
|
41447
|
+
if entity.Type == EntityType.FIREPLACE then
|
|
41448
|
+
local gridIndex = room:GetGridIndex(entity.Position)
|
|
41459
41449
|
room:SetGridPath(gridIndex, 0)
|
|
41460
41450
|
end
|
|
41461
41451
|
end
|
|
41462
41452
|
::__continue33::
|
|
41463
41453
|
end
|
|
41464
41454
|
end
|
|
41455
|
+
function emptyRoomGridEntities(self)
|
|
41456
|
+
local removedOneOrMoreGridEntities = false
|
|
41457
|
+
for ____, gridEntity in ipairs(getGridEntities(nil)) do
|
|
41458
|
+
do
|
|
41459
|
+
local gridEntityType = gridEntity:GetType()
|
|
41460
|
+
if EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET:has(gridEntityType) then
|
|
41461
|
+
goto __continue39
|
|
41462
|
+
end
|
|
41463
|
+
removeGridEntity(nil, gridEntity, false)
|
|
41464
|
+
removedOneOrMoreGridEntities = true
|
|
41465
|
+
end
|
|
41466
|
+
::__continue39::
|
|
41467
|
+
end
|
|
41468
|
+
if removedOneOrMoreGridEntities then
|
|
41469
|
+
roomUpdateSafe(nil)
|
|
41470
|
+
end
|
|
41471
|
+
end
|
|
41465
41472
|
function fillRoomWithDecorations(self)
|
|
41466
41473
|
local room = game:GetRoom()
|
|
41467
41474
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -41470,7 +41477,7 @@ function fillRoomWithDecorations(self)
|
|
|
41470
41477
|
do
|
|
41471
41478
|
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
41472
41479
|
if existingGridEntity ~= nil then
|
|
41473
|
-
goto
|
|
41480
|
+
goto __continue44
|
|
41474
41481
|
end
|
|
41475
41482
|
local position = room:GetGridPosition(gridIndex)
|
|
41476
41483
|
local decoration = Isaac.GridSpawn(GridEntityType.DECORATION, 0, position)
|
|
@@ -41479,7 +41486,7 @@ function fillRoomWithDecorations(self)
|
|
|
41479
41486
|
end
|
|
41480
41487
|
decorationGridIndexes[#decorationGridIndexes + 1] = gridIndex
|
|
41481
41488
|
end
|
|
41482
|
-
::
|
|
41489
|
+
::__continue44::
|
|
41483
41490
|
end
|
|
41484
41491
|
end
|
|
41485
41492
|
function spawnAllEntities(self, jsonRoom, rng, verbose)
|
|
@@ -41737,10 +41744,19 @@ function getPitFrame(self, L, R, U, D, UL, UR, DL, DR)
|
|
|
41737
41744
|
return F
|
|
41738
41745
|
end
|
|
41739
41746
|
FEATURE_NAME = "deployJSONRoom"
|
|
41740
|
-
NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.DARK_ESAU})
|
|
41741
41747
|
PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.WALL_HUGGER})
|
|
41742
41748
|
local gridEntityXMLTypes = getEnumValues(nil, GridEntityXMLType)
|
|
41743
41749
|
GRID_ENTITY_XML_TYPE_SET = __TS__New(Set, gridEntityXMLTypes)
|
|
41750
|
+
EMPTY_ROOM_BLACKLIST_ENTITY_SET = __TS__New(Set, {
|
|
41751
|
+
EntityType.PLAYER,
|
|
41752
|
+
EntityType.TEAR,
|
|
41753
|
+
EntityType.FAMILIAR,
|
|
41754
|
+
EntityType.LASER,
|
|
41755
|
+
EntityType.KNIFE,
|
|
41756
|
+
EntityType.PROJECTILE,
|
|
41757
|
+
EntityType.DARK_ESAU
|
|
41758
|
+
})
|
|
41759
|
+
EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET = __TS__New(Set, {GridEntityType.WALL, GridEntityType.DOOR})
|
|
41744
41760
|
v = {
|
|
41745
41761
|
level = {
|
|
41746
41762
|
deployedRoomListIndexes = __TS__New(Set),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployJSONRoom.d.ts","sourceRoot":"","sources":["../../../src/features/deployJSONRoom.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deployJSONRoom.d.ts","sourceRoot":"","sources":["../../../src/features/deployJSONRoom.ts"],"names":[],"mappings":";;AAqDA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAwLvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,EACvC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAuBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,EAAE,EACrB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAaN;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,mBAAmB,EAAE,OAAO,GAAG,IAAI,CAa5D"}
|
|
@@ -4,10 +4,9 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local Map = ____lualib.Map
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local preUseItemWeNeedToGoDeeper, postNewRoomReordered, setDecorationsInvisible, respawnPersistentEntities,
|
|
7
|
+
local preUseItemWeNeedToGoDeeper, postNewRoomReordered, setDecorationsInvisible, respawnPersistentEntities, emptyRoomEntities, emptyRoomGridEntities, fillRoomWithDecorations, spawnAllEntities, spawnGridEntityForJSONRoom, spawnNormalEntityForJSONRoom, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, PERSISTENT_ENTITY_TYPES, GRID_ENTITY_XML_TYPE_SET, EMPTY_ROOM_BLACKLIST_ENTITY_SET, EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET, v
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
10
|
-
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
11
10
|
local EntityCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityCollisionClass
|
|
12
11
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
13
12
|
local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
|
|
@@ -29,21 +28,16 @@ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNot
|
|
|
29
28
|
local ____array = require("src.functions.array")
|
|
30
29
|
local emptyArray = ____array.emptyArray
|
|
31
30
|
local ____entities = require("src.functions.entities")
|
|
31
|
+
local getEntities = ____entities.getEntities
|
|
32
32
|
local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
|
|
33
|
-
local removeAllMatchingEntities = ____entities.removeAllMatchingEntities
|
|
34
33
|
local spawn = ____entities.spawn
|
|
35
34
|
local spawnWithSeed = ____entities.spawnWithSeed
|
|
36
|
-
local ____entitiesSpecific = require("src.functions.entitiesSpecific")
|
|
37
|
-
local getNPCs = ____entitiesSpecific.getNPCs
|
|
38
|
-
local removeAllBombs = ____entitiesSpecific.removeAllBombs
|
|
39
|
-
local removeAllPickups = ____entitiesSpecific.removeAllPickups
|
|
40
35
|
local ____enums = require("src.functions.enums")
|
|
41
36
|
local getEnumValues = ____enums.getEnumValues
|
|
42
37
|
local ____gridEntities = require("src.functions.gridEntities")
|
|
43
38
|
local convertXMLGridEntityType = ____gridEntities.convertXMLGridEntityType
|
|
44
39
|
local getAllGridIndexes = ____gridEntities.getAllGridIndexes
|
|
45
40
|
local getGridEntities = ____gridEntities.getGridEntities
|
|
46
|
-
local removeAllGridEntitiesExcept = ____gridEntities.removeAllGridEntitiesExcept
|
|
47
41
|
local removeGridEntity = ____gridEntities.removeGridEntity
|
|
48
42
|
local setGridEntityInvisible = ____gridEntities.setGridEntityInvisible
|
|
49
43
|
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
@@ -61,6 +55,7 @@ local getRoomListIndex = ____roomData.getRoomListIndex
|
|
|
61
55
|
local ____roomGrid = require("src.functions.roomGrid")
|
|
62
56
|
local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
|
|
63
57
|
local ____rooms = require("src.functions.rooms")
|
|
58
|
+
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
64
59
|
local setRoomCleared = ____rooms.setRoomCleared
|
|
65
60
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
66
61
|
local ____spawnCollectible = require("src.functions.spawnCollectible")
|
|
@@ -155,38 +150,50 @@ function ____exports.emptyRoom(self, fillWithDecorations)
|
|
|
155
150
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
156
151
|
local roomListIndex = getRoomListIndex(nil)
|
|
157
152
|
v.level.deployedRoomListIndexes:add(roomListIndex)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
removeAllMatchingEntities(nil, EntityType.SLOT)
|
|
161
|
-
removeSpecificNPCs(nil)
|
|
162
|
-
removeAllMatchingEntities(nil, EntityType.EFFECT, EffectVariant.DEVIL)
|
|
163
|
-
removeAllMatchingEntities(nil, EntityType.EFFECT, EffectVariant.ANGEL)
|
|
164
|
-
removeAllGridEntitiesExcept(nil, GridEntityType.WALL, GridEntityType.DOOR)
|
|
153
|
+
emptyRoomEntities(nil)
|
|
154
|
+
emptyRoomGridEntities(nil)
|
|
165
155
|
setRoomCleared(nil)
|
|
166
156
|
if fillWithDecorations then
|
|
167
157
|
fillRoomWithDecorations(nil)
|
|
168
158
|
end
|
|
169
159
|
end
|
|
170
|
-
function
|
|
160
|
+
function emptyRoomEntities(self)
|
|
171
161
|
local room = game:GetRoom()
|
|
172
|
-
for ____,
|
|
162
|
+
for ____, entity in ipairs(getEntities(nil)) do
|
|
173
163
|
do
|
|
174
|
-
if
|
|
164
|
+
if EMPTY_ROOM_BLACKLIST_ENTITY_SET:has(entity.Type) then
|
|
175
165
|
goto __continue33
|
|
176
166
|
end
|
|
177
|
-
if
|
|
167
|
+
if entity:HasEntityFlags(EntityFlag.CHARM) or entity:HasEntityFlags(EntityFlag.FRIENDLY) or entity:HasEntityFlags(EntityFlag.PERSISTENT) then
|
|
178
168
|
goto __continue33
|
|
179
169
|
end
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if
|
|
183
|
-
local gridIndex = room:GetGridIndex(
|
|
170
|
+
entity:ClearEntityFlags(EntityFlag.APPEAR)
|
|
171
|
+
entity:Remove()
|
|
172
|
+
if entity.Type == EntityType.FIREPLACE then
|
|
173
|
+
local gridIndex = room:GetGridIndex(entity.Position)
|
|
184
174
|
room:SetGridPath(gridIndex, 0)
|
|
185
175
|
end
|
|
186
176
|
end
|
|
187
177
|
::__continue33::
|
|
188
178
|
end
|
|
189
179
|
end
|
|
180
|
+
function emptyRoomGridEntities(self)
|
|
181
|
+
local removedOneOrMoreGridEntities = false
|
|
182
|
+
for ____, gridEntity in ipairs(getGridEntities(nil)) do
|
|
183
|
+
do
|
|
184
|
+
local gridEntityType = gridEntity:GetType()
|
|
185
|
+
if EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET:has(gridEntityType) then
|
|
186
|
+
goto __continue39
|
|
187
|
+
end
|
|
188
|
+
removeGridEntity(nil, gridEntity, false)
|
|
189
|
+
removedOneOrMoreGridEntities = true
|
|
190
|
+
end
|
|
191
|
+
::__continue39::
|
|
192
|
+
end
|
|
193
|
+
if removedOneOrMoreGridEntities then
|
|
194
|
+
roomUpdateSafe(nil)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
190
197
|
function fillRoomWithDecorations(self)
|
|
191
198
|
local room = game:GetRoom()
|
|
192
199
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -195,7 +202,7 @@ function fillRoomWithDecorations(self)
|
|
|
195
202
|
do
|
|
196
203
|
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
197
204
|
if existingGridEntity ~= nil then
|
|
198
|
-
goto
|
|
205
|
+
goto __continue44
|
|
199
206
|
end
|
|
200
207
|
local position = room:GetGridPosition(gridIndex)
|
|
201
208
|
local decoration = Isaac.GridSpawn(GridEntityType.DECORATION, 0, position)
|
|
@@ -204,7 +211,7 @@ function fillRoomWithDecorations(self)
|
|
|
204
211
|
end
|
|
205
212
|
decorationGridIndexes[#decorationGridIndexes + 1] = gridIndex
|
|
206
213
|
end
|
|
207
|
-
::
|
|
214
|
+
::__continue44::
|
|
208
215
|
end
|
|
209
216
|
end
|
|
210
217
|
function spawnAllEntities(self, jsonRoom, rng, verbose)
|
|
@@ -462,10 +469,19 @@ function getPitFrame(self, L, R, U, D, UL, UR, DL, DR)
|
|
|
462
469
|
return F
|
|
463
470
|
end
|
|
464
471
|
FEATURE_NAME = "deployJSONRoom"
|
|
465
|
-
NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.DARK_ESAU})
|
|
466
472
|
PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.WALL_HUGGER})
|
|
467
473
|
local gridEntityXMLTypes = getEnumValues(nil, GridEntityXMLType)
|
|
468
474
|
GRID_ENTITY_XML_TYPE_SET = __TS__New(Set, gridEntityXMLTypes)
|
|
475
|
+
EMPTY_ROOM_BLACKLIST_ENTITY_SET = __TS__New(Set, {
|
|
476
|
+
EntityType.PLAYER,
|
|
477
|
+
EntityType.TEAR,
|
|
478
|
+
EntityType.FAMILIAR,
|
|
479
|
+
EntityType.LASER,
|
|
480
|
+
EntityType.KNIFE,
|
|
481
|
+
EntityType.PROJECTILE,
|
|
482
|
+
EntityType.DARK_ESAU
|
|
483
|
+
})
|
|
484
|
+
EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET = __TS__New(Set, {GridEntityType.WALL, GridEntityType.DOOR})
|
|
469
485
|
v = {
|
|
470
486
|
level = {
|
|
471
487
|
deployedRoomListIndexes = __TS__New(Set),
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import {
|
|
7
7
|
ActiveSlot,
|
|
8
8
|
CollectibleType,
|
|
9
|
-
EffectVariant,
|
|
10
9
|
EntityCollisionClass,
|
|
11
10
|
EntityFlag,
|
|
12
11
|
EntityGridCollisionClass,
|
|
@@ -26,22 +25,16 @@ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
|
26
25
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
27
26
|
import { emptyArray } from "../functions/array";
|
|
28
27
|
import {
|
|
28
|
+
getEntities,
|
|
29
29
|
getEntityIDFromConstituents,
|
|
30
|
-
removeAllMatchingEntities,
|
|
31
30
|
spawn,
|
|
32
31
|
spawnWithSeed,
|
|
33
32
|
} from "../functions/entities";
|
|
34
|
-
import {
|
|
35
|
-
getNPCs,
|
|
36
|
-
removeAllBombs,
|
|
37
|
-
removeAllPickups,
|
|
38
|
-
} from "../functions/entitiesSpecific";
|
|
39
33
|
import { getEnumValues } from "../functions/enums";
|
|
40
34
|
import {
|
|
41
35
|
convertXMLGridEntityType,
|
|
42
36
|
getAllGridIndexes,
|
|
43
37
|
getGridEntities,
|
|
44
|
-
removeAllGridEntitiesExcept,
|
|
45
38
|
removeGridEntity,
|
|
46
39
|
setGridEntityInvisible,
|
|
47
40
|
spawnGridEntityWithVariant,
|
|
@@ -51,7 +44,11 @@ import { log } from "../functions/log";
|
|
|
51
44
|
import { getRandomSeed, isRNG, newRNG } from "../functions/rng";
|
|
52
45
|
import { getRoomListIndex } from "../functions/roomData";
|
|
53
46
|
import { gridCoordinatesToWorldPosition } from "../functions/roomGrid";
|
|
54
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
roomUpdateSafe,
|
|
49
|
+
setRoomCleared,
|
|
50
|
+
setRoomUncleared,
|
|
51
|
+
} from "../functions/rooms";
|
|
55
52
|
import { spawnCollectible } from "../functions/spawnCollectible";
|
|
56
53
|
import { asCollectibleType, asNumber } from "../functions/types";
|
|
57
54
|
import { JSONRoom } from "../interfaces/JSONRoomsFile";
|
|
@@ -67,10 +64,6 @@ interface PersistentEntityDescription {
|
|
|
67
64
|
|
|
68
65
|
const FEATURE_NAME = "deployJSONRoom";
|
|
69
66
|
|
|
70
|
-
const NPC_TYPES_TO_NOT_REMOVE: ReadonlySet<EntityType> = new Set([
|
|
71
|
-
EntityType.DARK_ESAU,
|
|
72
|
-
]);
|
|
73
|
-
|
|
74
67
|
const PERSISTENT_ENTITY_TYPES: ReadonlySet<EntityType> = new Set([
|
|
75
68
|
EntityType.WALL_HUGGER,
|
|
76
69
|
]);
|
|
@@ -80,6 +73,22 @@ const GRID_ENTITY_XML_TYPE_SET: ReadonlySet<number> = new Set(
|
|
|
80
73
|
gridEntityXMLTypes,
|
|
81
74
|
);
|
|
82
75
|
|
|
76
|
+
const EMPTY_ROOM_BLACKLIST_ENTITY_SET: ReadonlySet<EntityType> = new Set([
|
|
77
|
+
EntityType.PLAYER, // 1
|
|
78
|
+
EntityType.TEAR, // 2
|
|
79
|
+
EntityType.FAMILIAR, // 3
|
|
80
|
+
EntityType.LASER, // 7
|
|
81
|
+
EntityType.KNIFE, // 8
|
|
82
|
+
EntityType.PROJECTILE, // 9
|
|
83
|
+
EntityType.DARK_ESAU, // 866
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
const EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET: ReadonlySet<GridEntityType> =
|
|
87
|
+
new Set([
|
|
88
|
+
GridEntityType.WALL, // 15
|
|
89
|
+
GridEntityType.DOOR, // 16
|
|
90
|
+
]);
|
|
91
|
+
|
|
83
92
|
const v = {
|
|
84
93
|
level: {
|
|
85
94
|
deployedRoomListIndexes: new Set<int>(),
|
|
@@ -348,21 +357,10 @@ export function emptyRoom(fillWithDecorations: boolean): void {
|
|
|
348
357
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
349
358
|
|
|
350
359
|
const roomListIndex = getRoomListIndex();
|
|
351
|
-
|
|
352
360
|
v.level.deployedRoomListIndexes.add(roomListIndex);
|
|
353
361
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
removeAllMatchingEntities(EntityType.SLOT); // 6
|
|
357
|
-
removeSpecificNPCs();
|
|
358
|
-
removeAllMatchingEntities(EntityType.EFFECT, EffectVariant.DEVIL);
|
|
359
|
-
removeAllMatchingEntities(EntityType.EFFECT, EffectVariant.ANGEL);
|
|
360
|
-
|
|
361
|
-
removeAllGridEntitiesExcept(
|
|
362
|
-
GridEntityType.WALL, // 15
|
|
363
|
-
GridEntityType.DOOR, // 16
|
|
364
|
-
);
|
|
365
|
-
|
|
362
|
+
emptyRoomEntities();
|
|
363
|
+
emptyRoomGridEntities();
|
|
366
364
|
setRoomCleared();
|
|
367
365
|
|
|
368
366
|
if (fillWithDecorations) {
|
|
@@ -371,38 +369,54 @@ export function emptyRoom(fillWithDecorations: boolean): void {
|
|
|
371
369
|
}
|
|
372
370
|
|
|
373
371
|
/**
|
|
374
|
-
* We remove entities in the `POST_NEW_ROOM` callback instead of in the
|
|
375
|
-
* so that they will not re-appear when we re-enter the room.
|
|
372
|
+
* We remove entities in the `POST_NEW_ROOM` callback instead of in the `PRE_ROOM_ENTITY_SPAWN`
|
|
373
|
+
* callback so that they will not re-appear when we re-enter the room.
|
|
376
374
|
*/
|
|
377
|
-
function
|
|
375
|
+
function emptyRoomEntities() {
|
|
378
376
|
const room = game.GetRoom();
|
|
379
377
|
|
|
380
|
-
for (const
|
|
381
|
-
if (
|
|
378
|
+
for (const entity of getEntities()) {
|
|
379
|
+
if (EMPTY_ROOM_BLACKLIST_ENTITY_SET.has(entity.Type)) {
|
|
382
380
|
continue;
|
|
383
381
|
}
|
|
384
382
|
|
|
385
383
|
if (
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
384
|
+
entity.HasEntityFlags(EntityFlag.CHARM) ||
|
|
385
|
+
entity.HasEntityFlags(EntityFlag.FRIENDLY) ||
|
|
386
|
+
entity.HasEntityFlags(EntityFlag.PERSISTENT)
|
|
389
387
|
) {
|
|
390
388
|
continue;
|
|
391
389
|
}
|
|
392
390
|
|
|
393
|
-
|
|
394
|
-
|
|
391
|
+
entity.ClearEntityFlags(EntityFlag.APPEAR);
|
|
392
|
+
entity.Remove();
|
|
395
393
|
|
|
396
394
|
// When fire places are removed, they will leave behind a "path" that will prevent future grid
|
|
397
395
|
// entities from being spawned on the same tile. Thus, reset the path for this tile if this is a
|
|
398
396
|
// fire place.
|
|
399
|
-
if (
|
|
400
|
-
const gridIndex = room.GetGridIndex(
|
|
397
|
+
if (entity.Type === EntityType.FIREPLACE) {
|
|
398
|
+
const gridIndex = room.GetGridIndex(entity.Position);
|
|
401
399
|
room.SetGridPath(gridIndex, 0);
|
|
402
400
|
}
|
|
403
401
|
}
|
|
404
402
|
}
|
|
405
403
|
|
|
404
|
+
function emptyRoomGridEntities() {
|
|
405
|
+
let removedOneOrMoreGridEntities = false;
|
|
406
|
+
for (const gridEntity of getGridEntities()) {
|
|
407
|
+
const gridEntityType = gridEntity.GetType();
|
|
408
|
+
if (EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET.has(gridEntityType)) {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
removeGridEntity(gridEntity, false);
|
|
413
|
+
removedOneOrMoreGridEntities = true;
|
|
414
|
+
}
|
|
415
|
+
if (removedOneOrMoreGridEntities) {
|
|
416
|
+
roomUpdateSafe();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
406
420
|
/**
|
|
407
421
|
* We removed most normal entities, which should prevent them from respawning when the player
|
|
408
422
|
* re-enters the room. However, this is not the case for grid entities; even if they are removed,
|