isaacscript-common 14.1.2 → 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 +954 -158
- package/dist/isaacscript-common.lua +4099 -1066
- 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 +16 -4
- package/dist/src/classes/ModFeature.d.ts.map +1 -1
- package/dist/src/classes/ModFeature.lua +67 -4
- package/dist/src/classes/ModUpgraded.d.ts +10 -10
- package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
- package/dist/src/classes/ModUpgraded.lua +35 -16
- 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 +2 -5
- 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 +28 -6
- package/dist/src/functions/decorators.d.ts.map +1 -1
- package/dist/src/functions/decorators.lua +24 -5
- 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/logMisc.d.ts +9 -2
- package/dist/src/functions/logMisc.d.ts.map +1 -1
- package/dist/src/functions/logMisc.lua +32 -2
- 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 +96 -6
- package/src/classes/ModUpgraded.ts +57 -32
- 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 +6 -13
- package/src/decorators.ts +17 -16
- 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 +83 -12
- 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/functions/logMisc.ts +28 -2
- 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,40 @@
|
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
+
import { AnyClass } from "../types/AnyClass";
|
|
3
|
+
/**
|
|
4
|
+
* `merge` takes the values from a new table and recursively merges them into an old object (while
|
|
5
|
+
* performing appropriate deserialization).
|
|
6
|
+
*
|
|
7
|
+
* This function is used to merge incoming data from the "save#.dat" file into a mod's variables.
|
|
8
|
+
* Merging is useful instead of blowing away a table entirely because mod code often relies on the
|
|
9
|
+
* local table/object references.
|
|
10
|
+
*
|
|
11
|
+
* This function always assumes that the new table is serialized data and will attempt to perform
|
|
12
|
+
* deserialization on the objects within. In other words, unlike the `deepCopy` function, the
|
|
13
|
+
* `merge` function will always operates in the mode of `SerializationType.DESERIALIZE`. For the
|
|
14
|
+
* types of objects that will be deserialized, see the documentation for the `deepCopy` function.
|
|
15
|
+
*
|
|
16
|
+
* This function does not iterate over the old object, like you would naively expect. This is
|
|
17
|
+
* because it is common for a variable to have a type of `something | null`. If this is the case,
|
|
18
|
+
* the key would not appear when iterating over the old object (because a value of null transpiles
|
|
19
|
+
* to nil, which means the table key does not exist). Thus, we must instead iterate over the new
|
|
20
|
+
* object and copy the values backwards. The consequence of this is that `merge` can copy over old
|
|
21
|
+
* variables that are no longer used in the code, or copy over old variables of a different type,
|
|
22
|
+
* which can cause run-time errors. In such cases, users will have to manually delete their save
|
|
23
|
+
* data.
|
|
24
|
+
*
|
|
25
|
+
* @param oldObject The old object to merge the values into. This can be either a Lua table, a TSTL
|
|
26
|
+
* map, or a TSTL set.
|
|
27
|
+
* @param newTable The new table to merge the values from. This must be a Lua table that represents
|
|
28
|
+
* serialized data. In other words, it should be created with the `deepCopy`
|
|
29
|
+
* function using `SerializationType.SERIALIZE`.
|
|
30
|
+
* @param traversalDescription Used to track the current key that we are operating on for debugging
|
|
31
|
+
* purposes. Use a name that corresponds to the name of the merging
|
|
32
|
+
* table.
|
|
33
|
+
* @param classConstructors Optional. A Lua table that maps the name of a user-defined TSTL class to
|
|
34
|
+
* its corresponding constructor. If the `deepCopy` function finds any
|
|
35
|
+
* user-defined TSTL classes when recursively iterating through the given
|
|
36
|
+
* object, it will use this map to instantiate a new class. Default is an
|
|
37
|
+
* empty Lua table.
|
|
38
|
+
*/
|
|
39
|
+
export declare function merge(oldObject: LuaMap<AnyNotNil, unknown> | Map<AnyNotNil, unknown> | Set<AnyNotNil>, newTable: LuaMap<AnyNotNil, unknown>, traversalDescription: string, classConstructors?: LuaMap<string, AnyClass>): void;
|
|
40
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/functions/merge.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAc7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,KAAK,CACnB,SAAS,EACL,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAC1B,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,GACvB,GAAG,CAAC,SAAS,CAAC,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EACpC,oBAAoB,EAAE,MAAM,EAC5B,iBAAiB,2BAAiC,GACjD,IAAI,CAyCN"}
|
|
@@ -3,10 +3,12 @@ local Set = ____lualib.Set
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local mergeSerializedArray, mergeSerializedTSTLObject, mergeSerializedTable
|
|
6
|
-
local ____SerializationBrand = require("src.enums.
|
|
6
|
+
local ____SerializationBrand = require("src.enums.SerializationBrand")
|
|
7
7
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
8
8
|
local ____SerializationType = require("src.enums.SerializationType")
|
|
9
9
|
local SerializationType = ____SerializationType.SerializationType
|
|
10
|
+
local ____constants = require("src.features.saveDataManager.constants")
|
|
11
|
+
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
10
12
|
local ____array = require("src.functions.array")
|
|
11
13
|
local isArray = ____array.isArray
|
|
12
14
|
local ____deepCopy = require("src.functions.deepCopy")
|
|
@@ -15,6 +17,7 @@ local ____log = require("src.functions.log")
|
|
|
15
17
|
local log = ____log.log
|
|
16
18
|
local ____serialization = require("src.functions.serialization")
|
|
17
19
|
local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
|
|
20
|
+
local isSerializationBrand = ____serialization.isSerializationBrand
|
|
18
21
|
local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
|
|
19
22
|
local ____table = require("src.functions.table")
|
|
20
23
|
local clearTable = ____table.clearTable
|
|
@@ -27,32 +30,44 @@ local ____types = require("src.functions.types")
|
|
|
27
30
|
local isTable = ____types.isTable
|
|
28
31
|
local ____utils = require("src.functions.utils")
|
|
29
32
|
local getTraversalDescription = ____utils.getTraversalDescription
|
|
30
|
-
local ____constants = require("src.features.saveDataManager.constants")
|
|
31
|
-
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
32
|
-
local ____serializationBrands = require("src.features.saveDataManager.serializationBrands")
|
|
33
|
-
local isSerializationBrand = ____serializationBrands.isSerializationBrand
|
|
34
33
|
--- `merge` takes the values from a new table and recursively merges them into an old object (while
|
|
35
34
|
-- performing appropriate deserialization).
|
|
36
35
|
--
|
|
37
|
-
--
|
|
36
|
+
-- This function is used to merge incoming data from the "save#.dat" file into a mod's variables.
|
|
37
|
+
-- Merging is useful instead of blowing away a table entirely because mod code often relies on the
|
|
38
|
+
-- local table/object references.
|
|
38
39
|
--
|
|
39
|
-
--
|
|
40
|
-
--
|
|
41
|
-
--
|
|
42
|
-
--
|
|
43
|
-
-- - `DefaultMap`
|
|
44
|
-
-- - Isaac `BitSet128` objects
|
|
45
|
-
-- - Isaac `Color` objects
|
|
46
|
-
-- - Isaac `KColor` objects
|
|
47
|
-
-- - Isaac `RNG` objects
|
|
48
|
-
-- - Isaac `Vector` objects
|
|
40
|
+
-- This function always assumes that the new table is serialized data and will attempt to perform
|
|
41
|
+
-- deserialization on the objects within. In other words, unlike the `deepCopy` function, the
|
|
42
|
+
-- `merge` function will always operates in the mode of `SerializationType.DESERIALIZE`. For the
|
|
43
|
+
-- types of objects that will be deserialized, see the documentation for the `deepCopy` function.
|
|
49
44
|
--
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
--
|
|
53
|
-
--
|
|
54
|
-
--
|
|
55
|
-
|
|
45
|
+
-- This function does not iterate over the old object, like you would naively expect. This is
|
|
46
|
+
-- because it is common for a variable to have a type of `something | null`. If this is the case,
|
|
47
|
+
-- the key would not appear when iterating over the old object (because a value of null transpiles
|
|
48
|
+
-- to nil, which means the table key does not exist). Thus, we must instead iterate over the new
|
|
49
|
+
-- object and copy the values backwards. The consequence of this is that `merge` can copy over old
|
|
50
|
+
-- variables that are no longer used in the code, or copy over old variables of a different type,
|
|
51
|
+
-- which can cause run-time errors. In such cases, users will have to manually delete their save
|
|
52
|
+
-- data.
|
|
53
|
+
--
|
|
54
|
+
-- @param oldObject The old object to merge the values into. This can be either a Lua table, a TSTL
|
|
55
|
+
-- map, or a TSTL set.
|
|
56
|
+
-- @param newTable The new table to merge the values from. This must be a Lua table that represents
|
|
57
|
+
-- serialized data. In other words, it should be created with the `deepCopy`
|
|
58
|
+
-- function using `SerializationType.SERIALIZE`.
|
|
59
|
+
-- @param traversalDescription Used to track the current key that we are operating on for debugging
|
|
60
|
+
-- purposes. Use a name that corresponds to the name of the merging
|
|
61
|
+
-- table.
|
|
62
|
+
-- @param classConstructors Optional. A Lua table that maps the name of a user-defined TSTL class to
|
|
63
|
+
-- its corresponding constructor. If the `deepCopy` function finds any
|
|
64
|
+
-- user-defined TSTL classes when recursively iterating through the given
|
|
65
|
+
-- object, it will use this map to instantiate a new class. Default is an
|
|
66
|
+
-- empty Lua table.
|
|
67
|
+
function ____exports.merge(self, oldObject, newTable, traversalDescription, classConstructors)
|
|
68
|
+
if classConstructors == nil then
|
|
69
|
+
classConstructors = {}
|
|
70
|
+
end
|
|
56
71
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
57
72
|
log(nil, "merge is traversing: " .. traversalDescription)
|
|
58
73
|
end
|
|
@@ -63,16 +78,34 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription)
|
|
|
63
78
|
error("The second argument given to the merge function is not a table.")
|
|
64
79
|
end
|
|
65
80
|
if isArray(nil, oldObject) and isArray(nil, newTable) then
|
|
66
|
-
mergeSerializedArray(
|
|
81
|
+
mergeSerializedArray(
|
|
82
|
+
nil,
|
|
83
|
+
oldObject,
|
|
84
|
+
newTable,
|
|
85
|
+
traversalDescription,
|
|
86
|
+
classConstructors
|
|
87
|
+
)
|
|
67
88
|
return
|
|
68
89
|
end
|
|
69
90
|
if isTSTLMap(nil, oldObject) or isTSTLSet(nil, oldObject) or isDefaultMap(nil, oldObject) then
|
|
70
|
-
mergeSerializedTSTLObject(
|
|
91
|
+
mergeSerializedTSTLObject(
|
|
92
|
+
nil,
|
|
93
|
+
oldObject,
|
|
94
|
+
newTable,
|
|
95
|
+
traversalDescription,
|
|
96
|
+
classConstructors
|
|
97
|
+
)
|
|
71
98
|
else
|
|
72
|
-
mergeSerializedTable(
|
|
99
|
+
mergeSerializedTable(
|
|
100
|
+
nil,
|
|
101
|
+
oldObject,
|
|
102
|
+
newTable,
|
|
103
|
+
traversalDescription,
|
|
104
|
+
classConstructors
|
|
105
|
+
)
|
|
73
106
|
end
|
|
74
107
|
end
|
|
75
|
-
function mergeSerializedArray(self, oldArray, newArray, traversalDescription)
|
|
108
|
+
function mergeSerializedArray(self, oldArray, newArray, traversalDescription, classConstructors)
|
|
76
109
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
77
110
|
log(nil, "merge encountered an array: " .. traversalDescription)
|
|
78
111
|
end
|
|
@@ -81,12 +114,19 @@ function mergeSerializedArray(self, oldArray, newArray, traversalDescription)
|
|
|
81
114
|
nil,
|
|
82
115
|
newArray,
|
|
83
116
|
function(____, key, value)
|
|
84
|
-
|
|
117
|
+
local deserializedValue = deepCopy(
|
|
118
|
+
nil,
|
|
119
|
+
value,
|
|
120
|
+
SerializationType.DESERIALIZE,
|
|
121
|
+
traversalDescription,
|
|
122
|
+
classConstructors
|
|
123
|
+
)
|
|
124
|
+
oldArray[key] = deserializedValue
|
|
85
125
|
end,
|
|
86
126
|
SAVE_DATA_MANAGER_DEBUG
|
|
87
127
|
)
|
|
88
128
|
end
|
|
89
|
-
function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescription)
|
|
129
|
+
function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescription, classConstructors)
|
|
90
130
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
91
131
|
log(nil, "merge encountered a TSTL object: " .. traversalDescription)
|
|
92
132
|
end
|
|
@@ -108,13 +148,14 @@ function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescripti
|
|
|
108
148
|
keyToUse = numberKey
|
|
109
149
|
end
|
|
110
150
|
if isTSTLMap(nil, oldObject) or isDefaultMap(nil, oldObject) then
|
|
111
|
-
local
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
151
|
+
local deserializedValue = deepCopy(
|
|
152
|
+
nil,
|
|
153
|
+
value,
|
|
154
|
+
SerializationType.DESERIALIZE,
|
|
155
|
+
traversalDescription,
|
|
156
|
+
classConstructors
|
|
157
|
+
)
|
|
158
|
+
oldObject:set(keyToUse, deserializedValue)
|
|
118
159
|
elseif isTSTLSet(nil, oldObject) then
|
|
119
160
|
oldObject:add(keyToUse)
|
|
120
161
|
end
|
|
@@ -122,7 +163,7 @@ function mergeSerializedTSTLObject(self, oldObject, newTable, traversalDescripti
|
|
|
122
163
|
SAVE_DATA_MANAGER_DEBUG
|
|
123
164
|
)
|
|
124
165
|
end
|
|
125
|
-
function mergeSerializedTable(self, oldTable, newTable, traversalDescription)
|
|
166
|
+
function mergeSerializedTable(self, oldTable, newTable, traversalDescription, classConstructors)
|
|
126
167
|
if SAVE_DATA_MANAGER_DEBUG then
|
|
127
168
|
log(nil, "merge encountered a Lua table: " .. traversalDescription)
|
|
128
169
|
end
|
|
@@ -152,7 +193,13 @@ function mergeSerializedTable(self, oldTable, newTable, traversalDescription)
|
|
|
152
193
|
oldTable[key] = oldValue
|
|
153
194
|
end
|
|
154
195
|
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
155
|
-
____exports.merge(
|
|
196
|
+
____exports.merge(
|
|
197
|
+
nil,
|
|
198
|
+
oldValue,
|
|
199
|
+
value,
|
|
200
|
+
traversalDescription,
|
|
201
|
+
classConstructors
|
|
202
|
+
)
|
|
156
203
|
else
|
|
157
204
|
oldTable[key] = value
|
|
158
205
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Run the suite of tests that prove that the "merge" function works properly.
|
|
3
|
-
* exported but is used internally in the save data manager.)
|
|
2
|
+
* Run the suite of tests that prove that the "merge" function works properly.
|
|
4
3
|
*
|
|
5
4
|
* This function is only useful if you are troubleshooting the save data manager.
|
|
6
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTests.d.ts","sourceRoot":"","sources":["../../../src/functions/mergeTests.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"mergeTests.d.ts","sourceRoot":"","sources":["../../../src/functions/mergeTests.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAkBpC"}
|
|
@@ -7,12 +7,12 @@ local ____DefaultMap = require("src.classes.DefaultMap")
|
|
|
7
7
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
8
8
|
local ____SerializationType = require("src.enums.SerializationType")
|
|
9
9
|
local SerializationType = ____SerializationType.SerializationType
|
|
10
|
-
local ____merge = require("src.features.saveDataManager.merge")
|
|
11
|
-
local merge = ____merge.merge
|
|
12
10
|
local ____deepCopy = require("src.functions.deepCopy")
|
|
13
11
|
local deepCopy = ____deepCopy.deepCopy
|
|
14
12
|
local ____log = require("src.functions.log")
|
|
15
13
|
local log = ____log.log
|
|
14
|
+
local ____merge = require("src.functions.merge")
|
|
15
|
+
local merge = ____merge.merge
|
|
16
16
|
local ____rng = require("src.functions.rng")
|
|
17
17
|
local isRNG = ____rng.isRNG
|
|
18
18
|
local newRNG = ____rng.newRNG
|
|
@@ -238,8 +238,7 @@ function oldTableHasRNGSerialized(self)
|
|
|
238
238
|
error("The old table's seed not match: " .. tostring(seed))
|
|
239
239
|
end
|
|
240
240
|
end
|
|
241
|
-
--- Run the suite of tests that prove that the "merge" function works properly.
|
|
242
|
-
-- exported but is used internally in the save data manager.)
|
|
241
|
+
--- Run the suite of tests that prove that the "merge" function works properly.
|
|
243
242
|
--
|
|
244
243
|
-- This function is only useful if you are troubleshooting the save data manager.
|
|
245
244
|
function ____exports.runMergeTests(self)
|
|
@@ -20,8 +20,8 @@ export declare function getRandomSeed(): Seed;
|
|
|
20
20
|
/** Helper function to check if something is an instantiated `RNG` object. */
|
|
21
21
|
export declare function isRNG(object: unknown): object is RNG;
|
|
22
22
|
/**
|
|
23
|
-
* Used to determine is the given table is a serialized `RNG` object created by the
|
|
24
|
-
*
|
|
23
|
+
* Used to determine is the given table is a serialized `RNG` object created by the `deepCopy`
|
|
24
|
+
* function.
|
|
25
25
|
*/
|
|
26
26
|
export declare function isSerializedRNG(object: unknown): object is SerializedRNG;
|
|
27
27
|
/**
|
|
@@ -4,7 +4,7 @@ local ____exports = {}
|
|
|
4
4
|
local RECOMMENDED_SHIFT_IDX, OBJECT_NAME
|
|
5
5
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
6
6
|
local game = ____cachedClasses.game
|
|
7
|
-
local ____SerializationBrand = require("src.enums.
|
|
7
|
+
local ____SerializationBrand = require("src.enums.SerializationBrand")
|
|
8
8
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
9
9
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
10
10
|
local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
|
|
@@ -72,8 +72,8 @@ function ____exports.deserializeRNG(self, rng)
|
|
|
72
72
|
end
|
|
73
73
|
return ____exports.newRNG(nil, seed)
|
|
74
74
|
end
|
|
75
|
-
--- Used to determine is the given table is a serialized `RNG` object created by the
|
|
76
|
-
--
|
|
75
|
+
--- Used to determine is the given table is a serialized `RNG` object created by the `deepCopy`
|
|
76
|
+
-- function.
|
|
77
77
|
function ____exports.isSerializedRNG(self, object)
|
|
78
78
|
if not isTable(nil, object) then
|
|
79
79
|
return false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EAErB,iCAAiC,EACjC,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AAUjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,EAC/D,aAAa,EAAE,CAAC,GACf,CAAC,CAoCH;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,SAAS,uBAAuB,EAE3C,uBAAuB,EAAE,WAAW,GACnC,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAkChD;AAoBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,qBAAqB,CAIjC;AAmBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,uBAAuB,CAQnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,EACpE,aAAa,EAAE,CAAC,GACf,iCAAiC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAoChD"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
4
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
3
5
|
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
4
6
|
local __TS__ObjectValues = ____lualib.__TS__ObjectValues
|
|
@@ -6,13 +8,18 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
6
8
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
9
|
local ____exports = {}
|
|
8
10
|
local getSerializedTableType
|
|
11
|
+
local ____SerializationBrand = require("src.enums.SerializationBrand")
|
|
12
|
+
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
9
13
|
local ____isaacAPIClassTypeToBrand = require("src.objects.isaacAPIClassTypeToBrand")
|
|
10
14
|
local ISAAC_API_CLASS_TYPE_TO_BRAND = ____isaacAPIClassTypeToBrand.ISAAC_API_CLASS_TYPE_TO_BRAND
|
|
11
15
|
local ____isaacAPIClassTypeToFunctions = require("src.objects.isaacAPIClassTypeToFunctions")
|
|
12
16
|
local ISAAC_API_CLASS_TYPE_TO_FUNCTIONS = ____isaacAPIClassTypeToFunctions.ISAAC_API_CLASS_TYPE_TO_FUNCTIONS
|
|
17
|
+
local ____enums = require("src.functions.enums")
|
|
18
|
+
local getEnumValues = ____enums.getEnumValues
|
|
13
19
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
14
20
|
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
15
21
|
local ____types = require("src.functions.types")
|
|
22
|
+
local isString = ____types.isString
|
|
16
23
|
local isTable = ____types.isTable
|
|
17
24
|
local isUserdata = ____types.isUserdata
|
|
18
25
|
function getSerializedTableType(self, serializedIsaacAPIClass)
|
|
@@ -25,6 +32,8 @@ function getSerializedTableType(self, serializedIsaacAPIClass)
|
|
|
25
32
|
end
|
|
26
33
|
return nil
|
|
27
34
|
end
|
|
35
|
+
local SERIALIZATION_BRANDS = getEnumValues(nil, SerializationBrand)
|
|
36
|
+
local SERIALIZATION_BRAND_SET = __TS__New(Set, SERIALIZATION_BRANDS)
|
|
28
37
|
--- Helper function to generically copy an Isaac API class without knowing what specific type of
|
|
29
38
|
-- class it is. (This is used by the save data manager.)
|
|
30
39
|
--
|
|
@@ -78,6 +87,19 @@ function ____exports.isCopyableIsaacAPIClass(self, object)
|
|
|
78
87
|
function(____, identityFunction) return identityFunction(nil, object) end
|
|
79
88
|
)
|
|
80
89
|
end
|
|
90
|
+
--- Helper function to check if a key of a table in the "save#.dat" file is a serialization brand
|
|
91
|
+
-- inserted by the save data manager (i.e. the `deepCopy` function).
|
|
92
|
+
--
|
|
93
|
+
-- This is marked internal because end-users would not normally be iterating through a serialized
|
|
94
|
+
-- object directly.
|
|
95
|
+
--
|
|
96
|
+
-- @internal
|
|
97
|
+
function ____exports.isSerializationBrand(self, key)
|
|
98
|
+
if not isString(nil, key) then
|
|
99
|
+
return false
|
|
100
|
+
end
|
|
101
|
+
return SERIALIZATION_BRAND_SET:has(key)
|
|
102
|
+
end
|
|
81
103
|
--- Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
|
|
82
104
|
-- is used by the save data manager when reading data from the "save#.dat" file.)
|
|
83
105
|
--
|
|
@@ -27,11 +27,6 @@ export declare function getTSTLClassName(object: unknown): string | undefined;
|
|
|
27
27
|
* their own copies of the entire lualib and thus their own instantiated version of a `Map`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isDefaultMap(object: unknown): object is DefaultMap<AnyNotNil, unknown>;
|
|
30
|
-
/**
|
|
31
|
-
* Returns whether or not this is a class that is provided by the `isaacscript-common` library, such
|
|
32
|
-
* as a `DefaultMap`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function isIsaacScriptCommonClass(object: unknown): boolean;
|
|
35
30
|
/**
|
|
36
31
|
* Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
37
32
|
*
|
|
@@ -50,11 +45,6 @@ export declare function isTSTLMap(object: unknown): object is Map<AnyNotNil, unk
|
|
|
50
45
|
export declare function isTSTLSet(object: unknown): object is Set<AnyNotNil>;
|
|
51
46
|
/** TypeScriptToLua classes are Lua tables that have a metatable with a certain amount of keys. */
|
|
52
47
|
export declare function isUserDefinedTSTLClass(object: unknown): object is TSTLClass;
|
|
53
|
-
/**
|
|
54
|
-
* Returns whether or not this is a class that is provided as part of the TypeScriptToLua
|
|
55
|
-
* transpiler, such as a `Map` or a `Set`.
|
|
56
|
-
*/
|
|
57
|
-
export declare function isVanillaTSTLClass(object: unknown): boolean;
|
|
58
48
|
/**
|
|
59
49
|
* Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
60
50
|
* it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tstlClass.d.ts","sourceRoot":"","sources":["../../../src/functions/tstlClass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"tstlClass.d.ts","sourceRoot":"","sources":["../../../src/functions/tstlClass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,kBAAkB,CAAC,aAAa,CAAC,GAAG,SAAS,CAW/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAG1C;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAG5E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAGnE;AAED,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,SAAS,CAG3E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAiB3D"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Set = ____lualib.Set
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
1
|
local ____exports = {}
|
|
5
|
-
local VANILLA_TSTL_CLASSES
|
|
6
2
|
local ____types = require("src.functions.types")
|
|
7
|
-
local isString = ____types.isString
|
|
8
3
|
local isTable = ____types.isTable
|
|
9
4
|
--- Helper function to get the constructor from an instantiated TypeScriptToLua class, which is
|
|
10
5
|
-- located on the metatable.
|
|
@@ -35,17 +30,6 @@ function ____exports.getTSTLClassName(self, object)
|
|
|
35
30
|
end
|
|
36
31
|
return constructor.name
|
|
37
32
|
end
|
|
38
|
-
--- Returns whether or not this is a class that is provided as part of the TypeScriptToLua
|
|
39
|
-
-- transpiler, such as a `Map` or a `Set`.
|
|
40
|
-
function ____exports.isVanillaTSTLClass(self, object)
|
|
41
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
42
|
-
if className == nil then
|
|
43
|
-
return false
|
|
44
|
-
end
|
|
45
|
-
return VANILLA_TSTL_CLASSES:has(className)
|
|
46
|
-
end
|
|
47
|
-
VANILLA_TSTL_CLASSES = __TS__New(Set, {"Map", "Set", "WeakMap", "WeakSet"})
|
|
48
|
-
local TSTL_CLASS_METATABLE_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
|
|
49
33
|
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
50
34
|
--
|
|
51
35
|
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
|
|
@@ -54,11 +38,6 @@ function ____exports.isDefaultMap(self, object)
|
|
|
54
38
|
local className = ____exports.getTSTLClassName(nil, object)
|
|
55
39
|
return className == "DefaultMap"
|
|
56
40
|
end
|
|
57
|
-
--- Returns whether or not this is a class that is provided by the `isaacscript-common` library, such
|
|
58
|
-
-- as a `DefaultMap`.
|
|
59
|
-
function ____exports.isIsaacScriptCommonClass(self, object)
|
|
60
|
-
return ____exports.isDefaultMap(nil, object)
|
|
61
|
-
end
|
|
62
41
|
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
63
42
|
--
|
|
64
43
|
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module
|
|
@@ -79,27 +58,8 @@ function ____exports.isTSTLSet(self, object)
|
|
|
79
58
|
end
|
|
80
59
|
--- TypeScriptToLua classes are Lua tables that have a metatable with a certain amount of keys.
|
|
81
60
|
function ____exports.isUserDefinedTSTLClass(self, object)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
if not isTable(nil, object) then
|
|
86
|
-
return false
|
|
87
|
-
end
|
|
88
|
-
local metatable = getmetatable(object)
|
|
89
|
-
if metatable == nil then
|
|
90
|
-
return false
|
|
91
|
-
end
|
|
92
|
-
local numKeys = 0
|
|
93
|
-
for key in pairs(metatable) do
|
|
94
|
-
numKeys = numKeys + 1
|
|
95
|
-
if not isString(nil, key) then
|
|
96
|
-
return false
|
|
97
|
-
end
|
|
98
|
-
if not TSTL_CLASS_METATABLE_KEYS:has(key) then
|
|
99
|
-
return false
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
return numKeys == TSTL_CLASS_METATABLE_KEYS.size
|
|
61
|
+
local tstlClassName = ____exports.getTSTLClassName(nil, object)
|
|
62
|
+
return tstlClassName ~= nil
|
|
103
63
|
end
|
|
104
64
|
--- Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
105
65
|
-- it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
@@ -23,8 +23,8 @@ export declare function deserializeVector(vector: SerializedVector): Vector;
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function getRandomVector(seedOrRNG?: Seed | RNG): Vector;
|
|
25
25
|
/**
|
|
26
|
-
* Used to determine is the given table is a serialized `Vector` object created by the
|
|
27
|
-
*
|
|
26
|
+
* Used to determine is the given table is a serialized `Vector` object created by the `deepCopy`
|
|
27
|
+
* function.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isSerializedVector(object: unknown): object is SerializedVector;
|
|
30
30
|
/** Helper function to check if something is an instantiated `Vector` object. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local OBJECT_NAME
|
|
3
|
-
local ____SerializationBrand = require("src.enums.
|
|
3
|
+
local ____SerializationBrand = require("src.enums.SerializationBrand")
|
|
4
4
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
5
5
|
local ____direction = require("src.functions.direction")
|
|
6
6
|
local angleToDirection = ____direction.angleToDirection
|
|
@@ -69,8 +69,8 @@ function ____exports.getRandomVector(self, seedOrRNG)
|
|
|
69
69
|
local y = getRandomFloat(nil, -1, 1, rng)
|
|
70
70
|
return Vector(x, y)
|
|
71
71
|
end
|
|
72
|
-
--- Used to determine is the given table is a serialized `Vector` object created by the
|
|
73
|
-
--
|
|
72
|
+
--- Used to determine is the given table is a serialized `Vector` object created by the `deepCopy`
|
|
73
|
+
-- function.
|
|
74
74
|
function ____exports.isSerializedVector(self, object)
|
|
75
75
|
if not isTable(nil, object) then
|
|
76
76
|
return false
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
4
|
import { WeightedArray } from "../types/WeightedArray";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Get a random value from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
7
|
+
* first element in the tuple is a value, and the second element in the tuple is a float
|
|
8
|
+
* corresponding to the value's weight.)
|
|
9
|
+
*/
|
|
5
10
|
export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG?: Seed | RNG): T;
|
|
11
|
+
/**
|
|
12
|
+
* Get a random index from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
13
|
+
* first element in the tuple is a value, and the second element in the tuple is a float
|
|
14
|
+
* corresponding to the value's weight.)
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRandomIndexFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG?: Seed | RNG): int;
|
|
6
17
|
//# sourceMappingURL=weighted.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,CAKH;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,EAC/C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,GAAG,CAwBL"}
|
|
@@ -2,19 +2,20 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____array = require("src.functions.array")
|
|
5
|
-
local arrayToString = ____array.arrayToString
|
|
6
5
|
local sumArray = ____array.sumArray
|
|
7
6
|
local ____random = require("src.functions.random")
|
|
8
7
|
local getRandomFloat = ____random.getRandomFloat
|
|
9
8
|
local ____rng = require("src.functions.rng")
|
|
10
9
|
local getRandomSeed = ____rng.getRandomSeed
|
|
11
|
-
--- Get a random
|
|
12
|
-
|
|
10
|
+
--- Get a random index from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
11
|
+
-- first element in the tuple is a value, and the second element in the tuple is a float
|
|
12
|
+
-- corresponding to the value's weight.)
|
|
13
|
+
function ____exports.getRandomIndexFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
13
14
|
if seedOrRNG == nil then
|
|
14
15
|
seedOrRNG = getRandomSeed(nil)
|
|
15
16
|
end
|
|
16
17
|
if #weightedArray == 0 then
|
|
17
|
-
error("Failed to get a random
|
|
18
|
+
error("Failed to get a random index from a weighted array since the provided array was empty.")
|
|
18
19
|
end
|
|
19
20
|
local weights = __TS__ArrayMap(
|
|
20
21
|
weightedArray,
|
|
@@ -23,13 +24,29 @@ function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
|
23
24
|
local totalWeight = sumArray(nil, weights)
|
|
24
25
|
local randomWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
25
26
|
local weightAccumulator = 0
|
|
26
|
-
|
|
27
|
-
local
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
do
|
|
28
|
+
local i = 0
|
|
29
|
+
while i < #weightedArray do
|
|
30
|
+
local tuple = weightedArray[i + 1]
|
|
31
|
+
local _element, weight = table.unpack(tuple)
|
|
32
|
+
weightAccumulator = weightAccumulator + weight
|
|
33
|
+
if weightAccumulator >= randomWeight then
|
|
34
|
+
return i
|
|
35
|
+
end
|
|
36
|
+
i = i + 1
|
|
31
37
|
end
|
|
32
38
|
end
|
|
33
|
-
error("Failed to get a random
|
|
39
|
+
error("Failed to get a random index from a weighted array.")
|
|
40
|
+
end
|
|
41
|
+
--- Get a random value from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
42
|
+
-- first element in the tuple is a value, and the second element in the tuple is a float
|
|
43
|
+
-- corresponding to the value's weight.)
|
|
44
|
+
function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
45
|
+
if seedOrRNG == nil then
|
|
46
|
+
seedOrRNG = getRandomSeed(nil)
|
|
47
|
+
end
|
|
48
|
+
local randomIndex = ____exports.getRandomIndexFromWeightedArray(nil, weightedArray, seedOrRNG)
|
|
49
|
+
local randomElement = weightedArray[randomIndex + 1]
|
|
50
|
+
return randomElement[1]
|
|
34
51
|
end
|
|
35
52
|
return ____exports
|
package/dist/src/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./enums/ModCallbackCustom2";
|
|
|
15
15
|
export * from "./enums/PocketItemType";
|
|
16
16
|
export * from "./enums/RockAltType";
|
|
17
17
|
export * from "./enums/SaveDataKey";
|
|
18
|
+
export * from "./enums/SerializationBrand";
|
|
18
19
|
export * from "./enums/SerializationType";
|
|
19
20
|
export * from "./enums/SlotDestructionType";
|
|
20
21
|
export * from "./enums/StatType";
|
|
@@ -23,6 +24,7 @@ export * from "./features/characterStats";
|
|
|
23
24
|
export * from "./features/collectibleItemPoolType";
|
|
24
25
|
export * from "./features/customGridEntity";
|
|
25
26
|
export * from "./features/customHotkeys";
|
|
27
|
+
export * from "./features/customItemPool";
|
|
26
28
|
export * from "./features/customPickup";
|
|
27
29
|
export * from "./features/customStage/exports";
|
|
28
30
|
export * from "./features/customTrapdoor/exports";
|
|
@@ -107,6 +109,7 @@ export * from "./functions/logEntities";
|
|
|
107
109
|
export * from "./functions/logMisc";
|
|
108
110
|
export * from "./functions/map";
|
|
109
111
|
export * from "./functions/math";
|
|
112
|
+
export * from "./functions/merge";
|
|
110
113
|
export * from "./functions/mergeTests";
|
|
111
114
|
export * from "./functions/minimap";
|
|
112
115
|
export * from "./functions/nextStage";
|
|
@@ -179,11 +182,13 @@ export * from "./objects/kColors";
|
|
|
179
182
|
export * from "./types/AllButFirst";
|
|
180
183
|
export * from "./types/AllButLast";
|
|
181
184
|
export * from "./types/AnyEntity";
|
|
185
|
+
export * from "./types/AnyFunction";
|
|
182
186
|
export * from "./types/AnyGridEntity";
|
|
183
187
|
export * from "./types/CollectibleIndex";
|
|
184
188
|
export * from "./types/Constructor";
|
|
185
189
|
export * from "./types/FunctionTuple";
|
|
186
190
|
export * from "./types/HasAllEnumKeys";
|
|
191
|
+
export * from "./types/HasFunction";
|
|
187
192
|
export * from "./types/Immutable";
|
|
188
193
|
export * from "./types/LowercaseKeys";
|
|
189
194
|
export * from "./types/PickingUpItem";
|