isaacscript-common 6.0.1 → 6.2.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 (60) 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/classes/DefaultMap.lua +2 -2
  6. package/enums/ModCallbackCustom.d.ts +92 -77
  7. package/enums/ModCallbackCustom.lua +79 -77
  8. package/features/customStage/exports.d.ts +3 -9
  9. package/features/customStage/exports.lua +86 -15
  10. package/features/customStage/init.d.ts +1 -0
  11. package/features/customStage/init.lua +48 -0
  12. package/features/customStage/metadata.lua +1 -0
  13. package/features/customStage/util.d.ts +11 -0
  14. package/features/customStage/util.lua +51 -0
  15. package/features/customStage/v.d.ts +6 -2
  16. package/features/customStage/v.lua +4 -1
  17. package/features/deployJSONRoom.d.ts +1 -1
  18. package/functions/boss.d.ts +2 -2
  19. package/functions/doors.d.ts +4 -0
  20. package/functions/doors.lua +14 -0
  21. package/functions/entity.d.ts +2 -2
  22. package/functions/entitySpecific.d.ts +20 -20
  23. package/functions/familiars.d.ts +2 -0
  24. package/functions/familiars.lua +16 -0
  25. package/functions/jsonRoom.d.ts +26 -4
  26. package/functions/jsonRoom.lua +64 -2
  27. package/functions/pickups.d.ts +16 -16
  28. package/functions/playerCenter.d.ts +6 -0
  29. package/functions/playerCenter.lua +57 -0
  30. package/functions/rooms.d.ts +1 -1
  31. package/functions/rooms.lua +2 -2
  32. package/functions/stage.d.ts +3 -3
  33. package/functions/stage.lua +5 -4
  34. package/functions/trinkets.lua +1 -1
  35. package/index.d.ts +1 -5
  36. package/initCustomCallbacks.lua +3 -0
  37. package/initFeatures.lua +3 -0
  38. package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
  39. package/interfaces/CustomStage.d.ts +10 -0
  40. package/interfaces/{CustomStageData.lua → CustomStage.lua} +0 -0
  41. package/interfaces/CustomStageLua.d.ts +118 -0
  42. package/interfaces/{JSONDoor.lua → CustomStageLua.lua} +0 -0
  43. package/interfaces/JSONRoomsFile.d.ts +75 -0
  44. package/interfaces/{JSONEntity.lua → JSONRoomsFile.lua} +0 -0
  45. package/objects/callbackRegisterFunctions.lua +3 -0
  46. package/objects/roomTypeGotoPrefixes.lua +29 -29
  47. package/package.json +1 -1
  48. package/features/customStage/constants.d.ts +0 -18
  49. package/features/customStage/constants.lua +0 -29
  50. package/features/customStage/scripts/generateCustomStageRooms.d.ts +0 -27
  51. package/features/customStage/scripts/generateCustomStageRooms.lua +0 -126
  52. package/interfaces/CustomStageData.d.ts +0 -5
  53. package/interfaces/JSONDoor.d.ts +0 -11
  54. package/interfaces/JSONEntity.d.ts +0 -13
  55. package/interfaces/JSONRoom.d.ts +0 -26
  56. package/interfaces/JSONRoom.lua +0 -2
  57. package/interfaces/JSONRooms.d.ts +0 -11
  58. package/interfaces/JSONRooms.lua +0 -2
  59. package/interfaces/JSONSpawn.d.ts +0 -11
  60. 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
@@ -120,7 +120,7 @@ function DefaultMap.prototype.getDefaultValue(self, ...)
120
120
  if self.defaultValueFactory ~= nil then
121
121
  return self:defaultValueFactory(...)
122
122
  end
123
- return error("A DefaultMap was incorrectly instantiated.")
123
+ error("A DefaultMap was incorrectly instantiated.")
124
124
  end
125
125
  function DefaultMap.prototype.getConstructorArg(self)
126
126
  if self.defaultValue ~= nil then
@@ -129,6 +129,6 @@ function DefaultMap.prototype.getConstructorArg(self)
129
129
  if self.defaultValueFactory ~= nil then
130
130
  return self.defaultValueFactory
131
131
  end
132
- return error("A DefaultMap was incorrectly instantiated.")
132
+ error("A DefaultMap was incorrectly instantiated.")
133
133
  end
134
134
  return ____exports