isaacscript-common 20.9.0 → 20.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.d.ts +1 -1
- package/dist/isaacscript-common.lua +4 -4
- package/dist/src/functions/entities.lua +2 -2
- package/dist/src/functions/vector.d.ts +1 -1
- package/dist/src/functions/vector.d.ts.map +1 -1
- package/dist/src/functions/vector.lua +1 -1
- package/package.json +1 -1
- package/src/functions/entities.ts +2 -2
- package/src/functions/vector.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3310,7 +3310,7 @@ export declare function doesPlayerHaveAllSoulHearts(player: EntityPlayer): boole
|
|
|
3310
3310
|
* @param threshold Optional. The threshold from 0 to consider to be a non-zero vector. Default is
|
|
3311
3311
|
* 0.01.
|
|
3312
3312
|
*/
|
|
3313
|
-
export declare function
|
|
3313
|
+
export declare function doesVectorHaveLength(vector: Vector, threshold?: number): boolean;
|
|
3314
3314
|
|
|
3315
3315
|
export declare const DOGMA_ROOM_GRID_INDEX = 109;
|
|
3316
3316
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 20.9.
|
|
3
|
+
isaacscript-common 20.9.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -17401,7 +17401,7 @@ function ____exports.deserializeVector(self, vector)
|
|
|
17401
17401
|
end
|
|
17402
17402
|
return Vector(x, y)
|
|
17403
17403
|
end
|
|
17404
|
-
function ____exports.
|
|
17404
|
+
function ____exports.doesVectorHaveLength(self, vector, threshold)
|
|
17405
17405
|
if threshold == nil then
|
|
17406
17406
|
threshold = 0.01
|
|
17407
17407
|
end
|
|
@@ -19751,7 +19751,7 @@ local ____types = require("src.functions.types")
|
|
|
19751
19751
|
local asNumber = ____types.asNumber
|
|
19752
19752
|
local isPrimitive = ____types.isPrimitive
|
|
19753
19753
|
local ____vector = require("src.functions.vector")
|
|
19754
|
-
local
|
|
19754
|
+
local doesVectorHaveLength = ____vector.doesVectorHaveLength
|
|
19755
19755
|
local isVector = ____vector.isVector
|
|
19756
19756
|
local vectorToString = ____vector.vectorToString
|
|
19757
19757
|
function setPrimitiveEntityFields(self, entity, metatable, entityFields)
|
|
@@ -19942,7 +19942,7 @@ function ____exports.isEntityMoving(self, entity, threshold)
|
|
|
19942
19942
|
if threshold == nil then
|
|
19943
19943
|
threshold = 0.01
|
|
19944
19944
|
end
|
|
19945
|
-
return
|
|
19945
|
+
return doesVectorHaveLength(nil, entity.Velocity, threshold)
|
|
19946
19946
|
end
|
|
19947
19947
|
function ____exports.isStoryBoss(self, entityType)
|
|
19948
19948
|
return STORY_BOSSES_SET:has(entityType)
|
|
@@ -27,7 +27,7 @@ local ____types = require("src.functions.types")
|
|
|
27
27
|
local asNumber = ____types.asNumber
|
|
28
28
|
local isPrimitive = ____types.isPrimitive
|
|
29
29
|
local ____vector = require("src.functions.vector")
|
|
30
|
-
local
|
|
30
|
+
local doesVectorHaveLength = ____vector.doesVectorHaveLength
|
|
31
31
|
local isVector = ____vector.isVector
|
|
32
32
|
local vectorToString = ____vector.vectorToString
|
|
33
33
|
function setPrimitiveEntityFields(self, entity, metatable, entityFields)
|
|
@@ -304,7 +304,7 @@ function ____exports.isEntityMoving(self, entity, threshold)
|
|
|
304
304
|
if threshold == nil then
|
|
305
305
|
threshold = 0.01
|
|
306
306
|
end
|
|
307
|
-
return
|
|
307
|
+
return doesVectorHaveLength(nil, entity.Velocity, threshold)
|
|
308
308
|
end
|
|
309
309
|
--- Helper function to determine if the specified entity type is an end-game story boss, like Isaac,
|
|
310
310
|
-- Blue Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only
|
|
@@ -22,7 +22,7 @@ export declare function deserializeVector(vector: SerializedVector): Vector;
|
|
|
22
22
|
* @param threshold Optional. The threshold from 0 to consider to be a non-zero vector. Default is
|
|
23
23
|
* 0.01.
|
|
24
24
|
*/
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function doesVectorHaveLength(vector: Vector, threshold?: number): boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to get a random vector between (-1, -1) and (1, 1).
|
|
28
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AAatC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AAatC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,SAAO,GACf,OAAO,CAET;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
|
|
@@ -61,7 +61,7 @@ end
|
|
|
61
61
|
-- @param vector The vector to measure.
|
|
62
62
|
-- @param threshold Optional. The threshold from 0 to consider to be a non-zero vector. Default is
|
|
63
63
|
-- 0.01.
|
|
64
|
-
function ____exports.
|
|
64
|
+
function ____exports.doesVectorHaveLength(self, vector, threshold)
|
|
65
65
|
if threshold == nil then
|
|
66
66
|
threshold = 0.01
|
|
67
67
|
end
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { getRandom } from "./random";
|
|
|
10
10
|
import { isRNG, newRNG } from "./rng";
|
|
11
11
|
import { setSpriteOpacity } from "./sprites";
|
|
12
12
|
import { asNumber, isPrimitive } from "./types";
|
|
13
|
-
import {
|
|
13
|
+
import { doesVectorHaveLength, isVector, vectorToString } from "./vector";
|
|
14
14
|
|
|
15
15
|
/** From DeadInfinity. */
|
|
16
16
|
const DAMAGE_FLASH_COLOR: Readonly<Color> = Color(
|
|
@@ -316,7 +316,7 @@ export function hasArmor(entity: Entity): boolean {
|
|
|
316
316
|
* @param threshold Optional. The threshold from 0 to consider to be moving. Default is 0.01.
|
|
317
317
|
*/
|
|
318
318
|
export function isEntityMoving(entity: Entity, threshold = 0.01): boolean {
|
|
319
|
-
return
|
|
319
|
+
return doesVectorHaveLength(entity.Velocity, threshold);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
/**
|
package/src/functions/vector.ts
CHANGED
|
@@ -71,7 +71,7 @@ export function deserializeVector(vector: SerializedVector): Vector {
|
|
|
71
71
|
* @param threshold Optional. The threshold from 0 to consider to be a non-zero vector. Default is
|
|
72
72
|
* 0.01.
|
|
73
73
|
*/
|
|
74
|
-
export function
|
|
74
|
+
export function doesVectorHaveLength(
|
|
75
75
|
vector: Vector,
|
|
76
76
|
threshold = 0.01,
|
|
77
77
|
): boolean {
|