isaacscript-common 4.2.6 → 4.2.8

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.
@@ -0,0 +1,5 @@
1
+ export declare enum StageTravelEntityType {
2
+ TRAPDOOR = 0,
3
+ CRAWLSPACE = 1,
4
+ HEAVEN_DOOR = 2
5
+ }
@@ -0,0 +1,9 @@
1
+ local ____exports = {}
2
+ ____exports.StageTravelEntityType = {}
3
+ ____exports.StageTravelEntityType.TRAPDOOR = 0
4
+ ____exports.StageTravelEntityType[____exports.StageTravelEntityType.TRAPDOOR] = "TRAPDOOR"
5
+ ____exports.StageTravelEntityType.CRAWLSPACE = 1
6
+ ____exports.StageTravelEntityType[____exports.StageTravelEntityType.CRAWLSPACE] = "CRAWLSPACE"
7
+ ____exports.StageTravelEntityType.HEAVEN_DOOR = 2
8
+ ____exports.StageTravelEntityType[____exports.StageTravelEntityType.HEAVEN_DOOR] = "HEAVEN_DOOR"
9
+ return ____exports
@@ -4,4 +4,3 @@ export declare enum SaveDataKey {
4
4
  LEVEL = "level",
5
5
  ROOM = "room"
6
6
  }
7
- export declare const RESETTABLE_SAVE_DATA_KEYS: ReadonlySet<SaveDataKey>;
@@ -1,11 +1,7 @@
1
- local ____lualib = require("lualib_bundle")
2
- local Set = ____lualib.Set
3
- local __TS__New = ____lualib.__TS__New
4
1
  local ____exports = {}
5
2
  ____exports.SaveDataKey = {}
6
3
  ____exports.SaveDataKey.PERSISTENT = "persistent"
7
4
  ____exports.SaveDataKey.RUN = "run"
8
5
  ____exports.SaveDataKey.LEVEL = "level"
9
6
  ____exports.SaveDataKey.ROOM = "room"
10
- ____exports.RESETTABLE_SAVE_DATA_KEYS = __TS__New(Set, {____exports.SaveDataKey.RUN, ____exports.SaveDataKey.LEVEL, ____exports.SaveDataKey.ROOM})
11
7
  return ____exports
@@ -1,7 +1,9 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
+ local Set = ____lualib.Set
4
+ local __TS__New = ____lualib.__TS__New
3
5
  local ____exports = {}
4
- local postPlayerInit, preGameExit, postNewLevel, postNewRoomEarly, restoreDefaultsAll, restoreDefaults, clearAndCopyAllElements, mod, loadedDataOnThisRun
6
+ local postPlayerInit, preGameExit, postNewLevel, postNewRoomEarly, restoreDefaultsAll, restoreDefaults, clearAndCopyAllElements, RESETTABLE_SAVE_DATA_KEYS, mod, loadedDataOnThisRun
5
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
8
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
7
9
  local ____cachedClasses = require("cachedClasses")
@@ -9,7 +11,6 @@ local game = ____cachedClasses.game
9
11
  local ____ModCallbackCustom = require("enums.ModCallbackCustom")
10
12
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
11
13
  local ____SaveDataKey = require("enums.private.SaveDataKey")
12
- local RESETTABLE_SAVE_DATA_KEYS = ____SaveDataKey.RESETTABLE_SAVE_DATA_KEYS
13
14
  local SaveDataKey = ____SaveDataKey.SaveDataKey
14
15
  local ____SerializationType = require("enums.SerializationType")
15
16
  local SerializationType = ____SerializationType.SerializationType
@@ -102,6 +103,7 @@ function clearAndCopyAllElements(self, oldTable, newTable)
102
103
  oldTable[key] = value
103
104
  end
104
105
  end
106
+ RESETTABLE_SAVE_DATA_KEYS = __TS__New(Set, {SaveDataKey.RUN, SaveDataKey.LEVEL, SaveDataKey.ROOM})
105
107
  mod = nil
106
108
  loadedDataOnThisRun = false
107
109
  ---
