isaacscript-common 20.9.0 → 20.10.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 +8 -1
- package/dist/isaacscript-common.lua +8 -4
- package/dist/src/classes/features/other/RoomHistory.d.ts +7 -0
- package/dist/src/classes/features/other/RoomHistory.d.ts.map +1 -1
- package/dist/src/classes/features/other/RoomHistory.lua +4 -0
- 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/classes/features/other/RoomHistory.ts +11 -0
- 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
|
|
|
@@ -13171,6 +13171,13 @@ export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
|
|
|
13171
13171
|
|
|
13172
13172
|
declare class RoomHistory extends Feature {
|
|
13173
13173
|
private postNewRoomEarly;
|
|
13174
|
+
/**
|
|
13175
|
+
* Helper function to get the total number of rooms that the player has visited thus far on the
|
|
13176
|
+
* run.
|
|
13177
|
+
*
|
|
13178
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
|
|
13179
|
+
*/
|
|
13180
|
+
getNumRoomsVisited(): ReadonlyArray<Readonly<RoomDescription>>;
|
|
13174
13181
|
/**
|
|
13175
13182
|
* Helper function to get information about all of the rooms that a player has visited thus far on
|
|
13176
13183
|
* this run.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 20.
|
|
3
|
+
isaacscript-common 20.10.0
|
|
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)
|
|
@@ -34187,6 +34187,9 @@ function RoomHistory.prototype.____constructor(self)
|
|
|
34187
34187
|
end
|
|
34188
34188
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_EARLY, self.postNewRoomEarly}}
|
|
34189
34189
|
end
|
|
34190
|
+
function RoomHistory.prototype.getNumRoomsVisited(self)
|
|
34191
|
+
return self.v.run.roomHistory
|
|
34192
|
+
end
|
|
34190
34193
|
function RoomHistory.prototype.getRoomHistory(self)
|
|
34191
34194
|
return self.v.run.roomHistory
|
|
34192
34195
|
end
|
|
@@ -34218,6 +34221,7 @@ function RoomHistory.prototype.isLeavingRoom(self)
|
|
|
34218
34221
|
end
|
|
34219
34222
|
return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
|
|
34220
34223
|
end
|
|
34224
|
+
__TS__Decorate({Exported}, RoomHistory.prototype, "getNumRoomsVisited", true)
|
|
34221
34225
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
|
|
34222
34226
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
|
|
34223
34227
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
|
|
@@ -2,6 +2,13 @@ import { RoomDescription } from "../../../interfaces/RoomDescription";
|
|
|
2
2
|
import { Feature } from "../../private/Feature";
|
|
3
3
|
export declare class RoomHistory extends Feature {
|
|
4
4
|
private postNewRoomEarly;
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to get the total number of rooms that the player has visited thus far on the
|
|
7
|
+
* run.
|
|
8
|
+
*
|
|
9
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
|
|
10
|
+
*/
|
|
11
|
+
getNumRoomsVisited(): ReadonlyArray<Readonly<RoomDescription>>;
|
|
5
12
|
/**
|
|
6
13
|
* Helper function to get information about all of the rooms that a player has visited thus far on
|
|
7
14
|
* this run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,OAAO;IAkBtC,OAAO,CAAC,gBAAgB,CAgCtB;IAEF;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
|
|
1
|
+
{"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,OAAO;IAkBtC,OAAO,CAAC,gBAAgB,CAgCtB;IAEF;;;;;OAKG;IAEI,kBAAkB,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIrE;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
|
|
@@ -65,6 +65,9 @@ function RoomHistory.prototype.____constructor(self)
|
|
|
65
65
|
end
|
|
66
66
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_EARLY, self.postNewRoomEarly}}
|
|
67
67
|
end
|
|
68
|
+
function RoomHistory.prototype.getNumRoomsVisited(self)
|
|
69
|
+
return self.v.run.roomHistory
|
|
70
|
+
end
|
|
68
71
|
function RoomHistory.prototype.getRoomHistory(self)
|
|
69
72
|
return self.v.run.roomHistory
|
|
70
73
|
end
|
|
@@ -96,6 +99,7 @@ function RoomHistory.prototype.isLeavingRoom(self)
|
|
|
96
99
|
end
|
|
97
100
|
return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
|
|
98
101
|
end
|
|
102
|
+
__TS__Decorate({Exported}, RoomHistory.prototype, "getNumRoomsVisited", true)
|
|
99
103
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
|
|
100
104
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
|
|
101
105
|
__TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
|
|
@@ -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
|
@@ -67,6 +67,17 @@ export class RoomHistory extends Feature {
|
|
|
67
67
|
this.v.run.roomHistory.push(roomDescription);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to get the total number of rooms that the player has visited thus far on the
|
|
72
|
+
* run.
|
|
73
|
+
*
|
|
74
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
|
|
75
|
+
*/
|
|
76
|
+
@Exported
|
|
77
|
+
public getNumRoomsVisited(): ReadonlyArray<Readonly<RoomDescription>> {
|
|
78
|
+
return this.v.run.roomHistory;
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
/**
|
|
71
82
|
* Helper function to get information about all of the rooms that a player has visited thus far on
|
|
72
83
|
* this run.
|
|
@@ -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 {
|