isaacscript-common 33.3.0 → 33.3.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.rollup.d.ts +5 -0
- package/dist/isaacscript-common.lua +1 -1
- package/dist/src/functions/globals.d.ts +5 -0
- package/dist/src/functions/globals.d.ts.map +1 -1
- package/dist/src/functions/globals.lua +3 -0
- package/package.json +1 -1
- package/src/functions/globals.ts +5 -0
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/playerHealth.ts +2 -2
- package/src/functions/tears.ts +1 -1
- package/src/functions/ui.ts +3 -3
package/dist/index.rollup.d.ts
CHANGED
|
@@ -16144,6 +16144,11 @@ export declare function setStage(stage: LevelStage, stageType: StageType, reseed
|
|
|
16144
16144
|
/** Helper function to convert a set of flags to a single `BitFlags` object. */
|
|
16145
16145
|
export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: Set<T> | ReadonlySet<T>): BitFlags<T>;
|
|
16146
16146
|
|
|
16147
|
+
/**
|
|
16148
|
+
* Sets the `traceback` and `getTraceback` functions to be global functions.
|
|
16149
|
+
*
|
|
16150
|
+
* This is useful when editing Lua files when troubleshooting.
|
|
16151
|
+
*/
|
|
16147
16152
|
export declare function setTracebackFunctionsGlobal(): void;
|
|
16148
16153
|
|
|
16149
16154
|
/**
|
|
@@ -18,5 +18,10 @@ export declare function logNewGlobals(): void;
|
|
|
18
18
|
* This is useful when printing out variables from the in-game debug console.
|
|
19
19
|
*/
|
|
20
20
|
export declare function setLogFunctionsGlobal(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the `traceback` and `getTraceback` functions to be global functions.
|
|
23
|
+
*
|
|
24
|
+
* This is useful when editing Lua files when troubleshooting.
|
|
25
|
+
*/
|
|
21
26
|
export declare function setTracebackFunctionsGlobal(): void;
|
|
22
27
|
//# sourceMappingURL=globals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/functions/globals.ts"],"names":[],"mappings":";AA6LA;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,MAAM,CAAC,CAYvD;AAMD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAcnE;AAED,wBAAgB,aAAa,IAAI,IAAI,CAapC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAS5C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD"}
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/functions/globals.ts"],"names":[],"mappings":";AA6LA;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,MAAM,CAAC,CAYvD;AAMD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAcnE;AAED,wBAAgB,aAAa,IAAI,IAAI,CAapC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAS5C;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD"}
|
|
@@ -254,6 +254,9 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
254
254
|
end
|
|
255
255
|
end
|
|
256
256
|
end
|
|
257
|
+
--- Sets the `traceback` and `getTraceback` functions to be global functions.
|
|
258
|
+
--
|
|
259
|
+
-- This is useful when editing Lua files when troubleshooting.
|
|
257
260
|
function ____exports.setTracebackFunctionsGlobal(self)
|
|
258
261
|
local globals = _G
|
|
259
262
|
globals.getTraceback = getTraceback
|
package/package.json
CHANGED
package/src/functions/globals.ts
CHANGED
|
@@ -262,6 +262,11 @@ export function setLogFunctionsGlobal(): void {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Sets the `traceback` and `getTraceback` functions to be global functions.
|
|
267
|
+
*
|
|
268
|
+
* This is useful when editing Lua files when troubleshooting.
|
|
269
|
+
*/
|
|
265
270
|
export function setTracebackFunctionsGlobal(): void {
|
|
266
271
|
const globals = _G as Record<string, unknown>;
|
|
267
272
|
|
|
@@ -266,13 +266,13 @@ export function getGridEntitiesInRadius(
|
|
|
266
266
|
targetPosition: Vector,
|
|
267
267
|
radius: number,
|
|
268
268
|
): GridEntity[] {
|
|
269
|
-
radius =
|
|
269
|
+
radius = Math.abs(radius);
|
|
270
270
|
const topLeftOffset = VectorOne.mul(-radius);
|
|
271
271
|
const mostTopLeftPosition = targetPosition.add(topLeftOffset);
|
|
272
272
|
const room = game.GetRoom();
|
|
273
273
|
|
|
274
274
|
const diameter = radius * 2;
|
|
275
|
-
const iterations =
|
|
275
|
+
const iterations = Math.ceil(diameter / DISTANCE_OF_GRID_TILE);
|
|
276
276
|
const separation = diameter / iterations;
|
|
277
277
|
|
|
278
278
|
const gridEntities: GridEntity[] = [];
|
|
@@ -136,7 +136,7 @@ export function getPlayerAvailableHeartSlots(player: EntityPlayer): int {
|
|
|
136
136
|
const effectiveMaxHearts = player.GetEffectiveMaxHearts();
|
|
137
137
|
const normalAndBoneHeartContainers = effectiveMaxHearts / 2;
|
|
138
138
|
const soulHearts = player.GetSoulHearts();
|
|
139
|
-
const soulHeartContainers =
|
|
139
|
+
const soulHeartContainers = Math.ceil(soulHearts / 2);
|
|
140
140
|
const totalHeartContainers =
|
|
141
141
|
normalAndBoneHeartContainers + soulHeartContainers;
|
|
142
142
|
const brokenHearts = player.GetBrokenHearts();
|
|
@@ -197,7 +197,7 @@ export function getPlayerHealth(player: EntityPlayer): PlayerHealth {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// This is the number of individual hearts shown in the HUD, minus heart containers.
|
|
200
|
-
const extraHearts =
|
|
200
|
+
const extraHearts = Math.ceil(soulHearts / 2) + boneHearts;
|
|
201
201
|
|
|
202
202
|
// Since bone hearts can be inserted anywhere between soul hearts, we need a separate counter to
|
|
203
203
|
// track which soul heart we're currently at.
|
package/src/functions/tears.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function addTearsStat(player: EntityPlayer, tearsStat: float): void {
|
|
|
31
31
|
* - In this context, the "tears stat" represents what is shown on the in-game stat UI.
|
|
32
32
|
*/
|
|
33
33
|
export function getFireDelay(tearsStat: float): float {
|
|
34
|
-
return
|
|
34
|
+
return Math.max(30 / tearsStat - 1, -0.9999);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
package/src/functions/ui.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { copyVector } from "./vector";
|
|
|
15
15
|
*/
|
|
16
16
|
export function getHUDOffsetVector(): Readonly<Vector> {
|
|
17
17
|
// Convert e.g. 0.4 to 4.
|
|
18
|
-
const hudOffset =
|
|
18
|
+
const hudOffset = Math.floor(Options.HUDOffset * 10);
|
|
19
19
|
|
|
20
20
|
// Expected values are integers between 1 and 10.
|
|
21
21
|
if (hudOffset < 1 || hudOffset > 10) {
|
|
@@ -145,9 +145,9 @@ export function getVisibleHearts(player: EntityPlayer): int {
|
|
|
145
145
|
const soulHearts = player.GetSoulHearts();
|
|
146
146
|
const boneHearts = player.GetBoneHearts();
|
|
147
147
|
|
|
148
|
-
const maxHearts =
|
|
148
|
+
const maxHearts = Math.max(effectiveMaxHearts, boneHearts * 2);
|
|
149
149
|
|
|
150
|
-
let visibleHearts =
|
|
150
|
+
let visibleHearts = Math.ceil((maxHearts + soulHearts) / 2);
|
|
151
151
|
if (visibleHearts < 1) {
|
|
152
152
|
visibleHearts = 1;
|
|
153
153
|
}
|