isaacscript-common 6.0.0 → 6.1.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.
Files changed (45) hide show
  1. package/callbacks/postCollectibleEmpty.d.ts +1 -0
  2. package/callbacks/postCollectibleEmpty.lua +40 -0
  3. package/callbacks/subscriptions/postCollectibleEmpty.d.ts +5 -0
  4. package/callbacks/subscriptions/postCollectibleEmpty.lua +29 -0
  5. package/enums/ModCallbackCustom.d.ts +92 -77
  6. package/enums/ModCallbackCustom.lua +79 -77
  7. package/features/customStage/exports.d.ts +1 -8
  8. package/features/customStage/exports.lua +6 -14
  9. package/features/customStage/init.d.ts +1 -0
  10. package/features/customStage/init.lua +18 -0
  11. package/features/customStage/metadata.lua +1 -0
  12. package/features/customStage/v.d.ts +2 -2
  13. package/features/customStage/v.lua +1 -1
  14. package/features/deployJSONRoom.d.ts +1 -1
  15. package/functions/boss.d.ts +2 -2
  16. package/functions/doors.d.ts +2 -2
  17. package/functions/doors.lua +5 -4
  18. package/functions/entity.d.ts +2 -2
  19. package/functions/entitySpecific.d.ts +20 -20
  20. package/functions/jsonRoom.d.ts +1 -1
  21. package/functions/pickups.d.ts +16 -16
  22. package/index.d.ts +1 -5
  23. package/initCustomCallbacks.lua +3 -0
  24. package/initFeatures.lua +3 -0
  25. package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
  26. package/interfaces/CustomStage.d.ts +51 -0
  27. package/interfaces/{CustomStageData.lua → CustomStage.lua} +0 -0
  28. package/interfaces/JSONRoomsFile.d.ts +75 -0
  29. package/interfaces/{JSONDoor.lua → JSONRoomsFile.lua} +0 -0
  30. package/objects/callbackRegisterFunctions.lua +3 -0
  31. package/package.json +1 -1
  32. package/features/customStage/constants.d.ts +0 -18
  33. package/features/customStage/constants.lua +0 -29
  34. package/features/customStage/scripts/generateCustomStageRooms.d.ts +0 -27
  35. package/features/customStage/scripts/generateCustomStageRooms.lua +0 -126
  36. package/interfaces/CustomStageData.d.ts +0 -5
  37. package/interfaces/JSONDoor.d.ts +0 -11
  38. package/interfaces/JSONEntity.d.ts +0 -13
  39. package/interfaces/JSONEntity.lua +0 -2
  40. package/interfaces/JSONRoom.d.ts +0 -26
  41. package/interfaces/JSONRoom.lua +0 -2
  42. package/interfaces/JSONRooms.d.ts +0 -11
  43. package/interfaces/JSONRooms.lua +0 -2
  44. package/interfaces/JSONSpawn.d.ts +0 -11
  45. package/interfaces/JSONSpawn.lua +0 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
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 postCollectibleEmptyHasSubscriptions = ____postCollectibleEmpty.postCollectibleEmptyHasSubscriptions
15
+ function hasSubscriptions(self)
16
+ return postCollectibleEmptyHasSubscriptions(nil)
17
+ end
18
+ function postPickupUpdateCollectible(self, pickup)
19
+ local collectible = pickup
20
+ local ptrHash = GetPtrHash(collectible)
21
+ local oldCollectibleType = v.room.collectibleTypeMap:get(ptrHash)
22
+ if oldCollectibleType == nil then
23
+ oldCollectibleType = collectible.SubType
24
+ end
25
+ v.room.collectibleTypeMap:set(ptrHash, collectible.SubType)
26
+ if oldCollectibleType == collectible.SubType then
27
+ return
28
+ end
29
+ if collectible.SubType == CollectibleType.NULL then
30
+ postCollectibleEmptyFire(nil, collectible, oldCollectibleType)
31
+ end
32
+ end
33
+ v = {room = {collectibleTypeMap = __TS__New(Map)}}
34
+ ---
35
+ -- @internal
36
+ function ____exports.postCollectibleEmptyInit(self, mod)
37
+ saveDataManager(nil, "postCollectibleEmpty", v, hasSubscriptions)
38
+ mod:AddCallback(ModCallback.POST_PICKUP_UPDATE, postPickupUpdateCollectible, PickupVariant.COLLECTIBLE)
39
+ end
40
+ 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