isaacscript-common 12.1.0 → 12.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.d.ts +9 -1
- package/dist/isaacscript-common.lua +21 -4
- package/dist/package.lua +1 -1
- package/dist/src/functions/entities.d.ts +6 -0
- package/dist/src/functions/entities.d.ts.map +1 -1
- package/dist/src/functions/entities.lua +16 -0
- package/dist/src/functions/players.d.ts +2 -1
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +3 -2
- package/package.json +1 -1
- package/src/functions/entities.ts +20 -0
- package/src/functions/players.ts +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -4110,7 +4110,8 @@ export declare function getPlayerFamiliars(player: EntityPlayer): EntityFamiliar
|
|
|
4110
4110
|
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
4111
4111
|
* does not correspond to any particular player.
|
|
4112
4112
|
*
|
|
4113
|
-
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
4113
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
4114
|
+
* a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
4114
4115
|
*/
|
|
4115
4116
|
export declare function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined;
|
|
4116
4117
|
|
|
@@ -10763,6 +10764,13 @@ export declare function setDoorDisplay(textCallback: (door: GridEntityDoor) => s
|
|
|
10763
10764
|
*/
|
|
10764
10765
|
export declare function setEffectDisplay(textCallback: (effect: EntityEffect) => string): void;
|
|
10765
10766
|
|
|
10767
|
+
/**
|
|
10768
|
+
* Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
10769
|
+
* want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
10770
|
+
* it.
|
|
10771
|
+
*/
|
|
10772
|
+
export declare function setEntityDamageFlash(entity: Entity): void;
|
|
10773
|
+
|
|
10766
10774
|
/**
|
|
10767
10775
|
* Helper function to set the position of every entity in the room based on a map of positions. If
|
|
10768
10776
|
* an entity is found that does not have matching element in the provided map, then that entity will
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 12.
|
|
3
|
+
isaacscript-common 12.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -20380,6 +20380,16 @@ function ____exports.removeEntities(self, entities, cap)
|
|
|
20380
20380
|
end
|
|
20381
20381
|
return entitiesRemoved
|
|
20382
20382
|
end
|
|
20383
|
+
--- From DeadInfinity.
|
|
20384
|
+
local DAMAGE_FLASH_COLOR = Color(
|
|
20385
|
+
0.5,
|
|
20386
|
+
0.5,
|
|
20387
|
+
0.5,
|
|
20388
|
+
1,
|
|
20389
|
+
200 / 255,
|
|
20390
|
+
0 / 255,
|
|
20391
|
+
0 / 255
|
|
20392
|
+
)
|
|
20383
20393
|
--- Helper function to count the number of entities in room. Use this over the vanilla
|
|
20384
20394
|
-- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
20385
20395
|
-- enemies.
|
|
@@ -20672,6 +20682,12 @@ function ____exports.rerollEnemy(self, entity)
|
|
|
20672
20682
|
end
|
|
20673
20683
|
return filteredNewEntities[1]
|
|
20674
20684
|
end
|
|
20685
|
+
--- Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
20686
|
+
-- want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
20687
|
+
-- it.
|
|
20688
|
+
function ____exports.setEntityDamageFlash(self, entity)
|
|
20689
|
+
entity:SetColor(DAMAGE_FLASH_COLOR, 2, 0)
|
|
20690
|
+
end
|
|
20675
20691
|
function ____exports.setEntityRandomColor(self, entity)
|
|
20676
20692
|
local rng = newRNG(nil, entity.InitSeed)
|
|
20677
20693
|
local r = getRandom(nil, rng)
|
|
@@ -26308,7 +26324,8 @@ end
|
|
|
26308
26324
|
--- Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
26309
26325
|
-- does not correspond to any particular player.
|
|
26310
26326
|
--
|
|
26311
|
-
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
26327
|
+
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
26328
|
+
-- a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
26312
26329
|
function ____exports.getPlayerFromEntity(self, entity)
|
|
26313
26330
|
if entity.Parent ~= nil then
|
|
26314
26331
|
local player = entity.Parent:ToPlayer()
|
|
@@ -26330,7 +26347,7 @@ function ____exports.getPlayerFromEntity(self, entity)
|
|
|
26330
26347
|
return familiar.Player
|
|
26331
26348
|
end
|
|
26332
26349
|
end
|
|
26333
|
-
return
|
|
26350
|
+
return entity:ToPlayer()
|
|
26334
26351
|
end
|
|
26335
26352
|
--- Helper function to get the proper name of the player. Use this instead of the
|
|
26336
26353
|
-- `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
|
@@ -47035,7 +47052,7 @@ return ____exports
|
|
|
47035
47052
|
["package"] = function(...)
|
|
47036
47053
|
return {
|
|
47037
47054
|
name = "isaacscript-common",
|
|
47038
|
-
version = "12.
|
|
47055
|
+
version = "12.2.0",
|
|
47039
47056
|
description = "Helper functions and features for IsaacScript mods.",
|
|
47040
47057
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
47041
47058
|
homepage = "https://isaacscript.github.io/",
|
package/dist/package.lua
CHANGED
|
@@ -151,6 +151,12 @@ export declare function removeEntities<T extends AnyEntity>(entities: T[], cap?:
|
|
|
151
151
|
* rerolled entity.
|
|
152
152
|
*/
|
|
153
153
|
export declare function rerollEnemy(entity: Entity): Entity | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
156
|
+
* want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
157
|
+
* it.
|
|
158
|
+
*/
|
|
159
|
+
export declare function setEntityDamageFlash(entity: Entity): void;
|
|
154
160
|
export declare function setEntityRandomColor(entity: Entity): void;
|
|
155
161
|
/**
|
|
156
162
|
* Helper function to spawn an entity. Use this instead of the `Isaac.Spawn` method if you do not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAkB/C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,GAAG,CAcL;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,OAAO,CAGT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EACpD,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,CAAC,EAAE,GACZ,CAAC,GAAG,SAAS,CAaf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CACzB,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,MAAM,EAAE,CAMV;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GACb,MAAM,C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AAC,EAAE,EACb,GAAG,CAAC,EAAE,GAAG,GACR,CAAC,EAAE,CAgBL;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CACnB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
|
|
@@ -59,6 +59,16 @@ function ____exports.removeEntities(self, entities, cap)
|
|
|
59
59
|
end
|
|
60
60
|
return entitiesRemoved
|
|
61
61
|
end
|
|
62
|
+
--- From DeadInfinity.
|
|
63
|
+
local DAMAGE_FLASH_COLOR = Color(
|
|
64
|
+
0.5,
|
|
65
|
+
0.5,
|
|
66
|
+
0.5,
|
|
67
|
+
1,
|
|
68
|
+
200 / 255,
|
|
69
|
+
0 / 255,
|
|
70
|
+
0 / 255
|
|
71
|
+
)
|
|
62
72
|
--- Helper function to count the number of entities in room. Use this over the vanilla
|
|
63
73
|
-- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
64
74
|
-- enemies.
|
|
@@ -351,6 +361,12 @@ function ____exports.rerollEnemy(self, entity)
|
|
|
351
361
|
end
|
|
352
362
|
return filteredNewEntities[1]
|
|
353
363
|
end
|
|
364
|
+
--- Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
365
|
+
-- want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
366
|
+
-- it.
|
|
367
|
+
function ____exports.setEntityDamageFlash(self, entity)
|
|
368
|
+
entity:SetColor(DAMAGE_FLASH_COLOR, 2, 0)
|
|
369
|
+
end
|
|
354
370
|
function ____exports.setEntityRandomColor(self, entity)
|
|
355
371
|
local rng = newRNG(nil, entity.InitSeed)
|
|
356
372
|
local r = getRandom(nil, rng)
|
|
@@ -77,7 +77,8 @@ export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<Colle
|
|
|
77
77
|
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
78
78
|
* does not correspond to any particular player.
|
|
79
79
|
*
|
|
80
|
-
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
80
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
81
|
+
* a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
81
82
|
*/
|
|
82
83
|
export declare function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined;
|
|
83
84
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAGf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAetC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAA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ACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
|
|
@@ -247,7 +247,8 @@ end
|
|
|
247
247
|
--- Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
248
248
|
-- does not correspond to any particular player.
|
|
249
249
|
--
|
|
250
|
-
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
250
|
+
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
251
|
+
-- a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
251
252
|
function ____exports.getPlayerFromEntity(self, entity)
|
|
252
253
|
if entity.Parent ~= nil then
|
|
253
254
|
local player = entity.Parent:ToPlayer()
|
|
@@ -269,7 +270,7 @@ function ____exports.getPlayerFromEntity(self, entity)
|
|
|
269
270
|
return familiar.Player
|
|
270
271
|
end
|
|
271
272
|
end
|
|
272
|
-
return
|
|
273
|
+
return entity:ToPlayer()
|
|
273
274
|
end
|
|
274
275
|
--- Helper function to get the proper name of the player. Use this instead of the
|
|
275
276
|
-- `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
package/package.json
CHANGED
|
@@ -9,6 +9,17 @@ import { isRNG, newRNG } from "./rng";
|
|
|
9
9
|
import { asNumber, isPrimitive } from "./types";
|
|
10
10
|
import { isVector, vectorToString } from "./vector";
|
|
11
11
|
|
|
12
|
+
/** From DeadInfinity. */
|
|
13
|
+
const DAMAGE_FLASH_COLOR: Readonly<Color> = Color(
|
|
14
|
+
0.5,
|
|
15
|
+
0.5,
|
|
16
|
+
0.5,
|
|
17
|
+
1.0,
|
|
18
|
+
200 / 255,
|
|
19
|
+
0 / 255,
|
|
20
|
+
0 / 255,
|
|
21
|
+
);
|
|
22
|
+
|
|
12
23
|
/**
|
|
13
24
|
* Helper function to count the number of entities in room. Use this over the vanilla
|
|
14
25
|
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
@@ -404,6 +415,15 @@ export function rerollEnemy(entity: Entity): Entity | undefined {
|
|
|
404
415
|
return filteredNewEntities[0];
|
|
405
416
|
}
|
|
406
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
420
|
+
* want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
421
|
+
* it.
|
|
422
|
+
*/
|
|
423
|
+
export function setEntityDamageFlash(entity: Entity): void {
|
|
424
|
+
entity.SetColor(DAMAGE_FLASH_COLOR, 2, 0);
|
|
425
|
+
}
|
|
426
|
+
|
|
407
427
|
export function setEntityRandomColor(entity: Entity): void {
|
|
408
428
|
const rng = newRNG(entity.InitSeed);
|
|
409
429
|
|
package/src/functions/players.ts
CHANGED
|
@@ -268,7 +268,8 @@ export function getPlayerCollectibleMap(
|
|
|
268
268
|
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
269
269
|
* does not correspond to any particular player.
|
|
270
270
|
*
|
|
271
|
-
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
271
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
272
|
+
* a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
272
273
|
*/
|
|
273
274
|
export function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined {
|
|
274
275
|
if (entity.Parent !== undefined) {
|
|
@@ -295,7 +296,7 @@ export function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined {
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
return
|
|
299
|
+
return entity.ToPlayer();
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
/**
|