@@ -0,0 +1,23 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ /// <reference types="isaac-typescript-definitions" />
4
+ /// <reference types="isaac-typescript-definitions" />
5
+ /**
6
+ * Spawn a trapdoor grid entity that will have one or more of the following custom attributes:
7
+ *
8
+ * - custom sprite
9
+ * - custom opening/closing logic
10
+ * - custom destination / logic for after the player enters
11
+ */
12
+ export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector): GridEntity;
13
+ /**
14
+ * Convert an existing trapdoor into a custom trapdoor that will have one or more of the following
15
+ * custom attributes:
16
+ *
17
+ * - custom sprite
18
+ * - custom opening/closing logic
19
+ * - custom destination / logic for after the player enters
20
+ */
21
+ export declare function initCustomTrapdoor(_trapdoor: GridEntity, _shouldSpawnOpenFunc?: typeof defaultShouldSpawnOpenFunc): void;
22
+ declare function defaultShouldSpawnOpenFunc(_entity: GridEntity | EntityEffect): boolean;
23
+ export {};
@@ -0,0 +1,44 @@
1
+ local ____exports = {}
2
+ local defaultShouldSpawnOpenFunc
3
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
+ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
5
+ local ____cachedClasses = require("cachedClasses")
6
+ local game = ____cachedClasses.game
7
+ local ____gridEntity = require("functions.gridEntity")
8
+ local spawnGrid = ____gridEntity.spawnGrid
9
+ --- Convert an existing trapdoor into a custom trapdoor that will have one or more of the following
10
+ -- custom attributes:
11
+ --
12
+ -- - custom sprite
13
+ -- - custom opening/closing logic
14
+ -- - custom destination / logic for after the player enters
15
+ function ____exports.initCustomTrapdoor(self, _trapdoor, _shouldSpawnOpenFunc)
16
+ if _shouldSpawnOpenFunc == nil then
17
+ _shouldSpawnOpenFunc = defaultShouldSpawnOpenFunc
18
+ end
19
+ end
20
+ function defaultShouldSpawnOpenFunc(self, _entity)
21
+ local room = game:GetRoom()
22
+ local roomFrameCount = room:GetFrameCount()
23
+ local roomClear = room:IsClear()
24
+ if roomFrameCount == 0 then
25
+ if not roomClear then
26
+ return false
27
+ end
28
+ end
29
+ return false
30
+ end
31
+ --- Spawn a trapdoor grid entity that will have one or more of the following custom attributes:
32
+ --
33
+ -- - custom sprite
34
+ -- - custom opening/closing logic
35
+ -- - custom destination / logic for after the player enters
36
+ function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition)
37
+ local trapdoor = spawnGrid(nil, GridEntityType.TRAPDOOR, gridIndexOrPosition)
38
+ if trapdoor == nil then
39
+ error("Failed to spawn a custom trapdoor.")
40
+ end
41
+ ____exports.initCustomTrapdoor(nil, trapdoor)
42
+ return trapdoor
43
+ end
44
+ return ____exports
File without changes
File without changes
File without changes
File without changes
@@ -42,7 +42,7 @@ export declare function getCharacterDeathAnimationName(character: PlayerType): s
42
42
  * Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
43
43
  */
44
44
  export declare function getCharacterMaxHeartContainers(character: PlayerType): int;
45
- /** Helper function to get the name of a character. Returns "unknown" for modded characters. */
45
+ /** Helper function to get the name of a character. Returns "Unknown" for modded characters. */
46
46
  export declare function getCharacterName(character: PlayerType): string;
47
47
  export declare function isModdedCharacter(character: PlayerType): boolean;
48
48
  export declare function isVanillaCharacter(character: PlayerType): boolean;
@@ -84,10 +84,10 @@ function ____exports.getCharacterMaxHeartContainers(self, character)
84
84
  end
85
85
  return 12
86
86
  end
87
- --- Helper function to get the name of a character. Returns "unknown" for modded characters.
87
+ --- Helper function to get the name of a character. Returns "Unknown" for modded characters.
88
88
  function ____exports.getCharacterName(self, character)
89
89
  if ____exports.isModdedCharacter(nil, character) then
90
- return "unknown"
90
+ return "Unknown"
91
91
  end
92
92
  return CHARACTER_NAMES[character]
93
93
  end
@@ -1,5 +1,4 @@
1
1
  import { PlayerType } from "isaac-typescript-definitions";
2
- export declare const DEFAULT_CHARACTER_NAME = "Unknown";
3
2
  export declare const CHARACTER_NAMES: {
4
3
  readonly [key in PlayerType]: string;
5
4
  };
@@ -1,7 +1,6 @@
1
1
  local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
4
- ____exports.DEFAULT_CHARACTER_NAME = "Unknown"
5
4
  ____exports.CHARACTER_NAMES = {
6
5
  [PlayerType.POSSESSOR] = "Possessor",
7
6
  [PlayerType.ISAAC] = "Isaac",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "index",
23
23
  "types": "index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.11"
25
+ "isaac-typescript-definitions": "^3.0.12"
26
26
  }
27
27
  }