isaacscript-common 5.1.4 → 6.0.1

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/constants.d.ts CHANGED
@@ -34,9 +34,11 @@ export declare const EMPTY_PNG_PATH = "gfx/none.png";
34
34
  * second TMTRAINER item subtracts one from that, and so on.
35
35
  */
36
36
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: CollectibleType;
37
+ /** Game frames are what is returned by the `Game.GetFrameCount` method. */
37
38
  export declare const GAME_FRAMES_PER_SECOND = 30;
39
+ /** Render frames are what is returned by the `Isaac.GetFrameCount` method. */
40
+ export declare const RENDER_FRAMES_PER_SECOND = 60;
38
41
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
39
- export declare const ISAAC_FRAMES_PER_SECOND = 60;
40
42
  /**
41
43
  * The floor is represented by a 13x13 grid. Room indexes start at 0. The first column is
42
44
  * represented by grid indexes 0, 13, 26, and so on.
package/constants.lua CHANGED
@@ -35,9 +35,11 @@ ____exports.EMPTY_PNG_PATH = "gfx/none.png"
35
35
  -- encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
36
36
  -- second TMTRAINER item subtracts one from that, and so on.
37
37
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
38
+ --- Game frames are what is returned by the `Game.GetFrameCount` method.
38
39
  ____exports.GAME_FRAMES_PER_SECOND = 30
40
+ --- Render frames are what is returned by the `Isaac.GetFrameCount` method.
41
+ ____exports.RENDER_FRAMES_PER_SECOND = 60
39
42
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
40
- ____exports.ISAAC_FRAMES_PER_SECOND = 60
41
43
  --- The floor is represented by a 13x13 grid. Room indexes start at 0. The first column is
42
44
  -- represented by grid indexes 0, 13, 26, and so on.
43
45
  ____exports.LEVEL_GRID_COLUMN_HEIGHT = 13
@@ -13,10 +13,10 @@ import { Keyboard } from "isaac-typescript-definitions";
13
13
  * @param triggerFunc A function containing the arbitrary code that you want to execute when the
14
14
  * hotkey is triggered.
15
15
  */
16
- export declare function registerHotkey(keyboardOrFunc: Keyboard | (() => Keyboard), triggerFunc: () => void): void;
16
+ export declare function registerHotkey(keyboardOrFunc: Keyboard | (() => Keyboard | undefined), triggerFunc: () => void): void;
17
17
  /**
18
18
  * Helper function to remove a hotkey created with the `registerHotkey` function.
19
19
  *
20
20
  * @param keyboardOrFunc Equal to the value that you passed when initially registering the hotkey.
21
21
  */
22
- export declare function unregisterHotkey(keyboardOrFunc: Keyboard | (() => Keyboard)): void;
22
+ export declare function unregisterHotkey(keyboardOrFunc: Keyboard | (() => Keyboard | undefined)): void;
@@ -25,7 +25,9 @@ function postRender(self)
25
25
  local keyboardFunc = ____value[1]
26
26
  local triggerFunc = ____value[2]
27
27
  local keyboard = keyboardFunc(nil)
28
- checkIfTriggered(nil, keyboard, triggerFunc)
28
+ if keyboard ~= nil then
29
+ checkIfTriggered(nil, keyboard, triggerFunc)
30
+ end
29
31
  end
30
32
  end
31
33
  function checkIfTriggered(self, keyboard, triggerFunc)
@@ -24,13 +24,13 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
24
24
  */
25
25
  export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
26
26
  /**
27
- * Helper function to help calculate the position that a player will enter a room at.
27
+ * Helper function to get the offset from a door position that a player will enter a room at.
28
28
  *
29
29
  * When players enter a room, they do not appear exactly on the location of the door, because then
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 getDoorEnterPositionOffset(doorSlot: DoorSlot): Vector;
33
+ export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): 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.
@@ -39,15 +39,16 @@ local isTSTLSet = ____tstlClass.isTSTLSet
39
39
  function ____exports.doorSlotToDirection(self, doorSlot)
40
40
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
41
41
  end
42
- --- Helper function to help calculate the position that a player will enter a room at.
42
+ --- Helper function to get the offset from a door position that a player will enter a room at.
43
43
  --
44
44
  -- When players enter a room, they do not appear exactly on the location of the door, because then
45
45
  -- they would immediately collide with the loading zone. Instead, they are offset by a certain
46
46
  -- amount of units.
47
- function ____exports.getDoorEnterPositionOffset(self, doorSlot)
47
+ function ____exports.getDoorSlotEnterPositionOffset(self, doorSlot)
48
48
  local direction = ____exports.doorSlotToDirection(nil, doorSlot)
49
49
  local vector = directionToVector(nil, direction)
50
- return vector * ROOM_ENTRY_OFFSET_FROM_DOOR
50
+ local oppositeVector = vector * -1
51
+ return oppositeVector * ROOM_ENTRY_OFFSET_FROM_DOOR
51
52
  end
52
53
  --- Helper function to get all of the doors in the room. By default, it will return every door. You
53
54
  -- can optionally specify one or more room types to return only the doors that match the specified
@@ -152,7 +153,7 @@ end
152
153
  -- they would immediately collide with the loading zone. Instead, they are offset by a certain
153
154
  -- amount of units.
154
155
  function ____exports.getDoorEnterPosition(self, door)
155
- local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
156
+ local offset = ____exports.getDoorSlotEnterPositionOffset(nil, door.Slot)
156
157
  return door.Position + offset
157
158
  end
158
159
  --- Helper function to convert an array of door slots or a set of door slots to the resulting bit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "5.1.4",
3
+ "version": "6.0.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",