isaacscript-common 6.0.1 → 6.1.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/postCollectibleEmpty.d.ts +1 -0
- package/callbacks/postCollectibleEmpty.lua +41 -0
- package/callbacks/subscriptions/postCollectibleEmpty.d.ts +5 -0
- package/callbacks/subscriptions/postCollectibleEmpty.lua +29 -0
- package/enums/ModCallbackCustom.d.ts +92 -77
- package/enums/ModCallbackCustom.lua +79 -77
- package/features/customStage/exports.d.ts +1 -8
- package/features/customStage/exports.lua +6 -14
- package/features/customStage/init.d.ts +1 -0
- package/features/customStage/init.lua +18 -0
- package/features/customStage/metadata.lua +1 -0
- package/features/customStage/v.d.ts +2 -2
- package/features/customStage/v.lua +1 -1
- package/features/deployJSONRoom.d.ts +1 -1
- package/functions/boss.d.ts +2 -2
- package/functions/entity.d.ts +2 -2
- package/functions/entitySpecific.d.ts +20 -20
- package/functions/jsonRoom.d.ts +1 -1
- package/functions/pickups.d.ts +16 -16
- package/index.d.ts +1 -5
- package/initCustomCallbacks.lua +3 -0
- package/initFeatures.lua +3 -0
- package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
- package/interfaces/CustomStage.d.ts +51 -0
- package/interfaces/{CustomStageData.lua → CustomStage.lua} +0 -0
- package/interfaces/JSONRoomsFile.d.ts +75 -0
- package/interfaces/{JSONDoor.lua → JSONRoomsFile.lua} +0 -0
- package/objects/callbackRegisterFunctions.lua +3 -0
- package/package.json +1 -1
- package/features/customStage/constants.d.ts +0 -18
- package/features/customStage/constants.lua +0 -29
- package/features/customStage/scripts/generateCustomStageRooms.d.ts +0 -27
- package/features/customStage/scripts/generateCustomStageRooms.lua +0 -126
- package/interfaces/CustomStageData.d.ts +0 -5
- package/interfaces/JSONDoor.d.ts +0 -11
- package/interfaces/JSONEntity.d.ts +0 -13
- package/interfaces/JSONEntity.lua +0 -2
- package/interfaces/JSONRoom.d.ts +0 -26
- package/interfaces/JSONRoom.lua +0 -2
- package/interfaces/JSONRooms.d.ts +0 -11
- package/interfaces/JSONRooms.lua +0 -2
- package/interfaces/JSONSpawn.d.ts +0 -11
- package/interfaces/JSONSpawn.lua +0 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the format of a custom stage in the "isaacscript" section of the "tsconfig.json" file.
|
|
3
|
+
*
|
|
4
|
+
* The contents of this interface are used to create a "tsconfig-isaacscript-section-schema.json"
|
|
5
|
+
* schema with the "ts-json-schema-generator" library.
|
|
6
|
+
*
|
|
7
|
+
* The contents of this interface are validated at run-time against the schema using the Ajv
|
|
8
|
+
* library.
|
|
9
|
+
*
|
|
10
|
+
* The `CustomStage` interface extends this, adding room metadata.
|
|
11
|
+
*/
|
|
12
|
+
export interface CustomStageTSConfig {
|
|
13
|
+
/** The name of the custom stage. */
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Path to the XML file that contains the rooms for the custom stage (created with Basement
|
|
17
|
+
* Renovator).
|
|
18
|
+
*/
|
|
19
|
+
xmlPath: string;
|
|
20
|
+
/** An arbitrarily chosen prefix in the range of 101-999. */
|
|
21
|
+
roomVariantPrefix: number;
|
|
22
|
+
/**
|
|
23
|
+
* An integer between 1 and 13, corresponding to the `LevelStage` enum. This is the number of the
|
|
24
|
+
* stage that will be warped to and used as a basis for the stage by the level generation
|
|
25
|
+
* algorithm.
|
|
26
|
+
*/
|
|
27
|
+
baseStage: number;
|
|
28
|
+
/**
|
|
29
|
+
* An integer between 0 and 5, corresponding to the `StageType` enum. This is the number of the
|
|
30
|
+
* stage type that will be warped to and used as a basis for the stage by the level generation
|
|
31
|
+
* algorithm.
|
|
32
|
+
*/
|
|
33
|
+
baseStageType: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An object that represents a custom stage. The "metadata.lua" file contains an array of these
|
|
37
|
+
* objects. Besides the room metadata, the data is the same as what is specified inside the
|
|
38
|
+
* "tsconfig.json" file.
|
|
39
|
+
*/
|
|
40
|
+
export interface CustomStage extends CustomStageTSConfig {
|
|
41
|
+
roomsMetadata: CustomStageRoomMetadata[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Metadata about a custom stage room. Each custom stage object contains an array with metadata for
|
|
45
|
+
* each room.
|
|
46
|
+
*/
|
|
47
|
+
export interface CustomStageRoomMetadata {
|
|
48
|
+
variant: number;
|
|
49
|
+
shape: number;
|
|
50
|
+
weight: number;
|
|
51
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom rooms are created with the Basement Renovator program, which outputs XML files and STB
|
|
3
|
+
* files. A `JSONRoomsFile` object is simply an XML file converted to JSON. (It is useful to have
|
|
4
|
+
* the room data in JSON format so that it can be directly consumed by TypeScript programs.)
|
|
5
|
+
*
|
|
6
|
+
* You can convert your XML files using the following command:
|
|
7
|
+
*
|
|
8
|
+
* ```sh
|
|
9
|
+
* npx convert-xml-to-json foo.xml foo.json
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface JSONRoomsFile {
|
|
13
|
+
rooms: JSONRooms;
|
|
14
|
+
}
|
|
15
|
+
export interface JSONRooms {
|
|
16
|
+
room: JSONRoom[];
|
|
17
|
+
}
|
|
18
|
+
/** Part of `JSONRooms`. */
|
|
19
|
+
export interface JSONRoom {
|
|
20
|
+
$: {
|
|
21
|
+
/** Needs to be converted to an `int`. */
|
|
22
|
+
difficulty: string;
|
|
23
|
+
/** Needs to be converted to an `int`. */
|
|
24
|
+
height: string;
|
|
25
|
+
name: string;
|
|
26
|
+
/** Needs to be converted to an `int`. */
|
|
27
|
+
shape: string;
|
|
28
|
+
/** Needs to be converted to an `int`. */
|
|
29
|
+
subtype: string;
|
|
30
|
+
/** Needs to be converted to an `int`. */
|
|
31
|
+
type: string;
|
|
32
|
+
/** Needs to be converted to an `int`. */
|
|
33
|
+
variant: string;
|
|
34
|
+
/** Needs to be converted to a `float`. */
|
|
35
|
+
weight: string;
|
|
36
|
+
/** Needs to be converted to an `int`. */
|
|
37
|
+
width: string;
|
|
38
|
+
};
|
|
39
|
+
door: JSONDoor[];
|
|
40
|
+
spawn: JSONSpawn[];
|
|
41
|
+
}
|
|
42
|
+
/** Part of `JSONRooms`. */
|
|
43
|
+
export interface JSONDoor {
|
|
44
|
+
$: {
|
|
45
|
+
/** Equal to "True" or "False". Needs to be converted to an `boolean`. */
|
|
46
|
+
exists: string;
|
|
47
|
+
/** Needs to be converted to an `int`. */
|
|
48
|
+
x: string;
|
|
49
|
+
/** Needs to be converted to an `int`. */
|
|
50
|
+
y: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Part of `JSONRooms`. */
|
|
54
|
+
export interface JSONSpawn {
|
|
55
|
+
$: {
|
|
56
|
+
/** Needs to be converted to an `int`. */
|
|
57
|
+
x: string;
|
|
58
|
+
/** Needs to be converted to an `int`. */
|
|
59
|
+
y: string;
|
|
60
|
+
};
|
|
61
|
+
entity: JSONEntity[];
|
|
62
|
+
}
|
|
63
|
+
/** Part of `JSONRooms`. */
|
|
64
|
+
export interface JSONEntity {
|
|
65
|
+
$: {
|
|
66
|
+
/** Needs to be converted to an `int`. */
|
|
67
|
+
type: string;
|
|
68
|
+
/** Needs to be converted to an `int`. */
|
|
69
|
+
variant: string;
|
|
70
|
+
/** Needs to be converted to an `int`. */
|
|
71
|
+
subtype: string;
|
|
72
|
+
/** Needs to be converted to a `float`. */
|
|
73
|
+
weight: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
File without changes
|
|
@@ -9,6 +9,8 @@ local ____postBoneExploded = require("callbacks.subscriptions.postBoneExploded")
|
|
|
9
9
|
local postBombExplodedRegister = ____postBoneExploded.postBombExplodedRegister
|
|
10
10
|
local ____postBoneSwing = require("callbacks.subscriptions.postBoneSwing")
|
|
11
11
|
local postBoneSwingRegister = ____postBoneSwing.postBoneSwingRegister
|
|
12
|
+
local ____postCollectibleEmpty = require("callbacks.subscriptions.postCollectibleEmpty")
|
|
13
|
+
local postCollectibleEmptyRegister = ____postCollectibleEmpty.postCollectibleEmptyRegister
|
|
12
14
|
local ____postCollectibleInitFirst = require("callbacks.subscriptions.postCollectibleInitFirst")
|
|
13
15
|
local postCollectibleInitFirstRegister = ____postCollectibleInitFirst.postCollectibleInitFirstRegister
|
|
14
16
|
local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
|
|
@@ -171,6 +173,7 @@ ____exports.CALLBACK_REGISTER_FUNCTIONS = {
|
|
|
171
173
|
[ModCallbackCustom.POST_BOMB_EXPLODED] = postBombExplodedRegister,
|
|
172
174
|
[ModCallbackCustom.POST_BOMB_INIT_LATE] = postBombInitLateRegister,
|
|
173
175
|
[ModCallbackCustom.POST_BONE_SWING] = postBoneSwingRegister,
|
|
176
|
+
[ModCallbackCustom.POST_COLLECTIBLE_EMPTY] = postCollectibleEmptyRegister,
|
|
174
177
|
[ModCallbackCustom.POST_COLLECTIBLE_INIT_FIRST] = postCollectibleInitFirstRegister,
|
|
175
178
|
[ModCallbackCustom.POST_CURSED_TELEPORT] = postCursedTeleportRegister,
|
|
176
179
|
[ModCallbackCustom.POST_CUSTOM_DOOR_ENTER] = postCustomDoorEnterRegister,
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { RoomType } from "isaac-typescript-definitions";
|
|
2
|
-
/**
|
|
3
|
-
* In order to keep the size of the STB file small, we only allow certain room types to be used in
|
|
4
|
-
* IsaacScript custom stages.
|
|
5
|
-
*/
|
|
6
|
-
export declare const CUSTOM_STAGE_ILLEGAL_ROOM_TYPES: Set<RoomType>;
|
|
7
|
-
/** StageAPI uses 70000 as a base. */
|
|
8
|
-
export declare const CUSTOM_STAGE_BASE_ROOM_VARIANT = 80000;
|
|
9
|
-
/**
|
|
10
|
-
* - The `RoomShape` enum goes from 1 to 12.
|
|
11
|
-
* - 12 in binary is 1100.
|
|
12
|
-
* - Thus, we need 4 bits to represent `RoomShape`.
|
|
13
|
-
*/
|
|
14
|
-
export declare const CUSTOM_STAGE_NUM_ROOM_SHAPE_BITS = 4;
|
|
15
|
-
/**
|
|
16
|
-
* One for each possible door slot. We add one to account for `DoorSlot.LEFT_0` being equal to zero.
|
|
17
|
-
*/
|
|
18
|
-
export declare const CUSTOM_STAGE_NUM_DOOR_SLOT_BITS: number;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Set = ____lualib.Set
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local ____exports = {}
|
|
5
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
|
-
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
7
|
-
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
8
|
-
local ____enums = require("functions.enums")
|
|
9
|
-
local getLastEnumValue = ____enums.getLastEnumValue
|
|
10
|
-
--- In order to keep the size of the STB file small, we only allow certain room types to be used in
|
|
11
|
-
-- IsaacScript custom stages.
|
|
12
|
-
____exports.CUSTOM_STAGE_ILLEGAL_ROOM_TYPES = __TS__New(Set, {
|
|
13
|
-
RoomType.BOSS_RUSH,
|
|
14
|
-
RoomType.BLACK_MARKET,
|
|
15
|
-
RoomType.GREED_EXIT,
|
|
16
|
-
RoomType.TELEPORTER,
|
|
17
|
-
RoomType.TELEPORTER_EXIT,
|
|
18
|
-
RoomType.SECRET_EXIT,
|
|
19
|
-
RoomType.BLUE
|
|
20
|
-
})
|
|
21
|
-
--- StageAPI uses 70000 as a base.
|
|
22
|
-
____exports.CUSTOM_STAGE_BASE_ROOM_VARIANT = 80000
|
|
23
|
-
--- - The `RoomShape` enum goes from 1 to 12.
|
|
24
|
-
-- - 12 in binary is 1100.
|
|
25
|
-
-- - Thus, we need 4 bits to represent `RoomShape`.
|
|
26
|
-
____exports.CUSTOM_STAGE_NUM_ROOM_SHAPE_BITS = 4
|
|
27
|
-
--- One for each possible door slot. We add one to account for `DoorSlot.LEFT_0` being equal to zero.
|
|
28
|
-
____exports.CUSTOM_STAGE_NUM_DOOR_SLOT_BITS = getLastEnumValue(nil, DoorSlot) + 1
|
|
29
|
-
return ____exports
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Since room data is immutable, we need to create an array of empty rooms like the following:
|
|
3
|
-
*
|
|
4
|
-
* ```xml
|
|
5
|
-
* <room variant="80150" name="1x1" type="2" subtype="0" shape="1" width="13" height="7"
|
|
6
|
-
* difficulty="1" weight="0.0">
|
|
7
|
-
* <door exists="True" x="-1" y="3"/>
|
|
8
|
-
* <door exists="True" x="6" y="-1"/>
|
|
9
|
-
* <door exists="True" x="6" y="7"/>
|
|
10
|
-
* <door exists="True" x="13" y="3"/>
|
|
11
|
-
* </room>
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* - We can repeat room variants between different room types.
|
|
15
|
-
* - The `RoomShape` enum goes from 1 to 12.
|
|
16
|
-
* - 12 in binary is 1100.
|
|
17
|
-
* - Thus, we need 4 bits to represent `RoomShape`.
|
|
18
|
-
* - There are 8 possible door slots.
|
|
19
|
-
* - Thus, we need 8 bits to represent `BitFlags<DoorSlot>`.
|
|
20
|
-
*
|
|
21
|
-
* Thus, the room variant has the following sequence:
|
|
22
|
-
* - 4 bits of `RoomShape` + 8 bits of `BitFlags<DoorSlot>`
|
|
23
|
-
*
|
|
24
|
-
* Even though Basement Renovator does not allow setting variants to values above 16 bits, values
|
|
25
|
-
* with 17 bits work fine in-game.
|
|
26
|
-
*/
|
|
27
|
-
export declare function generateCustomStageBaseRooms(): void;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Set = ____lualib.Set
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
5
|
-
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
6
|
-
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
7
|
-
local __TS__StringTrim = ____lualib.__TS__StringTrim
|
|
8
|
-
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
9
|
-
local ____exports = {}
|
|
10
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
-
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
12
|
-
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
13
|
-
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
14
|
-
local ____bitwise = require("functions.bitwise")
|
|
15
|
-
local convertBinaryToDecimal = ____bitwise.convertBinaryToDecimal
|
|
16
|
-
local convertDecimalToBinary = ____bitwise.convertDecimalToBinary
|
|
17
|
-
local setToBitFlags = ____bitwise.setToBitFlags
|
|
18
|
-
local ____doors = require("functions.doors")
|
|
19
|
-
local doorSlotToDoorSlotFlag = ____doors.doorSlotToDoorSlotFlag
|
|
20
|
-
local getDoorSlotsForRoomShape = ____doors.getDoorSlotsForRoomShape
|
|
21
|
-
local getRoomShapeDoorSlotCoordinates = ____doors.getRoomShapeDoorSlotCoordinates
|
|
22
|
-
local ____enums = require("functions.enums")
|
|
23
|
-
local getEnumValues = ____enums.getEnumValues
|
|
24
|
-
local ____flag = require("functions.flag")
|
|
25
|
-
local hasFlag = ____flag.hasFlag
|
|
26
|
-
local ____roomShape = require("functions.roomShape")
|
|
27
|
-
local getRoomShapeLayoutSize = ____roomShape.getRoomShapeLayoutSize
|
|
28
|
-
local ____set = require("functions.set")
|
|
29
|
-
local getSetCombinations = ____set.getSetCombinations
|
|
30
|
-
local getSortedSetValues = ____set.getSortedSetValues
|
|
31
|
-
local ____constants = require("features.customStage.constants")
|
|
32
|
-
local CUSTOM_STAGE_BASE_ROOM_VARIANT = ____constants.CUSTOM_STAGE_BASE_ROOM_VARIANT
|
|
33
|
-
local CUSTOM_STAGE_ILLEGAL_ROOM_TYPES = ____constants.CUSTOM_STAGE_ILLEGAL_ROOM_TYPES
|
|
34
|
-
local CUSTOM_STAGE_NUM_DOOR_SLOT_BITS = ____constants.CUSTOM_STAGE_NUM_DOOR_SLOT_BITS
|
|
35
|
-
local CUSTOM_STAGE_NUM_ROOM_SHAPE_BITS = ____constants.CUSTOM_STAGE_NUM_ROOM_SHAPE_BITS
|
|
36
|
-
--- Since room data is immutable, we need to create an array of empty rooms like the following:
|
|
37
|
-
--
|
|
38
|
-
-- ```xml
|
|
39
|
-
-- <room variant="80150" name="1x1" type="2" subtype="0" shape="1" width="13" height="7"
|
|
40
|
-
-- difficulty="1" weight="0.0">
|
|
41
|
-
-- <door exists="True" x="-1" y="3"/>
|
|
42
|
-
-- <door exists="True" x="6" y="-1"/>
|
|
43
|
-
-- <door exists="True" x="6" y="7"/>
|
|
44
|
-
-- <door exists="True" x="13" y="3"/>
|
|
45
|
-
-- </room>
|
|
46
|
-
-- ```
|
|
47
|
-
--
|
|
48
|
-
-- - We can repeat room variants between different room types.
|
|
49
|
-
-- - The `RoomShape` enum goes from 1 to 12.
|
|
50
|
-
-- - 12 in binary is 1100.
|
|
51
|
-
-- - Thus, we need 4 bits to represent `RoomShape`.
|
|
52
|
-
-- - There are 8 possible door slots.
|
|
53
|
-
-- - Thus, we need 8 bits to represent `BitFlags<DoorSlot>`.
|
|
54
|
-
--
|
|
55
|
-
-- Thus, the room variant has the following sequence:
|
|
56
|
-
-- - 4 bits of `RoomShape` + 8 bits of `BitFlags<DoorSlot>`
|
|
57
|
-
--
|
|
58
|
-
-- Even though Basement Renovator does not allow setting variants to values above 16 bits, values
|
|
59
|
-
-- with 17 bits work fine in-game.
|
|
60
|
-
function ____exports.generateCustomStageBaseRooms(self)
|
|
61
|
-
local rooms = {}
|
|
62
|
-
for ____, roomType in ipairs(getEnumValues(nil, RoomType)) do
|
|
63
|
-
do
|
|
64
|
-
if CUSTOM_STAGE_ILLEGAL_ROOM_TYPES:has(roomType) then
|
|
65
|
-
goto __continue3
|
|
66
|
-
end
|
|
67
|
-
for ____, roomShape in ipairs(getEnumValues(nil, RoomShape)) do
|
|
68
|
-
do
|
|
69
|
-
if roomType ~= RoomType.DEFAULT and roomShape ~= RoomShape.SHAPE_1x1 then
|
|
70
|
-
goto __continue5
|
|
71
|
-
end
|
|
72
|
-
local roomShapeBits = convertDecimalToBinary(nil, roomShape, CUSTOM_STAGE_NUM_ROOM_SHAPE_BITS)
|
|
73
|
-
local doorSlotsSet = getDoorSlotsForRoomShape(nil, roomShape)
|
|
74
|
-
local doorSlots = getSortedSetValues(nil, doorSlotsSet)
|
|
75
|
-
local doorSlotFlagsSet = __TS__New(Set)
|
|
76
|
-
for ____, doorSlot in ipairs(doorSlots) do
|
|
77
|
-
local doorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
|
|
78
|
-
doorSlotFlagsSet:add(doorSlotFlag)
|
|
79
|
-
end
|
|
80
|
-
local doorSlotFlagCombinations = getSetCombinations(nil, doorSlotFlagsSet, false)
|
|
81
|
-
for ____, doorSlotFlagCombination in ipairs(doorSlotFlagCombinations) do
|
|
82
|
-
local doorSlotFlags = setToBitFlags(nil, doorSlotFlagCombination)
|
|
83
|
-
local doorSlotBits = convertDecimalToBinary(nil, doorSlotFlags, CUSTOM_STAGE_NUM_DOOR_SLOT_BITS)
|
|
84
|
-
local ____array_0 = __TS__SparseArrayNew(table.unpack(roomShapeBits))
|
|
85
|
-
__TS__SparseArrayPush(
|
|
86
|
-
____array_0,
|
|
87
|
-
table.unpack(doorSlotBits)
|
|
88
|
-
)
|
|
89
|
-
local combinedBits = {__TS__SparseArraySpread(____array_0)}
|
|
90
|
-
local roomVariant = CUSTOM_STAGE_BASE_ROOM_VARIANT + convertBinaryToDecimal(nil, combinedBits)
|
|
91
|
-
local name = (((("Type: " .. tostring(roomType)) .. ", Shape: ") .. tostring(roomShape)) .. ", DoorSlotFlags: ") .. tostring(doorSlotFlags)
|
|
92
|
-
local width, height = table.unpack(getRoomShapeLayoutSize(nil, roomShape))
|
|
93
|
-
local roomHeader = (((((((((((" <room name=\"" .. name) .. "\" type=\"") .. tostring(roomType)) .. "\" variant=\"") .. tostring(roomVariant)) .. "\" subtype=\"0\" shape=\"") .. tostring(roomShape)) .. "\" width=\"") .. tostring(width)) .. "\" height=\"") .. tostring(height)) .. "\" difficulty=\"1\" weight=\"0.0\">\n"
|
|
94
|
-
local doors = {}
|
|
95
|
-
for ____, doorSlot in ipairs(doorSlots) do
|
|
96
|
-
local thisDoorSlotFlag = doorSlotToDoorSlotFlag(nil, doorSlot)
|
|
97
|
-
local exists = hasFlag(nil, doorSlotFlags, thisDoorSlotFlag)
|
|
98
|
-
local existsText = exists and "True" or "False"
|
|
99
|
-
local coordinates = getRoomShapeDoorSlotCoordinates(nil, roomShape, doorSlot)
|
|
100
|
-
if coordinates == nil then
|
|
101
|
-
error(((((((("Failed to get the coordinates for room shape " .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") and door slot ") .. tostring(DoorSlot[doorSlot])) .. " (") .. tostring(doorSlot)) .. ").")
|
|
102
|
-
end
|
|
103
|
-
local x, y = table.unpack(coordinates)
|
|
104
|
-
local door = (((((" <door exists=\"" .. existsText) .. "\" x=\"") .. tostring(x)) .. "\" y=\"") .. tostring(y)) .. "\" />\n"
|
|
105
|
-
doors[#doors + 1] = door
|
|
106
|
-
end
|
|
107
|
-
local doorsXML = table.concat(doors, "")
|
|
108
|
-
local roomFooter = " </room>\n"
|
|
109
|
-
local room = (roomHeader .. doorsXML) .. roomFooter
|
|
110
|
-
rooms[#rooms + 1] = room
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
::__continue5::
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
::__continue3::
|
|
117
|
-
end
|
|
118
|
-
local xml = table.concat({
|
|
119
|
-
__TS__StringTrim(("\n<?xml version=\"1.0\" ?>\n<rooms>\n" .. table.concat(rooms, "")) .. "\n</rooms>"),
|
|
120
|
-
"\n"
|
|
121
|
-
})
|
|
122
|
-
for ____, line in ipairs(__TS__StringSplit(xml, "\n")) do
|
|
123
|
-
Isaac.DebugString(line)
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
return ____exports
|
package/interfaces/JSONDoor.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Part of `JSONRooms`. */
|
|
2
|
-
export interface JSONDoor {
|
|
3
|
-
$: {
|
|
4
|
-
/** Equal to "True" or "False". Needs to be converted to an `boolean`. */
|
|
5
|
-
exists: string;
|
|
6
|
-
/** Needs to be converted to an `int`. */
|
|
7
|
-
x: string;
|
|
8
|
-
/** Needs to be converted to an `int`. */
|
|
9
|
-
y: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Part of `JSONRooms`. */
|
|
2
|
-
export interface JSONEntity {
|
|
3
|
-
$: {
|
|
4
|
-
/** Needs to be converted to an `int`. */
|
|
5
|
-
type: string;
|
|
6
|
-
/** Needs to be converted to an `int`. */
|
|
7
|
-
variant: string;
|
|
8
|
-
/** Needs to be converted to an `int`. */
|
|
9
|
-
subtype: string;
|
|
10
|
-
/** Needs to be converted to a `float`. */
|
|
11
|
-
weight: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
package/interfaces/JSONRoom.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { JSONDoor } from "./JSONDoor";
|
|
2
|
-
import { JSONSpawn } from "./JSONSpawn";
|
|
3
|
-
/** Part of `JSONRooms`. */
|
|
4
|
-
export interface JSONRoom {
|
|
5
|
-
$: {
|
|
6
|
-
/** Needs to be converted to an `int`. */
|
|
7
|
-
difficulty: string;
|
|
8
|
-
/** Needs to be converted to an `int`. */
|
|
9
|
-
height: string;
|
|
10
|
-
name: string;
|
|
11
|
-
/** Needs to be converted to an `int`. */
|
|
12
|
-
shape: string;
|
|
13
|
-
/** Needs to be converted to an `int`. */
|
|
14
|
-
subtype: string;
|
|
15
|
-
/** Needs to be converted to an `int`. */
|
|
16
|
-
type: string;
|
|
17
|
-
/** Needs to be converted to an `int`. */
|
|
18
|
-
variant: string;
|
|
19
|
-
/** Needs to be converted to a `float`. */
|
|
20
|
-
weight: string;
|
|
21
|
-
/** Needs to be converted to an `int`. */
|
|
22
|
-
width: string;
|
|
23
|
-
};
|
|
24
|
-
door: JSONDoor[];
|
|
25
|
-
spawn: JSONSpawn[];
|
|
26
|
-
}
|
package/interfaces/JSONRoom.lua
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JSONRoom } from "./JSONRoom";
|
|
2
|
-
/**
|
|
3
|
-
* Custom rooms are created with the Basement Renovator program, which outputs XML files and STB
|
|
4
|
-
* files. A `JSONRooms` object is simply an XML file converted to JSON. You can convert your XML
|
|
5
|
-
* files using the following command: `npx convert-xml-to-json foo.xml foo.json`
|
|
6
|
-
*/
|
|
7
|
-
export interface JSONRooms {
|
|
8
|
-
rooms: {
|
|
9
|
-
room: JSONRoom[];
|
|
10
|
-
};
|
|
11
|
-
}
|
package/interfaces/JSONRooms.lua
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JSONEntity } from "./JSONEntity";
|
|
2
|
-
/** Part of `JSONRooms`. */
|
|
3
|
-
export interface JSONSpawn {
|
|
4
|
-
$: {
|
|
5
|
-
/** Needs to be converted to an `int`. */
|
|
6
|
-
x: string;
|
|
7
|
-
/** Needs to be converted to an `int`. */
|
|
8
|
-
y: string;
|
|
9
|
-
};
|
|
10
|
-
entity: JSONEntity[];
|
|
11
|
-
}
|
package/interfaces/JSONSpawn.lua
DELETED