isaacscript-common 6.1.1 → 6.3.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/callbacks/reorderedCallbacks.d.ts +9 -0
- package/callbacks/reorderedCallbacks.lua +9 -0
- package/classes/DefaultMap.lua +2 -2
- package/constants.d.ts +9 -0
- package/constants.lua +7 -0
- package/enums/CornerType.d.ts +6 -0
- package/enums/CornerType.lua +11 -0
- package/features/customStage/backdrop.d.ts +2 -0
- package/features/customStage/backdrop.lua +200 -0
- package/features/customStage/boss.d.ts +2 -0
- package/features/customStage/boss.lua +74 -0
- package/features/customStage/exports.d.ts +4 -2
- package/features/customStage/exports.lua +109 -3
- package/features/customStage/init.d.ts +2 -1
- package/features/customStage/init.lua +63 -4
- package/features/customStage/stageAPIBoss.d.ts +29 -0
- package/features/customStage/stageAPIBoss.lua +9 -0
- package/features/customStage/util.d.ts +11 -0
- package/features/customStage/util.lua +51 -0
- package/features/customStage/v.d.ts +11 -0
- package/features/customStage/v.lua +5 -0
- package/features/debugDisplay/debugDisplay.lua +2 -0
- package/features/debugDisplay/exports.d.ts +108 -0
- package/features/debugDisplay/exports.lua +145 -0
- package/features/debugDisplay/v.d.ts +2 -0
- package/features/debugDisplay/v.lua +9 -0
- package/features/extraConsoleCommands/init.lua +8 -1
- package/features/extraConsoleCommands/listCommands.d.ts +12 -4
- package/features/extraConsoleCommands/listCommands.lua +30 -15
- package/features/extraConsoleCommands/v.d.ts +1 -0
- package/features/extraConsoleCommands/v.lua +2 -1
- package/features/pause.d.ts +11 -0
- package/features/pause.lua +71 -0
- package/features/runNextRoom.d.ts +8 -0
- package/features/runNextRoom.lua +40 -0
- package/functions/chargeBar.lua +4 -6
- package/functions/direction.d.ts +1 -1
- package/functions/doors.d.ts +6 -2
- package/functions/doors.lua +14 -0
- package/functions/familiars.d.ts +2 -0
- package/functions/familiars.lua +16 -0
- package/functions/jsonRoom.d.ts +25 -3
- package/functions/jsonRoom.lua +64 -2
- package/functions/playerCenter.d.ts +10 -0
- package/functions/playerCenter.lua +64 -0
- package/functions/playerIndex.d.ts +3 -0
- package/functions/playerIndex.lua +3 -0
- package/functions/roomShape.d.ts +10 -4
- package/functions/roomShape.lua +15 -2
- package/functions/rooms.d.ts +1 -1
- package/functions/rooms.lua +2 -2
- package/functions/sprite.d.ts +1 -1
- package/functions/sprite.lua +1 -1
- package/functions/stage.d.ts +3 -3
- package/functions/stage.lua +5 -4
- package/functions/trinkets.lua +1 -1
- package/index.d.ts +2 -1
- package/index.lua +10 -0
- package/initFeatures.lua +7 -1
- package/interfaces/Corner.d.ts +6 -0
- package/interfaces/Corner.lua +2 -0
- package/interfaces/CustomStage.d.ts +9 -50
- package/interfaces/CustomStageLua.d.ts +122 -0
- package/interfaces/CustomStageLua.lua +2 -0
- package/objects/roomShapeCorners.d.ts +6 -0
- package/objects/roomShapeCorners.lua +259 -0
- package/objects/roomShapeToBottomRightPosition.d.ts +1 -1
- package/objects/roomShapeToTopLeftPosition.d.ts +1 -1
- package/objects/roomTypeGotoPrefixes.lua +29 -29
- package/package.json +1 -1
- package/sets/narrowRoomShapesSet.d.ts +2 -0
- package/sets/narrowRoomShapesSet.lua +8 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supply a function to run on the next `POST_NEW_ROOM` callback.
|
|
3
|
+
*
|
|
4
|
+
* Note that this function will not handle saving and quitting. If a player saving and quitting
|
|
5
|
+
* before the deferred function fires would cause a bug in your mod, then you should handle deferred
|
|
6
|
+
* functions manually using serializable data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runNextRoom(func: () => void): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local postNewRoomReordered, v
|
|
3
|
+
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
4
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
5
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
6
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
7
|
+
local ____array = require("functions.array")
|
|
8
|
+
local emptyArray = ____array.emptyArray
|
|
9
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
10
|
+
local saveDataManager = ____exports.saveDataManager
|
|
11
|
+
function postNewRoomReordered(self)
|
|
12
|
+
for ____, func in ipairs(v.run.queuedFunctions) do
|
|
13
|
+
func(nil)
|
|
14
|
+
end
|
|
15
|
+
emptyArray(nil, v.run.queuedFunctions)
|
|
16
|
+
end
|
|
17
|
+
local FEATURE_NAME = "runNextRoom"
|
|
18
|
+
v = {run = {queuedFunctions = {}}}
|
|
19
|
+
---
|
|
20
|
+
-- @internal
|
|
21
|
+
function ____exports.runNextRoomInit(self, mod)
|
|
22
|
+
saveDataManager(
|
|
23
|
+
nil,
|
|
24
|
+
FEATURE_NAME,
|
|
25
|
+
v,
|
|
26
|
+
function() return false end
|
|
27
|
+
)
|
|
28
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
29
|
+
end
|
|
30
|
+
--- Supply a function to run on the next `POST_NEW_ROOM` callback.
|
|
31
|
+
--
|
|
32
|
+
-- Note that this function will not handle saving and quitting. If a player saving and quitting
|
|
33
|
+
-- before the deferred function fires would cause a bug in your mod, then you should handle deferred
|
|
34
|
+
-- functions manually using serializable data.
|
|
35
|
+
function ____exports.runNextRoom(self, func)
|
|
36
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
37
|
+
local ____v_run_queuedFunctions_0 = v.run.queuedFunctions
|
|
38
|
+
____v_run_queuedFunctions_0[#____v_run_queuedFunctions_0 + 1] = func
|
|
39
|
+
end
|
|
40
|
+
return ____exports
|
package/functions/chargeBar.lua
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local getChargeBarClamp
|
|
3
|
-
local ____constants = require("constants")
|
|
4
|
-
local VectorZero = ____constants.VectorZero
|
|
5
3
|
function getChargeBarClamp(self, charges, maxCharges)
|
|
6
4
|
local meterMultiplier = 24 / maxCharges
|
|
7
5
|
local meterClip = 26 - charges * meterMultiplier
|
|
@@ -37,11 +35,11 @@ end
|
|
|
37
35
|
--- Helper function to render a charge bar on the screen. First, call the `newChargeBarSprites`
|
|
38
36
|
-- function to initialize the sprites, and then call this function on every render frame.
|
|
39
37
|
function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
|
|
40
|
-
sprites.back:Render(position
|
|
38
|
+
sprites.back:Render(position)
|
|
41
39
|
local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
|
|
42
|
-
sprites.meter:Render(position, normalChargesClamp
|
|
40
|
+
sprites.meter:Render(position, normalChargesClamp)
|
|
43
41
|
local batteryChargesClamp = getChargeBarClamp(nil, batteryCharges, sprites.maxCharges)
|
|
44
|
-
sprites.meterBattery:Render(position, batteryChargesClamp
|
|
45
|
-
sprites.lines:Render(position
|
|
42
|
+
sprites.meterBattery:Render(position, batteryChargesClamp)
|
|
43
|
+
sprites.lines:Render(position)
|
|
46
44
|
end
|
|
47
45
|
return ____exports
|
package/functions/direction.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ import { Direction } from "isaac-typescript-definitions";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function angleToDirection(angleDegrees: int): Direction;
|
|
10
10
|
export declare function directionToDegrees(direction: Direction): int;
|
|
11
|
-
export declare function directionToVector(direction: Direction): Vector
|
|
11
|
+
export declare function directionToVector(direction: Direction): Readonly<Vector>;
|
|
12
12
|
export declare function getDirectionName(direction: Direction): string | undefined;
|
package/functions/doors.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
|
|
|
22
22
|
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
23
23
|
* amount of units.
|
|
24
24
|
*/
|
|
25
|
-
export declare function getDoorEnterPosition(door: GridEntityDoor): Vector
|
|
25
|
+
export declare function getDoorEnterPosition(door: GridEntityDoor): Readonly<Vector>;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to get the offset from a door position that a player will enter a room at.
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
|
|
|
30
30
|
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
31
31
|
* amount of units.
|
|
32
32
|
*/
|
|
33
|
-
export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Vector
|
|
33
|
+
export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Readonly<Vector>;
|
|
34
34
|
/**
|
|
35
35
|
* Helper function to convert an array of door slots or a set of door slots to the resulting bit
|
|
36
36
|
* flag number.
|
|
@@ -53,6 +53,10 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
|
53
53
|
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
54
54
|
export declare function getOppositeDoorSlot(doorSlot: DoorSlot): DoorSlot | undefined;
|
|
55
55
|
export declare function getRepentanceDoor(): GridEntityDoor | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Helper function to get the corresponding door slot for a given room shape and grid coordinates.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getRoomShapeDoorSlot(roomShape: RoomShape, x: int, y: int): DoorSlot | undefined;
|
|
56
60
|
/**
|
|
57
61
|
* Helper function to get the room grid coordinates for a specific room shape and door slot
|
|
58
62
|
* combination.
|
package/functions/doors.lua
CHANGED
|
@@ -5,6 +5,7 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
5
5
|
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
7
7
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
8
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ROOM_ENTRY_OFFSET_FROM_DOOR
|
|
10
11
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -193,6 +194,19 @@ function ____exports.getRepentanceDoor(self)
|
|
|
193
194
|
function(____, door) return ____exports.isRepentanceDoor(nil, door) end
|
|
194
195
|
)
|
|
195
196
|
end
|
|
197
|
+
--- Helper function to get the corresponding door slot for a given room shape and grid coordinates.
|
|
198
|
+
function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
|
|
199
|
+
local coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape]
|
|
200
|
+
for ____, ____value in __TS__Iterator(coordinatesMap:entries()) do
|
|
201
|
+
local doorSlot = ____value[1]
|
|
202
|
+
local doorX = ____value[2][1]
|
|
203
|
+
local doorY = ____value[2][2]
|
|
204
|
+
if x == doorX and y == doorY then
|
|
205
|
+
return doorSlot
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
return nil
|
|
209
|
+
end
|
|
196
210
|
--- Helper function to get the room grid coordinates for a specific room shape and door slot
|
|
197
211
|
-- combination.
|
|
198
212
|
function ____exports.getRoomShapeDoorSlotCoordinates(self, roomShape, doorSlot)
|
package/functions/familiars.d.ts
CHANGED
|
@@ -57,4 +57,6 @@ export declare function checkFamiliar(player: EntityPlayer, collectibleType: Col
|
|
|
57
57
|
* spawn new familiars with a sub-type of 0.
|
|
58
58
|
*/
|
|
59
59
|
export declare function checkFamiliarFromCollectibles(player: EntityPlayer, collectibleType: CollectibleType, familiarVariant: FamiliarVariant, familiarSubType?: int): void;
|
|
60
|
+
/** Helper function to get only the familiars that belong to a specific player. */
|
|
61
|
+
export declare function getPlayerFamiliars(player: EntityPlayer): EntityFamiliar[];
|
|
60
62
|
export declare function isFamiliarThatShootsPlayerTears(familiar: EntityFamiliar): boolean;
|
package/functions/familiars.lua
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
1
3
|
local ____exports = {}
|
|
2
4
|
local ____cachedClasses = require("cachedClasses")
|
|
3
5
|
local itemConfig = ____cachedClasses.itemConfig
|
|
4
6
|
local ____familiarsThatShootPlayerTearsSet = require("sets.familiarsThatShootPlayerTearsSet")
|
|
5
7
|
local FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET = ____familiarsThatShootPlayerTearsSet.FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET
|
|
8
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
9
|
+
local getFamiliars = ____entitySpecific.getFamiliars
|
|
6
10
|
--- Helper function to add and remove familiars based on a target amount that you specify.
|
|
7
11
|
--
|
|
8
12
|
-- This is a convenience wrapper around the `EntityPlayer.CheckFamiliar` method. Use this helper
|
|
@@ -79,6 +83,18 @@ function ____exports.checkFamiliarFromCollectibles(self, player, collectibleType
|
|
|
79
83
|
familiarSubType
|
|
80
84
|
)
|
|
81
85
|
end
|
|
86
|
+
--- Helper function to get only the familiars that belong to a specific player.
|
|
87
|
+
function ____exports.getPlayerFamiliars(self, player)
|
|
88
|
+
local playerPtrHash = GetPtrHash(player)
|
|
89
|
+
local familiars = getFamiliars(nil)
|
|
90
|
+
return __TS__ArrayFilter(
|
|
91
|
+
familiars,
|
|
92
|
+
function(____, familiar)
|
|
93
|
+
local familiarPlayerPtrHash = GetPtrHash(familiar.Player)
|
|
94
|
+
return familiarPlayerPtrHash == playerPtrHash
|
|
95
|
+
end
|
|
96
|
+
)
|
|
97
|
+
end
|
|
82
98
|
function ____exports.isFamiliarThatShootsPlayerTears(self, familiar)
|
|
83
99
|
return FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET:has(familiar.Variant)
|
|
84
100
|
end
|
package/functions/jsonRoom.d.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
1
|
+
import { DoorSlotFlag } from "isaac-typescript-definitions";
|
|
4
2
|
import { JSONRoom } from "../interfaces/JSONRoomsFile";
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to calculate what the resulting `BitFlags<DoorSlotFlag>` value would be for a
|
|
5
|
+
* given JSON room.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getJSONRoomDoorSlotFlags(jsonRoom: JSONRoom): BitFlags<DoorSlotFlag>;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to find a specific room from an array of JSON rooms.
|
|
10
|
+
*
|
|
11
|
+
* @param jsonRooms The array of rooms to search through.
|
|
12
|
+
* @param variant The room variant to select. (The room variant can be thought of as the ID of the
|
|
13
|
+
* room.)
|
|
14
|
+
*/
|
|
5
15
|
export declare function getJSONRoomOfVariant(jsonRooms: JSONRoom[] | readonly JSONRoom[], variant: int): JSONRoom | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to find all of the JSON rooms that match the sub-type provided.
|
|
18
|
+
*
|
|
19
|
+
* @param jsonRooms The array of rooms to search through.
|
|
20
|
+
* @param subType The sub-type to match.
|
|
21
|
+
*/
|
|
6
22
|
export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[] | readonly JSONRoom[], subType: int): JSONRoom[];
|
|
7
23
|
/**
|
|
8
24
|
* Helper function to get a random JSON room from an array of JSON rooms.
|
|
@@ -10,5 +26,11 @@ export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[] | readonly J
|
|
|
10
26
|
* Note that this function does not simply choose a random element in the provided array; it will
|
|
11
27
|
* properly account for each room weight using the algorithm from:
|
|
12
28
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
29
|
+
*
|
|
30
|
+
* @param jsonRooms The array of rooms to random choose between.
|
|
31
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
32
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
33
|
+
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
34
|
+
* what the function is doing. Default is false.
|
|
13
35
|
*/
|
|
14
36
|
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[] | readonly JSONRoom[], seedOrRNG?: Seed | RNG, verbose?: boolean): JSONRoom;
|
package/functions/jsonRoom.lua
CHANGED
|
@@ -3,8 +3,15 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
|
3
3
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local getTotalWeightOfJSONRooms, getJSONRoomWithChosenWeight
|
|
6
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
|
+
local DoorSlotFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlagZero
|
|
6
8
|
local ____array = require("functions.array")
|
|
7
9
|
local sumArray = ____array.sumArray
|
|
10
|
+
local ____doors = require("functions.doors")
|
|
11
|
+
local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
|
|
12
|
+
local getRoomShapeDoorSlot = ____doors.getRoomShapeDoorSlot
|
|
13
|
+
local ____flag = require("functions.flag")
|
|
14
|
+
local addFlag = ____flag.addFlag
|
|
8
15
|
local ____log = require("functions.log")
|
|
9
16
|
local log = ____log.log
|
|
10
17
|
local ____random = require("functions.random")
|
|
@@ -37,8 +44,53 @@ function getJSONRoomWithChosenWeight(self, jsonRooms, chosenWeight)
|
|
|
37
44
|
end
|
|
38
45
|
chosenWeight = chosenWeight - roomWeight
|
|
39
46
|
end
|
|
40
|
-
|
|
47
|
+
error("Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight))
|
|
41
48
|
end
|
|
49
|
+
--- Helper function to calculate what the resulting `BitFlags<DoorSlotFlag>` value would be for a
|
|
50
|
+
-- given JSON room.
|
|
51
|
+
function ____exports.getJSONRoomDoorSlotFlags(self, jsonRoom)
|
|
52
|
+
local roomShapeString = jsonRoom["$"].shape
|
|
53
|
+
local roomShapeNumber = tonumber(roomShapeString)
|
|
54
|
+
if roomShapeNumber == nil then
|
|
55
|
+
error("Failed to parse the \"shape\" property of a JSON room: " .. roomShapeString)
|
|
56
|
+
end
|
|
57
|
+
local roomShape = roomShapeNumber
|
|
58
|
+
local doorSlotFlags = DoorSlotFlagZero
|
|
59
|
+
for ____, door in ipairs(jsonRoom.door) do
|
|
60
|
+
do
|
|
61
|
+
local existsString = door["$"].exists
|
|
62
|
+
if existsString ~= "True" and existsString ~= "False" then
|
|
63
|
+
error("Failed to parse the \"exists\" property of a JSON room door: " .. existsString)
|
|
64
|
+
end
|
|
65
|
+
if existsString == "False" then
|
|
66
|
+
goto __continue4
|
|
67
|
+
end
|
|
68
|
+
local xString = door["$"].x
|
|
69
|
+
local x = tonumber(xString)
|
|
70
|
+
if x == nil then
|
|
71
|
+
error("Failed to parse the \"x\" property of a JSON room door: " .. xString)
|
|
72
|
+
end
|
|
73
|
+
local yString = door["$"].y
|
|
74
|
+
local y = tonumber(yString)
|
|
75
|
+
if y == nil then
|
|
76
|
+
error("Failed to parse the \"y\" property of a JSON room door: " .. yString)
|
|
77
|
+
end
|
|
78
|
+
local doorSlot = getRoomShapeDoorSlot(nil, roomShape, x, y)
|
|
79
|
+
if doorSlot == nil then
|
|
80
|
+
error(((("Failed to retrieve the door slot for a JSON room door at coordinates: [" .. tostring(x)) .. ", ") .. tostring(y)) .. "]")
|
|
81
|
+
end
|
|
82
|
+
local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
|
|
83
|
+
doorSlotFlags = addFlag(nil, doorSlotFlags, doorSlotFlag)
|
|
84
|
+
end
|
|
85
|
+
::__continue4::
|
|
86
|
+
end
|
|
87
|
+
return doorSlotFlags
|
|
88
|
+
end
|
|
89
|
+
--- Helper function to find a specific room from an array of JSON rooms.
|
|
90
|
+
--
|
|
91
|
+
-- @param jsonRooms The array of rooms to search through.
|
|
92
|
+
-- @param variant The room variant to select. (The room variant can be thought of as the ID of the
|
|
93
|
+
-- room.)
|
|
42
94
|
function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
|
|
43
95
|
local jsonRoomsOfVariant = __TS__ArrayFilter(
|
|
44
96
|
jsonRooms,
|
|
@@ -54,8 +106,12 @@ function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
|
|
|
54
106
|
if #jsonRoomsOfVariant == 1 then
|
|
55
107
|
return jsonRoomsOfVariant[1]
|
|
56
108
|
end
|
|
57
|
-
|
|
109
|
+
error(((("Found " .. tostring(#jsonRoomsOfVariant)) .. " JSON rooms with a variant of ") .. tostring(variant)) .. ", when there should only be 1.")
|
|
58
110
|
end
|
|
111
|
+
--- Helper function to find all of the JSON rooms that match the sub-type provided.
|
|
112
|
+
--
|
|
113
|
+
-- @param jsonRooms The array of rooms to search through.
|
|
114
|
+
-- @param subType The sub-type to match.
|
|
59
115
|
function ____exports.getJSONRoomsOfSubType(self, jsonRooms, subType)
|
|
60
116
|
return __TS__ArrayFilter(
|
|
61
117
|
jsonRooms,
|
|
@@ -71,6 +127,12 @@ end
|
|
|
71
127
|
-- Note that this function does not simply choose a random element in the provided array; it will
|
|
72
128
|
-- properly account for each room weight using the algorithm from:
|
|
73
129
|
-- https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
130
|
+
--
|
|
131
|
+
-- @param jsonRooms The array of rooms to random choose between.
|
|
132
|
+
-- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
133
|
+
-- `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
134
|
+
-- @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
135
|
+
-- what the function is doing. Default is false.
|
|
74
136
|
function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
75
137
|
if seedOrRNG == nil then
|
|
76
138
|
seedOrRNG = getRandomSeed(nil)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to move all of the players to where they would normally go when arriving at a new
|
|
3
|
+
* floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
|
|
4
|
+
* door.)
|
|
5
|
+
*
|
|
6
|
+
* If there is more than one player, they will be distributed around the center in a circle.
|
|
7
|
+
*
|
|
8
|
+
* This function emulates what happens in the vanilla game when you travel to a new floor.
|
|
9
|
+
*/
|
|
10
|
+
export declare function movePlayersToCenter(): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local movePlayerAndTheirFamiliars
|
|
3
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
|
+
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
|
|
5
|
+
local ____cachedClasses = require("cachedClasses")
|
|
6
|
+
local game = ____cachedClasses.game
|
|
7
|
+
local ____constants = require("constants")
|
|
8
|
+
local NEW_FLOOR_STARTING_POSITION_GREED_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_GREED_MODE
|
|
9
|
+
local NEW_FLOOR_STARTING_POSITION_NORMAL_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
|
|
10
|
+
local ____familiars = require("functions.familiars")
|
|
11
|
+
local getPlayerFamiliars = ____familiars.getPlayerFamiliars
|
|
12
|
+
local ____math = require("functions.math")
|
|
13
|
+
local getCircleDiscretizedPoints = ____math.getCircleDiscretizedPoints
|
|
14
|
+
local ____playerIndex = require("functions.playerIndex")
|
|
15
|
+
local getPlayers = ____playerIndex.getPlayers
|
|
16
|
+
function movePlayerAndTheirFamiliars(self, player, position)
|
|
17
|
+
player.Position = position
|
|
18
|
+
local familiars = getPlayerFamiliars(nil, player)
|
|
19
|
+
for ____, familiar in ipairs(familiars) do
|
|
20
|
+
familiar.Position = position
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
|
|
24
|
+
--- Helper function to move all of the players to where they would normally go when arriving at a new
|
|
25
|
+
-- floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
|
|
26
|
+
-- door.)
|
|
27
|
+
--
|
|
28
|
+
-- If there is more than one player, they will be distributed around the center in a circle.
|
|
29
|
+
--
|
|
30
|
+
-- This function emulates what happens in the vanilla game when you travel to a new floor.
|
|
31
|
+
function ____exports.movePlayersToCenter(self)
|
|
32
|
+
local isGreedMode = game:IsGreedMode()
|
|
33
|
+
local startingPosition = isGreedMode and NEW_FLOOR_STARTING_POSITION_GREED_MODE or NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
|
|
34
|
+
local players = getPlayers(nil)
|
|
35
|
+
local firstPlayer = players[1]
|
|
36
|
+
if firstPlayer == nil then
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
if #players == 1 then
|
|
40
|
+
movePlayerAndTheirFamiliars(nil, firstPlayer, startingPosition)
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
local circlePoints = getCircleDiscretizedPoints(
|
|
44
|
+
nil,
|
|
45
|
+
startingPosition,
|
|
46
|
+
CIRCLE_RADIUS_BETWEEN_PLAYERS,
|
|
47
|
+
#players,
|
|
48
|
+
1,
|
|
49
|
+
1,
|
|
50
|
+
Direction.LEFT
|
|
51
|
+
)
|
|
52
|
+
do
|
|
53
|
+
local i = 0
|
|
54
|
+
while i < #players do
|
|
55
|
+
local player = players[i + 1]
|
|
56
|
+
local circlePosition = circlePoints[i + 1]
|
|
57
|
+
if player ~= nil and circlePosition ~= nil then
|
|
58
|
+
player.Position = circlePosition
|
|
59
|
+
end
|
|
60
|
+
i = i + 1
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
return ____exports
|
|
@@ -44,6 +44,9 @@ export declare function getPlayerIndex(player: EntityPlayer, differentiateForgot
|
|
|
44
44
|
/**
|
|
45
45
|
* Helper function to return the index of this player with respect to the output of the
|
|
46
46
|
* `Isaac.GetPlayer` method.
|
|
47
|
+
*
|
|
48
|
+
* Note that if you storing information about a player in a data structure, you never want to use
|
|
49
|
+
* this index; use the `getPlayerIndex` function instead.
|
|
47
50
|
*/
|
|
48
51
|
export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
|
|
49
52
|
/**
|
|
@@ -155,6 +155,9 @@ function ____exports.getPlayerFromIndex(self, playerIndex)
|
|
|
155
155
|
end
|
|
156
156
|
--- Helper function to return the index of this player with respect to the output of the
|
|
157
157
|
-- `Isaac.GetPlayer` method.
|
|
158
|
+
--
|
|
159
|
+
-- Note that if you storing information about a player in a data structure, you never want to use
|
|
160
|
+
-- this index; use the `getPlayerIndex` function instead.
|
|
158
161
|
function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
159
162
|
local numPlayers = game:GetNumPlayers()
|
|
160
163
|
local playerToFindHash = GetPtrHash(playerToFind)
|
package/functions/roomShape.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DoorSlot, RoomShape } from "isaac-typescript-definitions";
|
|
2
|
+
import { Corner } from "../interfaces/Corner";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get the grid index delta that a door out of the given room shape would lead
|
|
4
5
|
* to. For example, if you went through the bottom door in a room of `RoomShape.SHAPE_1x2`, you
|
|
@@ -12,7 +13,7 @@ export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSl
|
|
|
12
13
|
*
|
|
13
14
|
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
14
15
|
*/
|
|
15
|
-
export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Vector
|
|
16
|
+
export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Readonly<Vector>;
|
|
16
17
|
/**
|
|
17
18
|
* Helper function to get the grid position of the bottom-right tile of a given room shape.
|
|
18
19
|
*
|
|
@@ -21,10 +22,14 @@ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): V
|
|
|
21
22
|
*/
|
|
22
23
|
export declare function getRoomShapeBounds(roomShape: RoomShape): readonly [width: int, height: int];
|
|
23
24
|
/**
|
|
24
|
-
* Helper function to get the
|
|
25
|
-
*
|
|
25
|
+
* Helper function to get the number of charges that a given room shape will grant to a player upon
|
|
26
|
+
* clearing it.
|
|
27
|
+
*
|
|
28
|
+
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
26
29
|
*/
|
|
27
30
|
export declare function getRoomShapeCharges(roomShape: RoomShape): int;
|
|
31
|
+
/** Helper function to get the corners that exist in the given room shape. */
|
|
32
|
+
export declare function getRoomShapeCorners(roomShape: RoomShape): readonly Corner[];
|
|
28
33
|
/**
|
|
29
34
|
* Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
30
35
|
* room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
@@ -38,7 +43,7 @@ export declare function getRoomShapeLayoutSize(roomShape: RoomShape): readonly [
|
|
|
38
43
|
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
39
44
|
* wall would be at "Vector(-1, -1)".)
|
|
40
45
|
*/
|
|
41
|
-
export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vector
|
|
46
|
+
export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Readonly<Vector>;
|
|
42
47
|
/**
|
|
43
48
|
* Helper function to get the volume of a room shape, which is the amount of tiles that are inside
|
|
44
49
|
* the room.
|
|
@@ -48,6 +53,7 @@ export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vecto
|
|
|
48
53
|
export declare function getRoomShapeVolume(roomShape: RoomShape): int;
|
|
49
54
|
export declare function getRoomShapeWidth(roomShape: RoomShape): int;
|
|
50
55
|
export declare function isLRoom(roomShape: RoomShape): boolean;
|
|
56
|
+
export declare function isNarrowRoom(roomShape: RoomShape): boolean;
|
|
51
57
|
/**
|
|
52
58
|
* Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
53
59
|
* player's active item(s).
|
package/functions/roomShape.lua
CHANGED
|
@@ -5,6 +5,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
5
5
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
6
6
|
local ____roomShapeBounds = require("objects.roomShapeBounds")
|
|
7
7
|
local ROOM_SHAPE_BOUNDS = ____roomShapeBounds.ROOM_SHAPE_BOUNDS
|
|
8
|
+
local ____roomShapeCorners = require("objects.roomShapeCorners")
|
|
9
|
+
local ROOM_SHAPE_CORNERS = ____roomShapeCorners.ROOM_SHAPE_CORNERS
|
|
8
10
|
local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
|
|
9
11
|
local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
|
|
10
12
|
local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
|
|
@@ -19,6 +21,8 @@ local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
|
19
21
|
local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
|
|
20
22
|
local ____LRoomShapesSet = require("sets.LRoomShapesSet")
|
|
21
23
|
local L_ROOM_SHAPES_SET = ____LRoomShapesSet.L_ROOM_SHAPES_SET
|
|
24
|
+
local ____narrowRoomShapesSet = require("sets.narrowRoomShapesSet")
|
|
25
|
+
local NARROW_ROOM_SHAPES_SET = ____narrowRoomShapesSet.NARROW_ROOM_SHAPES_SET
|
|
22
26
|
--- Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
23
27
|
-- player's active item(s).
|
|
24
28
|
--
|
|
@@ -48,11 +52,17 @@ end
|
|
|
48
52
|
function ____exports.getRoomShapeBounds(self, roomShape)
|
|
49
53
|
return ROOM_SHAPE_BOUNDS[roomShape]
|
|
50
54
|
end
|
|
51
|
-
--- Helper function to get the
|
|
52
|
-
--
|
|
55
|
+
--- Helper function to get the number of charges that a given room shape will grant to a player upon
|
|
56
|
+
-- clearing it.
|
|
57
|
+
--
|
|
58
|
+
-- For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
53
59
|
function ____exports.getRoomShapeCharges(self, roomShape)
|
|
54
60
|
return ____exports.isRoomShapeDoubleCharge(nil, roomShape) and 2 or 1
|
|
55
61
|
end
|
|
62
|
+
--- Helper function to get the corners that exist in the given room shape.
|
|
63
|
+
function ____exports.getRoomShapeCorners(self, roomShape)
|
|
64
|
+
return ROOM_SHAPE_CORNERS[roomShape]
|
|
65
|
+
end
|
|
56
66
|
--- Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
57
67
|
-- room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
58
68
|
--
|
|
@@ -80,4 +90,7 @@ end
|
|
|
80
90
|
function ____exports.isLRoom(self, roomShape)
|
|
81
91
|
return L_ROOM_SHAPES_SET:has(roomShape)
|
|
82
92
|
end
|
|
93
|
+
function ____exports.isNarrowRoom(self, roomShape)
|
|
94
|
+
return NARROW_ROOM_SHAPES_SET:has(roomShape)
|
|
95
|
+
end
|
|
83
96
|
return ____exports
|
package/functions/rooms.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare function getRoomTypeName(roomType: RoomType): string;
|
|
|
55
55
|
* non-existent and are not added to the list.
|
|
56
56
|
*
|
|
57
57
|
* @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
58
|
-
* extra-dimensional rooms are automatically
|
|
58
|
+
* extra-dimensional rooms are automatically generated and can be
|
|
59
59
|
* seen when you iterate over the `RoomList`. Default is false.
|
|
60
60
|
*/
|
|
61
61
|
export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
|
package/functions/rooms.lua
CHANGED
|
@@ -72,7 +72,7 @@ end
|
|
|
72
72
|
-- non-existent and are not added to the list.
|
|
73
73
|
--
|
|
74
74
|
-- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
|
|
75
|
-
-- extra-dimensional rooms are automatically
|
|
75
|
+
-- extra-dimensional rooms are automatically generated and can be
|
|
76
76
|
-- seen when you iterate over the `RoomList`. Default is false.
|
|
77
77
|
function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
78
78
|
if includeExtraDimensionalRooms == nil then
|
|
@@ -145,7 +145,7 @@ function ____exports.getDimension(self)
|
|
|
145
145
|
return dimension
|
|
146
146
|
end
|
|
147
147
|
end
|
|
148
|
-
|
|
148
|
+
error("Failed to get the current dimension.")
|
|
149
149
|
end
|
|
150
150
|
--- Helper function to get the number of rooms that are currently on the floor layout. This does not
|
|
151
151
|
-- include off-grid rooms, like the Devil Room.
|
package/functions/sprite.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
/**
|
|
5
|
-
* Helper function to clear
|
|
5
|
+
* Helper function to clear all layers or specific layers from a sprite.
|
|
6
6
|
*
|
|
7
7
|
* This function is variadic, so pass as many layer IDs as you want to clear. If no specific layers
|
|
8
8
|
* are passed, it will clear every layer.
|
package/functions/sprite.lua
CHANGED
|
@@ -12,7 +12,7 @@ function ____exports.texelEquals(self, sprite1, sprite2, position, layerID)
|
|
|
12
12
|
local kColor2 = sprite2:GetTexel(position, VectorZero, 1, layerID)
|
|
13
13
|
return kColorEquals(nil, kColor1, kColor2)
|
|
14
14
|
end
|
|
15
|
-
--- Helper function to clear
|
|
15
|
+
--- Helper function to clear all layers or specific layers from a sprite.
|
|
16
16
|
--
|
|
17
17
|
-- This function is variadic, so pass as many layer IDs as you want to clear. If no specific layers
|
|
18
18
|
-- are passed, it will clear every layer.
|
package/functions/stage.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export declare function calculateStageTypeRepentance(stage: LevelStage): StageTy
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function getEffectiveStage(): int;
|
|
18
18
|
/**
|
|
19
|
-
* Helper function to get the
|
|
20
|
-
*
|
|
19
|
+
* Helper function to get the corresponding "goto" console command that would correspond to the
|
|
20
|
+
* provided room type and room variant.
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function getGotoCommand(roomType: RoomType, roomVariant: int): string;
|
|
23
23
|
/** Alias for the `Level.GetStage` method. */
|
|
24
24
|
export declare function getStage(): LevelStage;
|
|
25
25
|
/** Alias for the `Level.GetStageType` method. */
|
package/functions/stage.lua
CHANGED
|
@@ -64,10 +64,11 @@ function ____exports.getEffectiveStage(self)
|
|
|
64
64
|
end
|
|
65
65
|
return stage
|
|
66
66
|
end
|
|
67
|
-
--- Helper function to get the
|
|
68
|
-
--
|
|
69
|
-
function ____exports.
|
|
70
|
-
|
|
67
|
+
--- Helper function to get the corresponding "goto" console command that would correspond to the
|
|
68
|
+
-- provided room type and room variant.
|
|
69
|
+
function ____exports.getGotoCommand(self, roomType, roomVariant)
|
|
70
|
+
local prefix = ROOM_TYPE_GOTO_PREFIXES[roomType]
|
|
71
|
+
return (("goto " .. prefix) .. ".") .. tostring(roomVariant)
|
|
71
72
|
end
|
|
72
73
|
--- Alias for the `Level.GetStage` method.
|
|
73
74
|
function ____exports.getStage(self)
|
package/functions/trinkets.lua
CHANGED
|
@@ -76,7 +76,7 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
76
76
|
end
|
|
77
77
|
return trinketType2 == TrinketType.NULL and 1 or nil
|
|
78
78
|
end
|
|
79
|
-
|
|
79
|
+
error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
80
80
|
end
|
|
81
81
|
--- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
82
82
|
-- trinket type was not valid.
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./cachedClasses";
|
|
2
2
|
export { initCustomDoor, spawnCustomDoor, } from "./callbacks/postCustomDoorEnter";
|
|
3
|
-
export { forceNewLevelCallback, forceNewRoomCallback, } from "./callbacks/reorderedCallbacks";
|
|
3
|
+
export { forceNewLevelCallback, forceNewRoomCallback, reorderedCallbacksSetStage, } from "./callbacks/reorderedCallbacks";
|
|
4
4
|
export * from "./classes/DefaultMap";
|
|
5
5
|
export * from "./classes/ModUpgraded";
|
|
6
6
|
export * from "./constants";
|
|
@@ -86,6 +86,7 @@ export * from "./functions/pickups";
|
|
|
86
86
|
export * from "./functions/pickupVariants";
|
|
87
87
|
export * from "./functions/pills";
|
|
88
88
|
export * from "./functions/player";
|
|
89
|
+
export * from "./functions/playerCenter";
|
|
89
90
|
export * from "./functions/playerDataStructures";
|
|
90
91
|
export * from "./functions/playerHealth";
|
|
91
92
|
export * from "./functions/playerIndex";
|
package/index.lua
CHANGED
|
@@ -18,8 +18,10 @@ do
|
|
|
18
18
|
local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
|
|
19
19
|
local forceNewLevelCallback = ____reorderedCallbacks.forceNewLevelCallback
|
|
20
20
|
local forceNewRoomCallback = ____reorderedCallbacks.forceNewRoomCallback
|
|
21
|
+
local reorderedCallbacksSetStage = ____reorderedCallbacks.reorderedCallbacksSetStage
|
|
21
22
|
____exports.forceNewLevelCallback = forceNewLevelCallback
|
|
22
23
|
____exports.forceNewRoomCallback = forceNewRoomCallback
|
|
24
|
+
____exports.reorderedCallbacksSetStage = reorderedCallbacksSetStage
|
|
23
25
|
end
|
|
24
26
|
do
|
|
25
27
|
local ____export = require("classes.DefaultMap")
|
|
@@ -685,6 +687,14 @@ do
|
|
|
685
687
|
end
|
|
686
688
|
end
|
|
687
689
|
end
|
|
690
|
+
do
|
|
691
|
+
local ____export = require("functions.playerCenter")
|
|
692
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
693
|
+
if ____exportKey ~= "default" then
|
|
694
|
+
____exports[____exportKey] = ____exportValue
|
|
695
|
+
end
|
|
696
|
+
end
|
|
697
|
+
end
|
|
688
698
|
do
|
|
689
699
|
local ____export = require("functions.playerDataStructures")
|
|
690
700
|
for ____exportKey, ____exportValue in pairs(____export) do
|