isaacscript-common 5.1.5 → 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.
Files changed (47) hide show
  1. package/callbacks/postCollectibleEmpty.d.ts +1 -0
  2. package/callbacks/postCollectibleEmpty.lua +41 -0
  3. package/callbacks/subscriptions/postCollectibleEmpty.d.ts +5 -0
  4. package/callbacks/subscriptions/postCollectibleEmpty.lua +29 -0
  5. package/constants.d.ts +3 -1
  6. package/constants.lua +3 -1
  7. package/enums/ModCallbackCustom.d.ts +92 -77
  8. package/enums/ModCallbackCustom.lua +79 -77
  9. package/features/customStage/exports.d.ts +1 -8
  10. package/features/customStage/exports.lua +6 -14
  11. package/features/customStage/init.d.ts +1 -0
  12. package/features/customStage/init.lua +18 -0
  13. package/features/customStage/metadata.lua +1 -0
  14. package/features/customStage/v.d.ts +2 -2
  15. package/features/customStage/v.lua +1 -1
  16. package/features/deployJSONRoom.d.ts +1 -1
  17. package/functions/boss.d.ts +2 -2
  18. package/functions/doors.d.ts +2 -2
  19. package/functions/doors.lua +5 -4
  20. package/functions/entity.d.ts +2 -2
  21. package/functions/entitySpecific.d.ts +20 -20
  22. package/functions/jsonRoom.d.ts +1 -1
  23. package/functions/pickups.d.ts +16 -16
  24. package/index.d.ts +1 -5
  25. package/initCustomCallbacks.lua +3 -0
  26. package/initFeatures.lua +3 -0
  27. package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
  28. package/interfaces/CustomStage.d.ts +51 -0
  29. package/interfaces/{CustomStageData.lua → CustomStage.lua} +0 -0
  30. package/interfaces/JSONRoomsFile.d.ts +75 -0
  31. package/interfaces/{JSONDoor.lua → JSONRoomsFile.lua} +0 -0
  32. package/objects/callbackRegisterFunctions.lua +3 -0
  33. package/package.json +1 -1
  34. package/features/customStage/constants.d.ts +0 -18
  35. package/features/customStage/constants.lua +0 -29
  36. package/features/customStage/scripts/generateCustomStageRooms.d.ts +0 -27
  37. package/features/customStage/scripts/generateCustomStageRooms.lua +0 -126
  38. package/interfaces/CustomStageData.d.ts +0 -5
  39. package/interfaces/JSONDoor.d.ts +0 -11
  40. package/interfaces/JSONEntity.d.ts +0 -13
  41. package/interfaces/JSONEntity.lua +0 -2
  42. package/interfaces/JSONRoom.d.ts +0 -26
  43. package/interfaces/JSONRoom.lua +0 -2
  44. package/interfaces/JSONRooms.d.ts +0 -11
  45. package/interfaces/JSONRooms.lua +0 -2
  46. package/interfaces/JSONSpawn.d.ts +0 -11
  47. package/interfaces/JSONSpawn.lua +0 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ local hasSubscriptions, postPickupUpdateCollectible, v
6
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
8
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
9
+ local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
10
+ local ____exports = require("features.saveDataManager.exports")
11
+ local saveDataManager = ____exports.saveDataManager
12
+ local ____postCollectibleEmpty = require("callbacks.subscriptions.postCollectibleEmpty")
13
+ local postCollectibleEmptyFire = ____postCollectibleEmpty.postCollectibleEmptyFire
14
+ local ____postCollectibleInitFirst = require("callbacks.subscriptions.postCollectibleInitFirst")
15
+ local postCollectibleInitFirstHasSubscriptions = ____postCollectibleInitFirst.postCollectibleInitFirstHasSubscriptions
16
+ function hasSubscriptions(self)
17
+ return postCollectibleInitFirstHasSubscriptions(nil)
18
+ end
19
+ function postPickupUpdateCollectible(self, pickup)
20
+ local collectible = pickup
21
+ local ptrHash = GetPtrHash(collectible)
22
+ local oldCollectibleType = v.room.collectibleTypeMap:get(ptrHash)
23
+ if oldCollectibleType == nil then
24
+ oldCollectibleType = collectible.SubType
25
+ end
26
+ v.room.collectibleTypeMap:set(ptrHash, collectible.SubType)
27
+ if oldCollectibleType == collectible.SubType then
28
+ return
29
+ end
30
+ if collectible.SubType == CollectibleType.NULL then
31
+ postCollectibleEmptyFire(nil, collectible, oldCollectibleType)
32
+ end
33
+ end
34
+ v = {room = {collectibleTypeMap = __TS__New(Map)}}
35
+ ---
36
+ -- @internal
37
+ function ____exports.postCollectibleEmptyInit(self, mod)
38
+ saveDataManager(nil, "postCollectibleEmpty", v, hasSubscriptions)
39
+ mod:AddCallback(ModCallback.POST_PICKUP_UPDATE, postPickupUpdateCollectible, PickupVariant.COLLECTIBLE)
40
+ end
41
+ return ____exports
@@ -0,0 +1,5 @@
1
+ import { CollectibleType } from "isaac-typescript-definitions";
2
+ export declare type PostCollectibleEmptyRegisterParameters = [
3
+ callback: (collectible: EntityPickup, oldCollectibleType: CollectibleType) => void,
4
+ collectibleType?: CollectibleType
5
+ ];
@@ -0,0 +1,29 @@
1
+ local ____exports = {}
2
+ local subscriptions = {}
3
+ ---
4
+ -- @internal
5
+ function ____exports.postCollectibleEmptyHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ ---
9
+ -- @internal
10
+ function ____exports.postCollectibleEmptyRegister(self, ...)
11
+ local args = {...}
12
+ subscriptions[#subscriptions + 1] = args
13
+ end
14
+ ---
15
+ -- @internal
16
+ function ____exports.postCollectibleEmptyFire(self, collectible, oldCollectibleType)
17
+ for ____, ____value in ipairs(subscriptions) do
18
+ local callback = ____value[1]
19
+ local collectibleType = ____value[2]
20
+ do
21
+ if collectibleType ~= nil and collectibleType ~= oldCollectibleType then
22
+ goto __continue5
23
+ end
24
+ callback(nil, collectible, oldCollectibleType)
25
+ end
26
+ ::__continue5::
27
+ end
28
+ end
29
+ return ____exports
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