isaacscript-common 76.2.0 → 76.3.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/classes/features/callbackLogic/CustomGridEntities.d.ts +8 -0
- package/dist/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.d.ts +6 -0
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/classes/features/other/CharacterHealthConversion.d.ts +2 -0
- package/dist/classes/features/other/CharacterHealthConversion.d.ts.map +1 -1
- package/dist/classes/features/other/CharacterStats.d.ts +2 -0
- package/dist/classes/features/other/CharacterStats.d.ts.map +1 -1
- package/dist/classes/features/other/CollectibleItemPoolType.d.ts +2 -0
- package/dist/classes/features/other/CollectibleItemPoolType.d.ts.map +1 -1
- package/dist/classes/features/other/CustomHotkeys.d.ts +4 -0
- package/dist/classes/features/other/CustomHotkeys.d.ts.map +1 -1
- package/dist/classes/features/other/CustomItemPools.d.ts +2 -0
- package/dist/classes/features/other/CustomItemPools.d.ts.map +1 -1
- package/dist/classes/features/other/CustomPickups.d.ts +1 -0
- package/dist/classes/features/other/CustomPickups.d.ts.map +1 -1
- package/dist/classes/features/other/CustomStages.d.ts +3 -0
- package/dist/classes/features/other/CustomStages.d.ts.map +1 -1
- package/dist/classes/features/other/DebugDisplay.d.ts +54 -0
- package/dist/classes/features/other/DebugDisplay.d.ts.map +1 -1
- package/dist/classes/features/other/DeployJSONRoom.d.ts +1 -0
- package/dist/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
- package/dist/classes/features/other/DisableInputs.d.ts +9 -0
- package/dist/classes/features/other/DisableInputs.d.ts.map +1 -1
- package/dist/classes/features/other/EdenStartingStatsHealth.d.ts +6 -0
- package/dist/classes/features/other/EdenStartingStatsHealth.d.ts.map +1 -1
- package/dist/classes/features/other/ExtraConsoleCommands.d.ts +6 -0
- package/dist/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
- package/dist/classes/features/other/FadeInRemover.d.ts +4 -0
- package/dist/classes/features/other/FadeInRemover.d.ts.map +1 -1
- package/dist/classes/features/other/FastReset.d.ts +4 -0
- package/dist/classes/features/other/FastReset.d.ts.map +1 -1
- package/dist/classes/features/other/FlyingDetection.d.ts +2 -0
- package/dist/classes/features/other/FlyingDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ForgottenSwitch.d.ts +2 -0
- package/dist/classes/features/other/ForgottenSwitch.d.ts.map +1 -1
- package/dist/classes/features/other/ItemPoolDetection.d.ts +6 -0
- package/dist/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementDetection.d.ts +32 -0
- package/dist/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementSets.d.ts +68 -0
- package/dist/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/classes/features/other/NoSirenSteal.d.ts +1 -0
- package/dist/classes/features/other/NoSirenSteal.d.ts.map +1 -1
- package/dist/classes/features/other/Pause.d.ts +10 -0
- package/dist/classes/features/other/Pause.d.ts.map +1 -1
- package/dist/classes/features/other/PersistentEntities.d.ts +2 -0
- package/dist/classes/features/other/PersistentEntities.d.ts.map +1 -1
- package/dist/classes/features/other/PlayerCollectibleTracking.d.ts +3 -0
- package/dist/classes/features/other/PlayerCollectibleTracking.d.ts.map +1 -1
- package/dist/classes/features/other/PonyDetection.d.ts +4 -0
- package/dist/classes/features/other/PonyDetection.d.ts.map +1 -1
- package/dist/classes/features/other/PreventChildEntities.d.ts +2 -0
- package/dist/classes/features/other/PreventChildEntities.d.ts.map +1 -1
- package/dist/classes/features/other/RoomClearFrame.d.ts +19 -0
- package/dist/classes/features/other/RoomClearFrame.d.ts.map +1 -1
- package/dist/classes/features/other/RoomClearFrame.lua +8 -2
- package/dist/classes/features/other/RoomHistory.d.ts +17 -1
- package/dist/classes/features/other/RoomHistory.d.ts.map +1 -1
- package/dist/classes/features/other/RunInNFrames.d.ts +9 -2
- package/dist/classes/features/other/RunInNFrames.d.ts.map +1 -1
- package/dist/classes/features/other/RunNextRun.d.ts +2 -0
- package/dist/classes/features/other/RunNextRun.d.ts.map +1 -1
- package/dist/classes/features/other/SaveDataManager.d.ts +21 -0
- package/dist/classes/features/other/SaveDataManager.d.ts.map +1 -1
- package/dist/classes/features/other/SpawnRockAltRewards.d.ts +1 -0
- package/dist/classes/features/other/SpawnRockAltRewards.d.ts.map +1 -1
- package/dist/classes/features/other/StageHistory.d.ts +3 -0
- package/dist/classes/features/other/StageHistory.d.ts.map +1 -1
- package/dist/classes/features/other/StartAmbush.d.ts +2 -0
- package/dist/classes/features/other/StartAmbush.d.ts.map +1 -1
- package/dist/classes/features/other/TaintedLazarusPlayers.d.ts +2 -0
- package/dist/classes/features/other/TaintedLazarusPlayers.d.ts.map +1 -1
- package/dist/classes/features/other/UnlockAchievementsDetection.d.ts +2 -0
- package/dist/classes/features/other/UnlockAchievementsDetection.d.ts.map +1 -1
- package/dist/classes/private/CustomCallback.d.ts +0 -1
- package/dist/classes/private/CustomCallback.d.ts.map +1 -1
- package/dist/classes/private/CustomCallback.lua +0 -19
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +7 -7
- package/dist/index.rollup.d.ts +324 -4
- package/dist/isaacscript-common.lua +370 -383
- package/package.json +1 -1
- package/src/classes/features/callbackLogic/CustomGridEntities.ts +8 -0
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +6 -0
- package/src/classes/features/other/CharacterHealthConversion.ts +2 -0
- package/src/classes/features/other/CharacterStats.ts +2 -0
- package/src/classes/features/other/CollectibleItemPoolType.ts +2 -0
- package/src/classes/features/other/CustomHotkeys.ts +4 -0
- package/src/classes/features/other/CustomItemPools.ts +2 -0
- package/src/classes/features/other/CustomPickups.ts +1 -0
- package/src/classes/features/other/CustomStages.ts +3 -0
- package/src/classes/features/other/DebugDisplay.ts +54 -0
- package/src/classes/features/other/DeployJSONRoom.ts +1 -0
- package/src/classes/features/other/DisableInputs.ts +9 -0
- package/src/classes/features/other/EdenStartingStatsHealth.ts +6 -0
- package/src/classes/features/other/ExtraConsoleCommands.ts +6 -0
- package/src/classes/features/other/FadeInRemover.ts +4 -0
- package/src/classes/features/other/FastReset.ts +4 -0
- package/src/classes/features/other/FlyingDetection.ts +2 -0
- package/src/classes/features/other/ForgottenSwitch.ts +2 -0
- package/src/classes/features/other/ItemPoolDetection.ts +6 -0
- package/src/classes/features/other/ModdedElementDetection.ts +32 -0
- package/src/classes/features/other/ModdedElementSets.ts +68 -0
- package/src/classes/features/other/NoSirenSteal.ts +1 -0
- package/src/classes/features/other/Pause.ts +10 -0
- package/src/classes/features/other/PersistentEntities.ts +2 -0
- package/src/classes/features/other/PlayerCollectibleTracking.ts +3 -0
- package/src/classes/features/other/PonyDetection.ts +4 -0
- package/src/classes/features/other/PreventChildEntities.ts +2 -0
- package/src/classes/features/other/RoomClearFrame.ts +27 -1
- package/src/classes/features/other/RoomHistory.ts +17 -1
- package/src/classes/features/other/RunInNFrames.ts +9 -2
- package/src/classes/features/other/RunNextRun.ts +2 -0
- package/src/classes/features/other/SaveDataManager.ts +21 -0
- package/src/classes/features/other/SpawnRockAltRewards.ts +1 -0
- package/src/classes/features/other/StageHistory.ts +3 -0
- package/src/classes/features/other/StartAmbush.ts +2 -0
- package/src/classes/features/other/TaintedLazarusPlayers.ts +2 -0
- package/src/classes/features/other/UnlockAchievementsDetection.ts +2 -0
- package/src/classes/private/CustomCallback.ts +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 76.
|
|
3
|
+
isaacscript-common 76.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -16287,81 +16287,6 @@ end
|
|
|
16287
16287
|
function ____exports.isUserdata(self, variable)
|
|
16288
16288
|
return type(variable) == "userdata"
|
|
16289
16289
|
end
|
|
16290
|
-
return ____exports
|
|
16291
|
-
end,
|
|
16292
|
-
["functions.log"] = function(...)
|
|
16293
|
-
local ____exports = {}
|
|
16294
|
-
local ____types = require("functions.types")
|
|
16295
|
-
local isNumber = ____types.isNumber
|
|
16296
|
-
--- Helper function to get the name and the line number of the current calling function.
|
|
16297
|
-
--
|
|
16298
|
-
-- For this function to work properly, the "--luadebug" flag must be enabled. Otherwise, it will
|
|
16299
|
-
-- always return undefined.
|
|
16300
|
-
--
|
|
16301
|
-
-- @param levels Optional. The amount of levels to look backwards in the call stack. Default is 3
|
|
16302
|
-
-- (because the first level is this function, the second level is the calling
|
|
16303
|
-
-- function, and the third level is the parent of the calling function).
|
|
16304
|
-
function ____exports.getParentFunctionDescription(levels)
|
|
16305
|
-
if levels == nil then
|
|
16306
|
-
levels = 3
|
|
16307
|
-
end
|
|
16308
|
-
if debug ~= nil then
|
|
16309
|
-
local debugTable = debug.getinfo(levels)
|
|
16310
|
-
if debugTable ~= nil then
|
|
16311
|
-
return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
|
|
16312
|
-
end
|
|
16313
|
-
end
|
|
16314
|
-
if SandboxGetParentFunctionDescription ~= nil then
|
|
16315
|
-
return SandboxGetParentFunctionDescription(levels)
|
|
16316
|
-
end
|
|
16317
|
-
return nil
|
|
16318
|
-
end
|
|
16319
|
-
--- Helper function to avoid typing out `Isaac.DebugString()`.
|
|
16320
|
-
--
|
|
16321
|
-
-- If you have the "--luadebug" launch flag turned on, then this function will also prepend the
|
|
16322
|
-
-- function name and the line number before the string, like this:
|
|
16323
|
-
--
|
|
16324
|
-
-- ```text
|
|
16325
|
-
-- [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
|
|
16326
|
-
-- ```
|
|
16327
|
-
--
|
|
16328
|
-
-- Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
|
|
16329
|
-
-- your mod so that debugging becomes a little bit easier.
|
|
16330
|
-
--
|
|
16331
|
-
-- @param msg The message to log.
|
|
16332
|
-
-- @param includeParentFunction Optional. Whether to prefix the message with the function name and
|
|
16333
|
-
-- line number, as shown in the above example. Default is true.
|
|
16334
|
-
function ____exports.log(msg, includeParentFunction)
|
|
16335
|
-
if includeParentFunction == nil then
|
|
16336
|
-
includeParentFunction = true
|
|
16337
|
-
end
|
|
16338
|
-
if isNumber(nil, msg) then
|
|
16339
|
-
msg = tostring(msg)
|
|
16340
|
-
end
|
|
16341
|
-
local ____includeParentFunction_0
|
|
16342
|
-
if includeParentFunction then
|
|
16343
|
-
____includeParentFunction_0 = ____exports.getParentFunctionDescription()
|
|
16344
|
-
else
|
|
16345
|
-
____includeParentFunction_0 = nil
|
|
16346
|
-
end
|
|
16347
|
-
local parentFunctionDescription = ____includeParentFunction_0
|
|
16348
|
-
local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
|
|
16349
|
-
Isaac.DebugString(debugMsg)
|
|
16350
|
-
end
|
|
16351
|
-
--- Helper function to log a message to the "log.txt" file and to print it to the screen at the same
|
|
16352
|
-
-- time.
|
|
16353
|
-
function ____exports.logAndPrint(self, msg)
|
|
16354
|
-
____exports.log(msg)
|
|
16355
|
-
print(msg)
|
|
16356
|
-
end
|
|
16357
|
-
--- Helper function to log an error message and also print it to the console for better visibility.
|
|
16358
|
-
--
|
|
16359
|
-
-- This is useful in situations where using the `error` function would be dangerous (since it
|
|
16360
|
-
-- prevents all of the subsequent code in the callback from running).
|
|
16361
|
-
function ____exports.logError(msg)
|
|
16362
|
-
local errorMsg = "Error: " .. msg
|
|
16363
|
-
____exports.logAndPrint(nil, errorMsg)
|
|
16364
|
-
end
|
|
16365
16290
|
return ____exports
|
|
16366
16291
|
end,
|
|
16367
16292
|
["functions.sort"] = function(...)
|
|
@@ -16507,183 +16432,7 @@ function ____exports.stableSort(self, array, sortFunc)
|
|
|
16507
16432
|
end
|
|
16508
16433
|
return ____exports
|
|
16509
16434
|
end,
|
|
16510
|
-
["
|
|
16511
|
-
local ____lualib = require("lualib_bundle")
|
|
16512
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
16513
|
-
local Map = ____lualib.Map
|
|
16514
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
16515
|
-
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
16516
|
-
local __TS__New = ____lualib.__TS__New
|
|
16517
|
-
local ____exports = {}
|
|
16518
|
-
local ____types = require("functions.types")
|
|
16519
|
-
local isFunction = ____types.isFunction
|
|
16520
|
-
local isPrimitive = ____types.isPrimitive
|
|
16521
|
-
--- `DefaultMap` is a data structure that makes working with default values easier. It extends a
|
|
16522
|
-
-- `Map` and adds additional methods.
|
|
16523
|
-
--
|
|
16524
|
-
-- It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
|
|
16525
|
-
-- a default value for the key, and then return the default value. `DefaultMap` abstracts this
|
|
16526
|
-
-- operation away by providing the `getAndSetDefault` method.
|
|
16527
|
-
--
|
|
16528
|
-
-- Using a `DefaultMap` is nice because it makes code more declarative, since you specify what the
|
|
16529
|
-
-- default value is alongside the types of the keys/values.
|
|
16530
|
-
--
|
|
16531
|
-
-- When instantiating a new `DefaultMap`, you must specify default value as the first argument. (The
|
|
16532
|
-
-- default value is the initial value that will be assigned to every new entry in the
|
|
16533
|
-
-- `getAndSetDefault` method.) For example:
|
|
16534
|
-
--
|
|
16535
|
-
-- ```ts
|
|
16536
|
-
-- // Initializes a new empty DefaultMap with a default value of "foo".
|
|
16537
|
-
-- const defaultMapWithString = new DefaultMap<string, string>("foo");
|
|
16538
|
-
--
|
|
16539
|
-
-- const value = defaultMapWithString.getAndSetDefault("bar");
|
|
16540
|
-
-- // value is now "foo" and an entry for "bar" is now set.
|
|
16541
|
-
-- ```
|
|
16542
|
-
--
|
|
16543
|
-
-- Sometimes, instead of having a static initial value for every entry in the map, you will want a
|
|
16544
|
-
-- dynamic initial value that is contingent upon the key or some other variable. In these cases, you
|
|
16545
|
-
-- can instead specify that the `DefaultMap` should run a function that will return the initial
|
|
16546
|
-
-- value. (This is referred to as a "factory function".) For example:
|
|
16547
|
-
--
|
|
16548
|
-
-- ```ts
|
|
16549
|
-
-- // Initializes a new empty DefaultMap with a default value based on "someGlobalVariable".
|
|
16550
|
-
-- const factoryFunction = () => someGlobalVariable ? 0 : 1;
|
|
16551
|
-
-- const defaultMapWithFactoryFunction = new DefaultMap<string, string>(factoryFunction);
|
|
16552
|
-
-- ```
|
|
16553
|
-
--
|
|
16554
|
-
-- Note that in TypeScript and Lua, booleans, numbers, and strings are "passed by value". This means
|
|
16555
|
-
-- that when the `DefaultMap` creates a new entry, if the default value is one of these 3 types, the
|
|
16556
|
-
-- values will be copied. On the other hand, arrays and maps and other complex data structures are
|
|
16557
|
-
-- "passed by reference". This means that when the `DefaultMap` creates a new entry, if the default
|
|
16558
|
-
-- value is an array, then it would not be copied. Instead, the same shared array would be assigned
|
|
16559
|
-
-- to every entry. Thus, to solve this problem, any variable that is passed by reference must be
|
|
16560
|
-
-- created using a factory function to ensure that each copy is unique. For example:
|
|
16561
|
-
--
|
|
16562
|
-
-- ```ts
|
|
16563
|
-
-- // Initializes a new empty DefaultMap with a default value of a new empty array.
|
|
16564
|
-
-- const factoryFunction = () => [];
|
|
16565
|
-
-- const defaultMapWithArray = new DefaultMap<string, string[]>(factoryFunction);
|
|
16566
|
-
-- ```
|
|
16567
|
-
--
|
|
16568
|
-
-- In the previous two examples, the factory functions did not have any arguments. But you can also
|
|
16569
|
-
-- specify a factory function that takes one or more arguments:
|
|
16570
|
-
--
|
|
16571
|
-
-- ```ts
|
|
16572
|
-
-- const factoryFunction = (arg: boolean) => arg ? 0 : 1;
|
|
16573
|
-
-- const defaultMapWithArg = new DefaultMap<string, string, [arg: boolean]>(factoryFunction);
|
|
16574
|
-
-- ```
|
|
16575
|
-
--
|
|
16576
|
-
-- Similar to a normal `Map`, you can also include an initializer list in the constructor as the
|
|
16577
|
-
-- second argument:
|
|
16578
|
-
--
|
|
16579
|
-
-- ```ts
|
|
16580
|
-
-- // Initializes a DefaultMap with a default value of "foo" and some initial values.
|
|
16581
|
-
-- const defaultMapWithInitialValues = new DefaultMap<string, string>("foo", [
|
|
16582
|
-
-- ["a1", "a2"],
|
|
16583
|
-
-- ["b1", "b2"],
|
|
16584
|
-
-- ], );
|
|
16585
|
-
-- ```
|
|
16586
|
-
--
|
|
16587
|
-
-- Finally, note that `DefaultMap` has the following additional utility methods:
|
|
16588
|
-
--
|
|
16589
|
-
-- - `getAndSetDefault` - The method that is called inside the overridden `get` method. In most
|
|
16590
|
-
-- cases, you can use the overridden `get` method instead of calling this function directly.
|
|
16591
|
-
-- However, if a factory function was provided during instantiation, and the factory function has
|
|
16592
|
-
-- one or more arguments, then you must call this method instead (and provide the corresponding
|
|
16593
|
-
-- arguments).
|
|
16594
|
-
-- - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
|
|
16595
|
-
-- was provided during instantiation, this will execute the factory function.)
|
|
16596
|
-
-- - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
|
|
16597
|
-
-- the reference to the factory function.
|
|
16598
|
-
____exports.DefaultMap = __TS__Class()
|
|
16599
|
-
local DefaultMap = ____exports.DefaultMap
|
|
16600
|
-
DefaultMap.name = "DefaultMap"
|
|
16601
|
-
__TS__ClassExtends(DefaultMap, Map)
|
|
16602
|
-
function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
|
|
16603
|
-
local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
|
|
16604
|
-
local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
|
|
16605
|
-
if not argIsPrimitive and not argIsFunction then
|
|
16606
|
-
error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
|
|
16607
|
-
end
|
|
16608
|
-
Map.prototype.____constructor(self, initializerArray)
|
|
16609
|
-
if argIsFunction then
|
|
16610
|
-
self.defaultValue = nil
|
|
16611
|
-
self.defaultValueFactory = defaultValueOrFactoryFunction
|
|
16612
|
-
else
|
|
16613
|
-
self.defaultValue = defaultValueOrFactoryFunction
|
|
16614
|
-
self.defaultValueFactory = nil
|
|
16615
|
-
end
|
|
16616
|
-
end
|
|
16617
|
-
function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
16618
|
-
local value = Map.prototype.get(self, key)
|
|
16619
|
-
if value ~= nil then
|
|
16620
|
-
return value
|
|
16621
|
-
end
|
|
16622
|
-
local defaultValue = self:getDefaultValue(...)
|
|
16623
|
-
self:set(key, defaultValue)
|
|
16624
|
-
return defaultValue
|
|
16625
|
-
end
|
|
16626
|
-
function DefaultMap.prototype.getDefaultValue(self, ...)
|
|
16627
|
-
if self.defaultValue ~= nil then
|
|
16628
|
-
return self.defaultValue
|
|
16629
|
-
end
|
|
16630
|
-
if self.defaultValueFactory ~= nil then
|
|
16631
|
-
return self:defaultValueFactory(...)
|
|
16632
|
-
end
|
|
16633
|
-
error("A DefaultMap was incorrectly instantiated.")
|
|
16634
|
-
end
|
|
16635
|
-
function DefaultMap.prototype.getConstructorArg(self)
|
|
16636
|
-
if self.defaultValue ~= nil then
|
|
16637
|
-
return self.defaultValue
|
|
16638
|
-
end
|
|
16639
|
-
if self.defaultValueFactory ~= nil then
|
|
16640
|
-
return self.defaultValueFactory
|
|
16641
|
-
end
|
|
16642
|
-
error("A DefaultMap was incorrectly instantiated.")
|
|
16643
|
-
end
|
|
16644
|
-
local function test(self)
|
|
16645
|
-
local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
|
|
16646
|
-
local myDefaultMapBooleanFactory = __TS__New(
|
|
16647
|
-
____exports.DefaultMap,
|
|
16648
|
-
function() return false end
|
|
16649
|
-
)
|
|
16650
|
-
local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
|
|
16651
|
-
local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
|
|
16652
|
-
local myDefaultMapNumberFactory = __TS__New(
|
|
16653
|
-
____exports.DefaultMap,
|
|
16654
|
-
function() return 123 end
|
|
16655
|
-
)
|
|
16656
|
-
local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
|
|
16657
|
-
local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
|
|
16658
|
-
local myDefaultMapStringFactory = __TS__New(
|
|
16659
|
-
____exports.DefaultMap,
|
|
16660
|
-
function() return "foo" end
|
|
16661
|
-
)
|
|
16662
|
-
local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
|
|
16663
|
-
local myDefaultMapArray = __TS__New(
|
|
16664
|
-
____exports.DefaultMap,
|
|
16665
|
-
function() return {} end
|
|
16666
|
-
)
|
|
16667
|
-
local myDefaultMapArrayWithoutParams = __TS__New(
|
|
16668
|
-
____exports.DefaultMap,
|
|
16669
|
-
function() return {} end
|
|
16670
|
-
)
|
|
16671
|
-
local myDefaultMapMap = __TS__New(
|
|
16672
|
-
____exports.DefaultMap,
|
|
16673
|
-
function() return __TS__New(Map) end
|
|
16674
|
-
)
|
|
16675
|
-
local myDefaultMapMapWithoutParams = __TS__New(
|
|
16676
|
-
____exports.DefaultMap,
|
|
16677
|
-
function() return __TS__New(Map) end
|
|
16678
|
-
)
|
|
16679
|
-
end
|
|
16680
|
-
return ____exports
|
|
16681
|
-
end,
|
|
16682
|
-
["interfaces.TSTLClassMetatable"] = function(...)
|
|
16683
|
-
local ____exports = {}
|
|
16684
|
-
return ____exports
|
|
16685
|
-
end,
|
|
16686
|
-
["types.TSTLClass"] = function(...)
|
|
16435
|
+
["types.WidenLiteral"] = function(...)
|
|
16687
16436
|
local ____exports = {}
|
|
16688
16437
|
return ____exports
|
|
16689
16438
|
end,
|
|
@@ -16737,6 +16486,24 @@ ____exports.fonts.teamMeatFont12:Load("font/teammeatfont12.fnt")
|
|
|
16737
16486
|
____exports.fonts.teamMeatFont16Bold:Load("font/teammeatfont16bold.fnt")
|
|
16738
16487
|
____exports.fonts.terminus:Load("font/terminus.fnt")
|
|
16739
16488
|
____exports.fonts.upheaval:Load("font/upheaval.fnt")
|
|
16489
|
+
return ____exports
|
|
16490
|
+
end,
|
|
16491
|
+
["enums.private.SerializationBrand"] = function(...)
|
|
16492
|
+
local ____exports = {}
|
|
16493
|
+
--- During serialization, we write an arbitrary string key to the object with a value of an empty
|
|
16494
|
+
-- string. This is used during deserialization to instantiate the correct type of object.
|
|
16495
|
+
____exports.SerializationBrand = {}
|
|
16496
|
+
____exports.SerializationBrand.DEFAULT_MAP = "__TSTL_DEFAULT_MAP"
|
|
16497
|
+
____exports.SerializationBrand.MAP = "__TSTL_MAP"
|
|
16498
|
+
____exports.SerializationBrand.SET = "__TSTL_SET"
|
|
16499
|
+
____exports.SerializationBrand.BIT_SET_128 = "__BIT_SET_128"
|
|
16500
|
+
____exports.SerializationBrand.COLOR = "__COLOR"
|
|
16501
|
+
____exports.SerializationBrand.K_COLOR = "__K_COLOR"
|
|
16502
|
+
____exports.SerializationBrand.RNG = "__RNG"
|
|
16503
|
+
____exports.SerializationBrand.VECTOR = "__VECTOR"
|
|
16504
|
+
____exports.SerializationBrand.DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE"
|
|
16505
|
+
____exports.SerializationBrand.OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS"
|
|
16506
|
+
____exports.SerializationBrand.TSTL_CLASS = "__TSTL_CLASS"
|
|
16740
16507
|
return ____exports
|
|
16741
16508
|
end,
|
|
16742
16509
|
["types.PlayerIndex"] = function(...)
|
|
@@ -17129,108 +16896,6 @@ end
|
|
|
17129
16896
|
-- @allowEmptyVariadic
|
|
17130
16897
|
function ____exports.todo(self, ...)
|
|
17131
16898
|
end
|
|
17132
|
-
return ____exports
|
|
17133
|
-
end,
|
|
17134
|
-
["functions.tstlClass"] = function(...)
|
|
17135
|
-
local ____exports = {}
|
|
17136
|
-
local ____types = require("functions.types")
|
|
17137
|
-
local isTable = ____types.isTable
|
|
17138
|
-
local ____utils = require("functions.utils")
|
|
17139
|
-
local assertDefined = ____utils.assertDefined
|
|
17140
|
-
--- Helper function to get the constructor from an instantiated TypeScriptToLua class, which is
|
|
17141
|
-
-- located on the metatable.
|
|
17142
|
-
--
|
|
17143
|
-
-- Returns undefined if passed a non-table or if the provided table does not have a metatable.
|
|
17144
|
-
function ____exports.getTSTLClassConstructor(self, object)
|
|
17145
|
-
if not isTable(nil, object) then
|
|
17146
|
-
return nil
|
|
17147
|
-
end
|
|
17148
|
-
local metatable = getmetatable(object)
|
|
17149
|
-
if metatable == nil then
|
|
17150
|
-
return nil
|
|
17151
|
-
end
|
|
17152
|
-
return metatable.constructor
|
|
17153
|
-
end
|
|
17154
|
-
--- Helper function to get the name of a TypeScriptToLua class from the instantiated class object.
|
|
17155
|
-
--
|
|
17156
|
-
-- TSTL classes are Lua tables created with the `__TS__Class` Lua function from the TSTL lualib.
|
|
17157
|
-
-- Their name is contained within "constructor.name" metatable key.
|
|
17158
|
-
--
|
|
17159
|
-
-- For example, a `Map` class is has a name of "Map".
|
|
17160
|
-
--
|
|
17161
|
-
-- Returns undefined if passed a non-table or if the provided table does not have a metatable.
|
|
17162
|
-
function ____exports.getTSTLClassName(self, object)
|
|
17163
|
-
local constructor = ____exports.getTSTLClassConstructor(nil, object)
|
|
17164
|
-
if constructor == nil then
|
|
17165
|
-
return nil
|
|
17166
|
-
end
|
|
17167
|
-
return constructor.name
|
|
17168
|
-
end
|
|
17169
|
-
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
17170
|
-
--
|
|
17171
|
-
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
|
|
17172
|
-
-- their own copies of the entire lualib and thus their own instantiated version of a `Map`.
|
|
17173
|
-
function ____exports.isDefaultMap(self, object)
|
|
17174
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
17175
|
-
return className == "DefaultMap"
|
|
17176
|
-
end
|
|
17177
|
-
--- Helper function to check if a given table is a class table created by TypeScriptToLua.
|
|
17178
|
-
function ____exports.isTSTLClass(self, object)
|
|
17179
|
-
local tstlClassName = ____exports.getTSTLClassName(nil, object)
|
|
17180
|
-
return tstlClassName ~= nil
|
|
17181
|
-
end
|
|
17182
|
-
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
17183
|
-
--
|
|
17184
|
-
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module
|
|
17185
|
-
-- might have their own copy of the entire lualib and thus their own instantiated version of a
|
|
17186
|
-
-- `Map`.
|
|
17187
|
-
function ____exports.isTSTLMap(self, object)
|
|
17188
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
17189
|
-
return className == "Map"
|
|
17190
|
-
end
|
|
17191
|
-
--- Helper function to determine if a given object is a TypeScriptToLua `Set`.
|
|
17192
|
-
--
|
|
17193
|
-
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module
|
|
17194
|
-
-- might have their own copy of the entire lualib and thus their own instantiated version of a
|
|
17195
|
-
-- `Set`.
|
|
17196
|
-
function ____exports.isTSTLSet(self, object)
|
|
17197
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
17198
|
-
return className == "Set"
|
|
17199
|
-
end
|
|
17200
|
-
--- Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
17201
|
-
-- it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
17202
|
-
-- use the class constructor that is present on the other object's metatable to initialize the new
|
|
17203
|
-
-- class.
|
|
17204
|
-
function ____exports.newTSTLClass(self, oldClass)
|
|
17205
|
-
local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
|
|
17206
|
-
assertDefined(nil, constructor, "Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
|
|
17207
|
-
local newClass = {}
|
|
17208
|
-
local newClassMetatable = setmetatable(newClass, constructor.prototype)
|
|
17209
|
-
newClassMetatable:____constructor()
|
|
17210
|
-
return newClass
|
|
17211
|
-
end
|
|
17212
|
-
return ____exports
|
|
17213
|
-
end,
|
|
17214
|
-
["types.WidenLiteral"] = function(...)
|
|
17215
|
-
local ____exports = {}
|
|
17216
|
-
return ____exports
|
|
17217
|
-
end,
|
|
17218
|
-
["enums.private.SerializationBrand"] = function(...)
|
|
17219
|
-
local ____exports = {}
|
|
17220
|
-
--- During serialization, we write an arbitrary string key to the object with a value of an empty
|
|
17221
|
-
-- string. This is used during deserialization to instantiate the correct type of object.
|
|
17222
|
-
____exports.SerializationBrand = {}
|
|
17223
|
-
____exports.SerializationBrand.DEFAULT_MAP = "__TSTL_DEFAULT_MAP"
|
|
17224
|
-
____exports.SerializationBrand.MAP = "__TSTL_MAP"
|
|
17225
|
-
____exports.SerializationBrand.SET = "__TSTL_SET"
|
|
17226
|
-
____exports.SerializationBrand.BIT_SET_128 = "__BIT_SET_128"
|
|
17227
|
-
____exports.SerializationBrand.COLOR = "__COLOR"
|
|
17228
|
-
____exports.SerializationBrand.K_COLOR = "__K_COLOR"
|
|
17229
|
-
____exports.SerializationBrand.RNG = "__RNG"
|
|
17230
|
-
____exports.SerializationBrand.VECTOR = "__VECTOR"
|
|
17231
|
-
____exports.SerializationBrand.DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE"
|
|
17232
|
-
____exports.SerializationBrand.OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS"
|
|
17233
|
-
____exports.SerializationBrand.TSTL_CLASS = "__TSTL_CLASS"
|
|
17234
16899
|
return ____exports
|
|
17235
16900
|
end,
|
|
17236
16901
|
["functions.string"] = function(...)
|
|
@@ -17539,6 +17204,81 @@ function ____exports.isaacAPIClassEquals(self, object1, object2, keys)
|
|
|
17539
17204
|
function(____, key) return table1[key] == table2[key] end
|
|
17540
17205
|
)
|
|
17541
17206
|
end
|
|
17207
|
+
return ____exports
|
|
17208
|
+
end,
|
|
17209
|
+
["functions.log"] = function(...)
|
|
17210
|
+
local ____exports = {}
|
|
17211
|
+
local ____types = require("functions.types")
|
|
17212
|
+
local isNumber = ____types.isNumber
|
|
17213
|
+
--- Helper function to get the name and the line number of the current calling function.
|
|
17214
|
+
--
|
|
17215
|
+
-- For this function to work properly, the "--luadebug" flag must be enabled. Otherwise, it will
|
|
17216
|
+
-- always return undefined.
|
|
17217
|
+
--
|
|
17218
|
+
-- @param levels Optional. The amount of levels to look backwards in the call stack. Default is 3
|
|
17219
|
+
-- (because the first level is this function, the second level is the calling
|
|
17220
|
+
-- function, and the third level is the parent of the calling function).
|
|
17221
|
+
function ____exports.getParentFunctionDescription(levels)
|
|
17222
|
+
if levels == nil then
|
|
17223
|
+
levels = 3
|
|
17224
|
+
end
|
|
17225
|
+
if debug ~= nil then
|
|
17226
|
+
local debugTable = debug.getinfo(levels)
|
|
17227
|
+
if debugTable ~= nil then
|
|
17228
|
+
return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
|
|
17229
|
+
end
|
|
17230
|
+
end
|
|
17231
|
+
if SandboxGetParentFunctionDescription ~= nil then
|
|
17232
|
+
return SandboxGetParentFunctionDescription(levels)
|
|
17233
|
+
end
|
|
17234
|
+
return nil
|
|
17235
|
+
end
|
|
17236
|
+
--- Helper function to avoid typing out `Isaac.DebugString()`.
|
|
17237
|
+
--
|
|
17238
|
+
-- If you have the "--luadebug" launch flag turned on, then this function will also prepend the
|
|
17239
|
+
-- function name and the line number before the string, like this:
|
|
17240
|
+
--
|
|
17241
|
+
-- ```text
|
|
17242
|
+
-- [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
|
|
17243
|
+
-- ```
|
|
17244
|
+
--
|
|
17245
|
+
-- Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
|
|
17246
|
+
-- your mod so that debugging becomes a little bit easier.
|
|
17247
|
+
--
|
|
17248
|
+
-- @param msg The message to log.
|
|
17249
|
+
-- @param includeParentFunction Optional. Whether to prefix the message with the function name and
|
|
17250
|
+
-- line number, as shown in the above example. Default is true.
|
|
17251
|
+
function ____exports.log(msg, includeParentFunction)
|
|
17252
|
+
if includeParentFunction == nil then
|
|
17253
|
+
includeParentFunction = true
|
|
17254
|
+
end
|
|
17255
|
+
if isNumber(nil, msg) then
|
|
17256
|
+
msg = tostring(msg)
|
|
17257
|
+
end
|
|
17258
|
+
local ____includeParentFunction_0
|
|
17259
|
+
if includeParentFunction then
|
|
17260
|
+
____includeParentFunction_0 = ____exports.getParentFunctionDescription()
|
|
17261
|
+
else
|
|
17262
|
+
____includeParentFunction_0 = nil
|
|
17263
|
+
end
|
|
17264
|
+
local parentFunctionDescription = ____includeParentFunction_0
|
|
17265
|
+
local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
|
|
17266
|
+
Isaac.DebugString(debugMsg)
|
|
17267
|
+
end
|
|
17268
|
+
--- Helper function to log a message to the "log.txt" file and to print it to the screen at the same
|
|
17269
|
+
-- time.
|
|
17270
|
+
function ____exports.logAndPrint(self, msg)
|
|
17271
|
+
____exports.log(msg)
|
|
17272
|
+
print(msg)
|
|
17273
|
+
end
|
|
17274
|
+
--- Helper function to log an error message and also print it to the console for better visibility.
|
|
17275
|
+
--
|
|
17276
|
+
-- This is useful in situations where using the `error` function would be dangerous (since it
|
|
17277
|
+
-- prevents all of the subsequent code in the callback from running).
|
|
17278
|
+
function ____exports.logError(msg)
|
|
17279
|
+
local errorMsg = "Error: " .. msg
|
|
17280
|
+
____exports.logAndPrint(nil, errorMsg)
|
|
17281
|
+
end
|
|
17542
17282
|
return ____exports
|
|
17543
17283
|
end,
|
|
17544
17284
|
["functions.table"] = function(...)
|
|
@@ -20126,16 +19866,10 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
20126
19866
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
20127
19867
|
local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
|
|
20128
19868
|
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
20129
|
-
local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
|
|
20130
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
20131
19869
|
local ____exports = {}
|
|
20132
|
-
local ____log = require("functions.log")
|
|
20133
|
-
local log = ____log.log
|
|
20134
19870
|
local ____sort = require("functions.sort")
|
|
20135
19871
|
local sortObjectArrayByKey = ____sort.sortObjectArrayByKey
|
|
20136
19872
|
local stableSort = ____sort.stableSort
|
|
20137
|
-
local ____tstlClass = require("functions.tstlClass")
|
|
20138
|
-
local getTSTLClassName = ____tstlClass.getTSTLClassName
|
|
20139
19873
|
local ____Feature = require("classes.private.Feature")
|
|
20140
19874
|
local Feature = ____Feature.Feature
|
|
20141
19875
|
--- The base class for a custom callback. Individual custom callbacks (and validation callbacks) will
|
|
@@ -20195,19 +19929,6 @@ function CustomCallback.prototype.removeSubscriber(self, callback)
|
|
|
20195
19929
|
__TS__ArraySplice(self.subscriptions, subscriptionIndexMatchingCallback, 1)
|
|
20196
19930
|
end
|
|
20197
19931
|
end
|
|
20198
|
-
function CustomCallback.prototype.logSubscriptions(self)
|
|
20199
|
-
local tstlClassName = getTSTLClassName(nil, self)
|
|
20200
|
-
log("Logging subscriptions for custom callback: " .. tostring(tstlClassName))
|
|
20201
|
-
if #self.subscriptions == 0 then
|
|
20202
|
-
log("- n/a (no subscriptions)")
|
|
20203
|
-
else
|
|
20204
|
-
for ____, ____value in __TS__Iterator(__TS__ArrayEntries(self.subscriptions)) do
|
|
20205
|
-
local i = ____value[1]
|
|
20206
|
-
local subscription = ____value[2]
|
|
20207
|
-
log((("- " .. tostring(i + 1)) .. " - priority: ") .. tostring(subscription.priority))
|
|
20208
|
-
end
|
|
20209
|
-
end
|
|
20210
|
-
end
|
|
20211
19932
|
return ____exports
|
|
20212
19933
|
end,
|
|
20213
19934
|
["classes.callbacks.EntityTakeDmgFilter"] = function(...)
|
|
@@ -20806,6 +20527,178 @@ function ____exports.onRoomFrame(self, roomFrameCount)
|
|
|
20806
20527
|
local thisGameFrameCount = room:GetFrameCount()
|
|
20807
20528
|
return thisGameFrameCount == roomFrameCount
|
|
20808
20529
|
end
|
|
20530
|
+
return ____exports
|
|
20531
|
+
end,
|
|
20532
|
+
["classes.DefaultMap"] = function(...)
|
|
20533
|
+
local ____lualib = require("lualib_bundle")
|
|
20534
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
20535
|
+
local Map = ____lualib.Map
|
|
20536
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
20537
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
20538
|
+
local __TS__New = ____lualib.__TS__New
|
|
20539
|
+
local ____exports = {}
|
|
20540
|
+
local ____types = require("functions.types")
|
|
20541
|
+
local isFunction = ____types.isFunction
|
|
20542
|
+
local isPrimitive = ____types.isPrimitive
|
|
20543
|
+
--- `DefaultMap` is a data structure that makes working with default values easier. It extends a
|
|
20544
|
+
-- `Map` and adds additional methods.
|
|
20545
|
+
--
|
|
20546
|
+
-- It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
|
|
20547
|
+
-- a default value for the key, and then return the default value. `DefaultMap` abstracts this
|
|
20548
|
+
-- operation away by providing the `getAndSetDefault` method.
|
|
20549
|
+
--
|
|
20550
|
+
-- Using a `DefaultMap` is nice because it makes code more declarative, since you specify what the
|
|
20551
|
+
-- default value is alongside the types of the keys/values.
|
|
20552
|
+
--
|
|
20553
|
+
-- When instantiating a new `DefaultMap`, you must specify default value as the first argument. (The
|
|
20554
|
+
-- default value is the initial value that will be assigned to every new entry in the
|
|
20555
|
+
-- `getAndSetDefault` method.) For example:
|
|
20556
|
+
--
|
|
20557
|
+
-- ```ts
|
|
20558
|
+
-- // Initializes a new empty DefaultMap with a default value of "foo".
|
|
20559
|
+
-- const defaultMapWithString = new DefaultMap<string, string>("foo");
|
|
20560
|
+
--
|
|
20561
|
+
-- const value = defaultMapWithString.getAndSetDefault("bar");
|
|
20562
|
+
-- // value is now "foo" and an entry for "bar" is now set.
|
|
20563
|
+
-- ```
|
|
20564
|
+
--
|
|
20565
|
+
-- Sometimes, instead of having a static initial value for every entry in the map, you will want a
|
|
20566
|
+
-- dynamic initial value that is contingent upon the key or some other variable. In these cases, you
|
|
20567
|
+
-- can instead specify that the `DefaultMap` should run a function that will return the initial
|
|
20568
|
+
-- value. (This is referred to as a "factory function".) For example:
|
|
20569
|
+
--
|
|
20570
|
+
-- ```ts
|
|
20571
|
+
-- // Initializes a new empty DefaultMap with a default value based on "someGlobalVariable".
|
|
20572
|
+
-- const factoryFunction = () => someGlobalVariable ? 0 : 1;
|
|
20573
|
+
-- const defaultMapWithFactoryFunction = new DefaultMap<string, string>(factoryFunction);
|
|
20574
|
+
-- ```
|
|
20575
|
+
--
|
|
20576
|
+
-- Note that in TypeScript and Lua, booleans, numbers, and strings are "passed by value". This means
|
|
20577
|
+
-- that when the `DefaultMap` creates a new entry, if the default value is one of these 3 types, the
|
|
20578
|
+
-- values will be copied. On the other hand, arrays and maps and other complex data structures are
|
|
20579
|
+
-- "passed by reference". This means that when the `DefaultMap` creates a new entry, if the default
|
|
20580
|
+
-- value is an array, then it would not be copied. Instead, the same shared array would be assigned
|
|
20581
|
+
-- to every entry. Thus, to solve this problem, any variable that is passed by reference must be
|
|
20582
|
+
-- created using a factory function to ensure that each copy is unique. For example:
|
|
20583
|
+
--
|
|
20584
|
+
-- ```ts
|
|
20585
|
+
-- // Initializes a new empty DefaultMap with a default value of a new empty array.
|
|
20586
|
+
-- const factoryFunction = () => [];
|
|
20587
|
+
-- const defaultMapWithArray = new DefaultMap<string, string[]>(factoryFunction);
|
|
20588
|
+
-- ```
|
|
20589
|
+
--
|
|
20590
|
+
-- In the previous two examples, the factory functions did not have any arguments. But you can also
|
|
20591
|
+
-- specify a factory function that takes one or more arguments:
|
|
20592
|
+
--
|
|
20593
|
+
-- ```ts
|
|
20594
|
+
-- const factoryFunction = (arg: boolean) => arg ? 0 : 1;
|
|
20595
|
+
-- const defaultMapWithArg = new DefaultMap<string, string, [arg: boolean]>(factoryFunction);
|
|
20596
|
+
-- ```
|
|
20597
|
+
--
|
|
20598
|
+
-- Similar to a normal `Map`, you can also include an initializer list in the constructor as the
|
|
20599
|
+
-- second argument:
|
|
20600
|
+
--
|
|
20601
|
+
-- ```ts
|
|
20602
|
+
-- // Initializes a DefaultMap with a default value of "foo" and some initial values.
|
|
20603
|
+
-- const defaultMapWithInitialValues = new DefaultMap<string, string>("foo", [
|
|
20604
|
+
-- ["a1", "a2"],
|
|
20605
|
+
-- ["b1", "b2"],
|
|
20606
|
+
-- ], );
|
|
20607
|
+
-- ```
|
|
20608
|
+
--
|
|
20609
|
+
-- Finally, note that `DefaultMap` has the following additional utility methods:
|
|
20610
|
+
--
|
|
20611
|
+
-- - `getAndSetDefault` - The method that is called inside the overridden `get` method. In most
|
|
20612
|
+
-- cases, you can use the overridden `get` method instead of calling this function directly.
|
|
20613
|
+
-- However, if a factory function was provided during instantiation, and the factory function has
|
|
20614
|
+
-- one or more arguments, then you must call this method instead (and provide the corresponding
|
|
20615
|
+
-- arguments).
|
|
20616
|
+
-- - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
|
|
20617
|
+
-- was provided during instantiation, this will execute the factory function.)
|
|
20618
|
+
-- - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
|
|
20619
|
+
-- the reference to the factory function.
|
|
20620
|
+
____exports.DefaultMap = __TS__Class()
|
|
20621
|
+
local DefaultMap = ____exports.DefaultMap
|
|
20622
|
+
DefaultMap.name = "DefaultMap"
|
|
20623
|
+
__TS__ClassExtends(DefaultMap, Map)
|
|
20624
|
+
function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
|
|
20625
|
+
local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
|
|
20626
|
+
local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
|
|
20627
|
+
if not argIsPrimitive and not argIsFunction then
|
|
20628
|
+
error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
|
|
20629
|
+
end
|
|
20630
|
+
Map.prototype.____constructor(self, initializerArray)
|
|
20631
|
+
if argIsFunction then
|
|
20632
|
+
self.defaultValue = nil
|
|
20633
|
+
self.defaultValueFactory = defaultValueOrFactoryFunction
|
|
20634
|
+
else
|
|
20635
|
+
self.defaultValue = defaultValueOrFactoryFunction
|
|
20636
|
+
self.defaultValueFactory = nil
|
|
20637
|
+
end
|
|
20638
|
+
end
|
|
20639
|
+
function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
20640
|
+
local value = Map.prototype.get(self, key)
|
|
20641
|
+
if value ~= nil then
|
|
20642
|
+
return value
|
|
20643
|
+
end
|
|
20644
|
+
local defaultValue = self:getDefaultValue(...)
|
|
20645
|
+
self:set(key, defaultValue)
|
|
20646
|
+
return defaultValue
|
|
20647
|
+
end
|
|
20648
|
+
function DefaultMap.prototype.getDefaultValue(self, ...)
|
|
20649
|
+
if self.defaultValue ~= nil then
|
|
20650
|
+
return self.defaultValue
|
|
20651
|
+
end
|
|
20652
|
+
if self.defaultValueFactory ~= nil then
|
|
20653
|
+
return self:defaultValueFactory(...)
|
|
20654
|
+
end
|
|
20655
|
+
error("A DefaultMap was incorrectly instantiated.")
|
|
20656
|
+
end
|
|
20657
|
+
function DefaultMap.prototype.getConstructorArg(self)
|
|
20658
|
+
if self.defaultValue ~= nil then
|
|
20659
|
+
return self.defaultValue
|
|
20660
|
+
end
|
|
20661
|
+
if self.defaultValueFactory ~= nil then
|
|
20662
|
+
return self.defaultValueFactory
|
|
20663
|
+
end
|
|
20664
|
+
error("A DefaultMap was incorrectly instantiated.")
|
|
20665
|
+
end
|
|
20666
|
+
local function test(self)
|
|
20667
|
+
local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
|
|
20668
|
+
local myDefaultMapBooleanFactory = __TS__New(
|
|
20669
|
+
____exports.DefaultMap,
|
|
20670
|
+
function() return false end
|
|
20671
|
+
)
|
|
20672
|
+
local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
|
|
20673
|
+
local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
|
|
20674
|
+
local myDefaultMapNumberFactory = __TS__New(
|
|
20675
|
+
____exports.DefaultMap,
|
|
20676
|
+
function() return 123 end
|
|
20677
|
+
)
|
|
20678
|
+
local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
|
|
20679
|
+
local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
|
|
20680
|
+
local myDefaultMapStringFactory = __TS__New(
|
|
20681
|
+
____exports.DefaultMap,
|
|
20682
|
+
function() return "foo" end
|
|
20683
|
+
)
|
|
20684
|
+
local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
|
|
20685
|
+
local myDefaultMapArray = __TS__New(
|
|
20686
|
+
____exports.DefaultMap,
|
|
20687
|
+
function() return {} end
|
|
20688
|
+
)
|
|
20689
|
+
local myDefaultMapArrayWithoutParams = __TS__New(
|
|
20690
|
+
____exports.DefaultMap,
|
|
20691
|
+
function() return {} end
|
|
20692
|
+
)
|
|
20693
|
+
local myDefaultMapMap = __TS__New(
|
|
20694
|
+
____exports.DefaultMap,
|
|
20695
|
+
function() return __TS__New(Map) end
|
|
20696
|
+
)
|
|
20697
|
+
local myDefaultMapMapWithoutParams = __TS__New(
|
|
20698
|
+
____exports.DefaultMap,
|
|
20699
|
+
function() return __TS__New(Map) end
|
|
20700
|
+
)
|
|
20701
|
+
end
|
|
20809
20702
|
return ____exports
|
|
20810
20703
|
end,
|
|
20811
20704
|
["functions.playerDataStructures"] = function(...)
|
|
@@ -21448,6 +21341,7 @@ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
|
|
|
21448
21341
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
21449
21342
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
21450
21343
|
local ____exports = {}
|
|
21344
|
+
local isTaintedModded
|
|
21451
21345
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
|
|
21452
21346
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
21453
21347
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
@@ -21489,6 +21383,12 @@ function ____exports.isVanillaPlayer(self, player)
|
|
|
21489
21383
|
local character = player:GetPlayerType()
|
|
21490
21384
|
return isVanillaCharacter(nil, character)
|
|
21491
21385
|
end
|
|
21386
|
+
function isTaintedModded(self, player)
|
|
21387
|
+
local character = player:GetPlayerType()
|
|
21388
|
+
local name = player:GetName()
|
|
21389
|
+
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
21390
|
+
return character == taintedCharacter
|
|
21391
|
+
end
|
|
21492
21392
|
--- Helper function to check to see if any player is holding up an item (from e.g. an active item
|
|
21493
21393
|
-- activation, a poop from IBS, etc.).
|
|
21494
21394
|
function ____exports.anyPlayerHoldingItem(self)
|
|
@@ -21761,13 +21661,6 @@ function ____exports.isDamageFromPlayer(self, damageSource)
|
|
|
21761
21661
|
local indirectPlayer = ____exports.getPlayerFromEntity(nil, damageSource)
|
|
21762
21662
|
return indirectPlayer ~= nil
|
|
21763
21663
|
end
|
|
21764
|
-
--- Not exported since end-users should use the `isTainted` helper function directly.
|
|
21765
|
-
local function isTaintedModded(self, player)
|
|
21766
|
-
local character = player:GetPlayerType()
|
|
21767
|
-
local name = player:GetName()
|
|
21768
|
-
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
21769
|
-
return character == taintedCharacter
|
|
21770
|
-
end
|
|
21771
21664
|
--- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
21772
21665
|
-- you want to know if the starting stats were randomized, for example.
|
|
21773
21666
|
function ____exports.isEden(self, player)
|
|
@@ -22559,6 +22452,94 @@ function ____exports.setToBitFlags(self, set)
|
|
|
22559
22452
|
end
|
|
22560
22453
|
return flags
|
|
22561
22454
|
end
|
|
22455
|
+
return ____exports
|
|
22456
|
+
end,
|
|
22457
|
+
["interfaces.TSTLClassMetatable"] = function(...)
|
|
22458
|
+
local ____exports = {}
|
|
22459
|
+
return ____exports
|
|
22460
|
+
end,
|
|
22461
|
+
["types.TSTLClass"] = function(...)
|
|
22462
|
+
local ____exports = {}
|
|
22463
|
+
return ____exports
|
|
22464
|
+
end,
|
|
22465
|
+
["functions.tstlClass"] = function(...)
|
|
22466
|
+
local ____exports = {}
|
|
22467
|
+
local ____types = require("functions.types")
|
|
22468
|
+
local isTable = ____types.isTable
|
|
22469
|
+
local ____utils = require("functions.utils")
|
|
22470
|
+
local assertDefined = ____utils.assertDefined
|
|
22471
|
+
--- Helper function to get the constructor from an instantiated TypeScriptToLua class, which is
|
|
22472
|
+
-- located on the metatable.
|
|
22473
|
+
--
|
|
22474
|
+
-- Returns undefined if passed a non-table or if the provided table does not have a metatable.
|
|
22475
|
+
function ____exports.getTSTLClassConstructor(self, object)
|
|
22476
|
+
if not isTable(nil, object) then
|
|
22477
|
+
return nil
|
|
22478
|
+
end
|
|
22479
|
+
local metatable = getmetatable(object)
|
|
22480
|
+
if metatable == nil then
|
|
22481
|
+
return nil
|
|
22482
|
+
end
|
|
22483
|
+
return metatable.constructor
|
|
22484
|
+
end
|
|
22485
|
+
--- Helper function to get the name of a TypeScriptToLua class from the instantiated class object.
|
|
22486
|
+
--
|
|
22487
|
+
-- TSTL classes are Lua tables created with the `__TS__Class` Lua function from the TSTL lualib.
|
|
22488
|
+
-- Their name is contained within "constructor.name" metatable key.
|
|
22489
|
+
--
|
|
22490
|
+
-- For example, a `Map` class is has a name of "Map".
|
|
22491
|
+
--
|
|
22492
|
+
-- Returns undefined if passed a non-table or if the provided table does not have a metatable.
|
|
22493
|
+
function ____exports.getTSTLClassName(self, object)
|
|
22494
|
+
local constructor = ____exports.getTSTLClassConstructor(nil, object)
|
|
22495
|
+
if constructor == nil then
|
|
22496
|
+
return nil
|
|
22497
|
+
end
|
|
22498
|
+
return constructor.name
|
|
22499
|
+
end
|
|
22500
|
+
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
22501
|
+
--
|
|
22502
|
+
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
|
|
22503
|
+
-- their own copies of the entire lualib and thus their own instantiated version of a `Map`.
|
|
22504
|
+
function ____exports.isDefaultMap(self, object)
|
|
22505
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
22506
|
+
return className == "DefaultMap"
|
|
22507
|
+
end
|
|
22508
|
+
--- Helper function to check if a given table is a class table created by TypeScriptToLua.
|
|
22509
|
+
function ____exports.isTSTLClass(self, object)
|
|
22510
|
+
local tstlClassName = ____exports.getTSTLClassName(nil, object)
|
|
22511
|
+
return tstlClassName ~= nil
|
|
22512
|
+
end
|
|
22513
|
+
--- Helper function to determine if a given object is a TypeScriptToLua `Map`.
|
|
22514
|
+
--
|
|
22515
|
+
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module
|
|
22516
|
+
-- might have their own copy of the entire lualib and thus their own instantiated version of a
|
|
22517
|
+
-- `Map`.
|
|
22518
|
+
function ____exports.isTSTLMap(self, object)
|
|
22519
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
22520
|
+
return className == "Map"
|
|
22521
|
+
end
|
|
22522
|
+
--- Helper function to determine if a given object is a TypeScriptToLua `Set`.
|
|
22523
|
+
--
|
|
22524
|
+
-- It is not reliable to use the `instanceof` operator to determine this because each Lua module
|
|
22525
|
+
-- might have their own copy of the entire lualib and thus their own instantiated version of a
|
|
22526
|
+
-- `Set`.
|
|
22527
|
+
function ____exports.isTSTLSet(self, object)
|
|
22528
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
22529
|
+
return className == "Set"
|
|
22530
|
+
end
|
|
22531
|
+
--- Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
22532
|
+
-- it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
22533
|
+
-- use the class constructor that is present on the other object's metatable to initialize the new
|
|
22534
|
+
-- class.
|
|
22535
|
+
function ____exports.newTSTLClass(self, oldClass)
|
|
22536
|
+
local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
|
|
22537
|
+
assertDefined(nil, constructor, "Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
|
|
22538
|
+
local newClass = {}
|
|
22539
|
+
local newClassMetatable = setmetatable(newClass, constructor.prototype)
|
|
22540
|
+
newClassMetatable:____constructor()
|
|
22541
|
+
return newClass
|
|
22542
|
+
end
|
|
22562
22543
|
return ____exports
|
|
22563
22544
|
end,
|
|
22564
22545
|
["functions.doors"] = function(...)
|
|
@@ -47196,7 +47177,7 @@ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
|
47196
47177
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
47197
47178
|
local ____Feature = require("classes.private.Feature")
|
|
47198
47179
|
local Feature = ____Feature.Feature
|
|
47199
|
-
local v = {room = {roomClearGameFrame = nil, roomClearRoomFrame = nil}}
|
|
47180
|
+
local v = {room = {roomClearGameFrame = nil, roomClearRenderFrame = nil, roomClearRoomFrame = nil}}
|
|
47200
47181
|
____exports.RoomClearFrame = __TS__Class()
|
|
47201
47182
|
local RoomClearFrame = ____exports.RoomClearFrame
|
|
47202
47183
|
RoomClearFrame.name = "RoomClearFrame"
|
|
@@ -47208,7 +47189,9 @@ function RoomClearFrame.prototype.____constructor(self)
|
|
|
47208
47189
|
local gameFrameCount = game:GetFrameCount()
|
|
47209
47190
|
local room = game:GetRoom()
|
|
47210
47191
|
local roomFrameCount = room:GetFrameCount()
|
|
47192
|
+
local renderFrameCount = Isaac.GetFrameCount()
|
|
47211
47193
|
v.room.roomClearGameFrame = gameFrameCount
|
|
47194
|
+
v.room.roomClearRenderFrame = renderFrameCount
|
|
47212
47195
|
v.room.roomClearRoomFrame = roomFrameCount
|
|
47213
47196
|
end
|
|
47214
47197
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_ROOM_CLEAR_CHANGED, self.postRoomClearChangedTrue}}
|
|
@@ -47217,8 +47200,12 @@ function RoomClearFrame.prototype.getRoomClearGameFrame(self)
|
|
|
47217
47200
|
return v.room.roomClearGameFrame
|
|
47218
47201
|
end
|
|
47219
47202
|
__TS__DecorateLegacy({Exported}, RoomClearFrame.prototype, "getRoomClearGameFrame", true)
|
|
47203
|
+
function RoomClearFrame.prototype.getRoomClearRenderFrame(self)
|
|
47204
|
+
return v.room.roomClearRenderFrame
|
|
47205
|
+
end
|
|
47206
|
+
__TS__DecorateLegacy({Exported}, RoomClearFrame.prototype, "getRoomClearRenderFrame", true)
|
|
47220
47207
|
function RoomClearFrame.prototype.getRoomClearRoomFrame(self)
|
|
47221
|
-
return v.room.
|
|
47208
|
+
return v.room.roomClearRoomFrame
|
|
47222
47209
|
end
|
|
47223
47210
|
__TS__DecorateLegacy({Exported}, RoomClearFrame.prototype, "getRoomClearRoomFrame", true)
|
|
47224
47211
|
return ____exports
|