isaacscript-common 10.2.1 → 11.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/index.d.ts +16 -11
- package/dist/isaacscript-common.lua +20 -17
- package/dist/package.lua +1 -1
- package/dist/src/functions/players.d.ts +7 -2
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +6 -3
- package/dist/src/functions/tears.d.ts +8 -8
- package/dist/src/functions/tears.lua +12 -12
- package/package.json +1 -1
- package/src/functions/players.ts +8 -3
- package/src/functions/tears.ts +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -4092,15 +4092,20 @@ export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer,
|
|
|
4092
4092
|
/** Helper function to get only the familiars that belong to a specific player. */
|
|
4093
4093
|
export declare function getPlayerFamiliars(player: EntityPlayer): EntityFamiliar[];
|
|
4094
4094
|
|
|
4095
|
+
/**
|
|
4096
|
+
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
4097
|
+
* does not correspond to any particular player.
|
|
4098
|
+
*
|
|
4099
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
4100
|
+
*/
|
|
4101
|
+
export declare function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined;
|
|
4102
|
+
|
|
4095
4103
|
/**
|
|
4096
4104
|
* Helper function to get the corresponding `EntityPlayer` object that corresponds to a
|
|
4097
4105
|
* `PlayerIndex`.
|
|
4098
4106
|
*/
|
|
4099
4107
|
export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlayer | undefined;
|
|
4100
4108
|
|
|
4101
|
-
/** Helper function to get the player from a tear, laser, bomb, etc. */
|
|
4102
|
-
export declare function getPlayerFromTear(entity: Entity): EntityPlayer | undefined;
|
|
4103
|
-
|
|
4104
4109
|
/**
|
|
4105
4110
|
* Helper function to get an object representing the player's health. You can use this in
|
|
4106
4111
|
* combination with the `setPlayerHealth` function to restore the player's health back to a certain
|
|
@@ -6443,11 +6448,11 @@ export declare function isTear(variable: unknown): variable is EntityTear;
|
|
|
6443
6448
|
* is determined by looking at the parent.
|
|
6444
6449
|
*
|
|
6445
6450
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
6446
|
-
* player. The parent of the tear is the player on
|
|
6447
|
-
*
|
|
6448
|
-
* callback or on frame
|
|
6451
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
6452
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
6453
|
+
* callback or on frame 1+.
|
|
6449
6454
|
*
|
|
6450
|
-
* If this function is called on frame 0
|
|
6455
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
6451
6456
|
*/
|
|
6452
6457
|
export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
6453
6458
|
|
|
@@ -6456,11 +6461,11 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
|
6456
6461
|
* is determined by looking at the parent.
|
|
6457
6462
|
*
|
|
6458
6463
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
6459
|
-
* player. The parent of the tear is the player on
|
|
6460
|
-
*
|
|
6461
|
-
* callback or on frame
|
|
6464
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
6465
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
6466
|
+
* callback or on frame 1+.
|
|
6462
6467
|
*
|
|
6463
|
-
* If this function is called on frame 0
|
|
6468
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
6464
6469
|
*/
|
|
6465
6470
|
export declare function isTearFromPlayer(tear: EntityTear): boolean;
|
|
6466
6471
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 11.0.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -26300,8 +26300,11 @@ function ____exports.getPlayerCollectibleMap(self, player)
|
|
|
26300
26300
|
end
|
|
26301
26301
|
return collectibleMap
|
|
26302
26302
|
end
|
|
26303
|
-
--- Helper function to get the player from a tear, laser, bomb, etc.
|
|
26304
|
-
|
|
26303
|
+
--- Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
26304
|
+
-- does not correspond to any particular player.
|
|
26305
|
+
--
|
|
26306
|
+
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
26307
|
+
function ____exports.getPlayerFromEntity(self, entity)
|
|
26305
26308
|
if entity.Parent ~= nil then
|
|
26306
26309
|
local player = entity.Parent:ToPlayer()
|
|
26307
26310
|
if player ~= nil then
|
|
@@ -26470,7 +26473,7 @@ function ____exports.isDamageFromPlayer(self, damageSource)
|
|
|
26470
26473
|
if player ~= nil then
|
|
26471
26474
|
return true
|
|
26472
26475
|
end
|
|
26473
|
-
local indirectPlayer = ____exports.
|
|
26476
|
+
local indirectPlayer = ____exports.getPlayerFromEntity(nil, damageSource)
|
|
26474
26477
|
return indirectPlayer ~= nil
|
|
26475
26478
|
end
|
|
26476
26479
|
--- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
@@ -39250,14 +39253,14 @@ end
|
|
|
39250
39253
|
-- is determined by looking at the parent.
|
|
39251
39254
|
--
|
|
39252
39255
|
-- For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
39253
|
-
-- player. The parent of the tear is the player on
|
|
39254
|
-
--
|
|
39255
|
-
-- callback or on frame
|
|
39256
|
+
-- player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
39257
|
+
-- onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
39258
|
+
-- callback or on frame 1+.
|
|
39256
39259
|
--
|
|
39257
|
-
-- If this function is called on frame 0
|
|
39260
|
+
-- If this function is called on frame 0, it will throw a run-time error.
|
|
39258
39261
|
function ____exports.isTearFromFamiliar(self, tear)
|
|
39259
|
-
if tear.FrameCount == 0
|
|
39260
|
-
error(
|
|
39262
|
+
if tear.FrameCount == 0 then
|
|
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.)")
|
|
39261
39264
|
end
|
|
39262
39265
|
if tear.Parent == nil then
|
|
39263
39266
|
return false
|
|
@@ -39269,14 +39272,14 @@ end
|
|
|
39269
39272
|
-- is determined by looking at the parent.
|
|
39270
39273
|
--
|
|
39271
39274
|
-- For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
39272
|
-
-- player. The parent of the tear is the player on
|
|
39273
|
-
--
|
|
39274
|
-
-- callback or on frame
|
|
39275
|
+
-- player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
39276
|
+
-- onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
39277
|
+
-- callback or on frame 1+.
|
|
39275
39278
|
--
|
|
39276
|
-
-- If this function is called on frame 0
|
|
39279
|
+
-- If this function is called on frame 0, it will throw a run-time error.
|
|
39277
39280
|
function ____exports.isTearFromPlayer(self, tear)
|
|
39278
|
-
if tear.FrameCount == 0
|
|
39279
|
-
error(
|
|
39281
|
+
if tear.FrameCount == 0 then
|
|
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.)")
|
|
39280
39283
|
end
|
|
39281
39284
|
if tear.Parent == nil then
|
|
39282
39285
|
return false
|
|
@@ -46947,7 +46950,7 @@ return ____exports
|
|
|
46947
46950
|
["package"] = function(...)
|
|
46948
46951
|
return {
|
|
46949
46952
|
name = "isaacscript-common",
|
|
46950
|
-
version = "
|
|
46953
|
+
version = "11.0.0",
|
|
46951
46954
|
description = "Helper functions and features for IsaacScript mods.",
|
|
46952
46955
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
46953
46956
|
homepage = "https://isaacscript.github.io/",
|
package/dist/package.lua
CHANGED
|
@@ -73,8 +73,13 @@ export declare function getPlayerCollectibleCount(player: EntityPlayer, ...colle
|
|
|
73
73
|
* Note that this will filter out non-real collectibles like Lilith's Incubus.
|
|
74
74
|
*/
|
|
75
75
|
export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType, int>;
|
|
76
|
-
/**
|
|
77
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
78
|
+
* does not correspond to any particular player.
|
|
79
|
+
*
|
|
80
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
81
|
+
*/
|
|
82
|
+
export declare function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined;
|
|
78
83
|
/**
|
|
79
84
|
* Helper function to get the proper name of the player. Use this instead of the
|
|
80
85
|
* `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
|
@@ -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,IAAI,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,GAAG,SAAS,CAMxB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiB/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,EAAE,CAatE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,YAAY,CAS7C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAe9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,YAAY,GAAG,SAAS,CAK1B;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,GAAG,CASL;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAc3B;AAED
|
|
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,qBA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;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"}
|
|
@@ -244,8 +244,11 @@ function ____exports.getPlayerCollectibleMap(self, player)
|
|
|
244
244
|
end
|
|
245
245
|
return collectibleMap
|
|
246
246
|
end
|
|
247
|
-
--- Helper function to get the player from a tear, laser, bomb, etc.
|
|
248
|
-
|
|
247
|
+
--- Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
248
|
+
-- does not correspond to any particular player.
|
|
249
|
+
--
|
|
250
|
+
-- This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
251
|
+
function ____exports.getPlayerFromEntity(self, entity)
|
|
249
252
|
if entity.Parent ~= nil then
|
|
250
253
|
local player = entity.Parent:ToPlayer()
|
|
251
254
|
if player ~= nil then
|
|
@@ -414,7 +417,7 @@ function ____exports.isDamageFromPlayer(self, damageSource)
|
|
|
414
417
|
if player ~= nil then
|
|
415
418
|
return true
|
|
416
419
|
end
|
|
417
|
-
local indirectPlayer = ____exports.
|
|
420
|
+
local indirectPlayer = ____exports.getPlayerFromEntity(nil, damageSource)
|
|
418
421
|
return indirectPlayer ~= nil
|
|
419
422
|
end
|
|
420
423
|
--- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
@@ -28,11 +28,11 @@ export declare function getTearsStat(fireDelay: float): float;
|
|
|
28
28
|
* is determined by looking at the parent.
|
|
29
29
|
*
|
|
30
30
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
31
|
-
* player. The parent of the tear is the player on
|
|
32
|
-
*
|
|
33
|
-
* callback or on frame
|
|
31
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
32
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
33
|
+
* callback or on frame 1+.
|
|
34
34
|
*
|
|
35
|
-
* If this function is called on frame 0
|
|
35
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
36
36
|
*/
|
|
37
37
|
export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
38
38
|
/**
|
|
@@ -40,11 +40,11 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
|
40
40
|
* is determined by looking at the parent.
|
|
41
41
|
*
|
|
42
42
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
43
|
-
* player. The parent of the tear is the player on
|
|
44
|
-
*
|
|
45
|
-
* callback or on frame
|
|
43
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
44
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
45
|
+
* callback or on frame 1+.
|
|
46
46
|
*
|
|
47
|
-
* If this function is called on frame 0
|
|
47
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
48
48
|
*/
|
|
49
49
|
export declare function isTearFromPlayer(tear: EntityTear): boolean;
|
|
50
50
|
//# sourceMappingURL=tears.d.ts.map
|
|
@@ -28,14 +28,14 @@ end
|
|
|
28
28
|
-- is determined by looking at the parent.
|
|
29
29
|
--
|
|
30
30
|
-- For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
31
|
-
-- player. The parent of the tear is the player on
|
|
32
|
-
--
|
|
33
|
-
-- callback or on frame
|
|
31
|
+
-- player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
32
|
+
-- onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
33
|
+
-- callback or on frame 1+.
|
|
34
34
|
--
|
|
35
|
-
-- If this function is called on frame 0
|
|
35
|
+
-- If this function is called on frame 0, it will throw a run-time error.
|
|
36
36
|
function ____exports.isTearFromFamiliar(self, tear)
|
|
37
|
-
if tear.FrameCount == 0
|
|
38
|
-
error(
|
|
37
|
+
if tear.FrameCount == 0 then
|
|
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
40
|
if tear.Parent == nil then
|
|
41
41
|
return false
|
|
@@ -47,14 +47,14 @@ end
|
|
|
47
47
|
-- is determined by looking at the parent.
|
|
48
48
|
--
|
|
49
49
|
-- For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
50
|
-
-- player. The parent of the tear is the player on
|
|
51
|
-
--
|
|
52
|
-
-- callback or on frame
|
|
50
|
+
-- player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
51
|
+
-- onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
52
|
+
-- callback or on frame 1+.
|
|
53
53
|
--
|
|
54
|
-
-- If this function is called on frame 0
|
|
54
|
+
-- If this function is called on frame 0, it will throw a run-time error.
|
|
55
55
|
function ____exports.isTearFromPlayer(self, tear)
|
|
56
|
-
if tear.FrameCount == 0
|
|
57
|
-
error(
|
|
56
|
+
if tear.FrameCount == 0 then
|
|
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
59
|
if tear.Parent == nil then
|
|
60
60
|
return false
|
package/package.json
CHANGED
package/src/functions/players.ts
CHANGED
|
@@ -264,8 +264,13 @@ export function getPlayerCollectibleMap(
|
|
|
264
264
|
return collectibleMap;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
/**
|
|
268
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
269
|
+
* does not correspond to any particular player.
|
|
270
|
+
*
|
|
271
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order).
|
|
272
|
+
*/
|
|
273
|
+
export function getPlayerFromEntity(entity: Entity): EntityPlayer | undefined {
|
|
269
274
|
if (entity.Parent !== undefined) {
|
|
270
275
|
const player = entity.Parent.ToPlayer();
|
|
271
276
|
if (player !== undefined) {
|
|
@@ -498,7 +503,7 @@ export function isDamageFromPlayer(damageSource: Entity): boolean {
|
|
|
498
503
|
return true;
|
|
499
504
|
}
|
|
500
505
|
|
|
501
|
-
const indirectPlayer =
|
|
506
|
+
const indirectPlayer = getPlayerFromEntity(damageSource);
|
|
502
507
|
return indirectPlayer !== undefined;
|
|
503
508
|
}
|
|
504
509
|
|
package/src/functions/tears.ts
CHANGED
|
@@ -37,16 +37,16 @@ export function getTearsStat(fireDelay: float): float {
|
|
|
37
37
|
* is determined by looking at the parent.
|
|
38
38
|
*
|
|
39
39
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
40
|
-
* player. The parent of the tear is the player on
|
|
41
|
-
*
|
|
42
|
-
* callback or on frame
|
|
40
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
41
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
42
|
+
* callback or on frame 1+.
|
|
43
43
|
*
|
|
44
|
-
* If this function is called on frame 0
|
|
44
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
45
45
|
*/
|
|
46
46
|
export function isTearFromFamiliar(tear: EntityTear): boolean {
|
|
47
|
-
if (tear.FrameCount === 0
|
|
47
|
+
if (tear.FrameCount === 0) {
|
|
48
48
|
error(
|
|
49
|
-
|
|
49
|
+
'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.)',
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -64,16 +64,16 @@ export function isTearFromFamiliar(tear: EntityTear): boolean {
|
|
|
64
64
|
* is determined by looking at the parent.
|
|
65
65
|
*
|
|
66
66
|
* For the special case of Incubus and Blood Babies, the spawner entity of the tear is always the
|
|
67
|
-
* player. The parent of the tear is the player on
|
|
68
|
-
*
|
|
69
|
-
* callback or on frame
|
|
67
|
+
* player. The parent of the tear is the player on frame 0 and it is the familiar on frame 1 and
|
|
68
|
+
* onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
69
|
+
* callback or on frame 1+.
|
|
70
70
|
*
|
|
71
|
-
* If this function is called on frame 0
|
|
71
|
+
* If this function is called on frame 0, it will throw a run-time error.
|
|
72
72
|
*/
|
|
73
73
|
export function isTearFromPlayer(tear: EntityTear): boolean {
|
|
74
|
-
if (tear.FrameCount === 0
|
|
74
|
+
if (tear.FrameCount === 0) {
|
|
75
75
|
error(
|
|
76
|
-
|
|
76
|
+
'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.)',
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|