isaacscript-common 36.1.0 → 36.2.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 +2 -2
- package/dist/isaacscript-common.lua +21 -18
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +2 -2
- package/dist/src/functions/collectibleTag.d.ts +2 -2
- package/dist/src/functions/collectibleTag.d.ts.map +1 -1
- package/dist/src/functions/collectibleTag.lua +6 -2
- package/dist/src/functions/collectibles.lua +3 -4
- package/dist/src/functions/gridEntities.lua +7 -7
- package/dist/src/functions/minimap.lua +2 -2
- package/package.json +1 -1
- package/src/classes/features/callbackLogic/CustomGridEntities.ts +2 -2
- package/src/functions/collectibleTag.ts +13 -2
- package/src/functions/collectibles.ts +3 -4
- package/src/functions/gridEntities.ts +3 -3
- package/src/functions/minimap.ts +2 -2
package/dist/index.rollup.d.ts
CHANGED
|
@@ -1583,7 +1583,7 @@ export declare const COLLECTIBLE_INITIAL_WAIT = 20;
|
|
|
1583
1583
|
/** Helper function to check in the item config if a given collectible has a given cache flag. */
|
|
1584
1584
|
export declare function collectibleHasCacheFlag(collectibleOrCollectibleType: EntityPickup | CollectibleType, cacheFlag: CacheFlag): boolean;
|
|
1585
1585
|
|
|
1586
|
-
export declare function collectibleHasTag(
|
|
1586
|
+
export declare function collectibleHasTag(collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType, tag: ItemConfigTag): boolean;
|
|
1587
1587
|
|
|
1588
1588
|
declare class CollectibleItemPoolType extends Feature {
|
|
1589
1589
|
private readonly pickupIndexCreation;
|
|
@@ -8892,7 +8892,7 @@ export declare function isProjectile(variable: unknown): variable is EntityProje
|
|
|
8892
8892
|
/** Helper function to check if a collectible type is a particular quality. */
|
|
8893
8893
|
export declare function isQuality(collectibleOrCollectibleType: EntityPickup | CollectibleType, quality: int): boolean;
|
|
8894
8894
|
|
|
8895
|
-
export declare function isQuestCollectible(
|
|
8895
|
+
export declare function isQuestCollectible(collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType): boolean;
|
|
8896
8896
|
|
|
8897
8897
|
/**
|
|
8898
8898
|
* Helper function to detect the custom death state of a Rag Man Ragling. When Rag Man Raglings die,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 36.
|
|
3
|
+
isaacscript-common 36.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -21508,7 +21508,7 @@ local ____sprites = require("src.functions.sprites")
|
|
|
21508
21508
|
local clearSprite = ____sprites.clearSprite
|
|
21509
21509
|
local spriteEquals = ____sprites.spriteEquals
|
|
21510
21510
|
local ____types = require("src.functions.types")
|
|
21511
|
-
local
|
|
21511
|
+
local isInteger = ____types.isInteger
|
|
21512
21512
|
local ____utils = require("src.functions.utils")
|
|
21513
21513
|
local iRange = ____utils.iRange
|
|
21514
21514
|
function initQuestionMarkSprite(self)
|
|
@@ -21568,9 +21568,8 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
21568
21568
|
)
|
|
21569
21569
|
end
|
|
21570
21570
|
function getCollectibleTypeFromArg(self, collectibleOrCollectibleType, functionName)
|
|
21571
|
-
if
|
|
21572
|
-
|
|
21573
|
-
return collectibleType
|
|
21571
|
+
if isInteger(nil, collectibleOrCollectibleType) then
|
|
21572
|
+
return collectibleOrCollectibleType
|
|
21574
21573
|
end
|
|
21575
21574
|
local collectible = collectibleOrCollectibleType
|
|
21576
21575
|
if not isCollectible(nil, collectible) then
|
|
@@ -28043,7 +28042,7 @@ local ____rooms = require("src.functions.rooms")
|
|
|
28043
28042
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
28044
28043
|
local ____types = require("src.functions.types")
|
|
28045
28044
|
local asNumber = ____types.asNumber
|
|
28046
|
-
local
|
|
28045
|
+
local isInteger = ____types.isInteger
|
|
28047
28046
|
local ____utils = require("src.functions.utils")
|
|
28048
28047
|
local assertDefined = ____utils.assertDefined
|
|
28049
28048
|
local eRange = ____utils.eRange
|
|
@@ -28080,20 +28079,20 @@ function ____exports.getTopLeftWallGridIndex(self)
|
|
|
28080
28079
|
end
|
|
28081
28080
|
function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
|
|
28082
28081
|
local room = game:GetRoom()
|
|
28083
|
-
local
|
|
28084
|
-
if
|
|
28085
|
-
|
|
28082
|
+
local ____isInteger_result_2
|
|
28083
|
+
if isInteger(nil, gridEntityOrGridIndex) then
|
|
28084
|
+
____isInteger_result_2 = room:GetGridEntity(gridEntityOrGridIndex)
|
|
28086
28085
|
else
|
|
28087
|
-
|
|
28086
|
+
____isInteger_result_2 = gridEntityOrGridIndex
|
|
28088
28087
|
end
|
|
28089
|
-
local gridEntity =
|
|
28088
|
+
local gridEntity = ____isInteger_result_2
|
|
28090
28089
|
if gridEntity == nil then
|
|
28091
28090
|
return
|
|
28092
28091
|
end
|
|
28093
28092
|
local gridEntityType = gridEntity:GetType()
|
|
28094
28093
|
local variant = gridEntity:GetVariant()
|
|
28095
28094
|
local position = gridEntity.Position
|
|
28096
|
-
local gridIndex =
|
|
28095
|
+
local gridIndex = isInteger(nil, gridEntityOrGridIndex) and gridEntityOrGridIndex or gridEntityOrGridIndex:GetGridIndex()
|
|
28097
28096
|
room:RemoveGridEntity(gridIndex, 0, false)
|
|
28098
28097
|
if updateRoom then
|
|
28099
28098
|
roomUpdateSafe(nil)
|
|
@@ -34978,7 +34977,7 @@ local getPlayerFromPtr = ____players.getPlayerFromPtr
|
|
|
34978
34977
|
local ____roomData = require("src.functions.roomData")
|
|
34979
34978
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
34980
34979
|
local ____types = require("src.functions.types")
|
|
34981
|
-
local
|
|
34980
|
+
local isInteger = ____types.isInteger
|
|
34982
34981
|
local ____utils = require("src.functions.utils")
|
|
34983
34982
|
local assertDefined = ____utils.assertDefined
|
|
34984
34983
|
local ____vector = require("src.functions.vector")
|
|
@@ -35155,7 +35154,7 @@ function CustomGridEntities.prototype.getCustomGridEntityType(self, gridEntityOr
|
|
|
35155
35154
|
if not self.initialized then
|
|
35156
35155
|
return nil
|
|
35157
35156
|
end
|
|
35158
|
-
local gridIndex =
|
|
35157
|
+
local gridIndex = isInteger(nil, gridEntityOrGridIndex) and gridEntityOrGridIndex or gridEntityOrGridIndex:GetGridIndex()
|
|
35159
35158
|
local roomListIndex = getRoomListIndex(nil)
|
|
35160
35159
|
local roomCustomGridEntities = v.level.customGridEntities:get(roomListIndex)
|
|
35161
35160
|
if roomCustomGridEntities == nil then
|
|
@@ -38299,14 +38298,18 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
|
|
|
38299
38298
|
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
|
|
38300
38299
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
38301
38300
|
local itemConfig = ____cachedClasses.itemConfig
|
|
38302
|
-
|
|
38301
|
+
local ____types = require("src.functions.types")
|
|
38302
|
+
local isInteger = ____types.isInteger
|
|
38303
|
+
function ____exports.collectibleHasTag(self, collectibleOrCollectibleType, tag)
|
|
38304
|
+
local collectibleType = isInteger(nil, collectibleOrCollectibleType) and collectibleOrCollectibleType or collectibleOrCollectibleType.SubType
|
|
38303
38305
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
38304
38306
|
if itemConfigItem == nil then
|
|
38305
38307
|
return false
|
|
38306
38308
|
end
|
|
38307
38309
|
return itemConfigItem:HasTags(tag)
|
|
38308
38310
|
end
|
|
38309
|
-
function ____exports.isQuestCollectible(self,
|
|
38311
|
+
function ____exports.isQuestCollectible(self, collectibleOrCollectibleType)
|
|
38312
|
+
local collectibleType = isInteger(nil, collectibleOrCollectibleType) and collectibleOrCollectibleType or collectibleOrCollectibleType.SubType
|
|
38310
38313
|
return ____exports.collectibleHasTag(nil, collectibleType, ItemConfigTag.QUEST)
|
|
38311
38314
|
end
|
|
38312
38315
|
return ____exports
|
|
@@ -53928,7 +53931,7 @@ local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
|
53928
53931
|
local ____rooms = require("src.functions.rooms")
|
|
53929
53932
|
local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
|
|
53930
53933
|
local ____types = require("src.functions.types")
|
|
53931
|
-
local
|
|
53934
|
+
local isInteger = ____types.isInteger
|
|
53932
53935
|
local ____utils = require("src.functions.utils")
|
|
53933
53936
|
local assertDefined = ____utils.assertDefined
|
|
53934
53937
|
function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
|
|
@@ -54025,7 +54028,7 @@ function ____exports.isRoomVisible(self, roomGridIndexOrRoomDescriptor, minimapA
|
|
|
54025
54028
|
if minimapAPI == nil then
|
|
54026
54029
|
minimapAPI = true
|
|
54027
54030
|
end
|
|
54028
|
-
local roomGridIndex =
|
|
54031
|
+
local roomGridIndex = isInteger(nil, roomGridIndexOrRoomDescriptor) and roomGridIndexOrRoomDescriptor or roomGridIndexOrRoomDescriptor.SafeGridIndex
|
|
54029
54032
|
local roomDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
|
|
54030
54033
|
return roomDisplayFlags ~= DisplayFlagZero
|
|
54031
54034
|
end
|
|
@@ -28,7 +28,7 @@ local getPlayerFromPtr = ____players.getPlayerFromPtr
|
|
|
28
28
|
local ____roomData = require("src.functions.roomData")
|
|
29
29
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
30
30
|
local ____types = require("src.functions.types")
|
|
31
|
-
local
|
|
31
|
+
local isInteger = ____types.isInteger
|
|
32
32
|
local ____utils = require("src.functions.utils")
|
|
33
33
|
local assertDefined = ____utils.assertDefined
|
|
34
34
|
local ____vector = require("src.functions.vector")
|
|
@@ -205,7 +205,7 @@ function CustomGridEntities.prototype.getCustomGridEntityType(self, gridEntityOr
|
|
|
205
205
|
if not self.initialized then
|
|
206
206
|
return nil
|
|
207
207
|
end
|
|
208
|
-
local gridIndex =
|
|
208
|
+
local gridIndex = isInteger(nil, gridEntityOrGridIndex) and gridEntityOrGridIndex or gridEntityOrGridIndex:GetGridIndex()
|
|
209
209
|
local roomListIndex = getRoomListIndex(nil)
|
|
210
210
|
local roomCustomGridEntities = v.level.customGridEntities:get(roomListIndex)
|
|
211
211
|
if roomCustomGridEntities == nil then
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectibleType } from "isaac-typescript-definitions";
|
|
2
2
|
import { ItemConfigTag } from "isaac-typescript-definitions";
|
|
3
|
-
export declare function collectibleHasTag(
|
|
4
|
-
export declare function isQuestCollectible(
|
|
3
|
+
export declare function collectibleHasTag(collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType, tag: ItemConfigTag): boolean;
|
|
4
|
+
export declare function isQuestCollectible(collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType): boolean;
|
|
5
5
|
//# sourceMappingURL=collectibleTag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibleTag.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibleTag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"collectibleTag.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibleTag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAI7D,wBAAgB,iBAAiB,CAC/B,4BAA4B,EAAE,uBAAuB,GAAG,eAAe,EACvE,GAAG,EAAE,aAAa,GACjB,OAAO,CAWT;AAED,wBAAgB,kBAAkB,CAChC,4BAA4B,EAAE,uBAAuB,GAAG,eAAe,GACtE,OAAO,CAMT"}
|
|
@@ -3,14 +3,18 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
3
3
|
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
|
|
4
4
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
5
5
|
local itemConfig = ____cachedClasses.itemConfig
|
|
6
|
-
|
|
6
|
+
local ____types = require("src.functions.types")
|
|
7
|
+
local isInteger = ____types.isInteger
|
|
8
|
+
function ____exports.collectibleHasTag(self, collectibleOrCollectibleType, tag)
|
|
9
|
+
local collectibleType = isInteger(nil, collectibleOrCollectibleType) and collectibleOrCollectibleType or collectibleOrCollectibleType.SubType
|
|
7
10
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
8
11
|
if itemConfigItem == nil then
|
|
9
12
|
return false
|
|
10
13
|
end
|
|
11
14
|
return itemConfigItem:HasTags(tag)
|
|
12
15
|
end
|
|
13
|
-
function ____exports.isQuestCollectible(self,
|
|
16
|
+
function ____exports.isQuestCollectible(self, collectibleOrCollectibleType)
|
|
17
|
+
local collectibleType = isInteger(nil, collectibleOrCollectibleType) and collectibleOrCollectibleType or collectibleOrCollectibleType.SubType
|
|
14
18
|
return ____exports.collectibleHasTag(nil, collectibleType, ItemConfigTag.QUEST)
|
|
15
19
|
end
|
|
16
20
|
return ____exports
|
|
@@ -37,7 +37,7 @@ local ____sprites = require("src.functions.sprites")
|
|
|
37
37
|
local clearSprite = ____sprites.clearSprite
|
|
38
38
|
local spriteEquals = ____sprites.spriteEquals
|
|
39
39
|
local ____types = require("src.functions.types")
|
|
40
|
-
local
|
|
40
|
+
local isInteger = ____types.isInteger
|
|
41
41
|
local ____utils = require("src.functions.utils")
|
|
42
42
|
local iRange = ____utils.iRange
|
|
43
43
|
function initQuestionMarkSprite(self)
|
|
@@ -114,9 +114,8 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
114
114
|
)
|
|
115
115
|
end
|
|
116
116
|
function getCollectibleTypeFromArg(self, collectibleOrCollectibleType, functionName)
|
|
117
|
-
if
|
|
118
|
-
|
|
119
|
-
return collectibleType
|
|
117
|
+
if isInteger(nil, collectibleOrCollectibleType) then
|
|
118
|
+
return collectibleOrCollectibleType
|
|
120
119
|
end
|
|
121
120
|
local collectible = collectibleOrCollectibleType
|
|
122
121
|
if not isCollectible(nil, collectible) then
|
|
@@ -42,7 +42,7 @@ local ____rooms = require("src.functions.rooms")
|
|
|
42
42
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
43
43
|
local ____types = require("src.functions.types")
|
|
44
44
|
local asNumber = ____types.asNumber
|
|
45
|
-
local
|
|
45
|
+
local isInteger = ____types.isInteger
|
|
46
46
|
local ____utils = require("src.functions.utils")
|
|
47
47
|
local assertDefined = ____utils.assertDefined
|
|
48
48
|
local eRange = ____utils.eRange
|
|
@@ -99,20 +99,20 @@ end
|
|
|
99
99
|
-- this to false if you need to run this function multiple times.
|
|
100
100
|
function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
|
|
101
101
|
local room = game:GetRoom()
|
|
102
|
-
local
|
|
103
|
-
if
|
|
104
|
-
|
|
102
|
+
local ____isInteger_result_2
|
|
103
|
+
if isInteger(nil, gridEntityOrGridIndex) then
|
|
104
|
+
____isInteger_result_2 = room:GetGridEntity(gridEntityOrGridIndex)
|
|
105
105
|
else
|
|
106
|
-
|
|
106
|
+
____isInteger_result_2 = gridEntityOrGridIndex
|
|
107
107
|
end
|
|
108
|
-
local gridEntity =
|
|
108
|
+
local gridEntity = ____isInteger_result_2
|
|
109
109
|
if gridEntity == nil then
|
|
110
110
|
return
|
|
111
111
|
end
|
|
112
112
|
local gridEntityType = gridEntity:GetType()
|
|
113
113
|
local variant = gridEntity:GetVariant()
|
|
114
114
|
local position = gridEntity.Position
|
|
115
|
-
local gridIndex =
|
|
115
|
+
local gridIndex = isInteger(nil, gridEntityOrGridIndex) and gridEntityOrGridIndex or gridEntityOrGridIndex:GetGridIndex()
|
|
116
116
|
room:RemoveGridEntity(gridIndex, 0, false)
|
|
117
117
|
if updateRoom then
|
|
118
118
|
roomUpdateSafe(nil)
|
|
@@ -15,7 +15,7 @@ local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
|
15
15
|
local ____rooms = require("src.functions.rooms")
|
|
16
16
|
local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
|
|
17
17
|
local ____types = require("src.functions.types")
|
|
18
|
-
local
|
|
18
|
+
local isInteger = ____types.isInteger
|
|
19
19
|
local ____utils = require("src.functions.utils")
|
|
20
20
|
local assertDefined = ____utils.assertDefined
|
|
21
21
|
--- Helper function to get a particular room's minimap display flags (e.g. whether it is visible and
|
|
@@ -178,7 +178,7 @@ function ____exports.isRoomVisible(self, roomGridIndexOrRoomDescriptor, minimapA
|
|
|
178
178
|
if minimapAPI == nil then
|
|
179
179
|
minimapAPI = true
|
|
180
180
|
end
|
|
181
|
-
local roomGridIndex =
|
|
181
|
+
local roomGridIndex = isInteger(nil, roomGridIndexOrRoomDescriptor) and roomGridIndexOrRoomDescriptor or roomGridIndexOrRoomDescriptor.SafeGridIndex
|
|
182
182
|
local roomDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
|
|
183
183
|
return roomDisplayFlags ~= DisplayFlagZero
|
|
184
184
|
end
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "../../../functions/gridEntities";
|
|
16
16
|
import { getPlayerFromPtr } from "../../../functions/players";
|
|
17
17
|
import { getRoomListIndex } from "../../../functions/roomData";
|
|
18
|
-
import {
|
|
18
|
+
import { isInteger } from "../../../functions/types";
|
|
19
19
|
import { assertDefined } from "../../../functions/utils";
|
|
20
20
|
import { isVector } from "../../../functions/vector";
|
|
21
21
|
import type { GridEntityCustomData } from "../../../interfaces/GridEntityCustomData";
|
|
@@ -386,7 +386,7 @@ export class CustomGridEntities extends Feature {
|
|
|
386
386
|
return undefined;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
const gridIndex =
|
|
389
|
+
const gridIndex = isInteger(gridEntityOrGridIndex)
|
|
390
390
|
? gridEntityOrGridIndex
|
|
391
391
|
: gridEntityOrGridIndex.GetGridIndex();
|
|
392
392
|
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { CollectibleType } from "isaac-typescript-definitions";
|
|
2
2
|
import { ItemConfigTag } from "isaac-typescript-definitions";
|
|
3
3
|
import { itemConfig } from "../core/cachedClasses";
|
|
4
|
+
import { isInteger } from "./types";
|
|
4
5
|
|
|
5
6
|
export function collectibleHasTag(
|
|
6
|
-
|
|
7
|
+
collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType,
|
|
7
8
|
tag: ItemConfigTag,
|
|
8
9
|
): boolean {
|
|
10
|
+
const collectibleType = isInteger(collectibleOrCollectibleType)
|
|
11
|
+
? collectibleOrCollectibleType
|
|
12
|
+
: collectibleOrCollectibleType.SubType;
|
|
13
|
+
|
|
9
14
|
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
10
15
|
if (itemConfigItem === undefined) {
|
|
11
16
|
return false;
|
|
@@ -14,6 +19,12 @@ export function collectibleHasTag(
|
|
|
14
19
|
return itemConfigItem.HasTags(tag);
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export function isQuestCollectible(
|
|
22
|
+
export function isQuestCollectible(
|
|
23
|
+
collectibleOrCollectibleType: EntityPickupCollectible | CollectibleType,
|
|
24
|
+
): boolean {
|
|
25
|
+
const collectibleType = isInteger(collectibleOrCollectibleType)
|
|
26
|
+
? collectibleOrCollectibleType
|
|
27
|
+
: collectibleOrCollectibleType.SubType;
|
|
28
|
+
|
|
18
29
|
return collectibleHasTag(collectibleType, ItemConfigTag.QUEST);
|
|
19
30
|
}
|
|
@@ -33,7 +33,7 @@ import { getEntityID } from "./entities";
|
|
|
33
33
|
import { hasFlag } from "./flag";
|
|
34
34
|
import { isCollectible } from "./pickupVariants";
|
|
35
35
|
import { clearSprite, spriteEquals } from "./sprites";
|
|
36
|
-
import {
|
|
36
|
+
import { isInteger } from "./types";
|
|
37
37
|
import { iRange } from "./utils";
|
|
38
38
|
|
|
39
39
|
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
@@ -754,9 +754,8 @@ function getCollectibleTypeFromArg(
|
|
|
754
754
|
collectibleOrCollectibleType: EntityPickup | CollectibleType,
|
|
755
755
|
functionName: string,
|
|
756
756
|
): CollectibleType {
|
|
757
|
-
if (
|
|
758
|
-
|
|
759
|
-
return collectibleType;
|
|
757
|
+
if (isInteger(collectibleOrCollectibleType)) {
|
|
758
|
+
return collectibleOrCollectibleType;
|
|
760
759
|
}
|
|
761
760
|
|
|
762
761
|
const collectible = collectibleOrCollectibleType;
|
|
@@ -24,7 +24,7 @@ import { removeEntities } from "./entities";
|
|
|
24
24
|
import { getEffects } from "./entitiesSpecific";
|
|
25
25
|
import { isCircleIntersectingRectangle } from "./math";
|
|
26
26
|
import { roomUpdateSafe } from "./rooms";
|
|
27
|
-
import { asNumber,
|
|
27
|
+
import { asNumber, isInteger } from "./types";
|
|
28
28
|
import { assertDefined, eRange, iRange } from "./utils";
|
|
29
29
|
import { isVector, vectorEquals } from "./vector";
|
|
30
30
|
|
|
@@ -662,7 +662,7 @@ export function removeGridEntity(
|
|
|
662
662
|
): void {
|
|
663
663
|
const room = game.GetRoom();
|
|
664
664
|
|
|
665
|
-
const gridEntity =
|
|
665
|
+
const gridEntity = isInteger(gridEntityOrGridIndex)
|
|
666
666
|
? room.GetGridEntity(gridEntityOrGridIndex)
|
|
667
667
|
: gridEntityOrGridIndex;
|
|
668
668
|
if (gridEntity === undefined) {
|
|
@@ -674,7 +674,7 @@ export function removeGridEntity(
|
|
|
674
674
|
const variant = gridEntity.GetVariant();
|
|
675
675
|
const position = gridEntity.Position;
|
|
676
676
|
|
|
677
|
-
const gridIndex =
|
|
677
|
+
const gridIndex = isInteger(gridEntityOrGridIndex)
|
|
678
678
|
? gridEntityOrGridIndex
|
|
679
679
|
: gridEntityOrGridIndex.GetGridIndex();
|
|
680
680
|
room.RemoveGridEntity(gridIndex, 0, false);
|
package/src/functions/minimap.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { game } from "../core/cachedClasses";
|
|
|
4
4
|
import { addFlag } from "./flag";
|
|
5
5
|
import { getRoomDescriptor, getRoomGridIndex } from "./roomData";
|
|
6
6
|
import { getRoomsInsideGrid } from "./rooms";
|
|
7
|
-
import {
|
|
7
|
+
import { isInteger } from "./types";
|
|
8
8
|
import { assertDefined } from "./utils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -145,7 +145,7 @@ export function isRoomVisible(
|
|
|
145
145
|
roomGridIndexOrRoomDescriptor: int | RoomDescriptor,
|
|
146
146
|
minimapAPI = true,
|
|
147
147
|
): boolean {
|
|
148
|
-
const roomGridIndex =
|
|
148
|
+
const roomGridIndex = isInteger(roomGridIndexOrRoomDescriptor)
|
|
149
149
|
? roomGridIndexOrRoomDescriptor
|
|
150
150
|
: roomGridIndexOrRoomDescriptor.SafeGridIndex;
|
|
151
151
|
const roomDisplayFlags = getRoomDisplayFlags(roomGridIndex, minimapAPI);
|