isaacscript-common 10.1.1 → 10.2.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 +26 -0
- package/dist/isaacscript-common.lua +42 -5
- package/dist/package.lua +1 -1
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +2 -3
- package/dist/src/functions/tears.d.ts +25 -0
- package/dist/src/functions/tears.d.ts.map +1 -1
- package/dist/src/functions/tears.lua +38 -0
- package/package.json +1 -1
- package/src/functions/players.ts +2 -9
- package/src/functions/tears.ts +54 -0
package/dist/index.d.ts
CHANGED
|
@@ -6438,6 +6438,32 @@ export declare function isTarotCard(cardType: CardType): boolean;
|
|
|
6438
6438
|
/** Helper function to detect if a variable is of type `EntityTear`. */
|
|
6439
6439
|
export declare function isTear(variable: unknown): variable is EntityTear;
|
|
6440
6440
|
|
|
6441
|
+
/**
|
|
6442
|
+
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
6443
|
+
* is determined by looking at the parent.
|
|
6444
|
+
*
|
|
6445
|
+
* 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 frames 0 and 1 and it is the familiar on frames 2
|
|
6447
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
6448
|
+
* callback or on frame 2+.
|
|
6449
|
+
*
|
|
6450
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
6451
|
+
*/
|
|
6452
|
+
export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
6453
|
+
|
|
6454
|
+
/**
|
|
6455
|
+
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
6456
|
+
* is determined by looking at the parent.
|
|
6457
|
+
*
|
|
6458
|
+
* 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 frames 0 and 1 and it is the familiar on frames 2
|
|
6460
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
6461
|
+
* callback or on frame 2+.
|
|
6462
|
+
*
|
|
6463
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
6464
|
+
*/
|
|
6465
|
+
export declare function isTearFromPlayer(tear: EntityTear): boolean;
|
|
6466
|
+
|
|
6441
6467
|
/** Helper function to detect if a variable is of type `GridEntityTNT`. */
|
|
6442
6468
|
export declare function isTNT(variable: unknown): variable is GridEntityTNT;
|
|
6443
6469
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 10.
|
|
3
|
+
isaacscript-common 10.2.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -26070,7 +26070,6 @@ local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
|
26070
26070
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
26071
26071
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
26072
26072
|
local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
|
|
26073
|
-
local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
|
|
26074
26073
|
local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
26075
26074
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
26076
26075
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
@@ -26309,7 +26308,7 @@ function ____exports.getPlayerFromTear(self, entity)
|
|
|
26309
26308
|
return player
|
|
26310
26309
|
end
|
|
26311
26310
|
local familiar = entity.Parent:ToFamiliar()
|
|
26312
|
-
if familiar ~= nil
|
|
26311
|
+
if familiar ~= nil then
|
|
26313
26312
|
return familiar.Player
|
|
26314
26313
|
end
|
|
26315
26314
|
end
|
|
@@ -26319,7 +26318,7 @@ function ____exports.getPlayerFromTear(self, entity)
|
|
|
26319
26318
|
return player
|
|
26320
26319
|
end
|
|
26321
26320
|
local familiar = entity.SpawnerEntity:ToFamiliar()
|
|
26322
|
-
if familiar ~= nil
|
|
26321
|
+
if familiar ~= nil then
|
|
26323
26322
|
return familiar.Player
|
|
26324
26323
|
end
|
|
26325
26324
|
end
|
|
@@ -39247,6 +39246,44 @@ function ____exports.addTearsStat(self, player, tearsStat)
|
|
|
39247
39246
|
local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
|
|
39248
39247
|
player.MaxFireDelay = newMaxFireDelay
|
|
39249
39248
|
end
|
|
39249
|
+
--- Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
39250
|
+
-- is determined by looking at the parent.
|
|
39251
|
+
--
|
|
39252
|
+
-- 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 frames 0 and 1 and it is the familiar on frames 2
|
|
39254
|
+
-- and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
39255
|
+
-- callback or on frame 2+.
|
|
39256
|
+
--
|
|
39257
|
+
-- If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
39258
|
+
function ____exports.isTearFromFamiliar(self, tear)
|
|
39259
|
+
if tear.FrameCount == 0 or tear.FrameCount == 1 then
|
|
39260
|
+
error(("Failed to check if the given tear was from a player since the tear's frame count was equal to " .. tostring(tear.FrameCount)) .. ". (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 2 and onwards.)")
|
|
39261
|
+
end
|
|
39262
|
+
if tear.Parent == nil then
|
|
39263
|
+
return false
|
|
39264
|
+
end
|
|
39265
|
+
local familiar = tear.Parent:ToFamiliar()
|
|
39266
|
+
return familiar ~= nil
|
|
39267
|
+
end
|
|
39268
|
+
--- Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
39269
|
+
-- is determined by looking at the parent.
|
|
39270
|
+
--
|
|
39271
|
+
-- 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 frames 0 and 1 and it is the familiar on frames 2
|
|
39273
|
+
-- and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
39274
|
+
-- callback or on frame 2+.
|
|
39275
|
+
--
|
|
39276
|
+
-- If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
39277
|
+
function ____exports.isTearFromPlayer(self, tear)
|
|
39278
|
+
if tear.FrameCount == 0 or tear.FrameCount == 1 then
|
|
39279
|
+
error(("Failed to check if the given tear was from a player since the tear's frame count was equal to " .. tostring(tear.FrameCount)) .. ". (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 2 and onwards.)")
|
|
39280
|
+
end
|
|
39281
|
+
if tear.Parent == nil then
|
|
39282
|
+
return false
|
|
39283
|
+
end
|
|
39284
|
+
local player = tear.Parent:ToPlayer()
|
|
39285
|
+
return player ~= nil
|
|
39286
|
+
end
|
|
39250
39287
|
return ____exports
|
|
39251
39288
|
end,
|
|
39252
39289
|
["src.maps.defaultPlayerStatMap"] = function(...)
|
|
@@ -46910,7 +46947,7 @@ return ____exports
|
|
|
46910
46947
|
["package"] = function(...)
|
|
46911
46948
|
return {
|
|
46912
46949
|
name = "isaacscript-common",
|
|
46913
|
-
version = "10.
|
|
46950
|
+
version = "10.2.1",
|
|
46914
46951
|
description = "Helper functions and features for IsaacScript mods.",
|
|
46915
46952
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
46916
46953
|
homepage = "https://isaacscript.github.io/",
|
package/dist/package.lua
CHANGED
|
@@ -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,
|
|
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,wBA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EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,OAAO,CAIT;AAED;;;GAGG;AACH,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"}
|
|
@@ -14,7 +14,6 @@ local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
|
14
14
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
15
15
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
16
16
|
local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
|
|
17
|
-
local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
|
|
18
17
|
local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
19
18
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
20
19
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
@@ -253,7 +252,7 @@ function ____exports.getPlayerFromTear(self, entity)
|
|
|
253
252
|
return player
|
|
254
253
|
end
|
|
255
254
|
local familiar = entity.Parent:ToFamiliar()
|
|
256
|
-
if familiar ~= nil
|
|
255
|
+
if familiar ~= nil then
|
|
257
256
|
return familiar.Player
|
|
258
257
|
end
|
|
259
258
|
end
|
|
@@ -263,7 +262,7 @@ function ____exports.getPlayerFromTear(self, entity)
|
|
|
263
262
|
return player
|
|
264
263
|
end
|
|
265
264
|
local familiar = entity.SpawnerEntity:ToFamiliar()
|
|
266
|
-
if familiar ~= nil
|
|
265
|
+
if familiar ~= nil then
|
|
267
266
|
return familiar.Player
|
|
268
267
|
end
|
|
269
268
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
4
|
/**
|
|
4
5
|
* - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
|
|
5
6
|
* adds it to the player.
|
|
@@ -22,4 +23,28 @@ export declare function getFireDelay(tearsStat: float): float;
|
|
|
22
23
|
* this function.
|
|
23
24
|
*/
|
|
24
25
|
export declare function getTearsStat(fireDelay: float): float;
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
28
|
+
* is determined by looking at the parent.
|
|
29
|
+
*
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
32
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
33
|
+
* callback or on frame 2+.
|
|
34
|
+
*
|
|
35
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isTearFromFamiliar(tear: EntityTear): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
40
|
+
* is determined by looking at the parent.
|
|
41
|
+
*
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
44
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
45
|
+
* callback or on frame 2+.
|
|
46
|
+
*
|
|
47
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isTearFromPlayer(tear: EntityTear): boolean;
|
|
25
50
|
//# sourceMappingURL=tears.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":"
|
|
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,CAc5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAc1D"}
|
|
@@ -24,4 +24,42 @@ function ____exports.addTearsStat(self, player, tearsStat)
|
|
|
24
24
|
local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
|
|
25
25
|
player.MaxFireDelay = newMaxFireDelay
|
|
26
26
|
end
|
|
27
|
+
--- Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
28
|
+
-- is determined by looking at the parent.
|
|
29
|
+
--
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
32
|
+
-- and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
33
|
+
-- callback or on frame 2+.
|
|
34
|
+
--
|
|
35
|
+
-- If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
36
|
+
function ____exports.isTearFromFamiliar(self, tear)
|
|
37
|
+
if tear.FrameCount == 0 or tear.FrameCount == 1 then
|
|
38
|
+
error(("Failed to check if the given tear was from a player since the tear's frame count was equal to " .. tostring(tear.FrameCount)) .. ". (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 2 and onwards.)")
|
|
39
|
+
end
|
|
40
|
+
if tear.Parent == nil then
|
|
41
|
+
return false
|
|
42
|
+
end
|
|
43
|
+
local familiar = tear.Parent:ToFamiliar()
|
|
44
|
+
return familiar ~= nil
|
|
45
|
+
end
|
|
46
|
+
--- Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
47
|
+
-- is determined by looking at the parent.
|
|
48
|
+
--
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
51
|
+
-- and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
52
|
+
-- callback or on frame 2+.
|
|
53
|
+
--
|
|
54
|
+
-- If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
55
|
+
function ____exports.isTearFromPlayer(self, tear)
|
|
56
|
+
if tear.FrameCount == 0 or tear.FrameCount == 1 then
|
|
57
|
+
error(("Failed to check if the given tear was from a player since the tear's frame count was equal to " .. tostring(tear.FrameCount)) .. ". (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 2 and onwards.)")
|
|
58
|
+
end
|
|
59
|
+
if tear.Parent == nil then
|
|
60
|
+
return false
|
|
61
|
+
end
|
|
62
|
+
local player = tear.Parent:ToPlayer()
|
|
63
|
+
return player ~= nil
|
|
64
|
+
end
|
|
27
65
|
return ____exports
|
package/package.json
CHANGED
package/src/functions/players.ts
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Challenge,
|
|
4
4
|
CollectibleType,
|
|
5
5
|
ControllerIndex,
|
|
6
|
-
FamiliarVariant,
|
|
7
6
|
NullItemID,
|
|
8
7
|
PlayerForm,
|
|
9
8
|
PlayerType,
|
|
@@ -274,10 +273,7 @@ export function getPlayerFromTear(entity: Entity): EntityPlayer | undefined {
|
|
|
274
273
|
}
|
|
275
274
|
|
|
276
275
|
const familiar = entity.Parent.ToFamiliar();
|
|
277
|
-
if (
|
|
278
|
-
familiar !== undefined &&
|
|
279
|
-
familiar.Variant === FamiliarVariant.INCUBUS
|
|
280
|
-
) {
|
|
276
|
+
if (familiar !== undefined) {
|
|
281
277
|
return familiar.Player;
|
|
282
278
|
}
|
|
283
279
|
}
|
|
@@ -289,10 +285,7 @@ export function getPlayerFromTear(entity: Entity): EntityPlayer | undefined {
|
|
|
289
285
|
}
|
|
290
286
|
|
|
291
287
|
const familiar = entity.SpawnerEntity.ToFamiliar();
|
|
292
|
-
if (
|
|
293
|
-
familiar !== undefined &&
|
|
294
|
-
familiar.Variant === FamiliarVariant.INCUBUS
|
|
295
|
-
) {
|
|
288
|
+
if (familiar !== undefined) {
|
|
296
289
|
return familiar.Player;
|
|
297
290
|
}
|
|
298
291
|
}
|
package/src/functions/tears.ts
CHANGED
|
@@ -31,3 +31,57 @@ export function getFireDelay(tearsStat: float): float {
|
|
|
31
31
|
export function getTearsStat(fireDelay: float): float {
|
|
32
32
|
return 30 / (fireDelay + 1);
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
|
|
37
|
+
* is determined by looking at the parent.
|
|
38
|
+
*
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
41
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
42
|
+
* callback or on frame 2+.
|
|
43
|
+
*
|
|
44
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
45
|
+
*/
|
|
46
|
+
export function isTearFromFamiliar(tear: EntityTear): boolean {
|
|
47
|
+
if (tear.FrameCount === 0 || tear.FrameCount === 1) {
|
|
48
|
+
error(
|
|
49
|
+
`Failed to check if the given tear was from a player since the tear's frame count was equal to ${tear.FrameCount}. (The "isTearFromFamiliar" function must only be used in the "POST_TEAR_INIT_VERY_LATE" callback or on frame 2 and onwards.)`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Normally, all tears have a parent, which is either the player or the familiar.
|
|
54
|
+
if (tear.Parent === undefined) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const familiar = tear.Parent.ToFamiliar();
|
|
59
|
+
return familiar !== undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
|
|
64
|
+
* is determined by looking at the parent.
|
|
65
|
+
*
|
|
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 frames 0 and 1 and it is the familiar on frames 2
|
|
68
|
+
* and onwards. For this reason, you can only use this function in the `POST_TEAR_INIT_VERY_LATE`
|
|
69
|
+
* callback or on frame 2+.
|
|
70
|
+
*
|
|
71
|
+
* If this function is called on frame 0 or frame 1, it will throw a run-time error.
|
|
72
|
+
*/
|
|
73
|
+
export function isTearFromPlayer(tear: EntityTear): boolean {
|
|
74
|
+
if (tear.FrameCount === 0 || tear.FrameCount === 1) {
|
|
75
|
+
error(
|
|
76
|
+
`Failed to check if the given tear was from a player since the tear's frame count was equal to ${tear.FrameCount}. (The "isTearFromPlayer" function must only be used in the "POST_TEAR_INIT_VERY_LATE" callback or on frame 2 and onwards.)`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Normally, all tears have a parent, which is either the player or the familiar.
|
|
81
|
+
if (tear.Parent === undefined) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const player = tear.Parent.ToPlayer();
|
|
86
|
+
return player !== undefined;
|
|
87
|
+
}
|