isaacscript-common 14.1.3 → 14.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.
- package/dist/index.d.ts +919 -141
- package/dist/isaacscript-common.lua +4752 -1790
- package/dist/src/callbacks.d.ts +102 -20
- package/dist/src/callbacks.d.ts.map +1 -1
- package/dist/src/callbacks.lua +124 -1
- package/dist/src/classes/ModFeature.d.ts.map +1 -1
- package/dist/src/classes/ModFeature.lua +22 -1
- package/dist/src/classes/ModUpgraded.d.ts +10 -5
- package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
- package/dist/src/classes/ModUpgraded.lua +30 -11
- package/dist/src/classes/callbacks/PostCustomRevive.d.ts +5 -2
- package/dist/src/classes/callbacks/PostCustomRevive.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostCustomRevive.lua +12 -4
- package/dist/src/classes/callbacks/PostGridEntityBroken.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCollision.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomBroken.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomCollision.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomInit.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomRemove.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomRender.d.ts +6 -0
- package/dist/src/classes/callbacks/PostGridEntityCustomRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostGridEntityCustomRender.lua +17 -0
- package/dist/src/classes/callbacks/PostGridEntityCustomStateChanged.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityCustomUpdate.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityInit.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityRemove.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityRender.d.ts +6 -0
- package/dist/src/classes/callbacks/PostGridEntityRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostGridEntityRender.lua +17 -0
- package/dist/src/classes/callbacks/PostGridEntityStateChanged.lua +1 -1
- package/dist/src/classes/callbacks/PostGridEntityUpdate.lua +1 -1
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.d.ts +1 -1
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.lua +3 -4
- package/dist/src/classes/callbacks/PostItemDischarge.d.ts +43 -0
- package/dist/src/classes/callbacks/PostItemDischarge.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostItemDischarge.lua +113 -0
- package/dist/src/classes/callbacks/PostItemPickup.d.ts +6 -0
- package/dist/src/classes/callbacks/PostItemPickup.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostItemPickup.lua +17 -0
- package/dist/src/classes/callbacks/PostLaserInitLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostLaserInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostLaserInitLate.lua +27 -0
- package/dist/src/classes/callbacks/PostNPCInitLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostNPCInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostNPCInitLate.lua +27 -0
- package/dist/src/classes/callbacks/PostNPCStateChanged.d.ts +14 -0
- package/dist/src/classes/callbacks/PostNPCStateChanged.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostNPCStateChanged.lua +33 -0
- package/dist/src/classes/callbacks/PostPickupCollect.d.ts +12 -0
- package/dist/src/classes/callbacks/PostPickupCollect.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPickupCollect.lua +35 -0
- package/dist/src/classes/callbacks/PostPickupInitFirst.d.ts +12 -0
- package/dist/src/classes/callbacks/PostPickupInitFirst.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPickupInitFirst.lua +32 -0
- package/dist/src/classes/callbacks/PostPickupInitLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostPickupInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPickupInitLate.lua +27 -0
- package/dist/src/classes/callbacks/PostPickupStateChanged.d.ts +13 -0
- package/dist/src/classes/callbacks/PostPickupStateChanged.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPickupStateChanged.lua +33 -0
- package/dist/src/classes/callbacks/PostPitUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostPitUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPitUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostPlayerChangeHealth.d.ts +15 -0
- package/dist/src/classes/callbacks/PostPlayerChangeHealth.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerChangeHealth.lua +52 -0
- package/dist/src/classes/callbacks/PostPlayerChangeStat.d.ts +16 -0
- package/dist/src/classes/callbacks/PostPlayerChangeStat.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerChangeStat.lua +94 -0
- package/dist/src/classes/callbacks/PostPlayerChangeType.d.ts +15 -0
- package/dist/src/classes/callbacks/PostPlayerChangeType.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerChangeType.lua +37 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleAdded.d.ts +6 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleAdded.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleAdded.lua +17 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleRemoved.d.ts +6 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleRemoved.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerCollectibleRemoved.lua +17 -0
- package/dist/src/classes/callbacks/PostPlayerInitFirst.d.ts +8 -0
- package/dist/src/classes/callbacks/PostPlayerInitFirst.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerInitFirst.lua +39 -0
- package/dist/src/classes/callbacks/PostPlayerInitLate.d.ts +13 -0
- package/dist/src/classes/callbacks/PostPlayerInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPlayerInitLate.lua +29 -0
- package/dist/src/classes/callbacks/PostPoopRender.d.ts +7 -0
- package/dist/src/classes/callbacks/PostPoopRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPoopRender.lua +24 -0
- package/dist/src/classes/callbacks/PostPoopUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostPoopUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPoopUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostPressurePlateRender.d.ts +7 -0
- package/dist/src/classes/callbacks/PostPressurePlateRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPressurePlateRender.lua +24 -0
- package/dist/src/classes/callbacks/PostPressurePlateUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostPressurePlateUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPressurePlateUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostProjectileInitLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostProjectileInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostProjectileInitLate.lua +27 -0
- package/dist/src/classes/callbacks/PostPurchase.d.ts +18 -0
- package/dist/src/classes/callbacks/PostPurchase.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostPurchase.lua +56 -0
- package/dist/src/classes/callbacks/PostRockRender.d.ts +7 -0
- package/dist/src/classes/callbacks/PostRockRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostRockRender.lua +24 -0
- package/dist/src/classes/callbacks/PostRockUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostRockUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostRockUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostSacrifice.d.ts +15 -0
- package/dist/src/classes/callbacks/PostSacrifice.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSacrifice.lua +52 -0
- package/dist/src/classes/callbacks/PostSlotAnimationChanged.d.ts +6 -0
- package/dist/src/classes/callbacks/PostSlotAnimationChanged.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotAnimationChanged.lua +17 -0
- package/dist/src/classes/callbacks/PostSlotCollision.d.ts +7 -0
- package/dist/src/classes/callbacks/PostSlotCollision.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotCollision.lua +25 -0
- package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts +14 -0
- package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotDestroyed.lua +65 -0
- package/dist/src/classes/callbacks/PostSlotInit.d.ts +6 -0
- package/dist/src/classes/callbacks/PostSlotInit.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotInit.lua +17 -0
- package/dist/src/classes/callbacks/PostSlotRender.d.ts +6 -0
- package/dist/src/classes/callbacks/PostSlotRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotRender.lua +17 -0
- package/dist/src/classes/callbacks/PostSlotUpdate.d.ts +6 -0
- package/dist/src/classes/callbacks/PostSlotUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSlotUpdate.lua +17 -0
- package/dist/src/classes/callbacks/PostSpikesUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostSpikesUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostSpikesUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostTNTRender.d.ts +7 -0
- package/dist/src/classes/callbacks/PostTNTRender.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostTNTRender.lua +24 -0
- package/dist/src/classes/callbacks/PostTNTUpdate.d.ts +7 -0
- package/dist/src/classes/callbacks/PostTNTUpdate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostTNTUpdate.lua +24 -0
- package/dist/src/classes/callbacks/PostTearInitLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostTearInitLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostTearInitLate.lua +27 -0
- package/dist/src/classes/callbacks/PostTearInitVeryLate.d.ts +12 -0
- package/dist/src/classes/callbacks/PostTearInitVeryLate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostTearInitVeryLate.lua +30 -0
- package/dist/src/classes/callbacks/PostTransformation.d.ts +18 -0
- package/dist/src/classes/callbacks/PostTransformation.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PostTransformation.lua +53 -0
- package/dist/src/classes/callbacks/PreBerserkDeath.d.ts +1 -1
- package/dist/src/classes/callbacks/PreBerserkDeath.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PreBerserkDeath.lua +3 -4
- package/dist/src/classes/callbacks/PreItemPickup.d.ts +6 -0
- package/dist/src/classes/callbacks/PreItemPickup.d.ts.map +1 -0
- package/dist/src/classes/callbacks/PreItemPickup.lua +17 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackCollectibleType.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackCollectibleType.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackCollectibleType.lua +19 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackItemPickup.d.ts +11 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackItemPickup.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackItemPickup.lua +22 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackLaser.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackLaser.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackLaser.lua +19 -0
- package/dist/src/classes/callbacks/validation/{CustomCallbackRevive.d.ts → CustomCallbackNPC.d.ts} +4 -4
- package/dist/src/classes/callbacks/validation/CustomCallbackNPC.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackNPC.lua +22 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPickup.d.ts +12 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPickup.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPickup.lua +22 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPlayer.d.ts +5 -2
- package/dist/src/classes/callbacks/validation/CustomCallbackPlayer.d.ts.map +1 -1
- package/dist/src/classes/callbacks/validation/CustomCallbackPoop.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPoop.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPoop.lua +20 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPressurePlate.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPressurePlate.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackPressurePlate.lua +20 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackProjectile.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackProjectile.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackProjectile.lua +19 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackRock.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackRock.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackRock.lua +20 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackSlot.d.ts +12 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackSlot.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackSlot.lua +19 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackSpikes.lua +4 -4
- package/dist/src/classes/callbacks/validation/CustomCallbackTNT.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackTNT.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackTNT.lua +20 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackTear.d.ts +10 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackTear.d.ts.map +1 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackTear.lua +19 -0
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +27 -30
- package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts +2 -2
- package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/CustomRevive.lua +6 -6
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.lua +3 -18
- package/dist/src/classes/features/callbackLogic/GridEntityCollisionDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GridEntityRenderDetection.d.ts +12 -0
- package/dist/src/classes/features/callbackLogic/GridEntityRenderDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/GridEntityRenderDetection.lua +33 -0
- package/dist/src/classes/features/callbackLogic/{GridEntityDetection.d.ts → GridEntityUpdateDetection.d.ts} +3 -3
- package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/{GridEntityDetection.lua → GridEntityUpdateDetection.lua} +11 -14
- package/dist/src/classes/features/callbackLogic/ItemPickupDetection.d.ts +20 -0
- package/dist/src/classes/features/callbackLogic/ItemPickupDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/ItemPickupDetection.lua +60 -0
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts +47 -0
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.lua +154 -0
- package/dist/src/classes/features/callbackLogic/SlotRenderDetection.d.ts +18 -0
- package/dist/src/classes/features/callbackLogic/SlotRenderDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/SlotRenderDetection.lua +51 -0
- package/dist/src/classes/features/callbackLogic/SlotUpdateDetection.d.ts +17 -0
- package/dist/src/classes/features/callbackLogic/SlotUpdateDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/SlotUpdateDetection.lua +45 -0
- package/dist/src/classes/features/other/RunInNFrames.d.ts.map +1 -1
- package/dist/src/classes/features/other/RunInNFrames.lua +9 -0
- package/dist/src/classes/features/other/SaveDataManager.d.ts +215 -0
- package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -0
- package/dist/src/classes/features/other/SaveDataManager.lua +190 -0
- package/dist/src/classes/features/other/saveDataManager/glowingHourGlass.d.ts +6 -0
- package/dist/src/classes/features/other/saveDataManager/glowingHourGlass.d.ts.map +1 -0
- package/dist/src/classes/features/other/saveDataManager/glowingHourGlass.lua +98 -0
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.d.ts +6 -0
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.d.ts.map +1 -0
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.lua +81 -0
- package/dist/src/classes/features/other/saveDataManager/restoreDefaults.d.ts +7 -0
- package/dist/src/classes/features/other/saveDataManager/restoreDefaults.d.ts.map +1 -0
- package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +69 -0
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.d.ts +5 -0
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.d.ts.map +1 -0
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.lua +46 -0
- package/dist/src/classes/private/CustomCallback.d.ts +2 -3
- package/dist/src/classes/private/CustomCallback.d.ts.map +1 -1
- package/dist/src/classes/private/CustomCallback.lua +2 -5
- package/dist/src/classes/private/Feature.d.ts +1 -0
- package/dist/src/classes/private/Feature.d.ts.map +1 -1
- package/dist/src/classes/private/Feature.lua +1 -0
- package/dist/src/core/upgradeMod.d.ts.map +1 -1
- package/dist/src/decorators.d.ts +1 -1
- package/dist/src/decorators.d.ts.map +1 -1
- package/dist/src/decorators.lua +6 -8
- package/dist/src/enums/ISCFeature.d.ts +15 -9
- package/dist/src/enums/ISCFeature.d.ts.map +1 -1
- package/dist/src/enums/ISCFeature.lua +30 -9
- package/dist/src/enums/ModCallbackCustom.d.ts +34 -20
- package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/src/enums/ModCallbackCustom2.d.ts +61 -20
- package/dist/src/enums/ModCallbackCustom2.d.ts.map +1 -1
- package/dist/src/enums/ModCallbackCustom2.lua +102 -20
- package/dist/src/enums/{private/SerializationBrand.d.ts → SerializationBrand.d.ts} +6 -1
- package/dist/src/enums/SerializationBrand.d.ts.map +1 -0
- package/dist/src/enums/{private/SerializationBrand.lua → SerializationBrand.lua} +1 -0
- package/dist/src/features/customItemPool.d.ts +52 -0
- package/dist/src/features/customItemPool.d.ts.map +1 -0
- package/dist/src/features/customItemPool.lua +111 -0
- package/dist/src/features/deployJSONRoom.d.ts +6 -4
- package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
- package/dist/src/features/deployJSONRoom.lua +6 -4
- package/dist/src/features/fadeInRemover.d.ts.map +1 -1
- package/dist/src/features/fadeInRemover.lua +4 -16
- package/dist/src/features/saveDataManager/exports.d.ts +14 -4
- package/dist/src/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/exports.lua +38 -0
- package/dist/src/features/saveDataManager/load.d.ts +2 -1
- package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/load.lua +10 -4
- package/dist/src/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/main.lua +12 -5
- package/dist/src/features/saveDataManager/maps.d.ts +14 -0
- package/dist/src/features/saveDataManager/maps.d.ts.map +1 -1
- package/dist/src/features/saveDataManager/maps.lua +7 -0
- package/dist/src/features.d.ts +31 -12
- package/dist/src/features.d.ts.map +1 -1
- package/dist/src/features.lua +24 -6
- package/dist/src/functions/array.d.ts.map +1 -1
- package/dist/src/functions/array.lua +4 -5
- package/dist/src/functions/bitSet128.d.ts +2 -2
- package/dist/src/functions/bitSet128.lua +3 -3
- package/dist/src/functions/color.d.ts +2 -2
- package/dist/src/functions/color.lua +3 -3
- package/dist/src/functions/decorators.d.ts +21 -0
- package/dist/src/functions/decorators.d.ts.map +1 -1
- package/dist/src/functions/deepCopy.d.ts +11 -4
- package/dist/src/functions/deepCopy.d.ts.map +1 -1
- package/dist/src/functions/deepCopy.lua +84 -32
- package/dist/src/functions/deepCopyTests.lua +1 -1
- package/dist/src/functions/initArray.d.ts +4 -4
- package/dist/src/functions/initArray.d.ts.map +1 -1
- package/dist/src/functions/initArray.lua +6 -12
- package/dist/src/functions/jsonRoom.d.ts +11 -0
- package/dist/src/functions/jsonRoom.d.ts.map +1 -1
- package/dist/src/functions/jsonRoom.lua +11 -0
- package/dist/src/functions/kColor.d.ts +2 -2
- package/dist/src/functions/kColor.lua +3 -3
- package/dist/src/functions/merge.d.ts +40 -0
- package/dist/src/functions/merge.d.ts.map +1 -0
- package/dist/src/{features/saveDataManager → functions}/merge.lua +84 -37
- package/dist/src/functions/mergeTests.d.ts +1 -2
- package/dist/src/functions/mergeTests.d.ts.map +1 -1
- package/dist/src/functions/mergeTests.lua +3 -4
- package/dist/src/functions/rng.d.ts +2 -2
- package/dist/src/functions/rng.lua +3 -3
- package/dist/src/functions/serialization.d.ts.map +1 -1
- package/dist/src/functions/serialization.lua +22 -0
- package/dist/src/functions/tstlClass.d.ts +0 -10
- package/dist/src/functions/tstlClass.d.ts.map +1 -1
- package/dist/src/functions/tstlClass.lua +2 -42
- package/dist/src/functions/vector.d.ts +2 -2
- package/dist/src/functions/vector.lua +3 -3
- package/dist/src/functions/weighted.d.ts +12 -1
- package/dist/src/functions/weighted.d.ts.map +1 -1
- package/dist/src/functions/weighted.lua +27 -10
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +24 -0
- package/dist/src/interfaces/SaveData.d.ts +3 -7
- package/dist/src/interfaces/SaveData.d.ts.map +1 -1
- package/dist/src/interfaces/SaveData.lua +0 -11
- package/dist/src/interfaces/private/AddCallbackParametersCustom2.d.ts +195 -2
- package/dist/src/interfaces/private/AddCallbackParametersCustom2.d.ts.map +1 -1
- package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts +1 -1
- package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
- package/dist/src/objects/isaacAPIClassTypeToBrand.lua +1 -1
- package/dist/src/types/AnyClass.d.ts +2 -0
- package/dist/src/types/AnyClass.d.ts.map +1 -0
- package/dist/src/types/AnyClass.lua +2 -0
- package/dist/src/types/AnyFunction.d.ts +6 -0
- package/dist/src/types/AnyFunction.d.ts.map +1 -0
- package/dist/src/types/AnyFunction.lua +2 -0
- package/dist/src/types/FunctionTuple.d.ts +2 -4
- package/dist/src/types/FunctionTuple.d.ts.map +1 -1
- package/dist/src/types/HasFunction.d.ts +5 -0
- package/dist/src/types/HasFunction.d.ts.map +1 -0
- package/dist/src/types/HasFunction.lua +2 -0
- package/package.json +1 -1
- package/src/callbacks.ts +88 -5
- package/src/classes/ModFeature.ts +31 -1
- package/src/classes/ModUpgraded.ts +49 -21
- package/src/classes/callbacks/PostCustomRevive.ts +22 -2
- package/src/classes/callbacks/PostGridEntityBroken.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCollision.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomBroken.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomCollision.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomInit.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomRemove.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomRender.ts +11 -0
- package/src/classes/callbacks/PostGridEntityCustomStateChanged.ts +1 -1
- package/src/classes/callbacks/PostGridEntityCustomUpdate.ts +1 -1
- package/src/classes/callbacks/PostGridEntityInit.ts +1 -1
- package/src/classes/callbacks/PostGridEntityRemove.ts +1 -1
- package/src/classes/callbacks/PostGridEntityRender.ts +11 -0
- package/src/classes/callbacks/PostGridEntityStateChanged.ts +1 -1
- package/src/classes/callbacks/PostGridEntityUpdate.ts +1 -1
- package/src/classes/callbacks/PostHolyMantleRemoved.ts +5 -8
- package/src/classes/callbacks/PostItemDischarge.ts +181 -0
- package/src/classes/callbacks/PostItemPickup.ts +11 -0
- package/src/classes/callbacks/PostLaserInitLate.ts +28 -0
- package/src/classes/callbacks/PostNPCInitLate.ts +28 -0
- package/src/classes/callbacks/PostNPCStateChanged.ts +37 -0
- package/src/classes/callbacks/PostPickupCollect.ts +37 -0
- package/src/classes/callbacks/PostPickupInitFirst.ts +34 -0
- package/src/classes/callbacks/PostPickupInitLate.ts +28 -0
- package/src/classes/callbacks/PostPickupStateChanged.ts +35 -0
- package/src/classes/callbacks/PostPitUpdate.ts +21 -0
- package/src/classes/callbacks/PostPlayerChangeHealth.ts +57 -0
- package/src/classes/callbacks/PostPlayerChangeStat.ts +102 -0
- package/src/classes/callbacks/PostPlayerChangeType.ts +44 -0
- package/src/classes/callbacks/PostPlayerCollectibleAdded.ts +11 -0
- package/src/classes/callbacks/PostPlayerCollectibleRemoved.ts +11 -0
- package/src/classes/callbacks/PostPlayerInitFirst.ts +44 -0
- package/src/classes/callbacks/PostPlayerInitLate.ts +32 -0
- package/src/classes/callbacks/PostPoopRender.ts +21 -0
- package/src/classes/callbacks/PostPoopUpdate.ts +21 -0
- package/src/classes/callbacks/PostPressurePlateRender.ts +21 -0
- package/src/classes/callbacks/PostPressurePlateUpdate.ts +21 -0
- package/src/classes/callbacks/PostProjectileInitLate.ts +28 -0
- package/src/classes/callbacks/PostPurchase.ts +87 -0
- package/src/classes/callbacks/PostRockRender.ts +21 -0
- package/src/classes/callbacks/PostRockUpdate.ts +21 -0
- package/src/classes/callbacks/PostSacrifice.ts +89 -0
- package/src/classes/callbacks/PostSlotAnimationChanged.ts +11 -0
- package/src/classes/callbacks/PostSlotCollision.ts +26 -0
- package/src/classes/callbacks/PostSlotDestroyed.ts +79 -0
- package/src/classes/callbacks/PostSlotInit.ts +11 -0
- package/src/classes/callbacks/PostSlotRender.ts +11 -0
- package/src/classes/callbacks/PostSlotUpdate.ts +11 -0
- package/src/classes/callbacks/PostSpikesUpdate.ts +21 -0
- package/src/classes/callbacks/PostTNTRender.ts +21 -0
- package/src/classes/callbacks/PostTNTUpdate.ts +21 -0
- package/src/classes/callbacks/PostTearInitLate.ts +28 -0
- package/src/classes/callbacks/PostTearInitVeryLate.ts +33 -0
- package/src/classes/callbacks/PostTransformation.ts +71 -0
- package/src/classes/callbacks/PreBerserkDeath.ts +5 -8
- package/src/classes/callbacks/PreItemPickup.ts +11 -0
- package/src/classes/callbacks/validation/CustomCallbackCollectibleType.ts +32 -0
- package/src/classes/callbacks/validation/CustomCallbackItemPickup.ts +48 -0
- package/src/classes/callbacks/validation/CustomCallbackLaser.ts +27 -0
- package/src/classes/callbacks/validation/CustomCallbackNPC.ts +34 -0
- package/src/classes/callbacks/validation/CustomCallbackPickup.ts +41 -0
- package/src/classes/callbacks/validation/CustomCallbackPlayer.ts +25 -2
- package/src/classes/callbacks/validation/CustomCallbackPoop.ts +28 -0
- package/src/classes/callbacks/validation/CustomCallbackPressurePlate.ts +31 -0
- package/src/classes/callbacks/validation/CustomCallbackProjectile.ts +28 -0
- package/src/classes/callbacks/validation/CustomCallbackRock.ts +30 -0
- package/src/classes/callbacks/validation/CustomCallbackSlot.ts +37 -0
- package/src/classes/callbacks/validation/CustomCallbackSpikes.ts +4 -4
- package/src/classes/callbacks/validation/CustomCallbackTNT.ts +28 -0
- package/src/classes/callbacks/validation/CustomCallbackTear.ts +27 -0
- package/src/classes/features/callbackLogic/CustomGridEntities.ts +32 -36
- package/src/classes/features/callbackLogic/CustomRevive.ts +14 -21
- package/src/classes/features/callbackLogic/EsauJrDetection.ts +0 -4
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +7 -9
- package/src/classes/features/callbackLogic/GridEntityCollisionDetection.ts +0 -4
- package/src/classes/features/callbackLogic/GridEntityRenderDetection.ts +42 -0
- package/src/classes/features/callbackLogic/{GridEntityDetection.ts → GridEntityUpdateDetection.ts} +4 -20
- package/src/classes/features/callbackLogic/ItemPickupDetection.ts +91 -0
- package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +245 -0
- package/src/classes/features/callbackLogic/SlotRenderDetection.ts +64 -0
- package/src/classes/features/callbackLogic/SlotUpdateDetection.ts +57 -0
- package/src/classes/features/other/RunInNFrames.ts +7 -0
- package/src/classes/features/other/SaveDataManager.ts +492 -0
- package/src/classes/features/other/saveDataManager/glowingHourGlass.ts +138 -0
- package/src/classes/features/other/saveDataManager/loadFromDisk.ts +99 -0
- package/src/classes/features/other/saveDataManager/restoreDefaults.ts +116 -0
- package/src/classes/features/other/saveDataManager/saveToDisk.ts +70 -0
- package/src/classes/private/CustomCallback.ts +2 -6
- package/src/classes/private/Feature.ts +1 -0
- package/src/core/upgradeMod.ts +2 -4
- package/src/decorators.ts +17 -19
- package/src/enums/ISCFeature.ts +44 -39
- package/src/enums/ModCallbackCustom.ts +34 -20
- package/src/enums/ModCallbackCustom2.ts +53 -5
- package/src/enums/{private/SerializationBrand.ts → SerializationBrand.ts} +8 -2
- package/src/features/customItemPool.ts +133 -0
- package/src/features/deployJSONRoom.ts +6 -4
- package/src/features/fadeInRemover.ts +4 -22
- package/src/features/saveDataManager/exports.ts +62 -3
- package/src/features/saveDataManager/load.ts +4 -1
- package/src/features/saveDataManager/main.ts +5 -3
- package/src/features/saveDataManager/maps.ts +16 -0
- package/src/features.ts +39 -4
- package/src/functions/array.ts +8 -9
- package/src/functions/bitSet128.ts +3 -3
- package/src/functions/color.ts +3 -3
- package/src/functions/decorators.ts +22 -0
- package/src/functions/deepCopy.ts +83 -17
- package/src/functions/deepCopyTests.ts +1 -1
- package/src/functions/initArray.ts +6 -11
- package/src/functions/jsonRoom.ts +11 -0
- package/src/functions/kColor.ts +3 -3
- package/src/{features/saveDataManager → functions}/merge.ts +79 -45
- package/src/functions/mergeTests.ts +2 -3
- package/src/functions/rng.ts +3 -3
- package/src/functions/serialization.ts +25 -1
- package/src/functions/table.ts +1 -1
- package/src/functions/tstlClass.ts +3 -57
- package/src/functions/vector.ts +3 -3
- package/src/functions/weighted.ts +28 -11
- package/src/index.ts +5 -0
- package/src/interfaces/SaveData.ts +3 -34
- package/src/interfaces/private/AddCallbackParametersCustom2.ts +298 -7
- package/src/objects/isaacAPIClassTypeToBrand.ts +1 -1
- package/src/types/AnyClass.ts +1 -0
- package/src/types/AnyFunction.ts +5 -0
- package/src/types/FunctionTuple.ts +3 -4
- package/src/types/HasFunction.ts +7 -0
- package/dist/src/classes/callbacks/validation/CustomCallbackRevive.d.ts.map +0 -1
- package/dist/src/classes/callbacks/validation/CustomCallbackRevive.lua +0 -19
- package/dist/src/classes/features/callbackLogic/GridEntityDetection.d.ts.map +0 -1
- package/dist/src/enums/private/SerializationBrand.d.ts.map +0 -1
- package/dist/src/features/saveDataManager/merge.d.ts +0 -26
- package/dist/src/features/saveDataManager/merge.d.ts.map +0 -1
- package/dist/src/features/saveDataManager/serializationBrands.d.ts +0 -2
- package/dist/src/features/saveDataManager/serializationBrands.d.ts.map +0 -1
- package/dist/src/features/saveDataManager/serializationBrands.lua +0 -19
- package/dist/src/indexLua.d.ts +0 -199
- package/dist/src/indexLua.d.ts.map +0 -1
- package/dist/src/indexLua.lua +0 -1354
- package/src/classes/callbacks/validation/CustomCallbackRevive.ts +0 -27
- package/src/features/saveDataManager/serializationBrands.ts +0 -16
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { SaveDataKey } from "../../../enums/SaveDataKey";
|
|
3
|
+
import { SaveData } from "../../../interfaces/SaveData";
|
|
4
|
+
import { AnyClass } from "../../../types/AnyClass";
|
|
5
|
+
import { Feature } from "../../private/Feature";
|
|
6
|
+
export declare class SaveDataManager extends Feature {
|
|
7
|
+
/**
|
|
8
|
+
* We store a local reference to the mod object so that we can access the corresponding methods
|
|
9
|
+
* that read and write to the "save#.dat" file.
|
|
10
|
+
*/
|
|
11
|
+
private mod;
|
|
12
|
+
/**
|
|
13
|
+
* The save data map is indexed by subscriber name. We use Lua tables instead of TypeScriptToLua
|
|
14
|
+
* Maps for the master map so that we can access the variables via the in-game console when
|
|
15
|
+
* debugging. (TSTL Maps don't expose the map keys as normal keys.)
|
|
16
|
+
*/
|
|
17
|
+
private saveDataMap;
|
|
18
|
+
/**
|
|
19
|
+
* When mod feature data is initialized, we copy the initial values into a separate map so that we
|
|
20
|
+
* can restore them later on.
|
|
21
|
+
*/
|
|
22
|
+
private saveDataDefaultsMap;
|
|
23
|
+
/**
|
|
24
|
+
* Each mod feature can optionally provide a function that can control whether or not the save
|
|
25
|
+
* data is written to disk.
|
|
26
|
+
*/
|
|
27
|
+
private saveDataConditionalFuncMap;
|
|
28
|
+
/**
|
|
29
|
+
* We backup some save data keys on every new room for the purposes of restoring it when Glowing
|
|
30
|
+
* Hour Glass is used.
|
|
31
|
+
*
|
|
32
|
+
* Note that the save data is backed up in serialized form so that we can use the `merge` function
|
|
33
|
+
* to restore it.
|
|
34
|
+
*/
|
|
35
|
+
private saveDataGlowingHourGlassMap;
|
|
36
|
+
/**
|
|
37
|
+
* End-users can register their classes with the save data manager for proper serialization when
|
|
38
|
+
* contained in nested maps, sets, and arrays.
|
|
39
|
+
*/
|
|
40
|
+
private classConstructors;
|
|
41
|
+
private loadedDataOnThisRun;
|
|
42
|
+
private restoreGlowingHourGlassDataOnNextRoom;
|
|
43
|
+
constructor(mod: Mod);
|
|
44
|
+
private postUseItemGlowingHourGlass;
|
|
45
|
+
private postPlayerInit;
|
|
46
|
+
private preGameExit;
|
|
47
|
+
private postNewLevel;
|
|
48
|
+
private postNewRoomEarly;
|
|
49
|
+
/**
|
|
50
|
+
* This is the entry point to the save data manager, a system which provides two major features:
|
|
51
|
+
*
|
|
52
|
+
* 1. automatic resetting of variables on a new run, on a new level, or on a new room (as desired)
|
|
53
|
+
* 2. automatic saving and loading of all tracked data to the "save#.dat" file
|
|
54
|
+
*
|
|
55
|
+
* You feed this function with an object containing your variables, and then it will automatically
|
|
56
|
+
* manage them for you. (See below for an example.)
|
|
57
|
+
*
|
|
58
|
+
* The save data manager is meant to be called once for each feature of your mod. In other words,
|
|
59
|
+
* you should not put all of the data for your mod on the same object. Instead, scope your
|
|
60
|
+
* variables locally to a single file that contains a mod feature, and then call this function to
|
|
61
|
+
* register them. For example:
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* // In file: feature1.ts
|
|
65
|
+
* import { saveDataManager } from "isaacscript-common";
|
|
66
|
+
*
|
|
67
|
+
* // Declare local variables for this file or feature.
|
|
68
|
+
* const v = {
|
|
69
|
+
* // These variables are never reset; manage them yourself at will.
|
|
70
|
+
* persistent: {
|
|
71
|
+
* foo1: 0,
|
|
72
|
+
* },
|
|
73
|
+
*
|
|
74
|
+
* // These variables are reset at the beginning of every run.
|
|
75
|
+
* run: {
|
|
76
|
+
* foo2: 0,
|
|
77
|
+
* },
|
|
78
|
+
*
|
|
79
|
+
* // These variables are reset at the beginning of every level.
|
|
80
|
+
* level: {
|
|
81
|
+
* foo3: 0,
|
|
82
|
+
* },
|
|
83
|
+
*
|
|
84
|
+
* // These variables are reset at the beginning of every room.
|
|
85
|
+
* room: {
|
|
86
|
+
* foo4: 0,
|
|
87
|
+
* },
|
|
88
|
+
* };
|
|
89
|
+
* // Every child object is optional; only create the ones that you need.
|
|
90
|
+
*
|
|
91
|
+
* // Register the variables with the save data manager. (We need to provide a string key that
|
|
92
|
+
* // matches the name of this file.)
|
|
93
|
+
* function feature1Init() {
|
|
94
|
+
* saveDataManager("feature1", v);
|
|
95
|
+
* }
|
|
96
|
+
*
|
|
97
|
+
* // Elsewhere in the file, use your variables.
|
|
98
|
+
* function feature1Function() {
|
|
99
|
+
* if (v.run.foo1 > 0) {
|
|
100
|
+
* // Insert code here.
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* - Save data is loaded from disk in the `POST_PLAYER_INIT` callback (i.e. the first callback
|
|
106
|
+
* that can possibly run).
|
|
107
|
+
* - Save data is recorded to disk in the `PRE_GAME_EXIT` callback.
|
|
108
|
+
*
|
|
109
|
+
* You can use many different variable types on your variable object, but not everything is
|
|
110
|
+
* supported. For the specific things that are supported, see the documentation for the `deepCopy`
|
|
111
|
+
* helper function.
|
|
112
|
+
*
|
|
113
|
+
* Note that before using the save data manager, you must call the `upgradeMod` function. (Upgrade
|
|
114
|
+
* your mod before registering any of your own callbacks so that the save data manager will run
|
|
115
|
+
* before any of your code does.)
|
|
116
|
+
*
|
|
117
|
+
* If you want the save data manager to load data before the `POST_PLAYER_INIT` callback (i.e. in
|
|
118
|
+
* the main menu), then you should explicitly call the `saveDataManagerLoad` function. (The save
|
|
119
|
+
* data manager cannot do this on its own because it cannot know when your mod features are
|
|
120
|
+
* finished initializing.)
|
|
121
|
+
*
|
|
122
|
+
* Some features may have variables that need to be automatically reset per run/level, but not
|
|
123
|
+
* saved to disk on game exit. (For example, if they contain functions or other non-serializable
|
|
124
|
+
* data.) For these cases, set the second argument to `false`.
|
|
125
|
+
*
|
|
126
|
+
* Note that when the player uses Glowing Hour Glass, the save data manager will automatically
|
|
127
|
+
* restore any variables on a "run" or "level" object with a backup that was created when the room
|
|
128
|
+
* was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass
|
|
129
|
+
* into your mod features that use the save data manager. If this is undesired for your specific
|
|
130
|
+
* use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
|
|
131
|
+
*
|
|
132
|
+
* @param key The name of the file or feature that is submitting data to be managed by the save
|
|
133
|
+
* data manager. The save data manager will throw an error if the key is already
|
|
134
|
+
* registered.
|
|
135
|
+
* @param v An object that corresponds to the `SaveData` interface. The object is conventionally
|
|
136
|
+
* called "v" for brevity. ("v" is short for "local variables").
|
|
137
|
+
* @param conditionalFunc Optional. A function to run to check if this save data should be written
|
|
138
|
+
* to disk. Default is `() => true`, meaning that this save data will
|
|
139
|
+
* always be written to disk. Use a conditional function for the situations
|
|
140
|
+
* when the local variables are for a feature that the end-user can
|
|
141
|
+
* disable. (If the feature is disabled, then there would be no point in
|
|
142
|
+
* writing any of the variables to the "save#.dat" file.) You can also
|
|
143
|
+
* specify `false` to this argument in order to completely disable saving
|
|
144
|
+
* data. (Specifying `false` will allow you to use non-serializable objects
|
|
145
|
+
* in your save data, such as `EntityPtr`.
|
|
146
|
+
*/
|
|
147
|
+
saveDataManager<Persistent, Run, Level>(key: string, // This is the overload for the standard case with serializable data.
|
|
148
|
+
v: SaveData<Persistent, Run, Level>, conditionalFunc?: () => boolean): void;
|
|
149
|
+
saveDataManager(key: string, // This is the overload for the case when saving data is disabled.
|
|
150
|
+
v: SaveData, conditionalFunc: false): void;
|
|
151
|
+
/**
|
|
152
|
+
* Recursively traverses an object, collecting all of the class constructors that it encounters.
|
|
153
|
+
*/
|
|
154
|
+
private storeClassConstructorsFromObject;
|
|
155
|
+
/**
|
|
156
|
+
* The save data manager will automatically load variables from disk at the appropriate times
|
|
157
|
+
* (i.e. when a new run is started). Use this function to explicitly force the save data manager
|
|
158
|
+
* to load all of its variables from disk immediately.
|
|
159
|
+
*
|
|
160
|
+
* Obviously, doing this will overwrite the current data, so using this function can potentially
|
|
161
|
+
* result in lost state.
|
|
162
|
+
*/
|
|
163
|
+
saveDataManagerLoad(): void;
|
|
164
|
+
/**
|
|
165
|
+
* The save data manager will automatically save variables to disk at the appropriate times (i.e.
|
|
166
|
+
* when the run is exited). Use this function to explicitly force the save data manager to write
|
|
167
|
+
* all of its variables to disk immediately.
|
|
168
|
+
*/
|
|
169
|
+
saveDataManagerSave(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Sets the global variable of "g" equal to all of the save data variables for this mod.
|
|
172
|
+
*
|
|
173
|
+
* This can make debugging easier, as you can access the variables from the game's debug console.
|
|
174
|
+
* e.g. `l print(g.feature1.run.foo)`
|
|
175
|
+
*/
|
|
176
|
+
saveDataManagerSetGlobal(): void;
|
|
177
|
+
/**
|
|
178
|
+
* By default, the save data manager will not be able to serialize/deserialize classes that are
|
|
179
|
+
* nested inside of maps, sets, and arrays, because it does not have access to the corresponding
|
|
180
|
+
* class constructor. If you want to use nested classes in this way, then use this function to
|
|
181
|
+
* register the class constructor with the save data manager. Once registered, the save data
|
|
182
|
+
* manager will automatically run the constructor when deserializing (in addition to copying over
|
|
183
|
+
* the data fields).
|
|
184
|
+
*
|
|
185
|
+
* This function is variadic, which means you can pass as many classes as you want to register.
|
|
186
|
+
*/
|
|
187
|
+
saveDataManagerRegisterClass(...tstlClasses: AnyClass[]): void;
|
|
188
|
+
/**
|
|
189
|
+
* Removes a previously registered key from the save data manager. This is the opposite of the
|
|
190
|
+
* "saveDataManager" method.
|
|
191
|
+
*/
|
|
192
|
+
saveDataManagerRemove(key: string): void;
|
|
193
|
+
/**
|
|
194
|
+
* The save data manager will automatically reset variables at the appropriate times, like when a
|
|
195
|
+
* player enters a new room. Use this function to explicitly force the save data manager to reset
|
|
196
|
+
* a specific variable group.
|
|
197
|
+
*
|
|
198
|
+
* For example:
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* const v = {
|
|
202
|
+
* room: {
|
|
203
|
+
* foo: 123,
|
|
204
|
+
* },
|
|
205
|
+
* };
|
|
206
|
+
*
|
|
207
|
+
* mod.saveDataManager("file1", v);
|
|
208
|
+
*
|
|
209
|
+
* // Then, later on, to explicit reset all of the "room" variables:
|
|
210
|
+
* mod.saveDataManagerReset("file1", "room");
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
saveDataManagerReset(key: string, childObjectKey: SaveDataKey): void;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=SaveDataManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveDataManager.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SaveDataManager.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAMzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAsBhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C;;;OAGG;IACH,OAAO,CAAC,GAAG,CAAM;IAEjB;;;;OAIG;IACH,OAAO,CAAC,WAAW,CAAkC;IAErD;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAkC;IAE7D;;;OAGG;IACH,OAAO,CAAC,0BAA0B,CAAuC;IAEzE;;;;;;OAMG;IACH,OAAO,CAAC,2BAA2B,CAAkC;IAErE;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAkC;IAG3D,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,qCAAqC,CAAS;gBAE1C,GAAG,EAAE,GAAG;IAkBpB,OAAO,CAAC,2BAA2B,CAGjC;IAIF,OAAO,CAAC,cAAc,CA0BpB;IAGF,OAAO,CAAC,WAAW,CAUjB;IAGF,OAAO,CAAC,YAAY,CAYlB;IAGF,OAAO,CAAC,gBAAgB,CAuBtB;IAMF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiGG;IACI,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAC3C,GAAG,EAAE,MAAM,EAAE,qEAAqE;IAClF,CAAC,EAAE,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,EACnC,eAAe,CAAC,EAAE,MAAM,OAAO,GAC9B,IAAI;IACA,eAAe,CACpB,GAAG,EAAE,MAAM,EAAE,kEAAkE;IAC/E,CAAC,EAAE,QAAQ,EACX,eAAe,EAAE,KAAK,GACrB,IAAI;IAkDP;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAgBxC;;;;;;;OAOG;IAEI,mBAAmB,IAAI,IAAI;IAIlC;;;;OAIG;IAEI,mBAAmB,IAAI,IAAI;IAIlC;;;;;OAKG;IAEI,wBAAwB,IAAI,IAAI;IAIvC;;;;;;;;;OASG;IAEI,4BAA4B,CAAC,GAAG,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI;IAcrE;;;OAGG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAoB/C;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,GAAG,IAAI;CAqB5E"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
6
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
7
|
+
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
8
|
+
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
9
|
+
local ____exports = {}
|
|
10
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
12
|
+
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
13
|
+
local ____cachedClasses = require("src.core.cachedClasses")
|
|
14
|
+
local game = ____cachedClasses.game
|
|
15
|
+
local ____decorators = require("src.decorators")
|
|
16
|
+
local Exported = ____decorators.Exported
|
|
17
|
+
local ____SaveDataKey = require("src.enums.SaveDataKey")
|
|
18
|
+
local SaveDataKey = ____SaveDataKey.SaveDataKey
|
|
19
|
+
local ____SerializationType = require("src.enums.SerializationType")
|
|
20
|
+
local SerializationType = ____SerializationType.SerializationType
|
|
21
|
+
local ____deepCopy = require("src.functions.deepCopy")
|
|
22
|
+
local deepCopy = ____deepCopy.deepCopy
|
|
23
|
+
local ____stage = require("src.functions.stage")
|
|
24
|
+
local onFirstFloor = ____stage.onFirstFloor
|
|
25
|
+
local ____tstlClass = require("src.functions.tstlClass")
|
|
26
|
+
local getTSTLClassName = ____tstlClass.getTSTLClassName
|
|
27
|
+
local ____types = require("src.functions.types")
|
|
28
|
+
local isString = ____types.isString
|
|
29
|
+
local isTable = ____types.isTable
|
|
30
|
+
local ____Feature = require("src.classes.private.Feature")
|
|
31
|
+
local Feature = ____Feature.Feature
|
|
32
|
+
local ____glowingHourGlass = require("src.classes.features.other.saveDataManager.glowingHourGlass")
|
|
33
|
+
local makeGlowingHourGlassBackup = ____glowingHourGlass.makeGlowingHourGlassBackup
|
|
34
|
+
local restoreGlowingHourGlassBackup = ____glowingHourGlass.restoreGlowingHourGlassBackup
|
|
35
|
+
local ____loadFromDisk = require("src.classes.features.other.saveDataManager.loadFromDisk")
|
|
36
|
+
local loadFromDisk = ____loadFromDisk.loadFromDisk
|
|
37
|
+
local ____restoreDefaults = require("src.classes.features.other.saveDataManager.restoreDefaults")
|
|
38
|
+
local restoreDefaultForFeatureKey = ____restoreDefaults.restoreDefaultForFeatureKey
|
|
39
|
+
local restoreDefaultsForAllFeaturesAndKeys = ____restoreDefaults.restoreDefaultsForAllFeaturesAndKeys
|
|
40
|
+
local restoreDefaultsForAllFeaturesKey = ____restoreDefaults.restoreDefaultsForAllFeaturesKey
|
|
41
|
+
local ____saveToDisk = require("src.classes.features.other.saveDataManager.saveToDisk")
|
|
42
|
+
local saveToDisk = ____saveToDisk.saveToDisk
|
|
43
|
+
local NON_USER_DEFINED_CLASS_NAMES = __TS__New(Set, {"Map", "Set", "DefaultMap"})
|
|
44
|
+
____exports.SaveDataManager = __TS__Class()
|
|
45
|
+
local SaveDataManager = ____exports.SaveDataManager
|
|
46
|
+
SaveDataManager.name = "SaveDataManager"
|
|
47
|
+
__TS__ClassExtends(SaveDataManager, Feature)
|
|
48
|
+
function SaveDataManager.prototype.____constructor(self, mod)
|
|
49
|
+
Feature.prototype.____constructor(self)
|
|
50
|
+
self.saveDataMap = {}
|
|
51
|
+
self.saveDataDefaultsMap = {}
|
|
52
|
+
self.saveDataConditionalFuncMap = {}
|
|
53
|
+
self.saveDataGlowingHourGlassMap = {}
|
|
54
|
+
self.classConstructors = {}
|
|
55
|
+
self.loadedDataOnThisRun = false
|
|
56
|
+
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
57
|
+
self.postUseItemGlowingHourGlass = function()
|
|
58
|
+
self.restoreGlowingHourGlassDataOnNextRoom = true
|
|
59
|
+
return nil
|
|
60
|
+
end
|
|
61
|
+
self.postPlayerInit = function()
|
|
62
|
+
if self.loadedDataOnThisRun then
|
|
63
|
+
return
|
|
64
|
+
end
|
|
65
|
+
self.loadedDataOnThisRun = true
|
|
66
|
+
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
67
|
+
loadFromDisk(nil, self.mod, self.saveDataMap, self.classConstructors)
|
|
68
|
+
local gameFrameCount = game:GetFrameCount()
|
|
69
|
+
local isContinued = gameFrameCount ~= 0
|
|
70
|
+
if not isContinued then
|
|
71
|
+
restoreDefaultsForAllFeaturesAndKeys(nil, self.saveDataMap, self.saveDataDefaultsMap)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
self.preGameExit = function()
|
|
75
|
+
saveToDisk(nil, self.mod, self.saveDataMap, self.saveDataConditionalFuncMap)
|
|
76
|
+
restoreDefaultsForAllFeaturesAndKeys(nil, self.saveDataMap, self.saveDataDefaultsMap)
|
|
77
|
+
self.loadedDataOnThisRun = false
|
|
78
|
+
end
|
|
79
|
+
self.postNewLevel = function()
|
|
80
|
+
restoreDefaultsForAllFeaturesKey(nil, self.saveDataMap, self.saveDataDefaultsMap, SaveDataKey.LEVEL)
|
|
81
|
+
if not onFirstFloor(nil) then
|
|
82
|
+
saveToDisk(nil, self.mod, self.saveDataMap, self.saveDataConditionalFuncMap)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
self.postNewRoomEarly = function()
|
|
86
|
+
restoreDefaultsForAllFeaturesKey(nil, self.saveDataMap, self.saveDataDefaultsMap, SaveDataKey.ROOM)
|
|
87
|
+
if self.restoreGlowingHourGlassDataOnNextRoom then
|
|
88
|
+
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
89
|
+
restoreGlowingHourGlassBackup(
|
|
90
|
+
nil,
|
|
91
|
+
self.saveDataMap,
|
|
92
|
+
self.saveDataConditionalFuncMap,
|
|
93
|
+
self.saveDataGlowingHourGlassMap,
|
|
94
|
+
self.classConstructors
|
|
95
|
+
)
|
|
96
|
+
else
|
|
97
|
+
makeGlowingHourGlassBackup(nil, self.saveDataMap, self.saveDataConditionalFuncMap, self.saveDataGlowingHourGlassMap)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
self.callbacksUsed = {{ModCallback.POST_USE_ITEM, {self.postUseItemGlowingHourGlass, CollectibleType.GLOWING_HOUR_GLASS}}, {ModCallback.POST_PLAYER_INIT, {self.postPlayerInit}}, {ModCallback.PRE_GAME_EXIT, {self.preGameExit}}, {ModCallback.POST_NEW_LEVEL, {self.postNewLevel}}}
|
|
101
|
+
self.mod = mod
|
|
102
|
+
end
|
|
103
|
+
function SaveDataManager.prototype.saveDataManager(self, key, v, conditionalFunc)
|
|
104
|
+
if not isString(nil, key) then
|
|
105
|
+
error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
|
|
106
|
+
end
|
|
107
|
+
if self.saveDataMap[key] ~= nil then
|
|
108
|
+
error("The save data manager is already managing save data for a key of: " .. key)
|
|
109
|
+
end
|
|
110
|
+
self:storeClassConstructorsFromObject(v)
|
|
111
|
+
self.saveDataMap[key] = v
|
|
112
|
+
if conditionalFunc == false then
|
|
113
|
+
conditionalFunc = function() return false end
|
|
114
|
+
end
|
|
115
|
+
local saveDataKeys = __TS__ObjectKeys(v)
|
|
116
|
+
if #saveDataKeys == 1 and saveDataKeys[1] == "room" then
|
|
117
|
+
conditionalFunc = function() return false end
|
|
118
|
+
end
|
|
119
|
+
local saveDataCopy = deepCopy(nil, v, SerializationType.NONE, key)
|
|
120
|
+
self.saveDataDefaultsMap[key] = saveDataCopy
|
|
121
|
+
if conditionalFunc ~= nil then
|
|
122
|
+
self.saveDataConditionalFuncMap[key] = conditionalFunc
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
function SaveDataManager.prototype.storeClassConstructorsFromObject(self, luaMap)
|
|
126
|
+
local tstlClassName = getTSTLClassName(nil, luaMap)
|
|
127
|
+
if tstlClassName ~= nil and not NON_USER_DEFINED_CLASS_NAMES:has(tstlClassName) then
|
|
128
|
+
self.classConstructors[tstlClassName] = luaMap
|
|
129
|
+
end
|
|
130
|
+
for _key, value in pairs(luaMap) do
|
|
131
|
+
if isTable(nil, value) then
|
|
132
|
+
self:storeClassConstructorsFromObject(value)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
function SaveDataManager.prototype.saveDataManagerLoad(self)
|
|
137
|
+
loadFromDisk(nil, self.mod, self.saveDataMap, self.classConstructors)
|
|
138
|
+
end
|
|
139
|
+
function SaveDataManager.prototype.saveDataManagerSave(self)
|
|
140
|
+
saveToDisk(nil, self.mod, self.saveDataMap, self.saveDataConditionalFuncMap)
|
|
141
|
+
end
|
|
142
|
+
function SaveDataManager.prototype.saveDataManagerSetGlobal(self)
|
|
143
|
+
g = self.saveDataMap
|
|
144
|
+
end
|
|
145
|
+
function SaveDataManager.prototype.saveDataManagerRegisterClass(self, ...)
|
|
146
|
+
local tstlClasses = {...}
|
|
147
|
+
for ____, tstlClass in ipairs(tstlClasses) do
|
|
148
|
+
local name = tstlClass.name
|
|
149
|
+
if name == nil then
|
|
150
|
+
error("Failed to register a class with the save data manager due to not being able to derive the name of the class.")
|
|
151
|
+
end
|
|
152
|
+
self.classConstructors[name] = tstlClass
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
function SaveDataManager.prototype.saveDataManagerRemove(self, key)
|
|
156
|
+
if not isString(nil, key) then
|
|
157
|
+
error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
|
|
158
|
+
end
|
|
159
|
+
if not (self.saveDataMap[key] ~= nil) then
|
|
160
|
+
error("The save data manager is not managing save data for a key of: " .. key)
|
|
161
|
+
end
|
|
162
|
+
self.saveDataMap[key] = nil
|
|
163
|
+
self.saveDataDefaultsMap[key] = nil
|
|
164
|
+
self.saveDataConditionalFuncMap[key] = nil
|
|
165
|
+
self.saveDataGlowingHourGlassMap[key] = nil
|
|
166
|
+
end
|
|
167
|
+
function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKey)
|
|
168
|
+
if not isString(nil, key) then
|
|
169
|
+
error("The save data manager requires that keys are strings. You tried to use a key of type: " .. __TS__TypeOf(key))
|
|
170
|
+
end
|
|
171
|
+
local saveData = self.saveDataMap[key]
|
|
172
|
+
if saveData == nil then
|
|
173
|
+
error("The save data manager is not managing save data for a key of: " .. key)
|
|
174
|
+
end
|
|
175
|
+
restoreDefaultForFeatureKey(
|
|
176
|
+
nil,
|
|
177
|
+
self.saveDataDefaultsMap,
|
|
178
|
+
key,
|
|
179
|
+
saveData,
|
|
180
|
+
childObjectKey
|
|
181
|
+
)
|
|
182
|
+
end
|
|
183
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManager", true)
|
|
184
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerLoad", true)
|
|
185
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerSave", true)
|
|
186
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerSetGlobal", true)
|
|
187
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerRegisterClass", true)
|
|
188
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerRemove", true)
|
|
189
|
+
__TS__Decorate({Exported}, SaveDataManager.prototype, "saveDataManagerReset", true)
|
|
190
|
+
return ____exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
+
import { SaveData } from "../../../../interfaces/SaveData";
|
|
3
|
+
import { AnyClass } from "../../../../types/AnyClass";
|
|
4
|
+
export declare function makeGlowingHourGlassBackup(saveDataMap: LuaMap<string, SaveData>, saveDataConditionalFuncMap: LuaMap<string, () => boolean>, saveDataGlowingHourGlassMap: LuaMap<string, SaveData>): void;
|
|
5
|
+
export declare function restoreGlowingHourGlassBackup(saveDataMap: LuaMap<string, SaveData>, saveDataConditionalFuncMap: LuaMap<string, () => boolean>, saveDataGlowingHourGlassMap: LuaMap<string, SaveData>, classConstructors: LuaMap<string, AnyClass>): void;
|
|
6
|
+
//# sourceMappingURL=glowingHourGlass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glowingHourGlass.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/glowingHourGlass.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAatD,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,EACzD,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GACpD,IAAI,CAkDN;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,EACzD,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAqDN"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____SaveDataKey = require("src.enums.SaveDataKey")
|
|
3
|
+
local SaveDataKey = ____SaveDataKey.SaveDataKey
|
|
4
|
+
local ____SerializationType = require("src.enums.SerializationType")
|
|
5
|
+
local SerializationType = ____SerializationType.SerializationType
|
|
6
|
+
local ____constants = require("src.features.saveDataManager.constants")
|
|
7
|
+
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
8
|
+
local ____deepCopy = require("src.functions.deepCopy")
|
|
9
|
+
local deepCopy = ____deepCopy.deepCopy
|
|
10
|
+
local ____merge = require("src.functions.merge")
|
|
11
|
+
local merge = ____merge.merge
|
|
12
|
+
local ____table = require("src.functions.table")
|
|
13
|
+
local iterateTableInOrder = ____table.iterateTableInOrder
|
|
14
|
+
--- When the Glowing Hour Glass is used, certain save data keys will automatically be restored to a
|
|
15
|
+
-- backup.
|
|
16
|
+
local GLOWING_HOUR_GLASS_BACKUP_KEYS = {SaveDataKey.RUN, SaveDataKey.LEVEL}
|
|
17
|
+
local IGNORE_GLOWING_HOUR_GLASS_KEY = "__ignoreGlowingHourGlass"
|
|
18
|
+
function ____exports.makeGlowingHourGlassBackup(self, saveDataMap, saveDataConditionalFuncMap, saveDataGlowingHourGlassMap)
|
|
19
|
+
iterateTableInOrder(
|
|
20
|
+
nil,
|
|
21
|
+
saveDataMap,
|
|
22
|
+
function(____, subscriberName, saveData)
|
|
23
|
+
local conditionalFunc = saveDataConditionalFuncMap[subscriberName]
|
|
24
|
+
if conditionalFunc ~= nil then
|
|
25
|
+
local shouldSave = conditionalFunc(nil)
|
|
26
|
+
if not shouldSave then
|
|
27
|
+
return
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
for ____, saveDataKey in ipairs(GLOWING_HOUR_GLASS_BACKUP_KEYS) do
|
|
31
|
+
do
|
|
32
|
+
local childTable = saveData[saveDataKey]
|
|
33
|
+
if childTable == nil then
|
|
34
|
+
goto __continue6
|
|
35
|
+
end
|
|
36
|
+
local childTableLuaMap = childTable
|
|
37
|
+
if childTableLuaMap[IGNORE_GLOWING_HOUR_GLASS_KEY] ~= nil then
|
|
38
|
+
goto __continue6
|
|
39
|
+
end
|
|
40
|
+
local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
|
|
41
|
+
if saveDataGlowingHourGlass == nil then
|
|
42
|
+
saveDataGlowingHourGlass = {}
|
|
43
|
+
saveDataGlowingHourGlassMap[subscriberName] = saveDataGlowingHourGlass
|
|
44
|
+
end
|
|
45
|
+
local copiedChildTable = deepCopy(nil, childTable, SerializationType.SERIALIZE)
|
|
46
|
+
saveDataGlowingHourGlass[saveDataKey] = copiedChildTable
|
|
47
|
+
end
|
|
48
|
+
::__continue6::
|
|
49
|
+
end
|
|
50
|
+
end,
|
|
51
|
+
SAVE_DATA_MANAGER_DEBUG
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
function ____exports.restoreGlowingHourGlassBackup(self, saveDataMap, saveDataConditionalFuncMap, saveDataGlowingHourGlassMap, classConstructors)
|
|
55
|
+
iterateTableInOrder(
|
|
56
|
+
nil,
|
|
57
|
+
saveDataMap,
|
|
58
|
+
function(____, subscriberName, saveData)
|
|
59
|
+
local conditionalFunc = saveDataConditionalFuncMap[subscriberName]
|
|
60
|
+
if conditionalFunc ~= nil then
|
|
61
|
+
local shouldSave = conditionalFunc(nil)
|
|
62
|
+
if not shouldSave then
|
|
63
|
+
return
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
for ____, saveDataKey in ipairs(GLOWING_HOUR_GLASS_BACKUP_KEYS) do
|
|
67
|
+
do
|
|
68
|
+
local childTable = saveData[saveDataKey]
|
|
69
|
+
if childTable == nil then
|
|
70
|
+
goto __continue15
|
|
71
|
+
end
|
|
72
|
+
local childTableLuaMap = childTable
|
|
73
|
+
if childTableLuaMap[IGNORE_GLOWING_HOUR_GLASS_KEY] ~= nil then
|
|
74
|
+
goto __continue15
|
|
75
|
+
end
|
|
76
|
+
local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
|
|
77
|
+
if saveDataGlowingHourGlass == nil then
|
|
78
|
+
goto __continue15
|
|
79
|
+
end
|
|
80
|
+
local childTableBackup = saveDataGlowingHourGlass[saveDataKey]
|
|
81
|
+
if childTableBackup == nil then
|
|
82
|
+
goto __continue15
|
|
83
|
+
end
|
|
84
|
+
merge(
|
|
85
|
+
nil,
|
|
86
|
+
childTable,
|
|
87
|
+
childTableBackup,
|
|
88
|
+
subscriberName .. "__glowingHourGlass",
|
|
89
|
+
classConstructors
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
::__continue15::
|
|
93
|
+
end
|
|
94
|
+
end,
|
|
95
|
+
SAVE_DATA_MANAGER_DEBUG
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
return ____exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
3
|
+
import { SaveData } from "../../../../interfaces/SaveData";
|
|
4
|
+
import { AnyClass } from "../../../../types/AnyClass";
|
|
5
|
+
export declare function loadFromDisk(mod: Mod, oldSaveData: LuaMap<string, SaveData>, classConstructors: LuaMap<string, AnyClass>): void;
|
|
6
|
+
//# sourceMappingURL=loadFromDisk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadFromDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/loadFromDisk.ts"],"names":[],"mappings":";;AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAsDN"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__StringTrim = ____lualib.__TS__StringTrim
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local readSaveDatFile, tryLoadModData, DEFAULT_MOD_DATA
|
|
5
|
+
local ____constants = require("src.features.saveDataManager.constants")
|
|
6
|
+
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
7
|
+
local ____jsonHelpers = require("src.functions.jsonHelpers")
|
|
8
|
+
local jsonDecode = ____jsonHelpers.jsonDecode
|
|
9
|
+
local ____log = require("src.functions.log")
|
|
10
|
+
local log = ____log.log
|
|
11
|
+
local ____logMisc = require("src.functions.logMisc")
|
|
12
|
+
local logError = ____logMisc.logError
|
|
13
|
+
local ____merge = require("src.functions.merge")
|
|
14
|
+
local merge = ____merge.merge
|
|
15
|
+
local ____table = require("src.functions.table")
|
|
16
|
+
local iterateTableInOrder = ____table.iterateTableInOrder
|
|
17
|
+
local ____types = require("src.functions.types")
|
|
18
|
+
local isString = ____types.isString
|
|
19
|
+
local isTable = ____types.isTable
|
|
20
|
+
function readSaveDatFile(self, mod)
|
|
21
|
+
local renderFrameCount = Isaac.GetFrameCount()
|
|
22
|
+
local ok, jsonStringOrErrMsg = pcall(tryLoadModData, mod)
|
|
23
|
+
if not ok then
|
|
24
|
+
logError(
|
|
25
|
+
nil,
|
|
26
|
+
(("Failed to read from the \"save#.dat\" file on render frame " .. tostring(renderFrameCount)) .. ": ") .. jsonStringOrErrMsg
|
|
27
|
+
)
|
|
28
|
+
return DEFAULT_MOD_DATA
|
|
29
|
+
end
|
|
30
|
+
if jsonStringOrErrMsg == nil then
|
|
31
|
+
return DEFAULT_MOD_DATA
|
|
32
|
+
end
|
|
33
|
+
local jsonStringTrimmed = __TS__StringTrim(jsonStringOrErrMsg)
|
|
34
|
+
if jsonStringTrimmed == "" then
|
|
35
|
+
return DEFAULT_MOD_DATA
|
|
36
|
+
end
|
|
37
|
+
return jsonStringTrimmed
|
|
38
|
+
end
|
|
39
|
+
function tryLoadModData(mod)
|
|
40
|
+
return mod:LoadData()
|
|
41
|
+
end
|
|
42
|
+
DEFAULT_MOD_DATA = "{}"
|
|
43
|
+
function ____exports.loadFromDisk(self, mod, oldSaveData, classConstructors)
|
|
44
|
+
if not mod:HasData() then
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
local jsonString = readSaveDatFile(nil, mod)
|
|
48
|
+
local newSaveData = jsonDecode(nil, jsonString)
|
|
49
|
+
if SAVE_DATA_MANAGER_DEBUG then
|
|
50
|
+
log(nil, "Converted data from the \"save#.dat\" to a Lua table.")
|
|
51
|
+
end
|
|
52
|
+
iterateTableInOrder(
|
|
53
|
+
nil,
|
|
54
|
+
newSaveData,
|
|
55
|
+
function(____, subscriberName, saveData)
|
|
56
|
+
if not isString(nil, subscriberName) then
|
|
57
|
+
return
|
|
58
|
+
end
|
|
59
|
+
if not isTable(nil, saveData) then
|
|
60
|
+
return
|
|
61
|
+
end
|
|
62
|
+
local oldSaveDataForSubscriber = oldSaveData[subscriberName]
|
|
63
|
+
if oldSaveDataForSubscriber == nil then
|
|
64
|
+
return
|
|
65
|
+
end
|
|
66
|
+
if SAVE_DATA_MANAGER_DEBUG then
|
|
67
|
+
log(nil, "Merging in stored data for feature: " .. subscriberName)
|
|
68
|
+
end
|
|
69
|
+
merge(
|
|
70
|
+
nil,
|
|
71
|
+
oldSaveDataForSubscriber,
|
|
72
|
+
saveData,
|
|
73
|
+
subscriberName,
|
|
74
|
+
classConstructors
|
|
75
|
+
)
|
|
76
|
+
end,
|
|
77
|
+
SAVE_DATA_MANAGER_DEBUG
|
|
78
|
+
)
|
|
79
|
+
log(nil, "The save data manager loaded data from the \"save#.dat\" file.")
|
|
80
|
+
end
|
|
81
|
+
return ____exports
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
+
import { SaveDataKey } from "../../../../enums/SaveDataKey";
|
|
3
|
+
import { SaveData } from "../../../../interfaces/SaveData";
|
|
4
|
+
export declare function restoreDefaultsForAllFeaturesAndKeys(saveDataMap: LuaMap<string, SaveData>, saveDataDefaultsMap: LuaMap<string, SaveData>): void;
|
|
5
|
+
export declare function restoreDefaultsForAllFeaturesKey(saveDataMap: LuaMap<string, SaveData>, saveDataDefaultsMap: LuaMap<string, SaveData>, saveDataKey: SaveDataKey): void;
|
|
6
|
+
export declare function restoreDefaultForFeatureKey(saveDataDefaultsMap: LuaMap<string, SaveData>, subscriberName: string, saveData: SaveData, saveDataKey: SaveDataKey): void;
|
|
7
|
+
//# sourceMappingURL=restoreDefaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restoreDefaults.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/restoreDefaults.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAM5D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAQ3D,wBAAgB,oCAAoC,CAClD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC5C,IAAI,CAQN;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC7C,WAAW,EAAE,WAAW,GACvB,IAAI,CAaN;AAED,wBAAgB,2BAA2B,CACzC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC7C,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,IAAI,CA8CN"}
|