isaacscript-common 20.11.5 → 20.12.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 CHANGED
@@ -8406,7 +8406,14 @@ export declare function lockDoor(door: GridEntityDoor): void;
8406
8406
  * Helper function to avoid typing out `Isaac.DebugString()`.
8407
8407
  *
8408
8408
  * If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
8409
- * function will also prepend the function name and the line number before the string.
8409
+ * function will also prepend the function name and the line number before the string, like this:
8410
+ *
8411
+ * ```text
8412
+ * [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
8413
+ * ```
8414
+ *
8415
+ * Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
8416
+ * your mod so that debugging becomes a little bit easier.
8410
8417
  */
8411
8418
  export declare function log(msg: string): void;
8412
8419
 
@@ -11434,6 +11441,14 @@ declare class ModdedElementSets extends Feature {
11434
11441
  * In almost all cases, you will want the callback functions to be immediately subscribed after
11435
11442
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
11436
11443
  * second argument to the constructor.
11444
+ *
11445
+ * If your mod feature has a property called `v`, it will be assumed that these are variables that
11446
+ * should be managed by the save data manager. Subsequently, they will automatically be registered
11447
+ * with the save data manager upon initialization. Unfortunately, due to technical limitations with
11448
+ * classes, this registration will only occur if you initialize the class with the `init` boolean
11449
+ * argument set to false, and then explicitly call the `ModFeature.init` method yourself after the
11450
+ * class is constructed. (This is because the parent class does not have access to the child's
11451
+ * properties upon first construction.)
11437
11452
  */
11438
11453
  export declare class ModFeature {
11439
11454
  private mod;
@@ -15100,7 +15115,8 @@ export declare interface TrinketSituation {
15100
15115
  }
15101
15116
 
15102
15117
  /**
15103
- * This is a type representing a user-created class from TypeScript code.
15118
+ * This is a type representing a user-created class from TypeScript code. (TypeScriptToLua
15119
+ * transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
15104
15120
  *
15105
15121
  * This type is used by the save data manager to when copying, serializing, and deserializing.
15106
15122
  */
@@ -15108,6 +15124,10 @@ export declare type TSTLClass = LuaMap<AnyNotNil, unknown> & {
15108
15124
  readonly __tstlClassBrand: symbol;
15109
15125
  };
15110
15126
 
15127
+ /**
15128
+ * This is a type representing the metatable of a user-created class from TypeScript code.
15129
+ * (TypeScriptToLua transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
15130
+ */
15111
15131
  declare interface TSTLClassMetatable {
15112
15132
  ____constructor: () => void;
15113
15133
  __index: unknown;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.11.5
3
+ isaacscript-common 20.12.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -14516,7 +14516,7 @@ ____exports.RockVariant.NORMAL = 0
14516
14516
  ____exports.RockVariant[____exports.RockVariant.NORMAL] = "NORMAL"
14517
14517
  ____exports.RockVariant.EVENT = 1
14518
14518
  ____exports.RockVariant[____exports.RockVariant.EVENT] = "EVENT"
14519
- --- For GridEntityType.ROCK_ALT (6), RockAltType.URN
14519
+ --- For GridEntityType.ROCK_ALT (6), RockAltType.URN.
14520
14520
  --
14521
14521
  -- Note that you are unable to spawn specific urn variants. The game will pick a random variant
14522
14522
  -- regardless of which one you select.
@@ -14527,7 +14527,7 @@ ____exports.UrnVariant.CHIPPED_TOP_LEFT = 1
14527
14527
  ____exports.UrnVariant[____exports.UrnVariant.CHIPPED_TOP_LEFT] = "CHIPPED_TOP_LEFT"
14528
14528
  ____exports.UrnVariant.NARROW = 2
14529
14529
  ____exports.UrnVariant[____exports.UrnVariant.NARROW] = "NARROW"
14530
- --- For GridEntityType.ROCK_ALT (6), RockAltType.MUSHROOM
14530
+ --- For GridEntityType.ROCK_ALT (6), RockAltType.MUSHROOM.
14531
14531
  --
14532
14532
  -- Note that you are unable to spawn specific mushroom variants. The game will pick a random variant
14533
14533
  -- regardless of which one you select.
@@ -14538,7 +14538,7 @@ ____exports.MushroomVariant.CHIPPED_TOP_RIGHT = 1
14538
14538
  ____exports.MushroomVariant[____exports.MushroomVariant.CHIPPED_TOP_RIGHT] = "CHIPPED_TOP_RIGHT"
14539
14539
  ____exports.MushroomVariant.NARROW = 2
14540
14540
  ____exports.MushroomVariant[____exports.MushroomVariant.NARROW] = "NARROW"
14541
- --- For GridEntityType.ROCK_ALT (6), RockAltType.SKULL
14541
+ --- For GridEntityType.ROCK_ALT (6), RockAltType.SKULL.
14542
14542
  --
14543
14543
  -- Note that you are unable to spawn specific skull variants. The game will pick a random variant
14544
14544
  -- regardless of which one you select.
@@ -14549,7 +14549,7 @@ ____exports.SkullVariant.FACING_RIGHT = 1
14549
14549
  ____exports.SkullVariant[____exports.SkullVariant.FACING_RIGHT] = "FACING_RIGHT"
14550
14550
  ____exports.SkullVariant.FACING_LEFT = 2
14551
14551
  ____exports.SkullVariant[____exports.SkullVariant.FACING_LEFT] = "FACING_LEFT"
14552
- --- For GridEntityType.ROCK_ALT (6), RockAltType.POLYP
14552
+ --- For GridEntityType.ROCK_ALT (6), RockAltType.POLYP.
14553
14553
  --
14554
14554
  -- Note that you are unable to spawn specific polyp variants. The game will pick a random variant
14555
14555
  -- regardless of which one you select.
@@ -14560,7 +14560,7 @@ ____exports.PolypVariant.MANY_FINGERS = 1
14560
14560
  ____exports.PolypVariant[____exports.PolypVariant.MANY_FINGERS] = "MANY_FINGERS"
14561
14561
  ____exports.PolypVariant.FLIPPED_AND_SHIFTED_UPWARDS = 2
14562
14562
  ____exports.PolypVariant[____exports.PolypVariant.FLIPPED_AND_SHIFTED_UPWARDS] = "FLIPPED_AND_SHIFTED_UPWARDS"
14563
- --- For GridEntityType.ROCK_ALT (6), RockAltType.BUCKET
14563
+ --- For GridEntityType.ROCK_ALT (6), RockAltType.BUCKET.
14564
14564
  --
14565
14565
  -- Note that you are unable to spawn specific bucket variants. The game will pick a random variant
14566
14566
  -- regardless of which one you select.
@@ -14577,7 +14577,7 @@ ____exports.PitVariant.NORMAL = 0
14577
14577
  ____exports.PitVariant[____exports.PitVariant.NORMAL] = "NORMAL"
14578
14578
  ____exports.PitVariant.FISSURE_SPAWNER = 16
14579
14579
  ____exports.PitVariant[____exports.PitVariant.FISSURE_SPAWNER] = "FISSURE_SPAWNER"
14580
- --- For `GridEntityType.FIREPLACE`. (13).
14580
+ --- For `GridEntityType.FIREPLACE` (13).
14581
14581
  --
14582
14582
  -- This only partially corresponds to the `FireplaceVariant` for non-grid entities. (Spawning a grid
14583
14583
  -- entity fireplace with a variant higher than 1 will result in a normal fireplace.)
@@ -14586,7 +14586,7 @@ ____exports.FireplaceGridEntityVariant.NORMAL = 0
14586
14586
  ____exports.FireplaceGridEntityVariant[____exports.FireplaceGridEntityVariant.NORMAL] = "NORMAL"
14587
14587
  ____exports.FireplaceGridEntityVariant.RED = 1
14588
14588
  ____exports.FireplaceGridEntityVariant[____exports.FireplaceGridEntityVariant.RED] = "RED"
14589
- --- For `GridEntityType.POOP`. (14).
14589
+ --- For `GridEntityType.POOP` (14).
14590
14590
  ____exports.PoopGridEntityVariant = {}
14591
14591
  ____exports.PoopGridEntityVariant.NORMAL = 0
14592
14592
  ____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.NORMAL] = "NORMAL"
@@ -14612,7 +14612,7 @@ ____exports.PoopGridEntityVariant.GIGA_BOTTOM_RIGHT = 10
14612
14612
  ____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.GIGA_BOTTOM_RIGHT] = "GIGA_BOTTOM_RIGHT"
14613
14613
  ____exports.PoopGridEntityVariant.CHARMING = 11
14614
14614
  ____exports.PoopGridEntityVariant[____exports.PoopGridEntityVariant.CHARMING] = "CHARMING"
14615
- --- For `GridEntityType.DOOR`. (16).
14615
+ --- For `GridEntityType.DOOR` (16).
14616
14616
  ____exports.DoorVariant = {}
14617
14617
  ____exports.DoorVariant.UNSPECIFIED = 0
14618
14618
  ____exports.DoorVariant[____exports.DoorVariant.UNSPECIFIED] = "UNSPECIFIED"
@@ -14638,7 +14638,7 @@ ____exports.TrapdoorVariant.NORMAL = 0
14638
14638
  ____exports.TrapdoorVariant[____exports.TrapdoorVariant.NORMAL] = "NORMAL"
14639
14639
  ____exports.TrapdoorVariant.VOID_PORTAL = 1
14640
14640
  ____exports.TrapdoorVariant[____exports.TrapdoorVariant.VOID_PORTAL] = "VOID_PORTAL"
14641
- --- For `GridEntityType.CRAWL_SPACE`. (18).
14641
+ --- For `GridEntityType.CRAWL_SPACE` (18).
14642
14642
  ____exports.CrawlSpaceVariant = {}
14643
14643
  ____exports.CrawlSpaceVariant.NORMAL = 0
14644
14644
  ____exports.CrawlSpaceVariant[____exports.CrawlSpaceVariant.NORMAL] = "NORMAL"
@@ -39233,6 +39233,8 @@ local ____DefaultMap = require("src.classes.DefaultMap")
39233
39233
  local DefaultMap = ____DefaultMap.DefaultMap
39234
39234
  local ____Feature = require("src.classes.private.Feature")
39235
39235
  local Feature = ____Feature.Feature
39236
+ local ____constants = require("src.classes.features.other.customStages.constants")
39237
+ local CUSTOM_FLOOR_STAGE = ____constants.CUSTOM_FLOOR_STAGE
39236
39238
  function anyPlayerPlayingExtraAnimation(self)
39237
39239
  local players = getAllPlayers(nil)
39238
39240
  return __TS__ArraySome(
@@ -39420,6 +39422,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
39420
39422
  player.EntityCollisionClass = EntityCollisionClass.ALL
39421
39423
  player.GridCollisionClass = EntityGridCollisionClass.GROUND
39422
39424
  end
39425
+ local level = game:GetLevel()
39426
+ local stage = level:GetStage()
39427
+ if stage ~= CUSTOM_FLOOR_STAGE then
39428
+ level:ShowName(false)
39429
+ end
39423
39430
  end)
39424
39431
  end
39425
39432
  function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
@@ -39483,14 +39490,14 @@ function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEn
39483
39490
  do
39484
39491
  local player = playerEntity:ToPlayer()
39485
39492
  if player == nil then
39486
- goto __continue42
39493
+ goto __continue43
39487
39494
  end
39488
39495
  if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
39489
39496
  self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
39490
39497
  return
39491
39498
  end
39492
39499
  end
39493
- ::__continue42::
39500
+ ::__continue43::
39494
39501
  end
39495
39502
  end
39496
39503
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
@@ -49893,7 +49900,7 @@ local __TS__Class = ____lualib.__TS__Class
49893
49900
  local Map = ____lualib.Map
49894
49901
  local __TS__New = ____lualib.__TS__New
49895
49902
  local ____exports = {}
49896
- local initDecoratedCallbacks, addCallback, removeCallback, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
49903
+ local initDecoratedCallbacks, addCallback, removeCallback, initSaveDataManager, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
49897
49904
  local ____array = require("src.functions.array")
49898
49905
  local isArray = ____array.isArray
49899
49906
  local ____tstlClass = require("src.functions.tstlClass")
@@ -49902,6 +49909,7 @@ local getTSTLClassName = ____tstlClass.getTSTLClassName
49902
49909
  local ____types = require("src.functions.types")
49903
49910
  local isFunction = ____types.isFunction
49904
49911
  local isNumber = ____types.isNumber
49912
+ local isTable = ____types.isTable
49905
49913
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
49906
49914
  local modFeatureConstructor = constructor
49907
49915
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -50013,6 +50021,34 @@ function removeCallback(self, modFeatureConstructor, mod, modCallback, vanilla)
50013
50021
  mod:RemoveCallbackCustom(modCallback, wrappedCallback)
50014
50022
  end
50015
50023
  end
50024
+ function initSaveDataManager(self, modFeature, tstlClassName, init)
50025
+ if tstlClassName == "AtePoopBaby" then
50026
+ Isaac.DebugString("GETTING HERE 1")
50027
+ end
50028
+ local ____modFeature_0 = modFeature
50029
+ local v = ____modFeature_0.v
50030
+ if v == nil then
50031
+ return
50032
+ end
50033
+ Isaac.DebugString("GETTING HERE 2")
50034
+ if not isTable(nil, v) then
50035
+ error("Failed to initialize a mod feature class due to having a \"v\" property that is not an object. (The \"v\" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)")
50036
+ end
50037
+ local mod = modFeature.mod
50038
+ local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
50039
+ local saveDataManagerMethod = mod[saveDataManagerMethodName]
50040
+ if saveDataManagerMethod == nil then
50041
+ error("Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
50042
+ end
50043
+ if type(saveDataManagerMethod) ~= "function" then
50044
+ error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
50045
+ end
50046
+ if init then
50047
+ saveDataManagerMethod(nil, tstlClassName, v)
50048
+ else
50049
+ saveDataManagerMethod(nil, tstlClassName)
50050
+ end
50051
+ end
50016
50052
  ____exports.MOD_FEATURE_CALLBACKS_KEY = "__callbacks"
50017
50053
  ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks"
50018
50054
  WRAPPED_CALLBACK_METHODS_KEY = "__wrappedCallbackMethods"
@@ -50063,6 +50099,7 @@ function ModFeature.prototype.init(self, init)
50063
50099
  false,
50064
50100
  init
50065
50101
  )
50102
+ initSaveDataManager(nil, self, tstlClassName, init)
50066
50103
  end
50067
50104
  function ModFeature.prototype.uninit(self)
50068
50105
  self:init(false)
@@ -18,6 +18,14 @@ export declare const MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks";
18
18
  * In almost all cases, you will want the callback functions to be immediately subscribed after
19
19
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
20
20
  * second argument to the constructor.
21
+ *
22
+ * If your mod feature has a property called `v`, it will be assumed that these are variables that
23
+ * should be managed by the save data manager. Subsequently, they will automatically be registered
24
+ * with the save data manager upon initialization. Unfortunately, due to technical limitations with
25
+ * classes, this registration will only occur if you initialize the class with the `init` boolean
26
+ * argument set to false, and then explicitly call the `ModFeature.init` method yourself after the
27
+ * class is constructed. (This is because the parent class does not have access to the child's
28
+ * properties upon first construction.)
21
29
  */
22
30
  export declare class ModFeature {
23
31
  private mod;
@@ -1 +1 @@
1
- {"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAS/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAyBpE;;;;;;;;;;;;;;;GAeG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,yBAAyB,EAC/B,CAAC,CAAC,CAAC,SAAS,OAAO,EACjB,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,iBAAiB,EAC7D,GAAG,YAAY,EAAE,OAAO,EAAE,KACvB,OAAO,CAAC,GACb,IAAI,CAAQ;IAEhB;;;;;OAKG;IACI,WAAW,UAAS;gBAEf,GAAG,EAAE,eAAe,EAAE,IAAI,UAAO;IAQ7C;;;;;OAKG;IACI,IAAI,CAAC,IAAI,UAAO,GAAG,IAAI;IAoB9B;;;;;OAKG;IACI,MAAM,IAAI,IAAI;CAGtB"}
1
+ {"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAS/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAyBpE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,yBAAyB,EAC/B,CAAC,CAAC,CAAC,SAAS,OAAO,EACjB,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,iBAAiB,EAC7D,GAAG,YAAY,EAAE,OAAO,EAAE,KACvB,OAAO,CAAC,GACb,IAAI,CAAQ;IAEhB;;;;;OAKG;IACI,WAAW,UAAS;gBAEf,GAAG,EAAE,eAAe,EAAE,IAAI,UAAO;IAQ7C;;;;;OAKG;IACI,IAAI,CAAC,IAAI,UAAO,GAAG,IAAI;IAqB9B;;;;;OAKG;IACI,MAAM,IAAI,IAAI;CAGtB"}
@@ -3,7 +3,7 @@ local __TS__Class = ____lualib.__TS__Class
3
3
  local Map = ____lualib.Map
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
- local initDecoratedCallbacks, addCallback, removeCallback, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
6
+ local initDecoratedCallbacks, addCallback, removeCallback, initSaveDataManager, WRAPPED_CALLBACK_METHODS_KEY, WRAPPED_CUSTOM_CALLBACK_METHODS_KEY
7
7
  local ____array = require("src.functions.array")
8
8
  local isArray = ____array.isArray
9
9
  local ____tstlClass = require("src.functions.tstlClass")
@@ -12,6 +12,7 @@ local getTSTLClassName = ____tstlClass.getTSTLClassName
12
12
  local ____types = require("src.functions.types")
13
13
  local isFunction = ____types.isFunction
14
14
  local isNumber = ____types.isNumber
15
+ local isTable = ____types.isTable
15
16
  function initDecoratedCallbacks(self, modFeature, constructor, tstlClassName, vanilla, init)
16
17
  local modFeatureConstructor = constructor
17
18
  local callbackTuplesKey = vanilla and ____exports.MOD_FEATURE_CALLBACKS_KEY or ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY
@@ -123,6 +124,34 @@ function removeCallback(self, modFeatureConstructor, mod, modCallback, vanilla)
123
124
  mod:RemoveCallbackCustom(modCallback, wrappedCallback)
124
125
  end
125
126
  end
127
+ function initSaveDataManager(self, modFeature, tstlClassName, init)
128
+ if tstlClassName == "AtePoopBaby" then
129
+ Isaac.DebugString("GETTING HERE 1")
130
+ end
131
+ local ____modFeature_0 = modFeature
132
+ local v = ____modFeature_0.v
133
+ if v == nil then
134
+ return
135
+ end
136
+ Isaac.DebugString("GETTING HERE 2")
137
+ if not isTable(nil, v) then
138
+ error("Failed to initialize a mod feature class due to having a \"v\" property that is not an object. (The \"v\" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)")
139
+ end
140
+ local mod = modFeature.mod
141
+ local saveDataManagerMethodName = init and "saveDataManager" or "saveDataManagerRemove"
142
+ local saveDataManagerMethod = mod[saveDataManagerMethodName]
143
+ if saveDataManagerMethod == nil then
144
+ error("Failed to initialize a mod feature class due to having a \"v\" object and not having the save data manager initialized. You must pass \"ISCFeature.SAVE_DATA_MANAGER\" to the \"upgradeMod\" function.")
145
+ end
146
+ if type(saveDataManagerMethod) ~= "function" then
147
+ error(("The \"" .. saveDataManagerMethodName) .. "\" property of the \"ModUpgraded\" object was not a function.")
148
+ end
149
+ if init then
150
+ saveDataManagerMethod(nil, tstlClassName, v)
151
+ else
152
+ saveDataManagerMethod(nil, tstlClassName)
153
+ end
154
+ end
126
155
  ____exports.MOD_FEATURE_CALLBACKS_KEY = "__callbacks"
127
156
  ____exports.MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks"
128
157
  WRAPPED_CALLBACK_METHODS_KEY = "__wrappedCallbackMethods"
@@ -141,6 +170,14 @@ WRAPPED_CUSTOM_CALLBACK_METHODS_KEY = "__wrappedCustomCallbacksMethods"
141
170
  -- In almost all cases, you will want the callback functions to be immediately subscribed after
142
171
  -- instantiating the class. However, if this is not the case, you can pass `false` as the optional
143
172
  -- second argument to the constructor.
173
+ --
174
+ -- If your mod feature has a property called `v`, it will be assumed that these are variables that
175
+ -- should be managed by the save data manager. Subsequently, they will automatically be registered
176
+ -- with the save data manager upon initialization. Unfortunately, due to technical limitations with
177
+ -- classes, this registration will only occur if you initialize the class with the `init` boolean
178
+ -- argument set to false, and then explicitly call the `ModFeature.init` method yourself after the
179
+ -- class is constructed. (This is because the parent class does not have access to the child's
180
+ -- properties upon first construction.)
144
181
  ____exports.ModFeature = __TS__Class()
145
182
  local ModFeature = ____exports.ModFeature
146
183
  ModFeature.name = "ModFeature"
@@ -187,6 +224,7 @@ function ModFeature.prototype.init(self, init)
187
224
  false,
188
225
  init
189
226
  )
227
+ initSaveDataManager(nil, self, tstlClassName, init)
190
228
  end
191
229
  function ModFeature.prototype.uninit(self)
192
230
  self:init(false)
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoors.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomTrapdoors.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAKV,SAAS,EACV,MAAM,8BAA8B,CAAC;AA6BtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA+BhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,qCAAqC;IACrC,OAAO,CAAC,kBAAkB,CAOtB;IAqBJ;;;;;OAKG;IACH,OAAO,CAAC,WAAW,CAAY;IAE/B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,aAAa,CAAgB;IACrC,OA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AM,GAAG,SAAS,EACnC,gBAAgB,EAAE,UAAU,EAC5B,oBAAoB,EAAE,SAAS,KAC5B,IAAI,GACR,IAAI;IAUP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IAEI,mBAAmB,CACxB,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,eAAe,CAAC,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,UAAU,EAC7B,oBAAoB,CAAC,EAAE,SAAS,EAChC,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU;CA0Dd"}
@@ -67,6 +67,8 @@ local ____DefaultMap = require("src.classes.DefaultMap")
67
67
  local DefaultMap = ____DefaultMap.DefaultMap
68
68
  local ____Feature = require("src.classes.private.Feature")
69
69
  local Feature = ____Feature.Feature
70
+ local ____constants = require("src.classes.features.other.customStages.constants")
71
+ local CUSTOM_FLOOR_STAGE = ____constants.CUSTOM_FLOOR_STAGE
70
72
  function anyPlayerPlayingExtraAnimation(self)
71
73
  local players = getAllPlayers(nil)
72
74
  return __TS__ArraySome(
@@ -255,6 +257,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
255
257
  player.EntityCollisionClass = EntityCollisionClass.ALL
256
258
  player.GridCollisionClass = EntityGridCollisionClass.GROUND
257
259
  end
260
+ local level = game:GetLevel()
261
+ local stage = level:GetStage()
262
+ if stage ~= CUSTOM_FLOOR_STAGE then
263
+ level:ShowName(false)
264
+ end
258
265
  end)
259
266
  end
260
267
  function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
@@ -318,14 +325,14 @@ function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEn
318
325
  do
319
326
  local player = playerEntity:ToPlayer()
320
327
  if player == nil then
321
- goto __continue42
328
+ goto __continue43
322
329
  end
323
330
  if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
324
331
  self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
325
332
  return
326
333
  end
327
334
  end
328
- ::__continue42::
335
+ ::__continue43::
329
336
  end
330
337
  end
331
338
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
@@ -13,7 +13,14 @@ export declare function getParentFunctionDescription(levels?: number): string |
13
13
  * Helper function to avoid typing out `Isaac.DebugString()`.
14
14
  *
15
15
  * If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
16
- * function will also prepend the function name and the line number before the string.
16
+ * function will also prepend the function name and the line number before the string, like this:
17
+ *
18
+ * ```text
19
+ * [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
20
+ * ```
21
+ *
22
+ * Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
23
+ * your mod so that debugging becomes a little bit easier.
17
24
  */
18
25
  export declare function log(msg: string): void;
19
26
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/functions/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAK1C,MAAM,SAAI,GACT,MAAM,GAAG,SAAS,CAiBpB;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOrC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/functions/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAK1C,MAAM,SAAI,GACT,MAAM,GAAG,SAAS,CAiBpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOrC"}
@@ -25,7 +25,14 @@ end
25
25
  --- Helper function to avoid typing out `Isaac.DebugString()`.
26
26
  --
27
27
  -- If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
28
- -- function will also prepend the function name and the line number before the string.
28
+ -- function will also prepend the function name and the line number before the string, like this:
29
+ --
30
+ -- ```text
31
+ -- [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
32
+ -- ```
33
+ --
34
+ -- Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
35
+ -- your mod so that debugging becomes a little bit easier.
29
36
  function ____exports.log(self, msg)
30
37
  local parentFunctionDescription = ____exports.getParentFunctionDescription(nil)
31
38
  local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
@@ -2,6 +2,10 @@
2
2
  /// <reference types="lua-types/5.3" />
3
3
  /// <reference types="lua-types/5.3" />
4
4
  /// <reference types="@typescript-to-lua/language-extensions" />
5
+ /**
6
+ * This is a type representing the metatable of a user-created class from TypeScript code.
7
+ * (TypeScriptToLua transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
8
+ */
5
9
  export interface TSTLClassMetatable {
6
10
  ____constructor: () => void;
7
11
  __index: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"TSTLClassMetatable.d.ts","sourceRoot":"","sources":["../../../src/interfaces/TSTLClassMetatable.ts"],"names":[],"mappings":";;;;AAAA,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;KAErD,CAAC;CACH"}
1
+ {"version":3,"file":"TSTLClassMetatable.d.ts","sourceRoot":"","sources":["../../../src/interfaces/TSTLClassMetatable.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;KAErD,CAAC;CACH"}
@@ -1,6 +1,7 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
2
  /**
3
- * This is a type representing a user-created class from TypeScript code.
3
+ * This is a type representing a user-created class from TypeScript code. (TypeScriptToLua
4
+ * transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
4
5
  *
5
6
  * This type is used by the save data manager to when copying, serializing, and deserializing.
6
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TSTLClass.d.ts","sourceRoot":"","sources":["../../../src/types/TSTLClass.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC"}
1
+ {"version":3,"file":"TSTLClass.d.ts","sourceRoot":"","sources":["../../../src/types/TSTLClass.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.11.5",
3
+ "version": "20.12.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^11.0.0"
25
+ "isaac-typescript-definitions": "^11.0.1"
26
26
  }
27
27
  }
@@ -5,7 +5,7 @@ import {
5
5
  getTSTLClassConstructor,
6
6
  getTSTLClassName,
7
7
  } from "../functions/tstlClass";
8
- import { isFunction, isNumber } from "../functions/types";
8
+ import { isFunction, isNumber, isTable } from "../functions/types";
9
9
  import { TSTLClassMetatable } from "../interfaces/TSTLClassMetatable";
10
10
  import { AnyFunction } from "../types/AnyFunction";
11
11
  import { ModUpgradedBase } from "./ModUpgradedBase";
@@ -51,6 +51,14 @@ type ModFeatureConstructor = TSTLClassMetatable["constructor"] & {
51
51
  * In almost all cases, you will want the callback functions to be immediately subscribed after
52
52
  * instantiating the class. However, if this is not the case, you can pass `false` as the optional
53
53
  * second argument to the constructor.
54
+ *
55
+ * If your mod feature has a property called `v`, it will be assumed that these are variables that
56
+ * should be managed by the save data manager. Subsequently, they will automatically be registered
57
+ * with the save data manager upon initialization. Unfortunately, due to technical limitations with
58
+ * classes, this registration will only occur if you initialize the class with the `init` boolean
59
+ * argument set to false, and then explicitly call the `ModFeature.init` method yourself after the
60
+ * class is constructed. (This is because the parent class does not have access to the child's
61
+ * properties upon first construction.)
54
62
  */
55
63
 
56
64
  export class ModFeature {
@@ -129,6 +137,7 @@ export class ModFeature {
129
137
 
130
138
  initDecoratedCallbacks(this, constructor, tstlClassName, true, init);
131
139
  initDecoratedCallbacks(this, constructor, tstlClassName, false, init);
140
+ initSaveDataManager(this, tstlClassName, init);
132
141
  }
133
142
 
134
143
  /**
@@ -314,3 +323,53 @@ function removeCallback(
314
323
  (mod.RemoveCallbackCustom as AnyFunction)(modCallback, wrappedCallback);
315
324
  }
316
325
  }
326
+
327
+ /** This will only work for end-users who are calling the `ModFeature.init` method explicitly. */
328
+ function initSaveDataManager(
329
+ modFeature: ModFeature,
330
+ tstlClassName: string,
331
+ init: boolean,
332
+ ) {
333
+ if (tstlClassName === "AtePoopBaby") {
334
+ Isaac.DebugString("GETTING HERE 1");
335
+ }
336
+
337
+ // Do nothing if this class does not have any variables.
338
+ const { v } = modFeature as unknown as Record<string, unknown>;
339
+ if (v === undefined) {
340
+ return;
341
+ }
342
+
343
+ Isaac.DebugString("GETTING HERE 2");
344
+
345
+ if (!isTable(v)) {
346
+ error(
347
+ 'Failed to initialize a mod feature class due to having a "v" property that is not an object. (The "v" property is supposed to be an object that holds the variables for the class, managed by the save data manager.)',
348
+ );
349
+ }
350
+
351
+ // Do nothing if we have not enabled the save data manager.
352
+ // eslint-disable-next-line @typescript-eslint/dot-notation
353
+ const mod = modFeature["mod"] as unknown as Record<string, unknown>;
354
+ const saveDataManagerMethodName = init
355
+ ? "saveDataManager"
356
+ : "saveDataManagerRemove";
357
+ const saveDataManagerMethod = mod[saveDataManagerMethodName];
358
+ if (saveDataManagerMethod === undefined) {
359
+ error(
360
+ 'Failed to initialize a mod feature class due to having a "v" object and not having the save data manager initialized. You must pass "ISCFeature.SAVE_DATA_MANAGER" to the "upgradeMod" function.',
361
+ );
362
+ }
363
+
364
+ if (typeof saveDataManagerMethod !== "function") {
365
+ error(
366
+ `The "${saveDataManagerMethodName}" property of the "ModUpgraded" object was not a function.`,
367
+ );
368
+ }
369
+
370
+ if (init) {
371
+ saveDataManagerMethod(tstlClassName, v);
372
+ } else {
373
+ saveDataManagerMethod(tstlClassName);
374
+ }
375
+ }
@@ -42,6 +42,7 @@ import { CustomTrapdoorDescription } from "../../../interfaces/private/CustomTra
42
42
  import { DefaultMap } from "../../DefaultMap";
43
43
  import { Feature } from "../../private/Feature";
44
44
  import { CustomGridEntities } from "../callbackLogic/CustomGridEntities";
45
+ import { CUSTOM_FLOOR_STAGE } from "./customStages/constants";
45
46
  import { DisableInputs } from "./DisableInputs";
46
47
  import { PonyDetection } from "./PonyDetection";
47
48
  import { RoomClearFrame } from "./RoomClearFrame";
@@ -337,6 +338,14 @@ export class CustomTrapdoors extends Feature {
337
338
  player.EntityCollisionClass = EntityCollisionClass.ALL;
338
339
  player.GridCollisionClass = EntityGridCollisionClass.GROUND;
339
340
  }
341
+
342
+ const level = game.GetLevel();
343
+ const stage = level.GetStage();
344
+ if (stage !== CUSTOM_FLOOR_STAGE) {
345
+ // The vanilla streak text shows just before the player stands up, which is a few frames
346
+ // from now. We arbitrarily play it now instead of waiting to avoid the extra complexity.
347
+ level.ShowName(false);
348
+ }
340
349
  });
341
350
  }
