isaacscript-common 30.8.0 → 30.9.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.rollup.d.ts +11 -2
- package/dist/isaacscript-common.lua +23 -3
- package/dist/src/classes/ModUpgraded.d.ts +2 -2
- package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
- package/dist/src/functions/gridEntities.d.ts +8 -0
- package/dist/src/functions/gridEntities.d.ts.map +1 -1
- package/dist/src/functions/gridEntities.lua +27 -2
- package/package.json +2 -2
- package/src/classes/ModUpgraded.ts +8 -4
- package/src/functions/gridEntities.ts +29 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -3598,6 +3598,15 @@ export declare function doesAnyEntityExist(entityTypes: EntityType[] | readonly
|
|
|
3598
3598
|
*/
|
|
3599
3599
|
export declare function doesEntityExist(entityType?: EntityType | -1, variant?: number, subType?: number, ignoreFriendly?: boolean): boolean;
|
|
3600
3600
|
|
|
3601
|
+
/**
|
|
3602
|
+
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
3603
|
+
* current room. It uses the `countEntities` helper function to determine this.
|
|
3604
|
+
*
|
|
3605
|
+
* @param gridEntityType The grid entity type to match.
|
|
3606
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
3607
|
+
*/
|
|
3608
|
+
export declare function doesGridEntityExist(gridEntityType: GridEntityType, variant?: number): boolean;
|
|
3609
|
+
|
|
3601
3610
|
/**
|
|
3602
3611
|
* Returns whether or not all of the player's soul-heart-type hearts are black hearts.
|
|
3603
3612
|
*
|
|
@@ -12693,8 +12702,8 @@ export declare class ModUpgraded implements Mod {
|
|
|
12693
12702
|
private callbacks;
|
|
12694
12703
|
private features;
|
|
12695
12704
|
constructor(mod: Mod, debug: boolean, timeThreshold?: float);
|
|
12696
|
-
AddCallback<T extends
|
|
12697
|
-
AddPriorityCallback<T extends
|
|
12705
|
+
AddCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
|
|
12706
|
+
AddPriorityCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, priority: CallbackPriority | int, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
|
|
12698
12707
|
HasData(): boolean;
|
|
12699
12708
|
LoadData(): string;
|
|
12700
12709
|
RemoveCallback<T extends ModCallback>(modCallback: T, callback: AddCallbackParameters[T][0]): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 30.
|
|
3
|
+
isaacscript-common 30.9.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -27731,6 +27731,7 @@ return ____exports
|
|
|
27731
27731
|
["src.functions.gridEntities"] = function(...)
|
|
27732
27732
|
local ____lualib = require("lualib_bundle")
|
|
27733
27733
|
local __TS__New = ____lualib.__TS__New
|
|
27734
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
27734
27735
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
27735
27736
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
27736
27737
|
local Set = ____lualib.Set
|
|
@@ -27888,6 +27889,25 @@ function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntit
|
|
|
27888
27889
|
end
|
|
27889
27890
|
return {gridEntityType, variant}
|
|
27890
27891
|
end
|
|
27892
|
+
function ____exports.doesGridEntityExist(self, gridEntityType, variant)
|
|
27893
|
+
if variant == nil then
|
|
27894
|
+
variant = -1
|
|
27895
|
+
end
|
|
27896
|
+
local room = game:GetRoom()
|
|
27897
|
+
local gridIndexes = ____exports.getAllGridIndexes(nil)
|
|
27898
|
+
return __TS__ArraySome(
|
|
27899
|
+
gridIndexes,
|
|
27900
|
+
function(____, gridIndex)
|
|
27901
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
27902
|
+
if gridEntity == nil then
|
|
27903
|
+
return false
|
|
27904
|
+
end
|
|
27905
|
+
local thisGridEntityType = gridEntity:GetType()
|
|
27906
|
+
local thisVariant = gridEntity:GetVariant()
|
|
27907
|
+
return gridEntityType == thisGridEntityType and (variant == -1 or variant == thisVariant)
|
|
27908
|
+
end
|
|
27909
|
+
)
|
|
27910
|
+
end
|
|
27891
27911
|
function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
27892
27912
|
local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
|
|
27893
27913
|
local closeEntities = Isaac.FindInRadius(gridEntity.Position, DISTANCE_OF_GRID_TILE * 2)
|
|
@@ -27965,7 +27985,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
27965
27985
|
local gridIndex = room:GetGridIndex(position)
|
|
27966
27986
|
local gridEntity = room:GetGridEntityFromPos(position)
|
|
27967
27987
|
if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
|
|
27968
|
-
goto
|
|
27988
|
+
goto __continue27
|
|
27969
27989
|
end
|
|
27970
27990
|
registeredGridIndexes:add(gridIndex)
|
|
27971
27991
|
local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
|
|
@@ -27979,7 +27999,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
27979
27999
|
gridEntities[#gridEntities + 1] = gridEntity
|
|
27980
28000
|
end
|
|
27981
28001
|
end
|
|
27982
|
-
::
|
|
28002
|
+
::__continue27::
|
|
27983
28003
|
end
|
|
27984
28004
|
end
|
|
27985
28005
|
return gridEntities
|
|
@@ -22,8 +22,8 @@ export declare class ModUpgraded implements Mod {
|
|
|
22
22
|
private callbacks;
|
|
23
23
|
private features;
|
|
24
24
|
constructor(mod: Mod, debug: boolean, timeThreshold?: float);
|
|
25
|
-
AddCallback<T extends
|
|
26
|
-
AddPriorityCallback<T extends
|
|
25
|
+
AddCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
|
|
26
|
+
AddPriorityCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, priority: CallbackPriority | int, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
|
|
27
27
|
HasData(): boolean;
|
|
28
28
|
LoadData(): string;
|
|
29
29
|
RemoveCallback<T extends ModCallback>(modCallback: T, callback: AddCallbackParameters[T][0]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModUpgraded.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgraded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAIhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAQ/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAMhG;;;;;;;;;;GAUG;AACH,qBAAa,WAAY,YAAW,GAAG;IAK9B,IAAI,EAAE,MAAM,CAAC;IAMpB,4FAA4F;IAC5F,OAAO,CAAC,GAAG,CAAM;IAEjB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,aAAa,CAAoB;IAEzC,OAAO,CAAC,SAAS,CAAC;IAGlB,OAAO,CAAC,QAAQ,CAAC;gBAML,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,KAAK;IAgBpD,WAAW,CAAC,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"ModUpgraded.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgraded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAIhG,OAAO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,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACtC,IAAI;IAQP;;;;OAIG;IACI,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,EAC1D,iBAAiB,EAAE,CAAC,EACpB,QAAQ,EAAE,gBAAgB,GAAG,GAAG,EAChC,GAAG,IAAI,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACtC,IAAI;IAOP;;;;;;;;;OASG;IACI,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,EACrD,iBAAiB,EAAE,CAAC,EACpB,QAAQ,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI;IAOP;;;OAGG;IACI,eAAe,IAAI,IAAI;IA0C9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAiEnB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAsDrB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAM5B"}
|
|
@@ -7,6 +7,14 @@ import { GridEntityID } from "../types/GridEntityID";
|
|
|
7
7
|
* 1000.0 in a room XML file, but `GridEntityType.ROCK` is equal to 2.
|
|
8
8
|
*/
|
|
9
9
|
export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
12
|
+
* current room. It uses the `countEntities` helper function to determine this.
|
|
13
|
+
*
|
|
14
|
+
* @param gridEntityType The grid entity type to match.
|
|
15
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
16
|
+
*/
|
|
17
|
+
export declare function doesGridEntityExist(gridEntityType: GridEntityType, variant?: number): boolean;
|
|
10
18
|
/**
|
|
11
19
|
* Helper function to get every legal grid index for the current room.
|
|
12
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,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B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAgCxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__New = ____lualib.__TS__New
|
|
3
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
5
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
5
6
|
local Set = ____lualib.Set
|
|
@@ -184,6 +185,30 @@ function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntit
|
|
|
184
185
|
end
|
|
185
186
|
return {gridEntityType, variant}
|
|
186
187
|
end
|
|
188
|
+
--- Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
189
|
+
-- current room. It uses the `countEntities` helper function to determine this.
|
|
190
|
+
--
|
|
191
|
+
-- @param gridEntityType The grid entity type to match.
|
|
192
|
+
-- @param variant Optional. Default is -1, which matches every variant.
|
|
193
|
+
function ____exports.doesGridEntityExist(self, gridEntityType, variant)
|
|
194
|
+
if variant == nil then
|
|
195
|
+
variant = -1
|
|
196
|
+
end
|
|
197
|
+
local room = game:GetRoom()
|
|
198
|
+
local gridIndexes = ____exports.getAllGridIndexes(nil)
|
|
199
|
+
return __TS__ArraySome(
|
|
200
|
+
gridIndexes,
|
|
201
|
+
function(____, gridIndex)
|
|
202
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
203
|
+
if gridEntity == nil then
|
|
204
|
+
return false
|
|
205
|
+
end
|
|
206
|
+
local thisGridEntityType = gridEntity:GetType()
|
|
207
|
+
local thisVariant = gridEntity:GetVariant()
|
|
208
|
+
return gridEntityType == thisGridEntityType and (variant == -1 or variant == thisVariant)
|
|
209
|
+
end
|
|
210
|
+
)
|
|
211
|
+
end
|
|
187
212
|
--- Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
188
213
|
-- entity is on.
|
|
189
214
|
--
|
|
@@ -296,7 +321,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
296
321
|
local gridIndex = room:GetGridIndex(position)
|
|
297
322
|
local gridEntity = room:GetGridEntityFromPos(position)
|
|
298
323
|
if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
|
|
299
|
-
goto
|
|
324
|
+
goto __continue27
|
|
300
325
|
end
|
|
301
326
|
registeredGridIndexes:add(gridIndex)
|
|
302
327
|
local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
|
|
@@ -310,7 +335,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
|
|
|
310
335
|
gridEntities[#gridEntities + 1] = gridEntity
|
|
311
336
|
end
|
|
312
337
|
end
|
|
313
|
-
::
|
|
338
|
+
::__continue27::
|
|
314
339
|
end
|
|
315
340
|
end
|
|
316
341
|
return gridEntities
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "30.
|
|
3
|
+
"version": "30.9.1",
|
|
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": "^13.0.
|
|
28
|
+
"isaac-typescript-definitions": "^13.0.10"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -70,17 +70,21 @@ export class ModUpgraded implements Mod {
|
|
|
70
70
|
// Vanilla methods
|
|
71
71
|
// ---------------
|
|
72
72
|
|
|
73
|
-
public AddCallback<T extends
|
|
73
|
+
public AddCallback<T extends keyof AddCallbackParameters | string>(
|
|
74
74
|
modCallback: T,
|
|
75
|
-
...args: T extends
|
|
75
|
+
...args: T extends keyof AddCallbackParameters
|
|
76
|
+
? AddCallbackParameters[T]
|
|
77
|
+
: unknown[]
|
|
76
78
|
): void {
|
|
77
79
|
this.AddPriorityCallback(modCallback, CallbackPriority.DEFAULT, ...args);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
public AddPriorityCallback<T extends
|
|
82
|
+
public AddPriorityCallback<T extends keyof AddCallbackParameters | string>(
|
|
81
83
|
modCallback: T,
|
|
82
84
|
priority: CallbackPriority | int,
|
|
83
|
-
...args: T extends
|
|
85
|
+
...args: T extends keyof AddCallbackParameters
|
|
86
|
+
? AddCallbackParameters[T]
|
|
87
|
+
: unknown[]
|
|
84
88
|
): void {
|
|
85
89
|
if (this.debug) {
|
|
86
90
|
const callback = args[0];
|
|
@@ -79,6 +79,35 @@ export function convertXMLGridEntityType(
|
|
|
79
79
|
return [gridEntityType, variant];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to check if one or more of a specific kind of grid entity is present in the
|
|
84
|
+
* current room. It uses the `countEntities` helper function to determine this.
|
|
85
|
+
*
|
|
86
|
+
* @param gridEntityType The grid entity type to match.
|
|
87
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
88
|
+
*/
|
|
89
|
+
export function doesGridEntityExist(
|
|
90
|
+
gridEntityType: GridEntityType,
|
|
91
|
+
variant = -1,
|
|
92
|
+
): boolean {
|
|
93
|
+
const room = game.GetRoom();
|
|
94
|
+
const gridIndexes = getAllGridIndexes();
|
|
95
|
+
|
|
96
|
+
return gridIndexes.some((gridIndex) => {
|
|
97
|
+
const gridEntity = room.GetGridEntity(gridIndex);
|
|
98
|
+
if (gridEntity === undefined) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const thisGridEntityType = gridEntity.GetType();
|
|
103
|
+
const thisVariant = gridEntity.GetVariant();
|
|
104
|
+
return (
|
|
105
|
+
gridEntityType === thisGridEntityType &&
|
|
106
|
+
(variant === -1 || variant === thisVariant)
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
82
111
|
/**
|
|
83
112
|
* Helper function to get every legal grid index for the current room.
|
|
84
113
|
*
|