isaacscript-common 79.2.0 → 80.0.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/functions/map.d.ts +16 -0
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.lua +16 -0
- package/dist/functions/rooms.d.ts +0 -8
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +2 -37
- package/dist/index.rollup.d.ts +17 -9
- package/dist/isaacscript-common.lua +19 -38
- package/package.json +1 -1
- package/src/functions/map.ts +21 -0
- package/src/functions/rooms.ts +1 -39
package/dist/functions/map.d.ts
CHANGED
|
@@ -54,8 +54,24 @@ export declare function mapSetHash<V>(map: Map<PtrHash, V>, entity: Entity, valu
|
|
|
54
54
|
*
|
|
55
55
|
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
56
56
|
* hood.
|
|
57
|
+
*
|
|
58
|
+
* Also see the `objectToReadonlyMap` function.
|
|
57
59
|
*/
|
|
58
60
|
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): Map<K, V>;
|
|
61
|
+
/**
|
|
62
|
+
* Helper function to convert an object to a read-only map.
|
|
63
|
+
*
|
|
64
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
65
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
66
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
67
|
+
* assertions.
|
|
68
|
+
*
|
|
69
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
70
|
+
* hood.
|
|
71
|
+
*
|
|
72
|
+
* Also see the `objectToMap` function.
|
|
73
|
+
*/
|
|
74
|
+
export declare function objectToReadonlyMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
59
75
|
/** Helper function to sum every value in a map together. */
|
|
60
76
|
export declare function sumMap(map: Map<unknown, number> | ReadonlyMap<unknown, number>): number;
|
|
61
77
|
//# sour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IAAI,CAGN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAQX;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACvE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEnB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACvD,MAAM,CAGR"}
|
package/dist/functions/map.lua
CHANGED
|
@@ -74,6 +74,8 @@ end
|
|
|
74
74
|
--
|
|
75
75
|
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
76
76
|
-- hood.
|
|
77
|
+
--
|
|
78
|
+
-- Also see the `objectToReadonlyMap` function.
|
|
77
79
|
function ____exports.objectToMap(self, object)
|
|
78
80
|
local map = __TS__New(Map)
|
|
79
81
|
for ____, ____value in ipairs(__TS__ObjectEntries(object)) do
|
|
@@ -83,6 +85,20 @@ function ____exports.objectToMap(self, object)
|
|
|
83
85
|
end
|
|
84
86
|
return map
|
|
85
87
|
end
|
|
88
|
+
--- Helper function to convert an object to a read-only map.
|
|
89
|
+
--
|
|
90
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
91
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
92
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
93
|
+
-- assertions.
|
|
94
|
+
--
|
|
95
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
96
|
+
-- hood.
|
|
97
|
+
--
|
|
98
|
+
-- Also see the `objectToMap` function.
|
|
99
|
+
function ____exports.objectToReadonlyMap(self, object)
|
|
100
|
+
return ____exports.objectToMap(nil, object)
|
|
101
|
+
end
|
|
86
102
|
--- Helper function to sum every value in a map together.
|
|
87
103
|
function ____exports.sumMap(self, map)
|
|
88
104
|
local values = {__TS__Spread(map:values())}
|
|
@@ -363,14 +363,6 @@ export declare function isMinibossRoomOf(roomData: RoomConfig, minibossID: Minib
|
|
|
363
363
|
* rooms are marked with a specific sub-type.)
|
|
364
364
|
*/
|
|
365
365
|
export declare function isMirrorRoom(roomData: RoomConfig): boolean;
|
|
366
|
-
/**
|
|
367
|
-
* Helper function to check if the room contains one or more enemies/projectiles that could damage
|
|
368
|
-
* the player.
|
|
369
|
-
*
|
|
370
|
-
* This is useful to check to see if it is safe to pause the game or display some informational
|
|
371
|
-
* text.
|
|
372
|
-
*/
|
|
373
|
-
export declare function isRoomDangerous(): boolean;
|
|
374
366
|
/**
|
|
375
367
|
* Helper function to check if the provided room matches one of the given room shapes.
|
|
376
368
|
*
|
|
@@ -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,EACV,SAAS,EACV,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,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,SAAS,EAQT,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAuCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAA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GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAO1D;AAED;;;;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,aAAa,EAAE,GAAG,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAExD;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"}
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -9,7 +9,6 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
|
9
9
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
10
10
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
11
11
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
12
|
-
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
13
12
|
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
14
13
|
local ____exports = {}
|
|
15
14
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -21,7 +20,6 @@ local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSub
|
|
|
21
20
|
local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
|
|
22
21
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
23
22
|
local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
|
|
24
|
-
local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
|
|
25
23
|
local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
|
|
26
24
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
27
25
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
@@ -47,7 +45,6 @@ local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
|
|
|
47
45
|
local openDoorFast = ____doors.openDoorFast
|
|
48
46
|
local ____entities = require("functions.entities")
|
|
49
47
|
local getEntities = ____entities.getEntities
|
|
50
|
-
local isActiveEnemy = ____entities.isActiveEnemy
|
|
51
48
|
local ____flag = require("functions.flag")
|
|
52
49
|
local hasFlag = ____flag.hasFlag
|
|
53
50
|
local ____positionVelocity = require("functions.positionVelocity")
|
|
@@ -621,38 +618,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes, includeSecretRoom
|
|
|
621
618
|
function(____, roomDescriptor) return roomDescriptor.Clear end
|
|
622
619
|
)
|
|
623
620
|
end
|
|
624
|
-
--- Helper function to check if the room contains one or more enemies/projectiles that could damage
|
|
625
|
-
-- the player.
|
|
626
|
-
--
|
|
627
|
-
-- This is useful to check to see if it is safe to pause the game or display some informational
|
|
628
|
-
-- text.
|
|
629
|
-
function ____exports.isRoomDangerous(self)
|
|
630
|
-
local room = game:GetRoom()
|
|
631
|
-
local isClear = room:IsClear()
|
|
632
|
-
if not isClear then
|
|
633
|
-
return true
|
|
634
|
-
end
|
|
635
|
-
local entities = getEntities(nil)
|
|
636
|
-
if __TS__ArraySome(
|
|
637
|
-
entities,
|
|
638
|
-
function(____, entity) return isActiveEnemy(nil, entity) end
|
|
639
|
-
) then
|
|
640
|
-
return true
|
|
641
|
-
end
|
|
642
|
-
if __TS__ArraySome(
|
|
643
|
-
entities,
|
|
644
|
-
function(____, entity)
|
|
645
|
-
local projectile = entity:ToProjectile()
|
|
646
|
-
if projectile == nil then
|
|
647
|
-
return false
|
|
648
|
-
end
|
|
649
|
-
return not projectile:HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER)
|
|
650
|
-
end
|
|
651
|
-
) then
|
|
652
|
-
return true
|
|
653
|
-
end
|
|
654
|
-
return false
|
|
655
|
-
end
|
|
656
621
|
--- Helper function to detect if a room type is a Secret Room, a Super Secret Room, or an Ultra
|
|
657
622
|
-- Secret Room.
|
|
658
623
|
function ____exports.isSecretRoomType(self, roomType)
|
|
@@ -689,12 +654,12 @@ function ____exports.setRoomCleared(self)
|
|
|
689
654
|
for ____, door in ipairs(getDoors(nil)) do
|
|
690
655
|
do
|
|
691
656
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
692
|
-
goto
|
|
657
|
+
goto __continue86
|
|
693
658
|
end
|
|
694
659
|
openDoorFast(nil, door)
|
|
695
660
|
door.ExtraVisible = false
|
|
696
661
|
end
|
|
697
|
-
::
|
|
662
|
+
::__continue86::
|
|
698
663
|
end
|
|
699
664
|
sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
|
|
700
665
|
game:ShakeScreen(0)
|
package/dist/index.rollup.d.ts
CHANGED
|
@@ -9935,15 +9935,6 @@ export declare function isRNG(object: unknown): object is RNG;
|
|
|
9935
9935
|
/** Helper function to detect if a variable is of type `GridEntityRock`. */
|
|
9936
9936
|
export declare function isRock(variable: unknown): variable is GridEntityRock;
|
|
9937
9937
|
|
|
9938
|
-
/**
|
|
9939
|
-
* Helper function to check if the room contains one or more enemies/projectiles that could damage
|
|
9940
|
-
* the player.
|
|
9941
|
-
*
|
|
9942
|
-
* This is useful to check to see if it is safe to pause the game or display some informational
|
|
9943
|
-
* text.
|
|
9944
|
-
*/
|
|
9945
|
-
export declare function isRoomDangerous(): boolean;
|
|
9946
|
-
|
|
9947
9938
|
/**
|
|
9948
9939
|
* Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
9949
9940
|
*
|
|
@@ -14908,9 +14899,26 @@ export declare const NUM_VANILLA_TRINKET_TYPES: number;
|
|
|
14908
14899
|
*
|
|
14909
14900
|
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
14910
14901
|
* hood.
|
|
14902
|
+
*
|
|
14903
|
+
* Also see the `objectToReadonlyMap` function.
|
|
14911
14904
|
*/
|
|
14912
14905
|
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): Map<K, V>;
|
|
14913
14906
|
|
|
14907
|
+
/**
|
|
14908
|
+
* Helper function to convert an object to a read-only map.
|
|
14909
|
+
*
|
|
14910
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
14911
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
14912
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
14913
|
+
* assertions.
|
|
14914
|
+
*
|
|
14915
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
14916
|
+
* hood.
|
|
14917
|
+
*
|
|
14918
|
+
* Also see the `objectToMap` function.
|
|
14919
|
+
*/
|
|
14920
|
+
export declare function objectToReadonlyMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
14921
|
+
|
|
14914
14922
|
/** Helper function to see if the player is playing any challenge. */
|
|
14915
14923
|
export declare function onAnyChallenge(): boolean;
|
|
14916
14924
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 79.
|
|
3
|
+
isaacscript-common 79.3.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -32438,7 +32438,6 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
|
32438
32438
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
32439
32439
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
32440
32440
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
32441
|
-
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
32442
32441
|
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
32443
32442
|
local ____exports = {}
|
|
32444
32443
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
|
|
@@ -32450,7 +32449,6 @@ local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSub
|
|
|
32450
32449
|
local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
|
|
32451
32450
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
32452
32451
|
local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
|
|
32453
|
-
local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
|
|
32454
32452
|
local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
|
|
32455
32453
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
32456
32454
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
@@ -32476,7 +32474,6 @@ local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
|
|
|
32476
32474
|
local openDoorFast = ____doors.openDoorFast
|
|
32477
32475
|
local ____entities = require("functions.entities")
|
|
32478
32476
|
local getEntities = ____entities.getEntities
|
|
32479
|
-
local isActiveEnemy = ____entities.isActiveEnemy
|
|
32480
32477
|
local ____flag = require("functions.flag")
|
|
32481
32478
|
local hasFlag = ____flag.hasFlag
|
|
32482
32479
|
local ____positionVelocity = require("functions.positionVelocity")
|
|
@@ -33050,38 +33047,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes, includeSecretRoom
|
|
|
33050
33047
|
function(____, roomDescriptor) return roomDescriptor.Clear end
|
|
33051
33048
|
)
|
|
33052
33049
|
end
|
|
33053
|
-
--- Helper function to check if the room contains one or more enemies/projectiles that could damage
|
|
33054
|
-
-- the player.
|
|
33055
|
-
--
|
|
33056
|
-
-- This is useful to check to see if it is safe to pause the game or display some informational
|
|
33057
|
-
-- text.
|
|
33058
|
-
function ____exports.isRoomDangerous(self)
|
|
33059
|
-
local room = game:GetRoom()
|
|
33060
|
-
local isClear = room:IsClear()
|
|
33061
|
-
if not isClear then
|
|
33062
|
-
return true
|
|
33063
|
-
end
|
|
33064
|
-
local entities = getEntities(nil)
|
|
33065
|
-
if __TS__ArraySome(
|
|
33066
|
-
entities,
|
|
33067
|
-
function(____, entity) return isActiveEnemy(nil, entity) end
|
|
33068
|
-
) then
|
|
33069
|
-
return true
|
|
33070
|
-
end
|
|
33071
|
-
if __TS__ArraySome(
|
|
33072
|
-
entities,
|
|
33073
|
-
function(____, entity)
|
|
33074
|
-
local projectile = entity:ToProjectile()
|
|
33075
|
-
if projectile == nil then
|
|
33076
|
-
return false
|
|
33077
|
-
end
|
|
33078
|
-
return not projectile:HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER)
|
|
33079
|
-
end
|
|
33080
|
-
) then
|
|
33081
|
-
return true
|
|
33082
|
-
end
|
|
33083
|
-
return false
|
|
33084
|
-
end
|
|
33085
33050
|
--- Helper function to detect if a room type is a Secret Room, a Super Secret Room, or an Ultra
|
|
33086
33051
|
-- Secret Room.
|
|
33087
33052
|
function ____exports.isSecretRoomType(self, roomType)
|
|
@@ -33118,12 +33083,12 @@ function ____exports.setRoomCleared(self)
|
|
|
33118
33083
|
for ____, door in ipairs(getDoors(nil)) do
|
|
33119
33084
|
do
|
|
33120
33085
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
33121
|
-
goto
|
|
33086
|
+
goto __continue86
|
|
33122
33087
|
end
|
|
33123
33088
|
openDoorFast(nil, door)
|
|
33124
33089
|
door.ExtraVisible = false
|
|
33125
33090
|
end
|
|
33126
|
-
::
|
|
33091
|
+
::__continue86::
|
|
33127
33092
|
end
|
|
33128
33093
|
sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
|
|
33129
33094
|
game:ShakeScreen(0)
|
|
@@ -46941,6 +46906,8 @@ end
|
|
|
46941
46906
|
--
|
|
46942
46907
|
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
46943
46908
|
-- hood.
|
|
46909
|
+
--
|
|
46910
|
+
-- Also see the `objectToReadonlyMap` function.
|
|
46944
46911
|
function ____exports.objectToMap(self, object)
|
|
46945
46912
|
local map = __TS__New(Map)
|
|
46946
46913
|
for ____, ____value in ipairs(__TS__ObjectEntries(object)) do
|
|
@@ -46950,6 +46917,20 @@ function ____exports.objectToMap(self, object)
|
|
|
46950
46917
|
end
|
|
46951
46918
|
return map
|
|
46952
46919
|
end
|
|
46920
|
+
--- Helper function to convert an object to a read-only map.
|
|
46921
|
+
--
|
|
46922
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
46923
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
46924
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
46925
|
+
-- assertions.
|
|
46926
|
+
--
|
|
46927
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
46928
|
+
-- hood.
|
|
46929
|
+
--
|
|
46930
|
+
-- Also see the `objectToMap` function.
|
|
46931
|
+
function ____exports.objectToReadonlyMap(self, object)
|
|
46932
|
+
return ____exports.objectToMap(nil, object)
|
|
46933
|
+
end
|
|
46953
46934
|
--- Helper function to sum every value in a map together.
|
|
46954
46935
|
function ____exports.sumMap(self, map)
|
|
46955
46936
|
local values = {__TS__Spread(map:values())}
|
package/package.json
CHANGED
package/src/functions/map.ts
CHANGED
|
@@ -99,6 +99,8 @@ export function mapSetHash<V>(
|
|
|
99
99
|
*
|
|
100
100
|
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
101
101
|
* hood.
|
|
102
|
+
*
|
|
103
|
+
* Also see the `objectToReadonlyMap` function.
|
|
102
104
|
*/
|
|
103
105
|
export function objectToMap<K extends string | number | symbol, V>(
|
|
104
106
|
object: Record<K, V>,
|
|
@@ -112,6 +114,25 @@ export function objectToMap<K extends string | number | symbol, V>(
|
|
|
112
114
|
return map;
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to convert an object to a read-only map.
|
|
119
|
+
*
|
|
120
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
121
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
122
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
123
|
+
* assertions.
|
|
124
|
+
*
|
|
125
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
126
|
+
* hood.
|
|
127
|
+
*
|
|
128
|
+
* Also see the `objectToMap` function.
|
|
129
|
+
*/
|
|
130
|
+
export function objectToReadonlyMap<K extends string | number | symbol, V>(
|
|
131
|
+
object: Record<K, V>,
|
|
132
|
+
): ReadonlyMap<K, V> {
|
|
133
|
+
return objectToMap(object);
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
/** Helper function to sum every value in a map together. */
|
|
116
137
|
export function sumMap(
|
|
117
138
|
map: Map<unknown, number> | ReadonlyMap<unknown, number>,
|
package/src/functions/rooms.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
DungeonSubType,
|
|
15
15
|
GridRoom,
|
|
16
16
|
HomeRoomSubType,
|
|
17
|
-
ProjectileFlag,
|
|
18
17
|
RoomDescriptorFlag,
|
|
19
18
|
RoomType,
|
|
20
19
|
SoundEffect,
|
|
@@ -32,7 +31,7 @@ import {
|
|
|
32
31
|
isHiddenSecretRoomDoor,
|
|
33
32
|
openDoorFast,
|
|
34
33
|
} from "./doors";
|
|
35
|
-
import { getEntities
|
|
34
|
+
import { getEntities } from "./entities";
|
|
36
35
|
import { hasFlag } from "./flag";
|
|
37
36
|
import {
|
|
38
37
|
getEntityPositions,
|
|
@@ -800,43 +799,6 @@ export function isMirrorRoom(roomData: RoomConfig): boolean {
|
|
|
800
799
|
);
|
|
801
800
|
}
|
|
802
801
|
|
|
803
|
-
/**
|
|
804
|
-
* Helper function to check if the room contains one or more enemies/projectiles that could damage
|
|
805
|
-
* the player.
|
|
806
|
-
*
|
|
807
|
-
* This is useful to check to see if it is safe to pause the game or display some informational
|
|
808
|
-
* text.
|
|
809
|
-
*/
|
|
810
|
-
export function isRoomDangerous(): boolean {
|
|
811
|
-
const room = game.GetRoom();
|
|
812
|
-
|
|
813
|
-
const isClear = room.IsClear();
|
|
814
|
-
if (!isClear) {
|
|
815
|
-
return true;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
const entities = getEntities();
|
|
819
|
-
|
|
820
|
-
if (entities.some((entity) => isActiveEnemy(entity))) {
|
|
821
|
-
return true;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
if (
|
|
825
|
-
entities.some((entity) => {
|
|
826
|
-
const projectile = entity.ToProjectile();
|
|
827
|
-
if (projectile === undefined) {
|
|
828
|
-
return false;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
return !projectile.HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER);
|
|
832
|
-
})
|
|
833
|
-
) {
|
|
834
|
-
return true;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
return false;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
802
|
/**
|
|
841
803
|
* Helper function to check if the provided room matches one of the given room shapes.
|
|
842
804
|
*
|