isaacscript-common 31.4.0 → 31.5.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.rollup.d.ts +12 -0
- package/dist/isaacscript-common.lua +97 -40
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayBomb.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayBomb.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayDoor.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayDoor.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayEffect.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayEffect.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayKnife.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayKnife.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayLaser.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayLaser.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayNPC.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayNPC.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPickup.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPickup.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPit.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPit.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPlayer.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPlayer.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPoop.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPoop.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayProjectile.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayProjectile.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayRock.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayRock.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplaySlot.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplaySlot.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplaySpikes.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplaySpikes.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayTNT.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayTNT.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayTear.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/DebugDisplayTear.lua +2 -1
- package/dist/src/classes/features/other/debugDisplay/utils.d.ts +0 -1
- package/dist/src/classes/features/other/debugDisplay/utils.d.ts.map +1 -1
- package/dist/src/classes/features/other/debugDisplay/utils.lua +0 -17
- package/dist/src/functions/render.d.ts +16 -0
- package/dist/src/functions/render.d.ts.map +1 -0
- package/dist/src/functions/render.lua +50 -0
- package/dist/src/functions/utils.d.ts +0 -10
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +0 -16
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/dist/src/types/Expand.d.ts +8 -0
- package/dist/src/types/Expand.d.ts.map +1 -0
- package/dist/src/types/Expand.lua +2 -0
- package/package.json +1 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayBomb.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayDoor.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayEffect.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayFamiliar.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayKnife.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayLaser.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayNPC.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayPickup.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayPit.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayPlayer.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayPoop.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayPressurePlate.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayProjectile.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayRock.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplaySlot.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplaySpikes.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayTNT.ts +2 -1
- package/src/classes/features/other/debugDisplay/DebugDisplayTear.ts +2 -1
- package/src/classes/features/other/debugDisplay/utils.ts +0 -13
- package/src/functions/render.ts +53 -0
- package/src/functions/utils.ts +0 -17
- package/src/index.ts +2 -0
- package/src/types/Expand.ts +5 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getEntityID } from "../../../../functions/entities";
|
|
2
2
|
import { getGridEntityID } from "../../../../functions/gridEntities";
|
|
3
|
-
import { isReflectionRender } from "../../../../functions/utils";
|
|
4
3
|
|
|
5
4
|
export function defaultEntityDisplayCallback(entity: Entity): string {
|
|
6
5
|
return getEntityID(entity);
|
|
@@ -11,15 +10,3 @@ export function defaultGridEntityDisplayCallback(
|
|
|
11
10
|
): string {
|
|
12
11
|
return getGridEntityID(gridEntity);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
export function renderTextOnEntity(
|
|
16
|
-
entity: Entity | GridEntity,
|
|
17
|
-
text: string,
|
|
18
|
-
): void {
|
|
19
|
-
if (isReflectionRender()) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const position = Isaac.WorldToScreen(entity.Position);
|
|
24
|
-
Isaac.RenderText(text, position.X, position.Y, 1, 1, 1, 1);
|
|
25
|
-
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RenderMode } from "isaac-typescript-definitions";
|
|
2
|
+
import { game } from "../core/cachedClasses";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to see if the current render callback is rendering a water reflection.
|
|
6
|
+
*
|
|
7
|
+
* When the player is in a room with water, things will be rendered twice: once for the normal
|
|
8
|
+
* rendering, and once for the reflecting rendering. Thus, any mod code in a render callback will
|
|
9
|
+
* run twice per frame in these situations, which may be unexpected or cause bugs.
|
|
10
|
+
*
|
|
11
|
+
* This function is typically used to early return from a render function if it returns true.
|
|
12
|
+
*/
|
|
13
|
+
export function isReflectionRender(): boolean {
|
|
14
|
+
const room = game.GetRoom();
|
|
15
|
+
const renderMode = room.GetRenderMode();
|
|
16
|
+
return renderMode === RenderMode.WATER_REFLECT;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function renderScaledTextOnEntity(
|
|
20
|
+
entity: Entity | GridEntity,
|
|
21
|
+
text: string,
|
|
22
|
+
scaleX: float,
|
|
23
|
+
scaleY: float,
|
|
24
|
+
): void {
|
|
25
|
+
if (isReflectionRender()) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const position = Isaac.WorldToScreen(entity.Position);
|
|
30
|
+
Isaac.RenderScaledText(
|
|
31
|
+
text,
|
|
32
|
+
position.X,
|
|
33
|
+
position.Y,
|
|
34
|
+
scaleX,
|
|
35
|
+
scaleY,
|
|
36
|
+
1,
|
|
37
|
+
1,
|
|
38
|
+
1,
|
|
39
|
+
1,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function renderTextOnEntity(
|
|
44
|
+
entity: Entity | GridEntity,
|
|
45
|
+
text: string,
|
|
46
|
+
): void {
|
|
47
|
+
if (isReflectionRender()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const position = Isaac.WorldToScreen(entity.Position);
|
|
52
|
+
Isaac.RenderText(text, position.X, position.Y, 1, 1, 1, 1);
|
|
53
|
+
}
|
package/src/functions/utils.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RenderMode } from "isaac-typescript-definitions";
|
|
2
|
-
import { game } from "../core/cachedClasses";
|
|
3
1
|
import { ReadonlySet } from "../types/ReadonlySet";
|
|
4
2
|
import { getAllPlayers } from "./playerIndex";
|
|
5
3
|
import { isFunction } from "./types";
|
|
@@ -123,21 +121,6 @@ export function isMultiplayer(): boolean {
|
|
|
123
121
|
return controllerIndexesSet.size > 1;
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
/**
|
|
127
|
-
* Helper function to see if the current render callback is rendering a water reflection.
|
|
128
|
-
*
|
|
129
|
-
* When the player is in a room with water, things will be rendered twice: once for the normal
|
|
130
|
-
* rendering, and once for the reflecting rendering. Thus, any mod code in a render callback will
|
|
131
|
-
* run twice per frame in these situations, which may be unexpected or cause bugs.
|
|
132
|
-
*
|
|
133
|
-
* This function is typically used to early return from a render function if it returns true.
|
|
134
|
-
*/
|
|
135
|
-
export function isReflectionRender(): boolean {
|
|
136
|
-
const room = game.GetRoom();
|
|
137
|
-
const renderMode = room.GetRenderMode();
|
|
138
|
-
return renderMode === RenderMode.WATER_REFLECT;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
124
|
/**
|
|
142
125
|
* Helper function to check if the player is using Afterbirth+ or Repentance.
|
|
143
126
|
*
|
package/src/index.ts
CHANGED
|
@@ -95,6 +95,7 @@ export * from "./functions/pressurePlate";
|
|
|
95
95
|
export * from "./functions/projectiles";
|
|
96
96
|
export * from "./functions/random";
|
|
97
97
|
export * from "./functions/readOnly";
|
|
98
|
+
export * from "./functions/render";
|
|
98
99
|
export * from "./functions/revive";
|
|
99
100
|
export * from "./functions/rng";
|
|
100
101
|
export * from "./functions/rockAlt";
|
|
@@ -157,6 +158,7 @@ export * from "./types/AnyGridEntity";
|
|
|
157
158
|
export * from "./types/ConversionHeartSubType";
|
|
158
159
|
export * from "./types/Decrement";
|
|
159
160
|
export * from "./types/EntityID";
|
|
161
|
+
export * from "./types/Expand";
|
|
160
162
|
export * from "./types/FunctionTuple";
|
|
161
163
|
export * from "./types/GridEntityID";
|
|
162
164
|
export * from "./types/HasFunction";
|