isaacscript-common 11.0.0 → 11.0.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.d.ts +8 -8
- package/dist/isaacscript-common.lua +14 -14
- package/dist/package.lua +1 -1
- package/dist/src/functions/tears.d.ts +8 -8
- package/dist/src/functions/tears.d.ts.map +1 -1
- package/dist/src/functions/tears.lua +12 -12
- package/package.json +1 -1
- package/src/functions/tears.ts +18 -14
package/dist/index.d.ts
CHANGED
|
@@ -6447,10 +6447,10 @@ export declare function isTear(variable: unknown): variable is EntityTear;
|
|
|
6447
6447
|
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
6448
6448
|
* is determined by looking at the parent.
|
|
6449
6449
|
*
|
|
6450
|
-
* For the special case of Incubus and Blood Babies, the
|
|
6451
|
-
*
|
|
6452
|
-
*
|
|
6453
|
-
* callback or on frame 1+.
|
|
6450
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
6451
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
6452
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
6453
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
6454
6454
|
*
|
|
6455
6455
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
6456
6456
|
*/
|
|
@@ -6460,10 +6460,10 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
|
6460
6460
|
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
6461
6461
|
* is determined by looking at the parent.
|
|
6462
6462
|
*
|
|
6463
|
-
* For the special case of Incubus and Blood Babies, the
|
|
6464
|
-
*
|
|
6465
|
-
*
|
|
6466
|
-
* callback or on frame 1+.
|
|
6463
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
6464
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
6465
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
6466
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
6467
6467
|
*
|
|
6468
6468
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
6469
6469
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 11.0.
|
|
3
|
+
isaacscript-common 11.0.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -39252,39 +39252,39 @@ end
|
|
|
39252
39252
|
--- Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
39253
39253
|
-- is determined by looking at the parent.
|
|
39254
39254
|
--
|
|
39255
|
-
-- For the special case of Incubus and Blood Babies, the
|
|
39256
|
-
--
|
|
39257
|
-
--
|
|
39258
|
-
-- callback or on frame 1+.
|
|
39255
|
+
-- For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
39256
|
+
-- but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
39257
|
+
-- player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
39258
|
+
-- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
39259
39259
|
--
|
|
39260
39260
|
-- If this function is called on frame 0, it will throw a run-time error.
|
|
39261
39261
|
function ____exports.isTearFromFamiliar(self, tear)
|
|
39262
39262
|
if tear.FrameCount == 0 then
|
|
39263
39263
|
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
39264
39264
|
end
|
|
39265
|
-
if tear.
|
|
39265
|
+
if tear.SpawnerEntity == nil then
|
|
39266
39266
|
return false
|
|
39267
39267
|
end
|
|
39268
|
-
local familiar = tear.
|
|
39268
|
+
local familiar = tear.SpawnerEntity:ToFamiliar()
|
|
39269
39269
|
return familiar ~= nil
|
|
39270
39270
|
end
|
|
39271
39271
|
--- Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
39272
39272
|
-- is determined by looking at the parent.
|
|
39273
39273
|
--
|
|
39274
|
-
-- For the special case of Incubus and Blood Babies, the
|
|
39275
|
-
--
|
|
39276
|
-
--
|
|
39277
|
-
-- callback or on frame 1+.
|
|
39274
|
+
-- For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
39275
|
+
-- but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
39276
|
+
-- player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
39277
|
+
-- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
39278
39278
|
--
|
|
39279
39279
|
-- If this function is called on frame 0, it will throw a run-time error.
|
|
39280
39280
|
function ____exports.isTearFromPlayer(self, tear)
|
|
39281
39281
|
if tear.FrameCount == 0 then
|
|
39282
39282
|
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
39283
39283
|
end
|
|
39284
|
-
if tear.
|
|
39284
|
+
if tear.SpawnerEntity == nil then
|
|
39285
39285
|
return false
|
|
39286
39286
|
end
|
|
39287
|
-
local player = tear.
|
|
39287
|
+
local player = tear.SpawnerEntity:ToPlayer()
|
|
39288
39288
|
return player ~= nil
|
|
39289
39289
|
end
|
|
39290
39290
|
return ____exports
|
|
@@ -46950,7 +46950,7 @@ return ____exports
|
|
|
46950
46950
|
["package"] = function(...)
|
|
46951
46951
|
return {
|
|
46952
46952
|
name = "isaacscript-common",
|
|
46953
|
-
version = "11.0.
|
|
46953
|
+
version = "11.0.1",
|
|
46954
46954
|
description = "Helper functions and features for IsaacScript mods.",
|
|
46955
46955
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
46956
46956
|
homepage = "https://isaacscript.github.io/",
|
package/dist/package.lua
CHANGED
|
@@ -27,10 +27,10 @@ export declare function getTearsStat(fireDelay: float): float;
|
|
|
27
27
|
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
28
28
|
* is determined by looking at the parent.
|
|
29
29
|
*
|
|
30
|
-
* For the special case of Incubus and Blood Babies, the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* callback or on frame 1+.
|
|
30
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
31
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
32
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
33
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
34
34
|
*
|
|
35
35
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
36
36
|
*/
|
|
@@ -39,10 +39,10 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
|
39
39
|
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
40
40
|
* is determined by looking at the parent.
|
|
41
41
|
*
|
|
42
|
-
* For the special case of Incubus and Blood Babies, the
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* callback or on frame 1+.
|
|
42
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
43
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
44
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
45
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
46
46
|
*
|
|
47
47
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
48
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
|
|
@@ -27,39 +27,39 @@ end
|
|
|
27
27
|
--- Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
28
28
|
-- is determined by looking at the parent.
|
|
29
29
|
--
|
|
30
|
-
-- For the special case of Incubus and Blood Babies, the
|
|
31
|
-
--
|
|
32
|
-
--
|
|
33
|
-
-- callback or on frame 1+.
|
|
30
|
+
-- For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
31
|
+
-- but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
32
|
+
-- player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
33
|
+
-- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
34
34
|
--
|
|
35
35
|
-- If this function is called on frame 0, it will throw a run-time error.
|
|
36
36
|
function ____exports.isTearFromFamiliar(self, tear)
|
|
37
37
|
if tear.FrameCount == 0 then
|
|
38
38
|
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
39
39
|
end
|
|
40
|
-
if tear.
|
|
40
|
+
if tear.SpawnerEntity == nil then
|
|
41
41
|
return false
|
|
42
42
|
end
|
|
43
|
-
local familiar = tear.
|
|
43
|
+
local familiar = tear.SpawnerEntity:ToFamiliar()
|
|
44
44
|
return familiar ~= nil
|
|
45
45
|
end
|
|
46
46
|
--- Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
47
47
|
-- is determined by looking at the parent.
|
|
48
48
|
--
|
|
49
|
-
-- For the special case of Incubus and Blood Babies, the
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
-- callback or on frame 1+.
|
|
49
|
+
-- For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
50
|
+
-- but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
51
|
+
-- player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
52
|
+
-- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
53
53
|
--
|
|
54
54
|
-- If this function is called on frame 0, it will throw a run-time error.
|
|
55
55
|
function ____exports.isTearFromPlayer(self, tear)
|
|
56
56
|
if tear.FrameCount == 0 then
|
|
57
57
|
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
58
58
|
end
|
|
59
|
-
if tear.
|
|
59
|
+
if tear.SpawnerEntity == nil then
|
|
60
60
|
return false
|
|
61
61
|
end
|
|
62
|
-
local player = tear.
|
|
62
|
+
local player = tear.SpawnerEntity:ToPlayer()
|
|
63
63
|
return player ~= nil
|
|
64
64
|
end
|
|
65
65
|
return ____exports
|
package/package.json
CHANGED
package/src/functions/tears.ts
CHANGED
|
@@ -36,10 +36,10 @@ export function getTearsStat(fireDelay: float): float {
|
|
|
36
36
|
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
37
37
|
* is determined by looking at the parent.
|
|
38
38
|
*
|
|
39
|
-
* For the special case of Incubus and Blood Babies, the
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* callback or on frame 1+.
|
|
39
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
40
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
41
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
42
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
43
43
|
*
|
|
44
44
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
45
45
|
*/
|
|
@@ -50,12 +50,14 @@ export function isTearFromFamiliar(tear: EntityTear): boolean {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// Normally, all tears have a
|
|
54
|
-
if (tear.
|
|
53
|
+
// Normally, all tears have a spawner entity, which is either the player or the familiar.
|
|
54
|
+
if (tear.SpawnerEntity === undefined) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
// We cannot use `tear.SpawnerType` to determine this, since it is baked in to be equal to
|
|
59
|
+
// `EntityType.PLAYER` regardless of whether the tear is from a player or familiar.
|
|
60
|
+
const familiar = tear.SpawnerEntity.ToFamiliar();
|
|
59
61
|
return familiar !== undefined;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -63,10 +65,10 @@ export function isTearFromFamiliar(tear: EntityTear): boolean {
|
|
|
63
65
|
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
64
66
|
* is determined by looking at the parent.
|
|
65
67
|
*
|
|
66
|
-
* For the special case of Incubus and Blood Babies, the
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* callback or on frame 1+.
|
|
68
|
+
* For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
|
|
69
|
+
* but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
|
|
70
|
+
* player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
|
|
71
|
+
* only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
|
|
70
72
|
*
|
|
71
73
|
* If this function is called on frame 0, it will throw a run-time error.
|
|
72
74
|
*/
|
|
@@ -77,11 +79,13 @@ export function isTearFromPlayer(tear: EntityTear): boolean {
|
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
// Normally, all tears have a
|
|
81
|
-
if (tear.
|
|
82
|
+
// Normally, all tears have a spawner entity, which is either the player or the familiar.
|
|
83
|
+
if (tear.SpawnerEntity === undefined) {
|
|
82
84
|
return false;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
// We cannot use `tear.SpawnerType` to determine this, since it is baked in to be equal to
|
|
88
|
+
// `EntityType.PLAYER` regardless of whether the tear is from a player or familiar.
|
|
89
|
+
const player = tear.SpawnerEntity.ToPlayer();
|
|
86
90
|
return player !== undefined;
|
|
87
91
|
}
|