342
351
 
@@ -37,7 +37,14 @@ export function getParentFunctionDescription(
37
37
  * Helper function to avoid typing out `Isaac.DebugString()`.
38
38
  *
39
39
  * If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
40
- * function will also prepend the function name and the line number before the string.
40
+ * function will also prepend the function name and the line number before the string, like this:
41
+ *
42
+ * ```text
43
+ * [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
44
+ * ```
45
+ *
46
+ * Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
47
+ * your mod so that debugging becomes a little bit easier.
41
48
  */
42
49
  export function log(msg: string): void {
43
50
  const parentFunctionDescription = getParentFunctionDescription();
@@ -1,3 +1,7 @@
1
+ /**
2
+ * This is a type representing the metatable of a user-created class from TypeScript code.
3
+ * (TypeScriptToLua transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
4
+ */
1
5
  export interface TSTLClassMetatable {
2
6
  ____constructor: () => void;
3
7
  __index: unknown;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * This is a type representing a user-created class from TypeScript code.
2
+ * This is a type representing a user-created class from TypeScript code. (TypeScriptToLua
3
+ * transpiles TypeScript classes to a Lua table with a specific kind of metatable.)
3
4
  *
4
5
  * This type is used by the save data manager to when copying, serializing, and deserializing.
5
6
  */