isaacscript-common 20.16.0 → 20.18.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 +35 -18
- package/dist/isaacscript-common.lua +249 -187
- package/dist/src/functions/collectibles.d.ts +24 -18
- package/dist/src/functions/collectibles.d.ts.map +1 -1
- package/dist/src/functions/collectibles.lua +68 -24
- package/dist/src/functions/entities.d.ts +9 -0
- package/dist/src/functions/entities.d.ts.map +1 -1
- package/dist/src/functions/entities.lua +27 -1
- package/dist/src/functions/pickupVariants.d.ts.map +1 -1
- package/dist/src/functions/pickupVariants.lua +12 -11
- package/package.json +1 -1
- package/src/functions/collectibles.ts +149 -24
- package/src/functions/entities.ts +26 -0
- package/src/functions/pickupVariants.ts +38 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 20.
|
|
3
|
+
isaacscript-common 20.18.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -19715,13 +19715,167 @@ function ____exports.spriteEquals(self, sprite1, sprite2, layerID, xStart, xFini
|
|
|
19715
19715
|
end
|
|
19716
19716
|
return true
|
|
19717
19717
|
end
|
|
19718
|
+
return ____exports
|
|
19719
|
+
end,
|
|
19720
|
+
["src.classes.DefaultMap"] = function(...)
|
|
19721
|
+
local ____lualib = require("lualib_bundle")
|
|
19722
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
19723
|
+
local Map = ____lualib.Map
|
|
19724
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
19725
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
19726
|
+
local __TS__New = ____lualib.__TS__New
|
|
19727
|
+
local ____exports = {}
|
|
19728
|
+
local ____types = require("src.functions.types")
|
|
19729
|
+
local isFunction = ____types.isFunction
|
|
19730
|
+
local isPrimitive = ____types.isPrimitive
|
|
19731
|
+
____exports.DefaultMap = __TS__Class()
|
|
19732
|
+
local DefaultMap = ____exports.DefaultMap
|
|
19733
|
+
DefaultMap.name = "DefaultMap"
|
|
19734
|
+
__TS__ClassExtends(DefaultMap, Map)
|
|
19735
|
+
function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
|
|
19736
|
+
local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
|
|
19737
|
+
local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
|
|
19738
|
+
if not argIsPrimitive and not argIsFunction then
|
|
19739
|
+
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.")
|
|
19740
|
+
end
|
|
19741
|
+
Map.prototype.____constructor(self, initializerArray)
|
|
19742
|
+
if argIsFunction then
|
|
19743
|
+
self.defaultValue = nil
|
|
19744
|
+
self.defaultValueFactory = defaultValueOrFactoryFunction
|
|
19745
|
+
else
|
|
19746
|
+
self.defaultValue = defaultValueOrFactoryFunction
|
|
19747
|
+
self.defaultValueFactory = nil
|
|
19748
|
+
end
|
|
19749
|
+
end
|
|
19750
|
+
function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
19751
|
+
local value = Map.prototype.get(self, key)
|
|
19752
|
+
if value ~= nil then
|
|
19753
|
+
return value
|
|
19754
|
+
end
|
|
19755
|
+
local defaultValue = self:getDefaultValue(...)
|
|
19756
|
+
self:set(key, defaultValue)
|
|
19757
|
+
return defaultValue
|
|
19758
|
+
end
|
|
19759
|
+
function DefaultMap.prototype.getDefaultValue(self, ...)
|
|
19760
|
+
if self.defaultValue ~= nil then
|
|
19761
|
+
return self.defaultValue
|
|
19762
|
+
end
|
|
19763
|
+
if self.defaultValueFactory ~= nil then
|
|
19764
|
+
return self:defaultValueFactory(...)
|
|
19765
|
+
end
|
|
19766
|
+
error("A DefaultMap was incorrectly instantiated.")
|
|
19767
|
+
end
|
|
19768
|
+
function DefaultMap.prototype.getConstructorArg(self)
|
|
19769
|
+
if self.defaultValue ~= nil then
|
|
19770
|
+
return self.defaultValue
|
|
19771
|
+
end
|
|
19772
|
+
if self.defaultValueFactory ~= nil then
|
|
19773
|
+
return self.defaultValueFactory
|
|
19774
|
+
end
|
|
19775
|
+
error("A DefaultMap was incorrectly instantiated.")
|
|
19776
|
+
end
|
|
19777
|
+
local function test(self)
|
|
19778
|
+
local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
|
|
19779
|
+
local myDefaultMapBooleanFactory = __TS__New(
|
|
19780
|
+
____exports.DefaultMap,
|
|
19781
|
+
function() return false end
|
|
19782
|
+
)
|
|
19783
|
+
local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
|
|
19784
|
+
local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
|
|
19785
|
+
local myDefaultMapNumberFactory = __TS__New(
|
|
19786
|
+
____exports.DefaultMap,
|
|
19787
|
+
function() return 123 end
|
|
19788
|
+
)
|
|
19789
|
+
local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
|
|
19790
|
+
local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
|
|
19791
|
+
local myDefaultMapStringFactory = __TS__New(
|
|
19792
|
+
____exports.DefaultMap,
|
|
19793
|
+
function() return "foo" end
|
|
19794
|
+
)
|
|
19795
|
+
local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
|
|
19796
|
+
local myDefaultMapArray = __TS__New(
|
|
19797
|
+
____exports.DefaultMap,
|
|
19798
|
+
function() return {} end
|
|
19799
|
+
)
|
|
19800
|
+
local myDefaultMapArrayWithoutParams = __TS__New(
|
|
19801
|
+
____exports.DefaultMap,
|
|
19802
|
+
function() return {} end
|
|
19803
|
+
)
|
|
19804
|
+
local myDefaultMapMap = __TS__New(
|
|
19805
|
+
____exports.DefaultMap,
|
|
19806
|
+
function() return __TS__New(Map) end
|
|
19807
|
+
)
|
|
19808
|
+
local myDefaultMapMapWithoutParams = __TS__New(
|
|
19809
|
+
____exports.DefaultMap,
|
|
19810
|
+
function() return __TS__New(Map) end
|
|
19811
|
+
)
|
|
19812
|
+
end
|
|
19813
|
+
return ____exports
|
|
19814
|
+
end,
|
|
19815
|
+
["src.interfaces.TSTLClassMetatable"] = function(...)
|
|
19816
|
+
local ____exports = {}
|
|
19817
|
+
return ____exports
|
|
19818
|
+
end,
|
|
19819
|
+
["src.types.TSTLClass"] = function(...)
|
|
19820
|
+
local ____exports = {}
|
|
19821
|
+
return ____exports
|
|
19822
|
+
end,
|
|
19823
|
+
["src.functions.tstlClass"] = function(...)
|
|
19824
|
+
local ____exports = {}
|
|
19825
|
+
local ____types = require("src.functions.types")
|
|
19826
|
+
local isTable = ____types.isTable
|
|
19827
|
+
function ____exports.getTSTLClassConstructor(self, object)
|
|
19828
|
+
if not isTable(nil, object) then
|
|
19829
|
+
return nil
|
|
19830
|
+
end
|
|
19831
|
+
local metatable = getmetatable(object)
|
|
19832
|
+
if metatable == nil then
|
|
19833
|
+
return nil
|
|
19834
|
+
end
|
|
19835
|
+
return metatable.constructor
|
|
19836
|
+
end
|
|
19837
|
+
function ____exports.getTSTLClassName(self, object)
|
|
19838
|
+
local constructor = ____exports.getTSTLClassConstructor(nil, object)
|
|
19839
|
+
if constructor == nil then
|
|
19840
|
+
return nil
|
|
19841
|
+
end
|
|
19842
|
+
return constructor.name
|
|
19843
|
+
end
|
|
19844
|
+
function ____exports.isDefaultMap(self, object)
|
|
19845
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
19846
|
+
return className == "DefaultMap"
|
|
19847
|
+
end
|
|
19848
|
+
function ____exports.isTSTLClass(self, object)
|
|
19849
|
+
local tstlClassName = ____exports.getTSTLClassName(nil, object)
|
|
19850
|
+
return tstlClassName ~= nil
|
|
19851
|
+
end
|
|
19852
|
+
function ____exports.isTSTLMap(self, object)
|
|
19853
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
19854
|
+
return className == "Map"
|
|
19855
|
+
end
|
|
19856
|
+
function ____exports.isTSTLSet(self, object)
|
|
19857
|
+
local className = ____exports.getTSTLClassName(nil, object)
|
|
19858
|
+
return className == "Set"
|
|
19859
|
+
end
|
|
19860
|
+
function ____exports.newTSTLClass(self, oldClass)
|
|
19861
|
+
local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
|
|
19862
|
+
if constructor == nil then
|
|
19863
|
+
error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
|
|
19864
|
+
end
|
|
19865
|
+
local newClass = {}
|
|
19866
|
+
local newClassMetatable = setmetatable(newClass, constructor.prototype)
|
|
19867
|
+
newClassMetatable:____constructor()
|
|
19868
|
+
return newClass
|
|
19869
|
+
end
|
|
19718
19870
|
return ____exports
|
|
19719
19871
|
end,
|
|
19720
19872
|
["src.functions.entities"] = function(...)
|
|
19721
19873
|
local ____lualib = require("lualib_bundle")
|
|
19874
|
+
local Set = ____lualib.Set
|
|
19875
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
19876
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
19722
19877
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
19723
19878
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
19724
|
-
local Set = ____lualib.Set
|
|
19725
19879
|
local __TS__New = ____lualib.__TS__New
|
|
19726
19880
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
19727
19881
|
local ____exports = {}
|
|
@@ -19743,6 +19897,8 @@ local isRNG = ____rng.isRNG
|
|
|
19743
19897
|
local newRNG = ____rng.newRNG
|
|
19744
19898
|
local ____sprites = require("src.functions.sprites")
|
|
19745
19899
|
local setSpriteOpacity = ____sprites.setSpriteOpacity
|
|
19900
|
+
local ____tstlClass = require("src.functions.tstlClass")
|
|
19901
|
+
local isTSTLSet = ____tstlClass.isTSTLSet
|
|
19746
19902
|
local ____types = require("src.functions.types")
|
|
19747
19903
|
local asNumber = ____types.asNumber
|
|
19748
19904
|
local isPrimitive = ____types.isPrimitive
|
|
@@ -19813,6 +19969,22 @@ function ____exports.countEntities(self, entityType, variant, subType, ignoreFri
|
|
|
19813
19969
|
)
|
|
19814
19970
|
return #entities
|
|
19815
19971
|
end
|
|
19972
|
+
function ____exports.doesAnyEntityExist(self, entityTypes, ignoreFriendly)
|
|
19973
|
+
if ignoreFriendly == nil then
|
|
19974
|
+
ignoreFriendly = false
|
|
19975
|
+
end
|
|
19976
|
+
local entityTypesArray = isTSTLSet(nil, entityTypes) and ({__TS__Spread(entityTypes:values())}) or entityTypes
|
|
19977
|
+
return __TS__ArraySome(
|
|
19978
|
+
entityTypesArray,
|
|
19979
|
+
function(____, entityType) return ____exports.countEntities(
|
|
19980
|
+
nil,
|
|
19981
|
+
entityType,
|
|
19982
|
+
-1,
|
|
19983
|
+
-1,
|
|
19984
|
+
ignoreFriendly
|
|
19985
|
+
) end
|
|
19986
|
+
)
|
|
19987
|
+
end
|
|
19816
19988
|
function ____exports.doesEntityExist(self, entityType, variant, subType, ignoreFriendly)
|
|
19817
19989
|
if entityType == nil then
|
|
19818
19990
|
entityType = -1
|
|
@@ -20112,39 +20284,40 @@ return ____exports
|
|
|
20112
20284
|
["src.functions.pickupVariants"] = function(...)
|
|
20113
20285
|
local ____exports = {}
|
|
20114
20286
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
20287
|
+
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
20115
20288
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
20116
20289
|
function ____exports.isHeart(self, pickup)
|
|
20117
|
-
return pickup.Variant == PickupVariant.HEART
|
|
20290
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.HEART
|
|
20118
20291
|
end
|
|
20119
20292
|
function ____exports.isCoin(self, pickup)
|
|
20120
|
-
return pickup.Variant == PickupVariant.COIN
|
|
20293
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COIN
|
|
20121
20294
|
end
|
|
20122
20295
|
function ____exports.isKey(self, pickup)
|
|
20123
|
-
return pickup.Variant == PickupVariant.KEY
|
|
20296
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.KEY
|
|
20124
20297
|
end
|
|
20125
20298
|
function ____exports.isBombPickup(self, pickup)
|
|
20126
|
-
return pickup.Variant == PickupVariant.BOMB
|
|
20299
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.BOMB
|
|
20127
20300
|
end
|
|
20128
20301
|
function ____exports.isPoopPickup(self, pickup)
|
|
20129
|
-
return pickup.Variant == PickupVariant.POOP
|
|
20302
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.POOP
|
|
20130
20303
|
end
|
|
20131
20304
|
function ____exports.isSack(self, pickup)
|
|
20132
|
-
return pickup.Variant == PickupVariant.SACK
|
|
20305
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.SACK
|
|
20133
20306
|
end
|
|
20134
20307
|
function ____exports.isPill(self, pickup)
|
|
20135
|
-
return pickup.Variant == PickupVariant.PILL
|
|
20308
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.PILL
|
|
20136
20309
|
end
|
|
20137
20310
|
function ____exports.isBattery(self, pickup)
|
|
20138
|
-
return pickup.Variant == PickupVariant.LIL_BATTERY
|
|
20311
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.LIL_BATTERY
|
|
20139
20312
|
end
|
|
20140
20313
|
function ____exports.isCollectible(self, pickup)
|
|
20141
|
-
return pickup.Variant == PickupVariant.COLLECTIBLE
|
|
20314
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COLLECTIBLE
|
|
20142
20315
|
end
|
|
20143
20316
|
function ____exports.isCardPickup(self, pickup)
|
|
20144
|
-
return pickup.Variant == PickupVariant.TAROT_CARD
|
|
20317
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.TAROT_CARD
|
|
20145
20318
|
end
|
|
20146
20319
|
function ____exports.isTrinket(self, pickup)
|
|
20147
|
-
return pickup.Variant == PickupVariant.TRINKET
|
|
20320
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.TRINKET
|
|
20148
20321
|
end
|
|
20149
20322
|
return ____exports
|
|
20150
20323
|
end,
|
|
@@ -20414,158 +20587,6 @@ function ____exports.setToBitFlags(self, set)
|
|
|
20414
20587
|
end
|
|
20415
20588
|
return flags
|
|
20416
20589
|
end
|
|
20417
|
-
return ____exports
|
|
20418
|
-
end,
|
|
20419
|
-
["src.classes.DefaultMap"] = function(...)
|
|
20420
|
-
local ____lualib = require("lualib_bundle")
|
|
20421
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
20422
|
-
local Map = ____lualib.Map
|
|
20423
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
20424
|
-
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
20425
|
-
local __TS__New = ____lualib.__TS__New
|
|
20426
|
-
local ____exports = {}
|
|
20427
|
-
local ____types = require("src.functions.types")
|
|
20428
|
-
local isFunction = ____types.isFunction
|
|
20429
|
-
local isPrimitive = ____types.isPrimitive
|
|
20430
|
-
____exports.DefaultMap = __TS__Class()
|
|
20431
|
-
local DefaultMap = ____exports.DefaultMap
|
|
20432
|
-
DefaultMap.name = "DefaultMap"
|
|
20433
|
-
__TS__ClassExtends(DefaultMap, Map)
|
|
20434
|
-
function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
|
|
20435
|
-
local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
|
|
20436
|
-
local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
|
|
20437
|
-
if not argIsPrimitive and not argIsFunction then
|
|
20438
|
-
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.")
|
|
20439
|
-
end
|
|
20440
|
-
Map.prototype.____constructor(self, initializerArray)
|
|
20441
|
-
if argIsFunction then
|
|
20442
|
-
self.defaultValue = nil
|
|
20443
|
-
self.defaultValueFactory = defaultValueOrFactoryFunction
|
|
20444
|
-
else
|
|
20445
|
-
self.defaultValue = defaultValueOrFactoryFunction
|
|
20446
|
-
self.defaultValueFactory = nil
|
|
20447
|
-
end
|
|
20448
|
-
end
|
|
20449
|
-
function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
20450
|
-
local value = Map.prototype.get(self, key)
|
|
20451
|
-
if value ~= nil then
|
|
20452
|
-
return value
|
|
20453
|
-
end
|
|
20454
|
-
local defaultValue = self:getDefaultValue(...)
|
|
20455
|
-
self:set(key, defaultValue)
|
|
20456
|
-
return defaultValue
|
|
20457
|
-
end
|
|
20458
|
-
function DefaultMap.prototype.getDefaultValue(self, ...)
|
|
20459
|
-
if self.defaultValue ~= nil then
|
|
20460
|
-
return self.defaultValue
|
|
20461
|
-
end
|
|
20462
|
-
if self.defaultValueFactory ~= nil then
|
|
20463
|
-
return self:defaultValueFactory(...)
|
|
20464
|
-
end
|
|
20465
|
-
error("A DefaultMap was incorrectly instantiated.")
|
|
20466
|
-
end
|
|
20467
|
-
function DefaultMap.prototype.getConstructorArg(self)
|
|
20468
|
-
if self.defaultValue ~= nil then
|
|
20469
|
-
return self.defaultValue
|
|
20470
|
-
end
|
|
20471
|
-
if self.defaultValueFactory ~= nil then
|
|
20472
|
-
return self.defaultValueFactory
|
|
20473
|
-
end
|
|
20474
|
-
error("A DefaultMap was incorrectly instantiated.")
|
|
20475
|
-
end
|
|
20476
|
-
local function test(self)
|
|
20477
|
-
local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
|
|
20478
|
-
local myDefaultMapBooleanFactory = __TS__New(
|
|
20479
|
-
____exports.DefaultMap,
|
|
20480
|
-
function() return false end
|
|
20481
|
-
)
|
|
20482
|
-
local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
|
|
20483
|
-
local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
|
|
20484
|
-
local myDefaultMapNumberFactory = __TS__New(
|
|
20485
|
-
____exports.DefaultMap,
|
|
20486
|
-
function() return 123 end
|
|
20487
|
-
)
|
|
20488
|
-
local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
|
|
20489
|
-
local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
|
|
20490
|
-
local myDefaultMapStringFactory = __TS__New(
|
|
20491
|
-
____exports.DefaultMap,
|
|
20492
|
-
function() return "foo" end
|
|
20493
|
-
)
|
|
20494
|
-
local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
|
|
20495
|
-
local myDefaultMapArray = __TS__New(
|
|
20496
|
-
____exports.DefaultMap,
|
|
20497
|
-
function() return {} end
|
|
20498
|
-
)
|
|
20499
|
-
local myDefaultMapArrayWithoutParams = __TS__New(
|
|
20500
|
-
____exports.DefaultMap,
|
|
20501
|
-
function() return {} end
|
|
20502
|
-
)
|
|
20503
|
-
local myDefaultMapMap = __TS__New(
|
|
20504
|
-
____exports.DefaultMap,
|
|
20505
|
-
function() return __TS__New(Map) end
|
|
20506
|
-
)
|
|
20507
|
-
local myDefaultMapMapWithoutParams = __TS__New(
|
|
20508
|
-
____exports.DefaultMap,
|
|
20509
|
-
function() return __TS__New(Map) end
|
|
20510
|
-
)
|
|
20511
|
-
end
|
|
20512
|
-
return ____exports
|
|
20513
|
-
end,
|
|
20514
|
-
["src.interfaces.TSTLClassMetatable"] = function(...)
|
|
20515
|
-
local ____exports = {}
|
|
20516
|
-
return ____exports
|
|
20517
|
-
end,
|
|
20518
|
-
["src.types.TSTLClass"] = function(...)
|
|
20519
|
-
local ____exports = {}
|
|
20520
|
-
return ____exports
|
|
20521
|
-
end,
|
|
20522
|
-
["src.functions.tstlClass"] = function(...)
|
|
20523
|
-
local ____exports = {}
|
|
20524
|
-
local ____types = require("src.functions.types")
|
|
20525
|
-
local isTable = ____types.isTable
|
|
20526
|
-
function ____exports.getTSTLClassConstructor(self, object)
|
|
20527
|
-
if not isTable(nil, object) then
|
|
20528
|
-
return nil
|
|
20529
|
-
end
|
|
20530
|
-
local metatable = getmetatable(object)
|
|
20531
|
-
if metatable == nil then
|
|
20532
|
-
return nil
|
|
20533
|
-
end
|
|
20534
|
-
return metatable.constructor
|
|
20535
|
-
end
|
|
20536
|
-
function ____exports.getTSTLClassName(self, object)
|
|
20537
|
-
local constructor = ____exports.getTSTLClassConstructor(nil, object)
|
|
20538
|
-
if constructor == nil then
|
|
20539
|
-
return nil
|
|
20540
|
-
end
|
|
20541
|
-
return constructor.name
|
|
20542
|
-
end
|
|
20543
|
-
function ____exports.isDefaultMap(self, object)
|
|
20544
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
20545
|
-
return className == "DefaultMap"
|
|
20546
|
-
end
|
|
20547
|
-
function ____exports.isTSTLClass(self, object)
|
|
20548
|
-
local tstlClassName = ____exports.getTSTLClassName(nil, object)
|
|
20549
|
-
return tstlClassName ~= nil
|
|
20550
|
-
end
|
|
20551
|
-
function ____exports.isTSTLMap(self, object)
|
|
20552
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
20553
|
-
return className == "Map"
|
|
20554
|
-
end
|
|
20555
|
-
function ____exports.isTSTLSet(self, object)
|
|
20556
|
-
local className = ____exports.getTSTLClassName(nil, object)
|
|
20557
|
-
return className == "Set"
|
|
20558
|
-
end
|
|
20559
|
-
function ____exports.newTSTLClass(self, oldClass)
|
|
20560
|
-
local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
|
|
20561
|
-
if constructor == nil then
|
|
20562
|
-
error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
|
|
20563
|
-
end
|
|
20564
|
-
local newClass = {}
|
|
20565
|
-
local newClassMetatable = setmetatable(newClass, constructor.prototype)
|
|
20566
|
-
newClassMetatable:____constructor()
|
|
20567
|
-
return newClass
|
|
20568
|
-
end
|
|
20569
20590
|
return ____exports
|
|
20570
20591
|
end,
|
|
20571
20592
|
["src.functions.doors"] = function(...)
|
|
@@ -20985,7 +21006,7 @@ return ____exports
|
|
|
20985
21006
|
end,
|
|
20986
21007
|
["src.functions.collectibles"] = function(...)
|
|
20987
21008
|
local ____exports = {}
|
|
20988
|
-
local initQuestionMarkSprite
|
|
21009
|
+
local initQuestionMarkSprite, getCollectibleTypeFromArg
|
|
20989
21010
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
20990
21011
|
local CollectibleSpriteLayer = ____isaac_2Dtypescript_2Ddefinitions.CollectibleSpriteLayer
|
|
20991
21012
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
@@ -21025,6 +21046,8 @@ local getRoomListIndex = ____roomData.getRoomListIndex
|
|
|
21025
21046
|
local ____sprites = require("src.functions.sprites")
|
|
21026
21047
|
local clearSprite = ____sprites.clearSprite
|
|
21027
21048
|
local spriteEquals = ____sprites.spriteEquals
|
|
21049
|
+
local ____types = require("src.functions.types")
|
|
21050
|
+
local isNumber = ____types.isNumber
|
|
21028
21051
|
local ____utils = require("src.functions.utils")
|
|
21029
21052
|
local iRange = ____utils.iRange
|
|
21030
21053
|
function initQuestionMarkSprite(self)
|
|
@@ -21035,6 +21058,10 @@ function initQuestionMarkSprite(self)
|
|
|
21035
21058
|
return sprite
|
|
21036
21059
|
end
|
|
21037
21060
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
21061
|
+
if not isCollectible(nil, collectible) then
|
|
21062
|
+
local entityID = getEntityID(nil, collectible)
|
|
21063
|
+
error("The \"clearCollectibleSprite\" function was given a non-collectible: " .. entityID)
|
|
21064
|
+
end
|
|
21038
21065
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
21039
21066
|
end
|
|
21040
21067
|
function ____exports.isVanillaCollectibleType(self, collectibleType)
|
|
@@ -21079,10 +21106,24 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
21079
21106
|
true
|
|
21080
21107
|
)
|
|
21081
21108
|
end
|
|
21109
|
+
function getCollectibleTypeFromArg(self, collectibleOrCollectibleType, functionName)
|
|
21110
|
+
if isNumber(nil, collectibleOrCollectibleType) then
|
|
21111
|
+
local collectibleType = collectibleOrCollectibleType
|
|
21112
|
+
return collectibleType
|
|
21113
|
+
end
|
|
21114
|
+
local collectible = collectibleOrCollectibleType
|
|
21115
|
+
if not isCollectible(nil, collectible) then
|
|
21116
|
+
local entityID = getEntityID(nil, collectible)
|
|
21117
|
+
error((("The \"" .. functionName) .. "\" function was given a non-collectible: ") .. entityID)
|
|
21118
|
+
end
|
|
21119
|
+
return collectible.SubType
|
|
21120
|
+
end
|
|
21082
21121
|
local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
|
|
21122
|
+
local DEFAULT_COLLECTIBLE_PRICE = 15
|
|
21083
21123
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
21084
21124
|
local questionMarkSprite = initQuestionMarkSprite(nil)
|
|
21085
|
-
function ____exports.collectibleHasCacheFlag(self,
|
|
21125
|
+
function ____exports.collectibleHasCacheFlag(self, collectibleOrCollectibleType, cacheFlag)
|
|
21126
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "collectibleHasCacheFlag")
|
|
21086
21127
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21087
21128
|
if itemConfigItem == nil then
|
|
21088
21129
|
return false
|
|
@@ -21109,14 +21150,16 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
|
21109
21150
|
yIncrement
|
|
21110
21151
|
)
|
|
21111
21152
|
end
|
|
21112
|
-
function ____exports.getCollectibleChargeType(self,
|
|
21153
|
+
function ____exports.getCollectibleChargeType(self, collectibleOrCollectibleType)
|
|
21154
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleChargeType")
|
|
21113
21155
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21114
21156
|
if itemConfigItem == nil then
|
|
21115
21157
|
return ItemConfigChargeType.NORMAL
|
|
21116
21158
|
end
|
|
21117
21159
|
return itemConfigItem.ChargeType
|
|
21118
21160
|
end
|
|
21119
|
-
function ____exports.getCollectibleDescription(self,
|
|
21161
|
+
function ____exports.getCollectibleDescription(self, collectibleOrCollectibleType)
|
|
21162
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDescription")
|
|
21120
21163
|
local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
|
|
21121
21164
|
if collectibleDescription ~= nil then
|
|
21122
21165
|
return collectibleDescription
|
|
@@ -21127,18 +21170,19 @@ function ____exports.getCollectibleDescription(self, collectibleType)
|
|
|
21127
21170
|
end
|
|
21128
21171
|
return DEFAULT_COLLECTIBLE_DESCRIPTION
|
|
21129
21172
|
end
|
|
21130
|
-
function ____exports.getCollectibleDevilCoinPrice(self,
|
|
21173
|
+
function ____exports.getCollectibleDevilCoinPrice(self, collectibleOrCollectibleType)
|
|
21174
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDescription")
|
|
21131
21175
|
if collectibleType == CollectibleType.NULL then
|
|
21132
21176
|
return 0
|
|
21133
21177
|
end
|
|
21134
|
-
local defaultCollectiblePrice = 15
|
|
21135
21178
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21136
21179
|
if itemConfigItem == nil then
|
|
21137
|
-
return
|
|
21180
|
+
return DEFAULT_COLLECTIBLE_PRICE
|
|
21138
21181
|
end
|
|
21139
|
-
return itemConfigItem.DevilPrice *
|
|
21182
|
+
return itemConfigItem.DevilPrice * DEFAULT_COLLECTIBLE_PRICE
|
|
21140
21183
|
end
|
|
21141
|
-
function ____exports.getCollectibleDevilHeartPrice(self,
|
|
21184
|
+
function ____exports.getCollectibleDevilHeartPrice(self, collectibleOrCollectibleType, player)
|
|
21185
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDevilHeartPrice")
|
|
21142
21186
|
local maxHearts = player:GetMaxHearts()
|
|
21143
21187
|
if collectibleType == CollectibleType.NULL then
|
|
21144
21188
|
return 0
|
|
@@ -21154,7 +21198,8 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
|
|
|
21154
21198
|
local twoHeartPrice = maxHearts == 2 and PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS or PickupPrice.TWO_HEARTS
|
|
21155
21199
|
return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.ONE_HEART
|
|
21156
21200
|
end
|
|
21157
|
-
function ____exports.getCollectibleGfxFilename(self,
|
|
21201
|
+
function ____exports.getCollectibleGfxFilename(self, collectibleOrCollectibleType)
|
|
21202
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleGfxFilename")
|
|
21158
21203
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21159
21204
|
if itemConfigItem == nil then
|
|
21160
21205
|
return BLIND_ITEM_PNG_PATH
|
|
@@ -21178,28 +21223,32 @@ function ____exports.getCollectibleIndex(self, collectible)
|
|
|
21178
21223
|
end
|
|
21179
21224
|
return (((((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.SubType)) .. ",") .. tostring(collectible.InitSeed)
|
|
21180
21225
|
end
|
|
21181
|
-
function ____exports.getCollectibleInitCharge(self,
|
|
21226
|
+
function ____exports.getCollectibleInitCharge(self, collectibleOrCollectibleType)
|
|
21227
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleInitCharge")
|
|
21182
21228
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21183
21229
|
if itemConfigItem == nil then
|
|
21184
21230
|
return 0
|
|
21185
21231
|
end
|
|
21186
21232
|
return itemConfigItem.InitCharge
|
|
21187
21233
|
end
|
|
21188
|
-
function ____exports.getCollectibleItemType(self,
|
|
21234
|
+
function ____exports.getCollectibleItemType(self, collectibleOrCollectibleType)
|
|
21235
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleItemType")
|
|
21189
21236
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21190
21237
|
if itemConfigItem == nil then
|
|
21191
21238
|
return ItemType.NULL
|
|
21192
21239
|
end
|
|
21193
21240
|
return itemConfigItem.Type
|
|
21194
21241
|
end
|
|
21195
|
-
function ____exports.getCollectibleMaxCharges(self,
|
|
21242
|
+
function ____exports.getCollectibleMaxCharges(self, collectibleOrCollectibleType)
|
|
21243
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleMaxCharges")
|
|
21196
21244
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21197
21245
|
if itemConfigItem == nil then
|
|
21198
21246
|
return 0
|
|
21199
21247
|
end
|
|
21200
21248
|
return itemConfigItem.MaxCharges
|
|
21201
21249
|
end
|
|
21202
|
-
function ____exports.getCollectibleName(self,
|
|
21250
|
+
function ____exports.getCollectibleName(self, collectibleOrCollectibleType)
|
|
21251
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleName")
|
|
21203
21252
|
local collectibleName = COLLECTIBLE_TYPE_TO_NAME_MAP:get(collectibleType)
|
|
21204
21253
|
if collectibleName ~= nil then
|
|
21205
21254
|
return collectibleName
|
|
@@ -21218,14 +21267,16 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
21218
21267
|
local sprite = collectible:GetSprite()
|
|
21219
21268
|
return sprite:GetOverlayFrame()
|
|
21220
21269
|
end
|
|
21221
|
-
function ____exports.getCollectibleQuality(self,
|
|
21270
|
+
function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
|
|
21271
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
|
|
21222
21272
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21223
21273
|
if itemConfigItem == nil then
|
|
21224
21274
|
return 0
|
|
21225
21275
|
end
|
|
21226
21276
|
return itemConfigItem.Quality
|
|
21227
21277
|
end
|
|
21228
|
-
function ____exports.getCollectibleTags(self,
|
|
21278
|
+
function ____exports.getCollectibleTags(self, collectibleOrCollectibleType)
|
|
21279
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleTags")
|
|
21229
21280
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21230
21281
|
return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
|
|
21231
21282
|
end
|
|
@@ -21252,22 +21303,24 @@ function ____exports.isBlindCollectible(self, collectible)
|
|
|
21252
21303
|
questionMarkSprite:SetFrame(animation, frame)
|
|
21253
21304
|
return ____exports.collectibleSpriteEquals(nil, sprite, questionMarkSprite)
|
|
21254
21305
|
end
|
|
21255
|
-
function ____exports.isGlitchedCollectible(self,
|
|
21256
|
-
return
|
|
21306
|
+
function ____exports.isGlitchedCollectible(self, collectible)
|
|
21307
|
+
return collectible.Variant == PickupVariant.COLLECTIBLE and collectible.SubType > GLITCHED_ITEM_THRESHOLD
|
|
21257
21308
|
end
|
|
21258
|
-
function ____exports.isHiddenCollectible(self,
|
|
21309
|
+
function ____exports.isHiddenCollectible(self, collectibleOrCollectibleType)
|
|
21310
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "isHiddenCollectible")
|
|
21259
21311
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
21260
21312
|
return itemConfigItem ~= nil and itemConfigItem.Hidden
|
|
21261
21313
|
end
|
|
21262
21314
|
function ____exports.isModdedCollectibleType(self, collectibleType)
|
|
21263
21315
|
return not ____exports.isVanillaCollectibleType(nil, collectibleType)
|
|
21264
21316
|
end
|
|
21265
|
-
function ____exports.isPassiveCollectible(self,
|
|
21317
|
+
function ____exports.isPassiveCollectible(self, collectibleOrCollectibleType)
|
|
21318
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "isPassiveCollectible")
|
|
21266
21319
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
21267
21320
|
return itemType == ItemType.PASSIVE or itemType == ItemType.FAMILIAR
|
|
21268
21321
|
end
|
|
21269
|
-
function ____exports.isQuality(self,
|
|
21270
|
-
local actualQuality = ____exports.getCollectibleQuality(nil,
|
|
21322
|
+
function ____exports.isQuality(self, collectibleOrCollectibleType, quality)
|
|
21323
|
+
local actualQuality = ____exports.getCollectibleQuality(nil, collectibleOrCollectibleType)
|
|
21271
21324
|
return quality == actualQuality
|
|
21272
21325
|
end
|
|
21273
21326
|
function ____exports.isSingleUseCollectible(self, collectibleType)
|
|
@@ -21323,6 +21376,15 @@ function ____exports.setCollectibleGlitched(self, collectible)
|
|
|
21323
21376
|
player:RemoveCollectible(CollectibleType.TMTRAINER)
|
|
21324
21377
|
end
|
|
21325
21378
|
end
|
|
21379
|
+
function ____exports.setCollectiblePedestalType(self, collectible, collectiblePedestalType)
|
|
21380
|
+
if not isCollectible(nil, collectible) then
|
|
21381
|
+
local entityID = getEntityID(nil, collectible)
|
|
21382
|
+
error("The \"setCollectiblePedestalType\" function was given a non-collectible: " .. entityID)
|
|
21383
|
+
end
|
|
21384
|
+
local sprite = collectible:GetSprite()
|
|
21385
|
+
local overlayAnimation = sprite:GetOverlayAnimation()
|
|
21386
|
+
sprite:SetOverlayFrame(overlayAnimation, collectiblePedestalType)
|
|
21387
|
+
end
|
|
21326
21388
|
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
21327
21389
|
Isaac.DebugString("Added 3 Collectibles")
|
|
21328
21390
|
end
|