isaacscript-common 4.2.8 → 4.3.2
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/enums/StageTravelEntityState.d.ts +4 -0
- package/enums/StageTravelEntityState.lua +7 -0
- package/enums/StageTravelState.d.ts +6 -0
- package/enums/StageTravelState.lua +11 -0
- package/features/{getCollectibleItemPoolType.d.ts → collectibleItemPoolType.d.ts} +0 -0
- package/features/{getCollectibleItemPoolType.lua → collectibleItemPoolType.lua} +2 -2
- package/features/customTrapdoor/constants.d.ts +5 -0
- package/features/customTrapdoor/constants.lua +7 -0
- package/features/customTrapdoor/exports.d.ts +37 -0
- package/features/customTrapdoor/exports.lua +120 -0
- package/features/customTrapdoor/init.d.ts +1 -0
- package/features/customTrapdoor/init.lua +11 -0
- package/features/{stageTravel → customTrapdoor}/stageTravel.d.ts +0 -0
- package/features/{stageTravel → customTrapdoor}/stageTravel.lua +0 -0
- package/features/{stageTravel → customTrapdoor}/trapdoor.d.ts +0 -0
- package/features/{stageTravel → customTrapdoor}/trapdoor.lua +0 -0
- package/features/customTrapdoor/v.d.ts +14 -0
- package/features/customTrapdoor/v.lua +16 -0
- package/features/extraConsoleCommands/commandsSubroutines.d.ts +1 -1
- package/features/extraConsoleCommands/commandsSubroutines.lua +1 -1
- package/features/extraConsoleCommands/init.lua +1 -1
- package/features/extraConsoleCommands/listCommands.d.ts +3 -3
- package/features/extraConsoleCommands/listCommands.lua +6 -6
- package/features/ponyDetection.d.ts +6 -1
- package/features/ponyDetection.lua +14 -1
- package/features/roomClearFrame.d.ts +11 -0
- package/features/roomClearFrame.lua +38 -0
- package/features/stageHistory.d.ts +15 -0
- package/features/stageHistory.lua +62 -0
- package/functions/gridEntity.d.ts +5 -0
- package/functions/gridEntity.lua +9 -0
- package/functions/gridEntitySpecific.d.ts +11 -6
- package/functions/gridEntitySpecific.lua +18 -0
- package/functions/log.lua +7 -1
- package/functions/nextStage.d.ts +18 -0
- package/functions/nextStage.lua +245 -0
- package/functions/rooms.d.ts +2 -2
- package/functions/rooms.lua +2 -2
- package/functions/stage.d.ts +10 -0
- package/functions/stage.lua +28 -0
- package/index.d.ts +9 -5
- package/index.lua +58 -20
- package/initFeatures.lua +12 -3
- package/interfaces/StageTravelEntityDescription.d.ts +5 -0
- package/interfaces/StageTravelEntityDescription.lua +2 -0
- package/objects/roomTypeNames.lua +1 -1
- package/package.json +2 -2
- package/enums/StageTravelEntityType.d.ts +0 -5
- package/enums/StageTravelEntityType.lua +0 -9
- package/features/stageTravel/exports.d.ts +0 -23
- package/features/stageTravel/exports.lua +0 -44
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.StageTravelEntityState = {}
|
|
3
|
+
____exports.StageTravelEntityState.OPEN = 0
|
|
4
|
+
____exports.StageTravelEntityState[____exports.StageTravelEntityState.OPEN] = "OPEN"
|
|
5
|
+
____exports.StageTravelEntityState.CLOSED = 1
|
|
6
|
+
____exports.StageTravelEntityState[____exports.StageTravelEntityState.CLOSED] = "CLOSED"
|
|
7
|
+
return ____exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.StageTravelState = {}
|
|
3
|
+
____exports.StageTravelState.DISABLED = 0
|
|
4
|
+
____exports.StageTravelState[____exports.StageTravelState.DISABLED] = "DISABLED"
|
|
5
|
+
____exports.StageTravelState.FADING_TO_BLACK = 1
|
|
6
|
+
____exports.StageTravelState[____exports.StageTravelState.FADING_TO_BLACK] = "FADING_TO_BLACK"
|
|
7
|
+
____exports.StageTravelState.GOING_TO_NEW_FLOOR = 2
|
|
8
|
+
____exports.StageTravelState[____exports.StageTravelState.GOING_TO_NEW_FLOOR] = "GOING_TO_NEW_FLOOR"
|
|
9
|
+
____exports.StageTravelState.FADING_IN = 3
|
|
10
|
+
____exports.StageTravelState[____exports.StageTravelState.FADING_IN] = "FADING_IN"
|
|
11
|
+
return ____exports
|
|
File without changes
|
|
@@ -28,8 +28,8 @@ local FEATURE_NAME = "get collectible item pool type"
|
|
|
28
28
|
v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
|
|
29
29
|
---
|
|
30
30
|
-- @internal
|
|
31
|
-
function ____exports.
|
|
32
|
-
saveDataManager(nil, "
|
|
31
|
+
function ____exports.collectibleItemPoolTypeInit(self, mod)
|
|
32
|
+
saveDataManager(nil, "collectibleItemPoolType", v)
|
|
33
33
|
mod:AddCallback(ModCallback.POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.COLLECTIBLE)
|
|
34
34
|
end
|
|
35
35
|
--- Helper function to get the item pool type that a given collectible came from. Since there is no
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const STAGE_TRAVEL_FEATURE_NAME = "stageTravel";
|
|
2
|
+
/** This also applies to crawl spaces. The value was determined through trial and error. */
|
|
3
|
+
export declare const TRAPDOOR_OPEN_DISTANCE = 60;
|
|
4
|
+
export declare const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS: number;
|
|
5
|
+
export declare const TRAPDOOR_BOSS_REACTION_FRAMES = 30;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.STAGE_TRAVEL_FEATURE_NAME = "stageTravel"
|
|
3
|
+
--- This also applies to crawl spaces. The value was determined through trial and error.
|
|
4
|
+
____exports.TRAPDOOR_OPEN_DISTANCE = 60
|
|
5
|
+
____exports.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____exports.TRAPDOOR_OPEN_DISTANCE * 2.5
|
|
6
|
+
____exports.TRAPDOOR_BOSS_REACTION_FRAMES = 30
|
|
7
|
+
return ____exports
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to spawn a trapdoor grid entity that will have one or more of the following
|
|
4
|
+
* attributes:
|
|
5
|
+
*
|
|
6
|
+
* - custom destination (or custom logic for after the player enters)
|
|
7
|
+
* - custom graphics
|
|
8
|
+
* - custom logic for opening/closing
|
|
9
|
+
* - TODO: animation
|
|
10
|
+
*
|
|
11
|
+
* You can use this function to take the player to your custom stage. (See the `registerCustomStage`
|
|
12
|
+
* helper function.)
|
|
13
|
+
*
|
|
14
|
+
* Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
|
|
15
|
+
* respawned every time the player re-enters the room.
|
|
16
|
+
*
|
|
17
|
+
* @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
18
|
+
* @param _destination Used to specify where the player will go after jumping into the trapdoor. Can
|
|
19
|
+
* either be a tuple containing the stage and stage type, a string containing
|
|
20
|
+
* the name of a custom stage, or a function that returns one of these things.
|
|
21
|
+
* You can also specify a function that returns undefined in order to perform
|
|
22
|
+
* some custom behavior and/or handle the traveling part yourself. By default,
|
|
23
|
+
* the destination will be set to the next floor like that of a vanilla
|
|
24
|
+
* trapdoor.
|
|
25
|
+
* @param _anm2 Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of
|
|
26
|
+
* "gfx/grid/door_11_trapdoor.anm2" will be used.
|
|
27
|
+
* @param _shouldOpenFunc Optional. If the trapdoor is currently closed, this function will run on
|
|
28
|
+
* every frame to determine if it should open. By default, a function that
|
|
29
|
+
* emulates a vanilla trapdoor will be used.
|
|
30
|
+
* @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
|
|
31
|
+
* every frame to determine if it should close. By default, a function that
|
|
32
|
+
* emulates a vanilla trapdoor will be used.
|
|
33
|
+
* @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
|
|
34
|
+
* a boolean or a function returning a boolean. By default, a function that
|
|
35
|
+
* emulates a vanilla trapdoor will be used.
|
|
36
|
+
*/
|
|
37
|
+
export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, _destination?: [stage: LevelStage, stageType: StageType] | string | ((gridEntity: GridEntity) => [stage: LevelStage, stageType: StageType] | string | undefined), _anm2?: string, _shouldOpenFunc?: (gridEntity: GridEntity) => boolean, _shouldCloseFunc?: (gridEntity: GridEntity) => boolean, _spawnOpen?: boolean | ((gridEntity: GridEntity) => boolean)): GridEntity;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local defaultDestinationFunc, defaultShouldOpenFunc, isPlayerCloseAfterBoss, shouldBeClosedFromStartingInRoomWithEnemies, defaultShouldCloseFunc, defaultShouldSpawnOpenFunc
|
|
3
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
|
+
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
5
|
+
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
6
|
+
local ____cachedClasses = require("cachedClasses")
|
|
7
|
+
local game = ____cachedClasses.game
|
|
8
|
+
local ____gridEntity = require("functions.gridEntity")
|
|
9
|
+
local spawnGrid = ____gridEntity.spawnGrid
|
|
10
|
+
local ____nextStage = require("functions.nextStage")
|
|
11
|
+
local getNextStage = ____nextStage.getNextStage
|
|
12
|
+
local getNextStageType = ____nextStage.getNextStageType
|
|
13
|
+
local ____positionVelocity = require("functions.positionVelocity")
|
|
14
|
+
local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
|
|
15
|
+
local ____roomClearFrame = require("features.roomClearFrame")
|
|
16
|
+
local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
|
|
17
|
+
local ____constants = require("features.customTrapdoor.constants")
|
|
18
|
+
local TRAPDOOR_BOSS_REACTION_FRAMES = ____constants.TRAPDOOR_BOSS_REACTION_FRAMES
|
|
19
|
+
local TRAPDOOR_OPEN_DISTANCE = ____constants.TRAPDOOR_OPEN_DISTANCE
|
|
20
|
+
local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____constants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
|
|
21
|
+
local ____v = require("features.customTrapdoor.v")
|
|
22
|
+
local getCustomTrapdoorDescription = ____v.getCustomTrapdoorDescription
|
|
23
|
+
function defaultDestinationFunc(self)
|
|
24
|
+
local nextStage = getNextStage(nil)
|
|
25
|
+
local nextStageType = getNextStageType(nil)
|
|
26
|
+
return {nextStage, nextStageType}
|
|
27
|
+
end
|
|
28
|
+
function defaultShouldOpenFunc(self, gridEntity)
|
|
29
|
+
local entityDescription = getCustomTrapdoorDescription(nil, gridEntity)
|
|
30
|
+
if entityDescription == nil then
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
local room = game:GetRoom()
|
|
34
|
+
local roomClear = room:IsClear()
|
|
35
|
+
return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not isPlayerCloseAfterBoss(nil, gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, entityDescription.initial, roomClear)
|
|
36
|
+
end
|
|
37
|
+
function isPlayerCloseAfterBoss(self, position)
|
|
38
|
+
local gameFrameCount = game:GetFrameCount()
|
|
39
|
+
local room = game:GetRoom()
|
|
40
|
+
local roomType = room:GetType()
|
|
41
|
+
local roomClearGameFrame = getRoomClearGameFrame(nil)
|
|
42
|
+
if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or gameFrameCount >= roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES then
|
|
43
|
+
return false
|
|
44
|
+
end
|
|
45
|
+
return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
|
|
46
|
+
end
|
|
47
|
+
function shouldBeClosedFromStartingInRoomWithEnemies(self, initial, roomClear)
|
|
48
|
+
return initial and not roomClear
|
|
49
|
+
end
|
|
50
|
+
function defaultShouldCloseFunc(self)
|
|
51
|
+
return false
|
|
52
|
+
end
|
|
53
|
+
function defaultShouldSpawnOpenFunc(self, gridEntity)
|
|
54
|
+
local room = game:GetRoom()
|
|
55
|
+
local roomFrameCount = room:GetFrameCount()
|
|
56
|
+
local roomClear = room:IsClear()
|
|
57
|
+
if roomFrameCount > 0 then
|
|
58
|
+
return false
|
|
59
|
+
end
|
|
60
|
+
if not roomClear then
|
|
61
|
+
return false
|
|
62
|
+
end
|
|
63
|
+
return defaultShouldOpenFunc(nil, gridEntity)
|
|
64
|
+
end
|
|
65
|
+
--- Helper function to spawn a trapdoor grid entity that will have one or more of the following
|
|
66
|
+
-- attributes:
|
|
67
|
+
--
|
|
68
|
+
-- - custom destination (or custom logic for after the player enters)
|
|
69
|
+
-- - custom graphics
|
|
70
|
+
-- - custom logic for opening/closing
|
|
71
|
+
-- - TODO: animation
|
|
72
|
+
--
|
|
73
|
+
-- You can use this function to take the player to your custom stage. (See the `registerCustomStage`
|
|
74
|
+
-- helper function.)
|
|
75
|
+
--
|
|
76
|
+
-- Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
|
|
77
|
+
-- respawned every time the player re-enters the room.
|
|
78
|
+
--
|
|
79
|
+
-- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
80
|
+
-- @param _destination Used to specify where the player will go after jumping into the trapdoor. Can
|
|
81
|
+
-- either be a tuple containing the stage and stage type, a string containing
|
|
82
|
+
-- the name of a custom stage, or a function that returns one of these things.
|
|
83
|
+
-- You can also specify a function that returns undefined in order to perform
|
|
84
|
+
-- some custom behavior and/or handle the traveling part yourself. By default,
|
|
85
|
+
-- the destination will be set to the next floor like that of a vanilla
|
|
86
|
+
-- trapdoor.
|
|
87
|
+
-- @param _anm2 Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of
|
|
88
|
+
-- "gfx/grid/door_11_trapdoor.anm2" will be used.
|
|
89
|
+
-- @param _shouldOpenFunc Optional. If the trapdoor is currently closed, this function will run on
|
|
90
|
+
-- every frame to determine if it should open. By default, a function that
|
|
91
|
+
-- emulates a vanilla trapdoor will be used.
|
|
92
|
+
-- @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
|
|
93
|
+
-- every frame to determine if it should close. By default, a function that
|
|
94
|
+
-- emulates a vanilla trapdoor will be used.
|
|
95
|
+
-- @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
|
|
96
|
+
-- a boolean or a function returning a boolean. By default, a function that
|
|
97
|
+
-- emulates a vanilla trapdoor will be used.
|
|
98
|
+
function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, _destination, _anm2, _shouldOpenFunc, _shouldCloseFunc, _spawnOpen)
|
|
99
|
+
if _destination == nil then
|
|
100
|
+
_destination = defaultDestinationFunc
|
|
101
|
+
end
|
|
102
|
+
if _anm2 == nil then
|
|
103
|
+
_anm2 = "gfx/grid/door_11_trapdoor.anm2"
|
|
104
|
+
end
|
|
105
|
+
if _shouldOpenFunc == nil then
|
|
106
|
+
_shouldOpenFunc = defaultShouldOpenFunc
|
|
107
|
+
end
|
|
108
|
+
if _shouldCloseFunc == nil then
|
|
109
|
+
_shouldCloseFunc = defaultShouldCloseFunc
|
|
110
|
+
end
|
|
111
|
+
if _spawnOpen == nil then
|
|
112
|
+
_spawnOpen = defaultShouldSpawnOpenFunc
|
|
113
|
+
end
|
|
114
|
+
local decoration = spawnGrid(nil, GridEntityType.DECORATION, gridIndexOrPosition)
|
|
115
|
+
if decoration == nil then
|
|
116
|
+
error("Failed to spawn a custom trapdoor.")
|
|
117
|
+
end
|
|
118
|
+
return decoration
|
|
119
|
+
end
|
|
120
|
+
return ____exports
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stageTravelInit(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
3
|
+
local saveDataManager = ____exports.saveDataManager
|
|
4
|
+
local ____constants = require("features.customTrapdoor.constants")
|
|
5
|
+
local STAGE_TRAVEL_FEATURE_NAME = ____constants.STAGE_TRAVEL_FEATURE_NAME
|
|
6
|
+
local ____v = require("features.customTrapdoor.v")
|
|
7
|
+
local v = ____v.default
|
|
8
|
+
function ____exports.stageTravelInit(self)
|
|
9
|
+
saveDataManager(nil, STAGE_TRAVEL_FEATURE_NAME, v)
|
|
10
|
+
end
|
|
11
|
+
return ____exports
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { StageTravelState } from "../../enums/StageTravelState";
|
|
3
|
+
import { StageTravelEntityDescription } from "../../interfaces/StageTravelEntityDescription";
|
|
4
|
+
declare const v: {
|
|
5
|
+
run: {
|
|
6
|
+
state: StageTravelState;
|
|
7
|
+
};
|
|
8
|
+
room: {
|
|
9
|
+
/** Indexed by grid index. */
|
|
10
|
+
trapdoors: Map<number, StageTravelEntityDescription>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default v;
|
|
14
|
+
export declare function getCustomTrapdoorDescription(gridEntity: GridEntity): StageTravelEntityDescription | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____StageTravelState = require("enums.StageTravelState")
|
|
6
|
+
local StageTravelState = ____StageTravelState.StageTravelState
|
|
7
|
+
local v = {
|
|
8
|
+
run = {state = StageTravelState.DISABLED},
|
|
9
|
+
room = {trapdoors = __TS__New(Map)}
|
|
10
|
+
}
|
|
11
|
+
____exports.default = v
|
|
12
|
+
function ____exports.getCustomTrapdoorDescription(self, gridEntity)
|
|
13
|
+
local gridIndex = gridEntity:GetGridIndex()
|
|
14
|
+
return v.room.trapdoors:get(gridIndex)
|
|
15
|
+
end
|
|
16
|
+
return ____exports
|
|
@@ -5,5 +5,5 @@ export declare function devilAngel(useDevil: boolean): void;
|
|
|
5
5
|
export declare function listEntities(params: string, includeBackgroundEffects: boolean): void;
|
|
6
6
|
export declare function listGridEntities(params: string, includeWalls: boolean): void;
|
|
7
7
|
export declare function movePlayer(params: string, direction: Direction): void;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function spawnTrapdoorOrCrawlSpace(trapdoor: boolean): void;
|
|
9
9
|
export declare function warpToRoomType(roomType: RoomType): void;
|
|
@@ -98,7 +98,7 @@ function ____exports.movePlayer(self, params, direction)
|
|
|
98
98
|
local modifiedVector = vector * amount
|
|
99
99
|
player.Position = player.Position + modifiedVector
|
|
100
100
|
end
|
|
101
|
-
function ____exports.
|
|
101
|
+
function ____exports.spawnTrapdoorOrCrawlSpace(self, trapdoor)
|
|
102
102
|
local room = game:GetRoom()
|
|
103
103
|
local player = Isaac.GetPlayer()
|
|
104
104
|
local position = room:FindFreeTilePosition(player.Position, 0)
|
|
@@ -146,7 +146,7 @@ commandFunctionsMap:set("charge", commands.charge)
|
|
|
146
146
|
commandFunctionsMap:set("cleanBedroom", commands.cleanBedroom)
|
|
147
147
|
commandFunctionsMap:set("coin", commands.coin)
|
|
148
148
|
commandFunctionsMap:set("coins", commands.coins)
|
|
149
|
-
commandFunctionsMap:set("
|
|
149
|
+
commandFunctionsMap:set("crawlSpace", commands.crawlSpace)
|
|
150
150
|
commandFunctionsMap:set("d20", commands.d20)
|
|
151
151
|
commandFunctionsMap:set("d6", commands.d6)
|
|
152
152
|
commandFunctionsMap:set("damage", commands.damage)
|
|
@@ -90,8 +90,8 @@ export declare function coin(params: string): void;
|
|
|
90
90
|
* to remove coins.)
|
|
91
91
|
*/
|
|
92
92
|
export declare function coins(params: string): void;
|
|
93
|
-
/** Creates a
|
|
94
|
-
export declare function
|
|
93
|
+
/** Creates a crawl space next to the player. */
|
|
94
|
+
export declare function crawlSpace(): void;
|
|
95
95
|
/** Uses the D20. */
|
|
96
96
|
export declare function d20(): void;
|
|
97
97
|
/** Uses the D6. */
|
|
@@ -111,7 +111,7 @@ export declare function dirtyBedroom(): void;
|
|
|
111
111
|
export declare function disableCurses(): void;
|
|
112
112
|
/** Moves the player 0.5 units down. Provide a number to move a custom amount of units. */
|
|
113
113
|
export declare function down(params: string): void;
|
|
114
|
-
/** Warps to the Dungeon (i.e.
|
|
114
|
+
/** Warps to the Dungeon (i.e. crawl space) for the floor. */
|
|
115
115
|
export declare function dungeon(): void;
|
|
116
116
|
/** Logs the player's current temporary effects to the "log.txt" file. */
|
|
117
117
|
export declare function effects(): void;
|
|
@@ -93,7 +93,7 @@ local devilAngel = ____commandsSubroutines.devilAngel
|
|
|
93
93
|
local listEntities = ____commandsSubroutines.listEntities
|
|
94
94
|
local listGridEntities = ____commandsSubroutines.listGridEntities
|
|
95
95
|
local movePlayer = ____commandsSubroutines.movePlayer
|
|
96
|
-
local
|
|
96
|
+
local spawnTrapdoorOrCrawlSpace = ____commandsSubroutines.spawnTrapdoorOrCrawlSpace
|
|
97
97
|
local warpToRoomType = ____commandsSubroutines.warpToRoomType
|
|
98
98
|
local ____v = require("features.extraConsoleCommands.v")
|
|
99
99
|
local v = ____v.default
|
|
@@ -466,9 +466,9 @@ function ____exports.coins(self, params)
|
|
|
466
466
|
local player = Isaac.GetPlayer()
|
|
467
467
|
player:AddCoins(numCoins)
|
|
468
468
|
end
|
|
469
|
-
--- Creates a
|
|
470
|
-
function ____exports.
|
|
471
|
-
|
|
469
|
+
--- Creates a crawl space next to the player.
|
|
470
|
+
function ____exports.crawlSpace(self)
|
|
471
|
+
spawnTrapdoorOrCrawlSpace(nil, false)
|
|
472
472
|
end
|
|
473
473
|
--- Uses the D20.
|
|
474
474
|
function ____exports.d20(self)
|
|
@@ -502,7 +502,7 @@ end
|
|
|
502
502
|
function ____exports.down(self, params)
|
|
503
503
|
movePlayer(nil, params, Direction.DOWN)
|
|
504
504
|
end
|
|
505
|
-
--- Warps to the Dungeon (i.e.
|
|
505
|
+
--- Warps to the Dungeon (i.e. crawl space) for the floor.
|
|
506
506
|
function ____exports.dungeon(self)
|
|
507
507
|
changeRoom(nil, GridRoom.DUNGEON)
|
|
508
508
|
end
|
|
@@ -1050,7 +1050,7 @@ function ____exports.tears(self)
|
|
|
1050
1050
|
end
|
|
1051
1051
|
--- Creates a trapdoor next to the player.
|
|
1052
1052
|
function ____exports.trapdoorCommand(self)
|
|
1053
|
-
|
|
1053
|
+
spawnTrapdoorOrCrawlSpace(nil, true)
|
|
1054
1054
|
end
|
|
1055
1055
|
--- Warps to the first Treasure Room on the floor.
|
|
1056
1056
|
function ____exports.treasure(self)
|
|
@@ -3,4 +3,9 @@
|
|
|
3
3
|
* Helper function to see if the player is under the effects of A Pony or White Pony charge.
|
|
4
4
|
* Detecting this is difficult, as the temporary effect will disappear upon entering a new room.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function isPlayerUsingPony(player: EntityPlayer): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to see if any player is under the effects of A Pony or White Pony charge.
|
|
9
|
+
* Detecting this is difficult, as the temporary effect will disappear upon entering a new room.
|
|
10
|
+
*/
|
|
11
|
+
export declare function anyPlayerUsingPony(): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local postPEffectUpdateReordered, FLAGS_WHEN_PONY_IS_ACTIVE, v
|
|
6
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -16,6 +17,8 @@ local ____playerDataStructures = require("functions.playerDataStructures")
|
|
|
16
17
|
local setAddPlayer = ____playerDataStructures.setAddPlayer
|
|
17
18
|
local setDeletePlayer = ____playerDataStructures.setDeletePlayer
|
|
18
19
|
local setHasPlayer = ____playerDataStructures.setHasPlayer
|
|
20
|
+
local ____playerIndex = require("functions.playerIndex")
|
|
21
|
+
local getPlayers = ____playerIndex.getPlayers
|
|
19
22
|
local ____exports = require("features.saveDataManager.exports")
|
|
20
23
|
local saveDataManager = ____exports.saveDataManager
|
|
21
24
|
function postPEffectUpdateReordered(self, player)
|
|
@@ -46,8 +49,18 @@ function ____exports.ponyDetectionInit(self, mod)
|
|
|
46
49
|
end
|
|
47
50
|
--- Helper function to see if the player is under the effects of A Pony or White Pony charge.
|
|
48
51
|
-- Detecting this is difficult, as the temporary effect will disappear upon entering a new room.
|
|
49
|
-
function ____exports.
|
|
52
|
+
function ____exports.isPlayerUsingPony(self, player)
|
|
50
53
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
51
54
|
return setHasPlayer(nil, v.run.playersIsPonyActive, player)
|
|
52
55
|
end
|
|
56
|
+
--- Helper function to see if any player is under the effects of A Pony or White Pony charge.
|
|
57
|
+
-- Detecting this is difficult, as the temporary effect will disappear upon entering a new room.
|
|
58
|
+
function ____exports.anyPlayerUsingPony(self)
|
|
59
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
60
|
+
local players = getPlayers(nil)
|
|
61
|
+
return __TS__ArraySome(
|
|
62
|
+
players,
|
|
63
|
+
function(____, player) return ____exports.isPlayerUsingPony(nil, player) end
|
|
64
|
+
)
|
|
65
|
+
end
|
|
53
66
|
return ____exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get the game frame (i.e. `Game.GetFrameCount`) of the last time that this room
|
|
4
|
+
* was cleared. Returns undefined if the room has never been cleared.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRoomClearGameFrame(): int | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to get the room frame (i.e. `Room.GetFrameCount`) of the last time that this room
|
|
9
|
+
* was cleared. Returns undefined if the room has never been cleared.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRoomClearRoomFrame(): int | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local postRoomClearChangedTrue, v
|
|
3
|
+
local ____cachedClasses = require("cachedClasses")
|
|
4
|
+
local game = ____cachedClasses.game
|
|
5
|
+
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
6
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
7
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
8
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
9
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
10
|
+
local saveDataManager = ____exports.saveDataManager
|
|
11
|
+
function postRoomClearChangedTrue(self)
|
|
12
|
+
local gameFrameCount = game:GetFrameCount()
|
|
13
|
+
local room = game:GetRoom()
|
|
14
|
+
local roomFrameCount = room:GetFrameCount()
|
|
15
|
+
v.room.roomClearGameFrame = gameFrameCount
|
|
16
|
+
v.room.roomClearRoomFrame = roomFrameCount
|
|
17
|
+
end
|
|
18
|
+
local FEATURE_NAME = "room clear frame"
|
|
19
|
+
v = {room = {roomClearGameFrame = nil, roomClearRoomFrame = nil}}
|
|
20
|
+
---
|
|
21
|
+
-- @internal
|
|
22
|
+
function ____exports.roomClearFrameInit(self, mod)
|
|
23
|
+
saveDataManager(nil, "roomClearFrame", v)
|
|
24
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_ROOM_CLEAR_CHANGED, postRoomClearChangedTrue, true)
|
|
25
|
+
end
|
|
26
|
+
--- Helper function to get the game frame (i.e. `Game.GetFrameCount`) of the last time that this room
|
|
27
|
+
-- was cleared. Returns undefined if the room has never been cleared.
|
|
28
|
+
function ____exports.getRoomClearGameFrame(self)
|
|
29
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
30
|
+
return v.room.roomClearGameFrame
|
|
31
|
+
end
|
|
32
|
+
--- Helper function to get the room frame (i.e. `Room.GetFrameCount`) of the last time that this room
|
|
33
|
+
-- was cleared. Returns undefined if the room has never been cleared.
|
|
34
|
+
function ____exports.getRoomClearRoomFrame(self)
|
|
35
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
36
|
+
return v.room.roomClearGameFrame
|
|
37
|
+
end
|
|
38
|
+
return ____exports
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
2
|
+
/** Helper function to get all of the stages that a player has visited thus far on this run. */
|
|
3
|
+
export declare function getStageHistory(): ReadonlyArray<[
|
|
4
|
+
stage: LevelStage,
|
|
5
|
+
stageType: StageType
|
|
6
|
+
]>;
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to check if a player has previous visited a particular stage (or stage + stage
|
|
9
|
+
* type combination) on this run.
|
|
10
|
+
*
|
|
11
|
+
* @param stage The stage to check for.
|
|
12
|
+
* @param stageType Optional. If provided, will check for a specific stage and stage type
|
|
13
|
+
* combination.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasVisitedStage(stage: LevelStage, stageType?: StageType): boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local postNewLevelReordered, v
|
|
5
|
+
local ____cachedClasses = require("cachedClasses")
|
|
6
|
+
local game = ____cachedClasses.game
|
|
7
|
+
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
8
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
9
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
10
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
11
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
12
|
+
local saveDataManager = ____exports.saveDataManager
|
|
13
|
+
function postNewLevelReordered(self)
|
|
14
|
+
local level = game:GetLevel()
|
|
15
|
+
local stage = level:GetStage()
|
|
16
|
+
local stageType = level:GetStageType()
|
|
17
|
+
local ____v_run_stageHistory_0 = v.run.stageHistory
|
|
18
|
+
____v_run_stageHistory_0[#____v_run_stageHistory_0 + 1] = {stage, stageType}
|
|
19
|
+
end
|
|
20
|
+
local FEATURE_NAME = "stage history"
|
|
21
|
+
v = {run = {stageHistory = {}}}
|
|
22
|
+
---
|
|
23
|
+
-- @internal
|
|
24
|
+
function ____exports.stageHistoryInit(self, mod)
|
|
25
|
+
saveDataManager(nil, "stageHistory", v)
|
|
26
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_LEVEL_REORDERED, postNewLevelReordered)
|
|
27
|
+
end
|
|
28
|
+
--- Helper function to get all of the stages that a player has visited thus far on this run.
|
|
29
|
+
function ____exports.getStageHistory(self)
|
|
30
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
31
|
+
return v.run.stageHistory
|
|
32
|
+
end
|
|
33
|
+
--- Helper function to check if a player has previous visited a particular stage (or stage + stage
|
|
34
|
+
-- type combination) on this run.
|
|
35
|
+
--
|
|
36
|
+
-- @param stage The stage to check for.
|
|
37
|
+
-- @param stageType Optional. If provided, will check for a specific stage and stage type
|
|
38
|
+
-- combination.
|
|
39
|
+
function ____exports.hasVisitedStage(self, stage, stageType)
|
|
40
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
41
|
+
if stageType == nil then
|
|
42
|
+
return __TS__ArraySome(
|
|
43
|
+
v.run.stageHistory,
|
|
44
|
+
function(____, ____bindingPattern0)
|
|
45
|
+
local previousStage
|
|
46
|
+
previousStage = ____bindingPattern0[1]
|
|
47
|
+
return previousStage == stage
|
|
48
|
+
end
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
return __TS__ArraySome(
|
|
52
|
+
v.run.stageHistory,
|
|
53
|
+
function(____, ____bindingPattern0)
|
|
54
|
+
local previousStageType
|
|
55
|
+
local previousStage
|
|
56
|
+
previousStage = ____bindingPattern0[1]
|
|
57
|
+
previousStageType = ____bindingPattern0[2]
|
|
58
|
+
return previousStage == stage and previousStageType == stageType
|
|
59
|
+
end
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
return ____exports
|
|
@@ -48,6 +48,11 @@ export declare function getGridEntities(...gridEntityTypes: GridEntityType[]): G
|
|
|
48
48
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
49
49
|
/** Helper function to return a string containing the grid entity's type and variant. */
|
|
50
50
|
export declare function getGridEntityID(gridEntity: GridEntity): string;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to get all of the grid entities in the room that specifically match the type and
|
|
53
|
+
* variant provided.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getMatchingGridEntities(gridEntityType: GridEntityType, variant: int): GridEntity[];
|
|
51
56
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
52
57
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
53
58
|
/**
|
package/functions/gridEntity.lua
CHANGED
|
@@ -214,6 +214,15 @@ function ____exports.getGridEntityID(self, gridEntity)
|
|
|
214
214
|
local gridEntityVariant = gridEntity:GetVariant()
|
|
215
215
|
return (tostring(gridEntityType) .. ".") .. tostring(gridEntityVariant)
|
|
216
216
|
end
|
|
217
|
+
--- Helper function to get all of the grid entities in the room that specifically match the type and
|
|
218
|
+
-- variant provided.
|
|
219
|
+
function ____exports.getMatchingGridEntities(self, gridEntityType, variant)
|
|
220
|
+
local gridEntities = ____exports.getGridEntities(nil, gridEntityType)
|
|
221
|
+
return __TS__ArrayFilter(
|
|
222
|
+
gridEntities,
|
|
223
|
+
function(____, gridEntity) return gridEntity:GetVariant() == variant end
|
|
224
|
+
)
|
|
225
|
+
end
|
|
217
226
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
218
227
|
local room = game:GetRoom()
|
|
219
228
|
local gridWidth = room:GetGridWidth()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { CrawlSpaceState, TrapdoorVariant } from "isaac-typescript-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get all of the grid entities of type `GridEntityType.TRAPDOOR` in the room.
|
|
4
|
+
* Specify a specific trapdoor variant to select only trapdoors of that variant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCrawlSpaces(crawlSpaceVariant?: CrawlSpaceState): GridEntity[];
|
|
7
7
|
/** Helper function to get all of the `GridEntityPit` in the room. */
|
|
8
8
|
export declare function getPits(): GridEntityPit[];
|
|
9
9
|
/** Helper function to get all of the `GridEntityPoop` in the room. */
|
|
@@ -16,6 +16,11 @@ export declare function getRocks(): GridEntityRock[];
|
|
|
16
16
|
export declare function getSpikes(): GridEntitySpikes[];
|
|
17
17
|
/** Helper function to get all of the `GridEntityTNT` in the room. */
|
|
18
18
|
export declare function getTNT(): GridEntityTNT[];
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to get all of the grid entities of type `GridEntityType.TRAPDOOR` in the room.
|
|
21
|
+
* Specify a specific trapdoor variant to select only trapdoors of that variant.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getTrapdoors(trapdoorVariant?: TrapdoorVariant): GridEntity[];
|
|
19
24
|
/**
|
|
20
25
|
* Helper function to determine if all of the pressure plates in the current room are pushed.
|
|
21
26
|
* Returns true if there are no pressure plates in the room.
|