isaacscript-common 7.5.1 → 7.6.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/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +9 -5
- package/dist/features/customTrapdoor/exports.d.ts +28 -16
- package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.lua +45 -61
- package/dist/features/customTrapdoor/init.d.ts.map +1 -1
- package/dist/features/customTrapdoor/init.lua +12 -10
- package/dist/features/customTrapdoor/spawn.d.ts +6 -0
- package/dist/features/customTrapdoor/spawn.d.ts.map +1 -0
- package/dist/features/customTrapdoor/spawn.lua +52 -0
- package/dist/features/customTrapdoor/v.d.ts +2 -2
- package/dist/features/customTrapdoor/v.d.ts.map +1 -1
- package/dist/index.d.ts +172 -11148
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +4 -4
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
- package/dist/interfaces/private/CustomTrapdoorDestination.d.ts +14 -0
- package/dist/interfaces/private/CustomTrapdoorDestination.d.ts.map +1 -0
- package/dist/{types/TrapdoorDestination.lua → interfaces/private/CustomTrapdoorDestination.lua} +0 -0
- package/package.json +1 -1
- package/src/features/customStage/customStageGridEntities.ts +20 -16
- package/src/features/customTrapdoor/exports.ts +60 -66
- package/src/features/customTrapdoor/init.ts +12 -11
- package/src/features/customTrapdoor/spawn.ts +54 -0
- package/src/features/customTrapdoor/v.ts +2 -2
- package/src/index.ts +2 -3
- package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
- package/src/interfaces/private/CustomTrapdoorDestination.ts +14 -0
- package/dist/types/TrapdoorDestination.d.ts +0 -6
- package/dist/types/TrapdoorDestination.d.ts.map +0 -1
- package/src/types/TrapdoorDestination.ts +0 -8
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC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cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC"}
|
package/dist/index.lua
CHANGED
|
@@ -151,10 +151,10 @@ do
|
|
|
151
151
|
end
|
|
152
152
|
do
|
|
153
153
|
local ____customGridEntity = require("features.customGridEntity")
|
|
154
|
-
local
|
|
155
|
-
local
|
|
156
|
-
____exports.
|
|
157
|
-
____exports.
|
|
154
|
+
local removeCustomGridEntity = ____customGridEntity.removeCustomGridEntity
|
|
155
|
+
local spawnCustomGridEntity = ____customGridEntity.spawnCustomGridEntity
|
|
156
|
+
____exports.removeCustomGridEntity = removeCustomGridEntity
|
|
157
|
+
____exports.spawnCustomGridEntity = spawnCustomGridEntity
|
|
158
158
|
end
|
|
159
159
|
do
|
|
160
160
|
local ____export = require("features.customStage.exports")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomTrapdoorDestination } from "./CustomTrapdoorDestination";
|
|
2
2
|
export interface CustomTrapdoorDescription {
|
|
3
3
|
open: boolean;
|
|
4
|
-
destination:
|
|
4
|
+
destination: CustomTrapdoorDestination;
|
|
5
5
|
firstSpawn: boolean;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=CustomTrapdoorDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CustomTrapdoorDescription.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,yBAAyB,CAAC;IACvC,UAAU,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* - If the destination is a custom stage, then `vanillaStage` and `vanillaStageType` will be
|
|
4
|
+
* undefined.
|
|
5
|
+
* - If the destination is a vanilla stage, then `customStageName` and `customStageFloorNum` will be
|
|
6
|
+
* undefined.
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTrapdoorDestination {
|
|
9
|
+
customStageName?: string;
|
|
10
|
+
customStageFloorNum?: int;
|
|
11
|
+
vanillaStage?: LevelStage;
|
|
12
|
+
vanillaStageType?: StageType;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=CustomTrapdoorDestination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomTrapdoorDestination.d.ts","sourceRoot":"","sources":["../../../src/interfaces/private/CustomTrapdoorDestination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,GAAG,CAAC;IAC1B,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B"}
|
package/dist/{types/TrapdoorDestination.lua → interfaces/private/CustomTrapdoorDestination.lua}
RENAMED
|
File without changes
|
package/package.json
CHANGED
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
import { calculateStageType } from "../../functions/stage";
|
|
17
17
|
import { vectorEquals } from "../../functions/vector";
|
|
18
18
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
19
|
-
import { TrapdoorDestination } from "../../types/TrapdoorDestination";
|
|
20
19
|
import { isCustomGridEntity } from "../customGridEntity";
|
|
21
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
spawnCustomTrapdoor,
|
|
22
|
+
spawnCustomTrapdoorToVanilla,
|
|
23
|
+
} from "../customTrapdoor/exports";
|
|
22
24
|
import { DEFAULT_BASE_STAGE } from "./exports";
|
|
23
25
|
import v from "./v";
|
|
24
26
|
|
|
@@ -203,20 +205,22 @@ export function convertVanillaTrapdoors(
|
|
|
203
205
|
|
|
204
206
|
removeGridEntity(gridEntity, true);
|
|
205
207
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
208
|
+
if (v.run.firstFloor) {
|
|
209
|
+
// If we are on the first floor of a custom stage, then the destination will be the second floor
|
|
210
|
+
// of the custom stage. (e.g. Caves 1 to Caves 2)
|
|
211
|
+
spawnCustomTrapdoor(gridEntity.Position, customStage.name, 2);
|
|
212
|
+
} else {
|
|
213
|
+
// If we are on the second floor of a custom stage, then the destination will be the vanilla
|
|
214
|
+
// floor equivalent to 2 floors after the floor used as a basis for the custom stage.
|
|
215
|
+
const baseStage =
|
|
216
|
+
customStage.baseStage === undefined
|
|
217
|
+
? DEFAULT_BASE_STAGE
|
|
218
|
+
: customStage.baseStage;
|
|
219
|
+
const stage = (baseStage + 2) as LevelStage;
|
|
220
|
+
const stageType = calculateStageType(stage);
|
|
221
|
+
|
|
222
|
+
spawnCustomTrapdoorToVanilla(gridEntity.Position, stage, stageType);
|
|
223
|
+
}
|
|
220
224
|
}
|
|
221
225
|
|
|
222
226
|
/**
|
|
@@ -1,45 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GridCollisionClass,
|
|
3
|
-
LevelStage,
|
|
4
|
-
StageType,
|
|
5
|
-
} from "isaac-typescript-definitions";
|
|
6
|
-
import { game } from "../../core/cachedClasses";
|
|
7
|
-
import { TrapdoorAnimation } from "../../enums/private/TrapdoorAnimation";
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
8
2
|
import { errorIfFeaturesNotInitialized } from "../../featuresInitialized";
|
|
9
3
|
import { getNextStage, getNextStageType } from "../../functions/nextStage";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { TrapdoorDestination } from "../../types/TrapdoorDestination";
|
|
14
|
-
import { spawnCustomGridEntity } from "../customGridEntity";
|
|
15
|
-
import {
|
|
16
|
-
CUSTOM_TRAPDOOR_FEATURE_NAME,
|
|
17
|
-
GridEntityTypeCustom,
|
|
18
|
-
} from "./customTrapdoorConstants";
|
|
19
|
-
import { shouldTrapdoorSpawnOpen } from "./openClose";
|
|
20
|
-
import v from "./v";
|
|
4
|
+
import { CustomTrapdoorDestination } from "../../interfaces/private/CustomTrapdoorDestination";
|
|
5
|
+
import { CUSTOM_TRAPDOOR_FEATURE_NAME } from "./customTrapdoorConstants";
|
|
6
|
+
import { spawnCustomTrapdoorToDestination } from "./spawn";
|
|
21
7
|
|
|
22
8
|
/**
|
|
23
|
-
* Helper function to spawn a trapdoor grid entity that will
|
|
24
|
-
*
|
|
9
|
+
* Helper function to spawn a trapdoor grid entity that will take a player to a custom stage. If you
|
|
10
|
+
* want to create a custom trapdoor that goes to a vanilla stage instead, use the
|
|
11
|
+
* `spawnCustomTrapdoorToVanilla` helper function.
|
|
12
|
+
*
|
|
13
|
+
* Custom trapdoors can have one or more of the following attributes:
|
|
25
14
|
*
|
|
26
15
|
* - custom destination (or custom logic for after the player enters)
|
|
27
16
|
* - custom graphics
|
|
28
17
|
* - custom logic for opening/closing
|
|
29
18
|
*
|
|
30
|
-
* You can use this function to take the player to your custom stage.
|
|
31
|
-
*
|
|
32
19
|
* Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
|
|
33
20
|
* respawned every time the player re-enters the room.
|
|
34
21
|
*
|
|
35
22
|
* @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
36
|
-
* @param
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* StageType.ORIGINAL]` corresponds to Caves 1, and a destination of
|
|
40
|
-
* `["Slaughterhouse", 1]` corresponds to a custom stage of Slaughterhouse 1. If
|
|
41
|
-
* the destination is undefined, then the "normal" destination corresponding to
|
|
42
|
-
* the current stage and room will be used (e.g. the next floor, in most cases).
|
|
23
|
+
* @param customStageName The name of the custom stage.
|
|
24
|
+
* @param customStageFloorNum The floor of the custom stage. For most purposes, you should use 1 or
|
|
25
|
+
* 2.
|
|
43
26
|
* @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
|
|
44
27
|
* of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
|
|
45
28
|
* have animations called "Opened", "Closed", and "Open Animation".
|
|
@@ -48,54 +31,65 @@ import v from "./v";
|
|
|
48
31
|
*/
|
|
49
32
|
export function spawnCustomTrapdoor(
|
|
50
33
|
gridIndexOrPosition: int | Vector,
|
|
51
|
-
|
|
34
|
+
customStageName: string,
|
|
35
|
+
customStageFloorNum: int,
|
|
52
36
|
anm2Path = "gfx/grid/door_11_trapdoor.anm2",
|
|
53
37
|
spawnOpen?: boolean,
|
|
54
38
|
): GridEntity {
|
|
55
39
|
errorIfFeaturesNotInitialized(CUSTOM_TRAPDOOR_FEATURE_NAME);
|
|
56
40
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
? room.GetGridIndex(gridIndexOrPosition)
|
|
62
|
-
: gridIndexOrPosition;
|
|
41
|
+
const destination: CustomTrapdoorDestination = {
|
|
42
|
+
customStageName,
|
|
43
|
+
customStageFloorNum,
|
|
44
|
+
};
|
|
63
45
|
|
|
64
|
-
|
|
65
|
-
GridEntityTypeCustom.TRAPDOOR_CUSTOM,
|
|
46
|
+
return spawnCustomTrapdoorToDestination(
|
|
66
47
|
gridIndexOrPosition,
|
|
67
|
-
|
|
48
|
+
destination,
|
|
68
49
|
anm2Path,
|
|
69
|
-
|
|
50
|
+
spawnOpen,
|
|
70
51
|
);
|
|
52
|
+
}
|
|
71
53
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
54
|
+
/**
|
|
55
|
+
* This is the same thing as the `spawnCustomTrapdoor` function, but instead of having a destination
|
|
56
|
+
* of a custom stage, it has a destination of a vanilla stage.
|
|
57
|
+
*
|
|
58
|
+
* For more information, see the `spawnCustomTrapdoor` function.
|
|
59
|
+
*
|
|
60
|
+
* @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
61
|
+
* @param stage Optional. The number of the vanilla stage to go to. If not provided, the "normal"
|
|
62
|
+
* next stage will be selected.
|
|
63
|
+
* @param stageType The stage type of the vanilla stage to go to. If not provided, the "normal" next
|
|
64
|
+
* stage type will be selected.
|
|
65
|
+
* @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
|
|
66
|
+
* of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
|
|
67
|
+
* have animations called "Opened", "Closed", and "Open Animation".
|
|
68
|
+
* @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
|
|
69
|
+
* behavior will be used that emulates a vanilla trapdoor.
|
|
70
|
+
*/
|
|
71
|
+
export function spawnCustomTrapdoorToVanilla(
|
|
72
|
+
gridIndexOrPosition: int | Vector,
|
|
73
|
+
stage?: LevelStage,
|
|
74
|
+
stageType?: StageType,
|
|
75
|
+
anm2Path = "gfx/grid/door_11_trapdoor.anm2",
|
|
76
|
+
spawnOpen?: boolean,
|
|
77
|
+
): GridEntity {
|
|
78
|
+
errorIfFeaturesNotInitialized(CUSTOM_TRAPDOOR_FEATURE_NAME);
|
|
92
79
|
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
const vanillaStage = stage === undefined ? getNextStage() : stage;
|
|
81
|
+
const vanillaStageType =
|
|
82
|
+
stageType === undefined ? getNextStageType() : stageType;
|
|
95
83
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const destination: CustomTrapdoorDestination = {
|
|
85
|
+
vanillaStage,
|
|
86
|
+
vanillaStageType,
|
|
87
|
+
};
|
|
99
88
|
|
|
100
|
-
return
|
|
89
|
+
return spawnCustomTrapdoorToDestination(
|
|
90
|
+
gridIndexOrPosition,
|
|
91
|
+
destination,
|
|
92
|
+
anm2Path,
|
|
93
|
+
spawnOpen,
|
|
94
|
+
);
|
|
101
95
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
EntityGridCollisionClass,
|
|
5
5
|
ModCallback,
|
|
6
6
|
RoomTransitionAnim,
|
|
7
|
-
StageType,
|
|
8
7
|
} from "isaac-typescript-definitions";
|
|
9
8
|
import { ModUpgraded } from "../../classes/ModUpgraded";
|
|
10
9
|
import { game } from "../../core/cachedClasses";
|
|
@@ -15,7 +14,6 @@ import { getAllPlayers } from "../../functions/playerIndex";
|
|
|
15
14
|
import { getRoomGridIndex, getRoomListIndex } from "../../functions/roomData";
|
|
16
15
|
import { teleport } from "../../functions/roomTransition";
|
|
17
16
|
import { setStage } from "../../functions/stage";
|
|
18
|
-
import { isString } from "../../functions/types";
|
|
19
17
|
import { disableCustomStage, setCustomStage } from "../customStage/exports";
|
|
20
18
|
import { topStreakTextStart } from "../customStage/streakText";
|
|
21
19
|
import { enableAllInputs } from "../disableInputs";
|
|
@@ -119,7 +117,7 @@ function checkPixelationToBlackComplete() {
|
|
|
119
117
|
StageTravelState.WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY;
|
|
120
118
|
v.run.stateRenderFrame = futureRenderFrameCount;
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
goToCustomTrapdoorDestination();
|
|
123
121
|
|
|
124
122
|
// Start another pixelation effect. This time, we will keep the screen black with the sprite,
|
|
125
123
|
// and then remove the black sprite once the pixelation effect is halfway complete.
|
|
@@ -193,21 +191,24 @@ function checkAllPlayersLayingDownComplete() {
|
|
|
193
191
|
enableAllInputs(CUSTOM_TRAPDOOR_FEATURE_NAME);
|
|
194
192
|
}
|
|
195
193
|
|
|
196
|
-
function
|
|
194
|
+
function goToCustomTrapdoorDestination() {
|
|
197
195
|
if (v.run.destination === null) {
|
|
198
196
|
return;
|
|
199
197
|
}
|
|
200
198
|
|
|
201
|
-
const
|
|
199
|
+
const {
|
|
200
|
+
customStageName,
|
|
201
|
+
customStageFloorNum,
|
|
202
|
+
vanillaStage,
|
|
203
|
+
vanillaStageType,
|
|
204
|
+
} = v.run.destination;
|
|
202
205
|
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
const firstFloor = arg2 === 1;
|
|
206
|
+
if (customStageName !== undefined && customStageFloorNum !== undefined) {
|
|
207
|
+
const firstFloor = customStageFloorNum === 1;
|
|
206
208
|
setCustomStage("Slaughterhouse", firstFloor);
|
|
207
|
-
} else {
|
|
208
|
-
// A number represents a vanilla `LevelStage`.
|
|
209
|
+
} else if (vanillaStage !== undefined && vanillaStageType !== undefined) {
|
|
209
210
|
disableCustomStage();
|
|
210
|
-
setStage(
|
|
211
|
+
setStage(vanillaStage, vanillaStageType);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { GridCollisionClass } from "isaac-typescript-definitions";
|
|
2
|
+
import { game } from "../../core/cachedClasses";
|
|
3
|
+
import { TrapdoorAnimation } from "../../enums/private/TrapdoorAnimation";
|
|
4
|
+
import { getRoomListIndex } from "../../functions/roomData";
|
|
5
|
+
import { isVector } from "../../functions/vector";
|
|
6
|
+
import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
|
|
7
|
+
import { CustomTrapdoorDestination } from "../../interfaces/private/CustomTrapdoorDestination";
|
|
8
|
+
import { spawnCustomGridEntity } from "../customGridEntity";
|
|
9
|
+
import { GridEntityTypeCustom } from "./customTrapdoorConstants";
|
|
10
|
+
import { shouldTrapdoorSpawnOpen } from "./openClose";
|
|
11
|
+
import v from "./v";
|
|
12
|
+
|
|
13
|
+
export function spawnCustomTrapdoorToDestination(
|
|
14
|
+
gridIndexOrPosition: int | Vector,
|
|
15
|
+
destination: CustomTrapdoorDestination,
|
|
16
|
+
anm2Path: string,
|
|
17
|
+
spawnOpen?: boolean,
|
|
18
|
+
): GridEntity {
|
|
19
|
+
const room = game.GetRoom();
|
|
20
|
+
const roomFrameCount = room.GetFrameCount();
|
|
21
|
+
const roomListIndex = getRoomListIndex();
|
|
22
|
+
const gridIndex = isVector(gridIndexOrPosition)
|
|
23
|
+
? room.GetGridIndex(gridIndexOrPosition)
|
|
24
|
+
: gridIndexOrPosition;
|
|
25
|
+
|
|
26
|
+
const gridEntity = spawnCustomGridEntity(
|
|
27
|
+
GridEntityTypeCustom.TRAPDOOR_CUSTOM,
|
|
28
|
+
gridIndexOrPosition,
|
|
29
|
+
GridCollisionClass.NONE,
|
|
30
|
+
anm2Path,
|
|
31
|
+
TrapdoorAnimation.OPENED,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const firstSpawn = roomFrameCount !== 0;
|
|
35
|
+
const open =
|
|
36
|
+
spawnOpen === undefined
|
|
37
|
+
? shouldTrapdoorSpawnOpen(gridEntity, firstSpawn)
|
|
38
|
+
: spawnOpen;
|
|
39
|
+
|
|
40
|
+
const roomTrapdoorMap = v.level.trapdoors.getAndSetDefault(roomListIndex);
|
|
41
|
+
const customTrapdoorDescription: CustomTrapdoorDescription = {
|
|
42
|
+
open,
|
|
43
|
+
destination,
|
|
44
|
+
firstSpawn,
|
|
45
|
+
};
|
|
46
|
+
roomTrapdoorMap.set(gridIndex, customTrapdoorDescription);
|
|
47
|
+
|
|
48
|
+
if (!open) {
|
|
49
|
+
const sprite = gridEntity.GetSprite();
|
|
50
|
+
sprite.Play(TrapdoorAnimation.CLOSED, true);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return gridEntity;
|
|
54
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultMap } from "../../classes/DefaultMap";
|
|
2
2
|
import { StageTravelState } from "../../enums/private/StageTravelState";
|
|
3
3
|
import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
|
|
4
|
-
import {
|
|
4
|
+
import { CustomTrapdoorDestination } from "../../interfaces/private/CustomTrapdoorDestination";
|
|
5
5
|
|
|
6
6
|
const v = {
|
|
7
7
|
run: {
|
|
@@ -10,7 +10,7 @@ const v = {
|
|
|
10
10
|
/** The render frame that this state was reached. */
|
|
11
11
|
stateRenderFrame: null as int | null,
|
|
12
12
|
|
|
13
|
-
destination: null as
|
|
13
|
+
destination: null as CustomTrapdoorDestination | null,
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
level: {
|
package/src/index.ts
CHANGED
|
@@ -22,8 +22,8 @@ export { registerCharacterStats } from "./features/characterStats";
|
|
|
22
22
|
export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
|
|
23
23
|
export { initCustomDoor, spawnCustomDoor } from "./features/customDoor";
|
|
24
24
|
export {
|
|
25
|
-
removeCustomGridEntity
|
|
26
|
-
spawnCustomGridEntity
|
|
25
|
+
removeCustomGridEntity,
|
|
26
|
+
spawnCustomGridEntity,
|
|
27
27
|
} from "./features/customGridEntity";
|
|
28
28
|
export * from "./features/customStage/exports";
|
|
29
29
|
export * from "./features/customTrapdoor/exports";
|
|
@@ -204,5 +204,4 @@ export * from "./types/PickupIndex";
|
|
|
204
204
|
export * from "./types/PlayerIndex";
|
|
205
205
|
export * from "./types/PossibleStatType";
|
|
206
206
|
export * from "./types/SerializedIsaacAPIClass";
|
|
207
|
-
export * from "./types/TrapdoorDestination";
|
|
208
207
|
export * from "./types/TSTLClass";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomTrapdoorDestination } from "./CustomTrapdoorDestination";
|
|
2
2
|
|
|
3
3
|
export interface CustomTrapdoorDescription {
|
|
4
4
|
open: boolean;
|
|
5
|
-
destination:
|
|
5
|
+
destination: CustomTrapdoorDestination;
|
|
6
6
|
firstSpawn: boolean;
|
|
7
7
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* - If the destination is a custom stage, then `vanillaStage` and `vanillaStageType` will be
|
|
5
|
+
* undefined.
|
|
6
|
+
* - If the destination is a vanilla stage, then `customStageName` and `customStageFloorNum` will be
|
|
7
|
+
* undefined.
|
|
8
|
+
*/
|
|
9
|
+
export interface CustomTrapdoorDestination {
|
|
10
|
+
customStageName?: string;
|
|
11
|
+
customStageFloorNum?: int;
|
|
12
|
+
vanillaStage?: LevelStage;
|
|
13
|
+
vanillaStageType?: StageType;
|
|
14
|
+
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
-
/**
|
|
3
|
-
* This is the type that you need to specify when using the `spawnCustomTrapdoor` helper function.
|
|
4
|
-
*/
|
|
5
|
-
export declare type TrapdoorDestination = [stage: LevelStage, stageType: StageType] | [customStageName: string, floorNum: int];
|
|
6
|
-
//# sourceMappingURL=TrapdoorDestination.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrapdoorDestination.d.ts","sourceRoot":"","sources":["../../src/types/TrapdoorDestination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAErE;;GAEG;AACH,oBAAY,mBAAmB,GAC3B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,GACzC,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is the type that you need to specify when using the `spawnCustomTrapdoor` helper function.
|
|
5
|
-
*/
|
|
6
|
-
export type TrapdoorDestination =
|
|
7
|
-
| [stage: LevelStage, stageType: StageType]
|
|
8
|
-
| [customStageName: string, floorNum: int];
|