isaacscript-common 72.6.0 → 72.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.rollup.d.ts +7 -0
- package/dist/isaacscript-common.lua +25 -4
- package/dist/src/functions/entities.d.ts +7 -1
- package/dist/src/functions/entities.d.ts.map +1 -1
- package/dist/src/functions/entities.lua +23 -0
- package/dist/src/functions/logEntities.d.ts.map +1 -1
- package/dist/src/functions/logEntities.lua +2 -0
- package/dist/src/functions/rooms.d.ts.map +1 -1
- package/dist/src/functions/rooms.lua +2 -3
- package/package.json +2 -2
- package/src/functions/entities.ts +43 -2
- package/src/functions/logEntities.ts +2 -0
- package/src/functions/rooms.ts +2 -12
package/dist/index.rollup.d.ts
CHANGED
|
@@ -8716,6 +8716,13 @@ export declare function isActionTriggeredOnAnyInput(...buttonActions: ButtonActi
|
|
|
8716
8716
|
/** Returns true if the item type in the item config is equal to `ItemType.ACTIVE`. */
|
|
8717
8717
|
export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
|
|
8718
8718
|
|
|
8719
|
+
/**
|
|
8720
|
+
* Helper function to detect if a particular entity is an active enemy. Use this over the
|
|
8721
|
+
* `Entity.IsActiveEnemy` method since it is bugged with friendly enemies, Grimaces, Ultra Doors,
|
|
8722
|
+
* and Mother.
|
|
8723
|
+
*/
|
|
8724
|
+
export declare function isActiveEnemy(entity: Entity): boolean;
|
|
8725
|
+
|
|
8719
8726
|
/**
|
|
8720
8727
|
* Helper function to check if a player's active item is "double charged", meaning that it has both
|
|
8721
8728
|
* a full normal charge and a full charge from The Battery.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 72.
|
|
3
|
+
isaacscript-common 72.7.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -23655,6 +23655,9 @@ local ____exports = {}
|
|
|
23655
23655
|
local setPrimitiveEntityFields
|
|
23656
23656
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
23657
23657
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
23658
|
+
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
23659
|
+
local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
|
|
23660
|
+
local NPCState = ____isaac_2Dtypescript_2Ddefinitions.NPCState
|
|
23658
23661
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
23659
23662
|
local game = ____cachedClasses.game
|
|
23660
23663
|
local ____constants = require("src.core.constants")
|
|
@@ -23895,6 +23898,23 @@ function ____exports.hasArmor(self, entity)
|
|
|
23895
23898
|
local typeVariantString = (tostring(entity.Type) .. ".") .. tostring(entity.Variant)
|
|
23896
23899
|
return ENTITIES_WITH_ARMOR_SET:has(typeVariantString)
|
|
23897
23900
|
end
|
|
23901
|
+
function ____exports.isActiveEnemy(self, entity)
|
|
23902
|
+
if entity:HasEntityFlags(EntityFlag.FRIENDLY) then
|
|
23903
|
+
return false
|
|
23904
|
+
end
|
|
23905
|
+
local room = game:GetRoom()
|
|
23906
|
+
local isClear = room:IsClear()
|
|
23907
|
+
if isClear and (entity.Type == EntityType.GRIMACE or entity.Type == EntityType.ULTRA_DOOR) then
|
|
23908
|
+
return false
|
|
23909
|
+
end
|
|
23910
|
+
if entity.Type == EntityType.MOTHER and entity.Variant == MotherVariant.MOTHER_1 then
|
|
23911
|
+
local npc = entity:ToNPC()
|
|
23912
|
+
if npc ~= nil and npc.State == NPCState.SPECIAL then
|
|
23913
|
+
return false
|
|
23914
|
+
end
|
|
23915
|
+
end
|
|
23916
|
+
return entity:IsActiveEnemy(false)
|
|
23917
|
+
end
|
|
23898
23918
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
23899
23919
|
if threshold == nil then
|
|
23900
23920
|
threshold = 0.01
|
|
@@ -28111,8 +28131,6 @@ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
|
28111
28131
|
local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
|
|
28112
28132
|
local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
|
|
28113
28133
|
local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
|
|
28114
|
-
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
28115
|
-
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
28116
28134
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
28117
28135
|
local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
|
|
28118
28136
|
local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
|
|
@@ -28142,6 +28160,7 @@ local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
|
|
|
28142
28160
|
local openDoorFast = ____doors.openDoorFast
|
|
28143
28161
|
local ____entities = require("src.functions.entities")
|
|
28144
28162
|
local getEntities = ____entities.getEntities
|
|
28163
|
+
local isActiveEnemy = ____entities.isActiveEnemy
|
|
28145
28164
|
local ____flag = require("src.functions.flag")
|
|
28146
28165
|
local hasFlag = ____flag.hasFlag
|
|
28147
28166
|
local ____positionVelocity = require("src.functions.positionVelocity")
|
|
@@ -28492,7 +28511,7 @@ function ____exports.isRoomDangerous(self)
|
|
|
28492
28511
|
local entities = getEntities(nil)
|
|
28493
28512
|
if __TS__ArraySome(
|
|
28494
28513
|
entities,
|
|
28495
|
-
function(____, entity) return
|
|
28514
|
+
function(____, entity) return isActiveEnemy(nil, entity) end
|
|
28496
28515
|
) then
|
|
28497
28516
|
return true
|
|
28498
28517
|
end
|
|
@@ -52949,6 +52968,8 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(ReadonlySet, {
|
|
|
52949
52968
|
EffectVariant.WALL_BUG,
|
|
52950
52969
|
EffectVariant.FALLING_EMBER,
|
|
52951
52970
|
EffectVariant.LIGHT,
|
|
52971
|
+
EffectVariant.MIST,
|
|
52972
|
+
EffectVariant.BACKDROP_DECORATION,
|
|
52952
52973
|
EffectVariant.TADPOLE
|
|
52953
52974
|
})
|
|
52954
52975
|
function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
-
import
|
|
2
|
+
import { EntityType } from "isaac-typescript-definitions";
|
|
3
3
|
import type { AnyEntity } from "../types/AnyEntity";
|
|
4
4
|
import type { EntityID } from "../types/EntityID";
|
|
5
5
|
/**
|
|
@@ -113,6 +113,12 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
|
|
|
113
113
|
* For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
|
|
114
114
|
*/
|
|
115
115
|
export declare function hasArmor(entity: Entity): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Helper function to detect if a particular entity is an active enemy. Use this over the
|
|
118
|
+
* `Entity.IsActiveEnemy` method since it is bugged with friendly enemies, Grimaces, Ultra Doors,
|
|
119
|
+
* and Mother.
|
|
120
|
+
*/
|
|
121
|
+
export declare function isActiveEnemy(entity: Entity): boolean;
|
|
116
122
|
/**
|
|
117
123
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
118
124
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAGX,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
|
|
@@ -10,6 +10,9 @@ local ____exports = {}
|
|
|
10
10
|
local setPrimitiveEntityFields
|
|
11
11
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
12
12
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
13
|
+
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
14
|
+
local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
|
|
15
|
+
local NPCState = ____isaac_2Dtypescript_2Ddefinitions.NPCState
|
|
13
16
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
14
17
|
local game = ____cachedClasses.game
|
|
15
18
|
local ____constants = require("src.core.constants")
|
|
@@ -335,6 +338,26 @@ function ____exports.hasArmor(self, entity)
|
|
|
335
338
|
local typeVariantString = (tostring(entity.Type) .. ".") .. tostring(entity.Variant)
|
|
336
339
|
return ENTITIES_WITH_ARMOR_SET:has(typeVariantString)
|
|
337
340
|
end
|
|
341
|
+
--- Helper function to detect if a particular entity is an active enemy. Use this over the
|
|
342
|
+
-- `Entity.IsActiveEnemy` method since it is bugged with friendly enemies, Grimaces, Ultra Doors,
|
|
343
|
+
-- and Mother.
|
|
344
|
+
function ____exports.isActiveEnemy(self, entity)
|
|
345
|
+
if entity:HasEntityFlags(EntityFlag.FRIENDLY) then
|
|
346
|
+
return false
|
|
347
|
+
end
|
|
348
|
+
local room = game:GetRoom()
|
|
349
|
+
local isClear = room:IsClear()
|
|
350
|
+
if isClear and (entity.Type == EntityType.GRIMACE or entity.Type == EntityType.ULTRA_DOOR) then
|
|
351
|
+
return false
|
|
352
|
+
end
|
|
353
|
+
if entity.Type == EntityType.MOTHER and entity.Variant == MotherVariant.MOTHER_1 then
|
|
354
|
+
local npc = entity:ToNPC()
|
|
355
|
+
if npc ~= nil and npc.State == NPCState.SPECIAL then
|
|
356
|
+
return false
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
return entity:IsActiveEnemy(false)
|
|
360
|
+
end
|
|
338
361
|
--- Helper function to measure an entity's velocity to see if it is moving.
|
|
339
362
|
--
|
|
340
363
|
-- Use this helper function over checking if the velocity length is equal to 0 because entities can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,cAAc,EAOf,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,cAAc,EAOf,MAAM,8BAA8B,CAAC;AAqBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CA2CN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,YAAY,UAAQ,EACpB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA+CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhE;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D;AA8ID,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAI5E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAGtE;AA+DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAInE"}
|
|
@@ -194,6 +194,8 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(ReadonlySet, {
|
|
|
194
194
|
EffectVariant.WALL_BUG,
|
|
195
195
|
EffectVariant.FALLING_EMBER,
|
|
196
196
|
EffectVariant.LIGHT,
|
|
197
|
+
EffectVariant.MIST,
|
|
198
|
+
EffectVariant.BACKDROP_DECORATION,
|
|
197
199
|
EffectVariant.TADPOLE
|
|
198
200
|
})
|
|
199
201
|
--- Helper function for printing out every entity (or filtered entity) in the current room.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,SAAS,
|
|
1
|
+
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,SAAS,EAST,SAAS,EACT,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAuCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAcnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CACvC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;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,UAAU,EACpB,GAAG,UAAU,EAAE,SAAS,EAAE,GACzB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,SAAS,EAAE,QAAQ,EAAE,GACvB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
|
|
@@ -19,8 +19,6 @@ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
|
19
19
|
local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
|
|
20
20
|
local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
|
|
21
21
|
local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
|
|
22
|
-
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
23
|
-
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
24
22
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
25
23
|
local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
|
|
26
24
|
local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
|
|
@@ -50,6 +48,7 @@ local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
|
|
|
50
48
|
local openDoorFast = ____doors.openDoorFast
|
|
51
49
|
local ____entities = require("src.functions.entities")
|
|
52
50
|
local getEntities = ____entities.getEntities
|
|
51
|
+
local isActiveEnemy = ____entities.isActiveEnemy
|
|
53
52
|
local ____flag = require("src.functions.flag")
|
|
54
53
|
local hasFlag = ____flag.hasFlag
|
|
55
54
|
local ____positionVelocity = require("src.functions.positionVelocity")
|
|
@@ -636,7 +635,7 @@ function ____exports.isRoomDangerous(self)
|
|
|
636
635
|
local entities = getEntities(nil)
|
|
637
636
|
if __TS__ArraySome(
|
|
638
637
|
entities,
|
|
639
|
-
function(____, entity) return
|
|
638
|
+
function(____, entity) return isActiveEnemy(nil, entity) end
|
|
640
639
|
) then
|
|
641
640
|
return true
|
|
642
641
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "72.
|
|
3
|
+
"version": "72.7.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^36.
|
|
28
|
+
"isaac-typescript-definitions": "^36.1.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
EntityFlag,
|
|
3
|
+
EntityType,
|
|
4
|
+
MotherVariant,
|
|
5
|
+
NPCState,
|
|
6
|
+
} from "isaac-typescript-definitions";
|
|
3
7
|
import { game } from "../core/cachedClasses";
|
|
4
8
|
import { VectorZero } from "../core/constants";
|
|
5
9
|
import { ENTITIES_WITH_ARMOR_SET } from "../sets/entitiesWithArmorSet";
|
|
@@ -349,6 +353,43 @@ export function hasArmor(entity: Entity): boolean {
|
|
|
349
353
|
return ENTITIES_WITH_ARMOR_SET.has(typeVariantString);
|
|
350
354
|
}
|
|
351
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Helper function to detect if a particular entity is an active enemy. Use this over the
|
|
358
|
+
* `Entity.IsActiveEnemy` method since it is bugged with friendly enemies, Grimaces, Ultra Doors,
|
|
359
|
+
* and Mother.
|
|
360
|
+
*/
|
|
361
|
+
export function isActiveEnemy(entity: Entity): boolean {
|
|
362
|
+
if (entity.HasEntityFlags(EntityFlag.FRIENDLY)) {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const room = game.GetRoom();
|
|
367
|
+
const isClear = room.IsClear();
|
|
368
|
+
|
|
369
|
+
// Some entities count as being "active" enemies, but they deactivate when the room is cleared.
|
|
370
|
+
if (
|
|
371
|
+
isClear &&
|
|
372
|
+
(entity.Type === EntityType.GRIMACE || // 42
|
|
373
|
+
entity.Type === EntityType.ULTRA_DOOR) // 294
|
|
374
|
+
) {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// The `Entity.IsActiveEnemy` function does not work properly with Mother.
|
|
379
|
+
if (
|
|
380
|
+
entity.Type === EntityType.MOTHER &&
|
|
381
|
+
entity.Variant === MotherVariant.MOTHER_1
|
|
382
|
+
) {
|
|
383
|
+
const npc = entity.ToNPC();
|
|
384
|
+
if (npc !== undefined && npc.State === NPCState.SPECIAL) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
390
|
+
return entity.IsActiveEnemy(false);
|
|
391
|
+
}
|
|
392
|
+
|
|
352
393
|
/**
|
|
353
394
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
354
395
|
*
|
|
@@ -26,6 +26,8 @@ const IGNORE_EFFECT_VARIANTS = new ReadonlySet<EffectVariant>([
|
|
|
26
26
|
EffectVariant.WALL_BUG, // 68
|
|
27
27
|
EffectVariant.FALLING_EMBER, // 87
|
|
28
28
|
EffectVariant.LIGHT, // 121
|
|
29
|
+
EffectVariant.MIST, // 138
|
|
30
|
+
EffectVariant.BACKDROP_DECORATION, // 140
|
|
29
31
|
EffectVariant.TADPOLE, // 158
|
|
30
32
|
]);
|
|
31
33
|
|
package/src/functions/rooms.ts
CHANGED
|
@@ -11,8 +11,6 @@ import {
|
|
|
11
11
|
DoorSlotFlag,
|
|
12
12
|
DownpourRoomSubType,
|
|
13
13
|
DungeonSubType,
|
|
14
|
-
EntityFlag,
|
|
15
|
-
EntityType,
|
|
16
14
|
GridRoom,
|
|
17
15
|
HomeRoomSubType,
|
|
18
16
|
ProjectileFlag,
|
|
@@ -34,7 +32,7 @@ import {
|
|
|
34
32
|
isHiddenSecretRoomDoor,
|
|
35
33
|
openDoorFast,
|
|
36
34
|
} from "./doors";
|
|
37
|
-
import { getEntities } from "./entities";
|
|
35
|
+
import { getEntities, isActiveEnemy } from "./entities";
|
|
38
36
|
import { hasFlag } from "./flag";
|
|
39
37
|
import {
|
|
40
38
|
getEntityPositions,
|
|
@@ -820,15 +818,7 @@ export function isRoomDangerous(): boolean {
|
|
|
820
818
|
|
|
821
819
|
const entities = getEntities();
|
|
822
820
|
|
|
823
|
-
if (
|
|
824
|
-
entities.some(
|
|
825
|
-
(entity) =>
|
|
826
|
-
entity.IsActiveEnemy(false) &&
|
|
827
|
-
!entity.HasEntityFlags(EntityFlag.FRIENDLY) &&
|
|
828
|
-
// Grimaces count as being "active" enemies, but they go to sleep when the room is cleared.
|
|
829
|
-
entity.Type !== EntityType.GRIMACE,
|
|
830
|
-
)
|
|
831
|
-
) {
|
|
821
|
+
if (entities.some((entity) => isActiveEnemy(entity))) {
|
|
832
822
|
return true;
|
|
833
823
|
}
|
|
834
824
|
|