isaacscript-common 6.17.0 → 6.19.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/enums/ModCallbackCustom.d.ts +1 -1
- package/dist/features/customGridEntity.d.ts +3 -3
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +18 -11
- package/dist/features/extraConsoleCommands/listCommands.lua +2 -2
- package/dist/features/pickupIndex.lua +3 -2
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +2 -4
- package/dist/functions/eden.d.ts.map +1 -1
- package/dist/functions/eden.lua +2 -4
- package/dist/functions/itemPool.d.ts +8 -0
- package/dist/functions/itemPool.d.ts.map +1 -1
- package/dist/functions/itemPool.lua +53 -36
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +27 -27
- package/dist/functions/saveFile.d.ts +1 -1
- package/dist/functions/saveFile.lua +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +1 -1
- package/dist/interfaces/{CustomGridEntityData.d.ts → GridEntityCustomData.d.ts} +2 -2
- package/dist/interfaces/{CustomGridEntityData.d.ts.map → GridEntityCustomData.d.ts.map} +1 -1
- package/dist/interfaces/{CustomGridEntityData.lua → GridEntityCustomData.lua} +0 -0
- package/package.json +1 -1
- package/src/enums/ModCallbackCustom.ts +1 -1
- package/src/features/customGridEntity.ts +30 -17
- package/src/features/extraConsoleCommands/listCommands.ts +2 -2
- package/src/features/pickupIndex.ts +4 -4
- package/src/features/playerInventory.ts +2 -3
- package/src/functions/eden.ts +2 -4
- package/src/functions/itemPool.ts +30 -5
- package/src/functions/log.ts +29 -29
- package/src/functions/saveFile.ts +1 -1
- package/src/index.ts +1 -1
- package/src/interfaces/{CustomGridEntityData.ts → GridEntityCustomData.ts} +1 -1
|
@@ -519,7 +519,7 @@ export declare enum ModCallbackCustom {
|
|
|
519
519
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
520
520
|
* only fire if it matches the `ItemType` provided.
|
|
521
521
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
522
|
-
* only fire if the `CollectibleType` or the `TrinketType` matches the
|
|
522
|
+
* only fire if the `CollectibleType` or the `TrinketType` matches the sub-type provided.
|
|
523
523
|
*
|
|
524
524
|
* ```ts
|
|
525
525
|
* function postItemPickup(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridCollisionClass, GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
-
import {
|
|
2
|
+
import { GridEntityCustomData } from "../interfaces/GridEntityCustomData";
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
|
|
5
5
|
* will reappear if the player leaves and re-enters the room. (It will be manually respawned in the
|
|
@@ -46,13 +46,13 @@ export declare function spawnCustomGridEntity(gridEntityTypeCustom: GridEntityTy
|
|
|
46
46
|
* @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
|
|
47
47
|
* given location or if the given grid entity was not a custom grid entity.
|
|
48
48
|
*/
|
|
49
|
-
export declare function
|
|
49
|
+
export declare function removeCustomGridEntity(gridIndexOrPositionOrGridEntity: int | Vector | GridEntity, updateRoom?: boolean): GridEntity | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* Helper function to get the custom grid entities in the current room. Returns an array of tuples
|
|
52
52
|
* containing the raw decoration grid entity and the associated entity data.
|
|
53
53
|
*/
|
|
54
54
|
export declare function getCustomGridEntities(): Array<[
|
|
55
55
|
gridEntity: GridEntity,
|
|
56
|
-
data:
|
|
56
|
+
data: GridEntityCustomData
|
|
57
57
|
]>;
|
|
58
58
|
//# sourceMappingURL=customGridEntity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,kBAAkB,EAClB,cAAc,EAGf,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AA2K1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,qBAAqB,CACnC,oBAAoB,EAAE,cAAc,EACpC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,MAAM,EACzB,SAAS,UAAQ,GAChB,UAAU,CAyEZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,+BAA+B,EAAE,GAAG,GAAG,MAAM,GAAG,UAAU,EAC1D,UAAU,UAAO,GAChB,UAAU,GAAG,SAAS,CAqCxB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,KAAK,CAC5C;IAAC,UAAU,EAAE,UAAU;IAAE,IAAI,EAAE,oBAAoB;CAAC,CACrD,CAiBA"}
|
|
@@ -4,10 +4,11 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local Set = ____lualib.Set
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local
|
|
7
|
+
local entityTakeDmgGenericProp, preUseItemWeNeedToGoDeeper, postNewRoomReordered, v
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
10
10
|
local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
|
|
11
|
+
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
11
12
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
12
13
|
local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
|
|
13
14
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
@@ -24,8 +25,8 @@ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
|
24
25
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
25
26
|
local ____featuresInitialized = require("featuresInitialized")
|
|
26
27
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
27
|
-
local
|
|
28
|
-
local
|
|
28
|
+
local ____entities = require("functions.entities")
|
|
29
|
+
local spawn = ____entities.spawn
|
|
29
30
|
local ____flag = require("functions.flag")
|
|
30
31
|
local hasFlag = ____flag.hasFlag
|
|
31
32
|
local ____gridEntities = require("functions.gridEntities")
|
|
@@ -39,9 +40,9 @@ local ____runInNFrames = require("features.runInNFrames")
|
|
|
39
40
|
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
40
41
|
local ____exports = require("features.saveDataManager.exports")
|
|
41
42
|
local saveDataManager = ____exports.saveDataManager
|
|
42
|
-
function
|
|
43
|
+
function entityTakeDmgGenericProp(self, tookDamage, _damageAmount, damageFlags, _damageSource, _damageCountdownFrames)
|
|
43
44
|
local ptrHash = GetPtrHash(tookDamage)
|
|
44
|
-
if not v.room.
|
|
45
|
+
if not v.room.genericPropPtrHashes:has(ptrHash) then
|
|
45
46
|
return nil
|
|
46
47
|
end
|
|
47
48
|
if not hasFlag(nil, damageFlags, DamageFlag.EXPLOSION) then
|
|
@@ -125,13 +126,14 @@ function postNewRoomReordered(self)
|
|
|
125
126
|
end
|
|
126
127
|
end
|
|
127
128
|
local FEATURE_NAME = "customGridEntity"
|
|
129
|
+
local GENERIC_PROP_SIZE_MULTIPLIER = 0.66
|
|
128
130
|
v = {
|
|
129
131
|
level = {customGridEntities = __TS__New(
|
|
130
132
|
DefaultMap,
|
|
131
133
|
function() return __TS__New(Map) end
|
|
132
134
|
)},
|
|
133
135
|
room = {
|
|
134
|
-
|
|
136
|
+
genericPropPtrHashes = __TS__New(Set),
|
|
135
137
|
manuallyUsingShovel = false
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -139,7 +141,7 @@ v = {
|
|
|
139
141
|
-- @internal
|
|
140
142
|
function ____exports.customGridEntityInit(self, mod)
|
|
141
143
|
saveDataManager(nil, FEATURE_NAME, v)
|
|
142
|
-
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG,
|
|
144
|
+
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDmgGenericProp, EntityType.GENERIC_PROP)
|
|
143
145
|
mod:AddCallback(ModCallback.PRE_USE_ITEM, preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER)
|
|
144
146
|
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
145
147
|
end
|
|
@@ -188,6 +190,7 @@ function ____exports.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndex
|
|
|
188
190
|
if decoration == nil then
|
|
189
191
|
error("Failed to spawn a decoration for a custom grid entity.")
|
|
190
192
|
end
|
|
193
|
+
decoration.CollisionClass = gridCollisionClass
|
|
191
194
|
local sprite = decoration:GetSprite()
|
|
192
195
|
sprite:Load(anm2Path, true)
|
|
193
196
|
local animationToPlay = defaultAnimation == nil and sprite:GetDefaultAnimation() or defaultAnimation
|
|
@@ -204,14 +207,18 @@ function ____exports.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndex
|
|
|
204
207
|
roomCustomGridEntities:set(gridIndex, customGridEntityData)
|
|
205
208
|
if breakable then
|
|
206
209
|
local position = room:GetGridPosition(gridIndex)
|
|
207
|
-
local
|
|
210
|
+
local entity = spawn(
|
|
208
211
|
nil,
|
|
209
|
-
EntityType.
|
|
212
|
+
EntityType.GENERIC_PROP,
|
|
210
213
|
0,
|
|
211
214
|
0,
|
|
212
215
|
position
|
|
213
216
|
)
|
|
214
|
-
|
|
217
|
+
entity:ClearEntityFlags(EntityFlag.APPEAR)
|
|
218
|
+
entity.Visible = false
|
|
219
|
+
entity.SizeMulti = Vector(GENERIC_PROP_SIZE_MULTIPLIER, GENERIC_PROP_SIZE_MULTIPLIER)
|
|
220
|
+
local ptrHash = GetPtrHash(entity)
|
|
221
|
+
v.room.genericPropPtrHashes:add(ptrHash)
|
|
215
222
|
end
|
|
216
223
|
return decoration
|
|
217
224
|
end
|
|
@@ -228,7 +235,7 @@ end
|
|
|
228
235
|
-- multiple times.
|
|
229
236
|
-- @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
|
|
230
237
|
-- given location or if the given grid entity was not a custom grid entity.
|
|
231
|
-
function ____exports.
|
|
238
|
+
function ____exports.removeCustomGridEntity(self, gridIndexOrPositionOrGridEntity, updateRoom)
|
|
232
239
|
if updateRoom == nil then
|
|
233
240
|
updateRoom = true
|
|
234
241
|
end
|
|
@@ -53,7 +53,7 @@ local addFlag = ____flag.addFlag
|
|
|
53
53
|
local ____gridEntities = require("functions.gridEntities")
|
|
54
54
|
local spawnGridEntity = ____gridEntities.spawnGridEntity
|
|
55
55
|
local ____log = require("functions.log")
|
|
56
|
-
local
|
|
56
|
+
local logPlayerEffects = ____log.logPlayerEffects
|
|
57
57
|
local logRoom = ____log.logRoom
|
|
58
58
|
local logSeedEffects = ____log.logSeedEffects
|
|
59
59
|
local logSounds = ____log.logSounds
|
|
@@ -512,7 +512,7 @@ end
|
|
|
512
512
|
--- Logs the player's current temporary effects to the "log.txt" file.
|
|
513
513
|
function ____exports.effects(self)
|
|
514
514
|
local player = Isaac.GetPlayer()
|
|
515
|
-
|
|
515
|
+
logPlayerEffects(player)
|
|
516
516
|
printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
|
|
517
517
|
end
|
|
518
518
|
--- Alias for the "eternalHearts" command.
|
|
@@ -108,8 +108,9 @@ function postNewRoomReordered(self)
|
|
|
108
108
|
pickupIndex = getPostAscentPickupIndex(nil, pickup)
|
|
109
109
|
end
|
|
110
110
|
if pickupIndex == nil then
|
|
111
|
-
local
|
|
112
|
-
|
|
111
|
+
local ____v_run_2, ____pickupCounter_3 = v.run, "pickupCounter"
|
|
112
|
+
____v_run_2[____pickupCounter_3] = ____v_run_2[____pickupCounter_3] + 1
|
|
113
|
+
pickupIndex = v.run.pickupCounter
|
|
113
114
|
end
|
|
114
115
|
local ptrHash = GetPtrHash(pickup)
|
|
115
116
|
v.room.pickupIndexes:set(ptrHash, pickupIndex)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerInventory.d.ts","sourceRoot":"","sources":["../../src/features/playerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"playerInventory.d.ts","sourceRoot":"","sources":["../../src/features/playerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAC;AAyG5E;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,eAAe,EAAE,CAanB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__New = ____lualib.__TS__New
|
|
3
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
4
3
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
4
|
local ____exports = {}
|
|
6
5
|
local newPlayerInventory, resetInventory, useItemD4, postGameStarted, postCollectibleAdded, postCollectibleRemoved, v
|
|
@@ -19,7 +18,7 @@ local copyArray = ____array.copyArray
|
|
|
19
18
|
local ____collectibles = require("functions.collectibles")
|
|
20
19
|
local isActiveCollectible = ____collectibles.isActiveCollectible
|
|
21
20
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
22
|
-
local
|
|
21
|
+
local getCollectibleArray = ____collectibleSet.getCollectibleArray
|
|
23
22
|
local ____playerDataStructures = require("functions.playerDataStructures")
|
|
24
23
|
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
|
|
25
24
|
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
@@ -32,8 +31,7 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
32
31
|
local saveDataManager = ____exports.saveDataManager
|
|
33
32
|
function newPlayerInventory(self, player)
|
|
34
33
|
local inventory = {}
|
|
35
|
-
|
|
36
|
-
for ____, collectibleType in __TS__Iterator(collectibleSet:values()) do
|
|
34
|
+
for ____, collectibleType in ipairs(getCollectibleArray(nil)) do
|
|
37
35
|
local numCollectibles = player:GetCollectibleNum(collectibleType, true)
|
|
38
36
|
____repeat(
|
|
39
37
|
nil,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eden.d.ts","sourceRoot":"","sources":["../../src/functions/eden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"eden.d.ts","sourceRoot":"","sources":["../../src/functions/eden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,8BAA8B,CAAC;AAqB9E,wBAAgB,eAAe,IAAI,GAAG,CAAC,eAAe,CAAC,CAOtD;AAED,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,eAAe,EAAE,GAAG,SAAS,eAAe,EAAO,GAC9D,eAAe,CAWjB"}
|
package/dist/functions/eden.lua
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
4
|
local ____exports = {}
|
|
6
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
6
|
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
|
|
@@ -9,7 +8,7 @@ local ____collectibles = require("functions.collectibles")
|
|
|
9
8
|
local isHiddenCollectible = ____collectibles.isHiddenCollectible
|
|
10
9
|
local isPassiveCollectible = ____collectibles.isPassiveCollectible
|
|
11
10
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
12
|
-
local
|
|
11
|
+
local getCollectibleArray = ____collectibleSet.getCollectibleArray
|
|
13
12
|
local ____collectibleTag = require("functions.collectibleTag")
|
|
14
13
|
local collectibleHasTag = ____collectibleTag.collectibleHasTag
|
|
15
14
|
local ____rng = require("functions.rng")
|
|
@@ -19,8 +18,7 @@ local copySet = ____set.copySet
|
|
|
19
18
|
local getRandomSetElement = ____set.getRandomSetElement
|
|
20
19
|
local EDEN_PASSIVE_COLLECTIBLES_SET = __TS__New(Set)
|
|
21
20
|
local function initCollectibleSet(self)
|
|
22
|
-
|
|
23
|
-
for ____, collectibleType in __TS__Iterator(collectibleSet:values()) do
|
|
21
|
+
for ____, collectibleType in ipairs(getCollectibleArray(nil)) do
|
|
24
22
|
if isPassiveCollectible(nil, collectibleType) and not isHiddenCollectible(nil, collectibleType) and not collectibleHasTag(nil, collectibleType, ItemConfigTag.NO_EDEN) then
|
|
25
23
|
EDEN_PASSIVE_COLLECTIBLES_SET:add(collectibleType)
|
|
26
24
|
end
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get the remaining collectibles in a given item pool. This function is
|
|
4
|
+
* expensive, so only use it in situations where the lag is acceptable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCollectiblesInItemPool(itemPoolType: ItemPoolType): CollectibleType[];
|
|
2
7
|
/**
|
|
3
8
|
* Helper function to see if the given collectible is still present in the given item pool.
|
|
4
9
|
*
|
|
5
10
|
* If the collectible is non-offensive, any Tainted Losts will be temporarily changed to Isaac and
|
|
6
11
|
* then changed back. (This is because Tainted Lost is not able to retrieve non-offensive
|
|
7
12
|
* collectibles from item pools).
|
|
13
|
+
*
|
|
14
|
+
* Under the hood, this function works by using the `ItemPool.AddRoomBlacklist` method to blacklist
|
|
15
|
+
* every collectible except for the one provided.
|
|
8
16
|
*/
|
|
9
17
|
export declare function isCollectibleInItemPool(collectibleType: CollectibleType, itemPoolType: ItemPoolType): boolean;
|
|
10
18
|
//# sourceMappingURL=itemPool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EAGb,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAsBtC;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,YAAY,GACzB,eAAe,EAAE,CAKnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GACzB,OAAO,CA6DT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
2
3
|
local Map = ____lualib.Map
|
|
3
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local ____exports = {}
|
|
6
|
-
local removeItemsAndTrinketsThatAffectItemPools, restoreItemsAndTrinketsThatAffectItemPools, COLLECTIBLES_THAT_AFFECT_ITEM_POOLS, TRINKETS_THAT_AFFECT_ITEM_POOLS
|
|
6
|
+
local removeItemsAndTrinketsThatAffectItemPools, restoreItemsAndTrinketsThatAffectItemPools, COLLECTIBLES_THAT_AFFECT_ITEM_POOLS, TRINKETS_THAT_AFFECT_ITEM_POOLS, COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS
|
|
7
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
8
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
9
9
|
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
|
|
@@ -12,7 +12,7 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
|
12
12
|
local ____cachedClasses = require("cachedClasses")
|
|
13
13
|
local game = ____cachedClasses.game
|
|
14
14
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
15
|
-
local
|
|
15
|
+
local getCollectibleArray = ____collectibleSet.getCollectibleArray
|
|
16
16
|
local ____collectibleTag = require("functions.collectibleTag")
|
|
17
17
|
local collectibleHasTag = ____collectibleTag.collectibleHasTag
|
|
18
18
|
local ____playerDataStructures = require("functions.playerDataStructures")
|
|
@@ -24,6 +24,47 @@ local ____players = require("functions.players")
|
|
|
24
24
|
local getPlayersOfType = ____players.getPlayersOfType
|
|
25
25
|
local ____utils = require("functions.utils")
|
|
26
26
|
local ____repeat = ____utils["repeat"]
|
|
27
|
+
--- Helper function to see if the given collectible is still present in the given item pool.
|
|
28
|
+
--
|
|
29
|
+
-- If the collectible is non-offensive, any Tainted Losts will be temporarily changed to Isaac and
|
|
30
|
+
-- then changed back. (This is because Tainted Lost is not able to retrieve non-offensive
|
|
31
|
+
-- collectibles from item pools).
|
|
32
|
+
--
|
|
33
|
+
-- Under the hood, this function works by using the `ItemPool.AddRoomBlacklist` method to blacklist
|
|
34
|
+
-- every collectible except for the one provided.
|
|
35
|
+
function ____exports.isCollectibleInItemPool(self, collectibleType, itemPoolType)
|
|
36
|
+
if collectibleType == COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS then
|
|
37
|
+
return false
|
|
38
|
+
end
|
|
39
|
+
local taintedLosts = getPlayersOfType(nil, PlayerType.THE_LOST_B)
|
|
40
|
+
local isOffensive = collectibleHasTag(nil, collectibleType, ItemConfigTag.OFFENSIVE)
|
|
41
|
+
local changedPlayerTypes = false
|
|
42
|
+
if not isOffensive then
|
|
43
|
+
changedPlayerTypes = true
|
|
44
|
+
for ____, player in ipairs(taintedLosts) do
|
|
45
|
+
player:ChangePlayerType(PlayerType.ISAAC)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
local removedItemsMap, removedTrinketsMap = table.unpack(removeItemsAndTrinketsThatAffectItemPools(nil))
|
|
49
|
+
local itemPool = game:GetItemPool()
|
|
50
|
+
itemPool:ResetRoomBlacklist()
|
|
51
|
+
for ____, collectibleTypeInSet in ipairs(getCollectibleArray(nil)) do
|
|
52
|
+
if collectibleTypeInSet ~= collectibleType then
|
|
53
|
+
itemPool:AddRoomBlacklist(collectibleTypeInSet)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
local seed = 1
|
|
57
|
+
local retrievedCollectibleType = itemPool:GetCollectible(itemPoolType, false, seed, COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS)
|
|
58
|
+
local collectibleUnlocked = retrievedCollectibleType == collectibleType
|
|
59
|
+
itemPool:ResetRoomBlacklist()
|
|
60
|
+
restoreItemsAndTrinketsThatAffectItemPools(nil, removedItemsMap, removedTrinketsMap)
|
|
61
|
+
if changedPlayerTypes then
|
|
62
|
+
for ____, player in ipairs(taintedLosts) do
|
|
63
|
+
player:ChangePlayerType(PlayerType.THE_LOST_B)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
return collectibleUnlocked
|
|
67
|
+
end
|
|
27
68
|
function removeItemsAndTrinketsThatAffectItemPools(self)
|
|
28
69
|
local removedItemsMap = __TS__New(Map)
|
|
29
70
|
local removedTrinketsMap = __TS__New(Map)
|
|
@@ -79,38 +120,14 @@ function restoreItemsAndTrinketsThatAffectItemPools(self, removedItemsMap, remov
|
|
|
79
120
|
end
|
|
80
121
|
COLLECTIBLES_THAT_AFFECT_ITEM_POOLS = {CollectibleType.CHAOS, CollectibleType.SACRED_ORB, CollectibleType.TMTRAINER}
|
|
81
122
|
TRINKETS_THAT_AFFECT_ITEM_POOLS = {TrinketType.NO}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
--
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if not isOffensive then
|
|
92
|
-
changedPlayerTypes = true
|
|
93
|
-
for ____, player in ipairs(taintedLosts) do
|
|
94
|
-
player:ChangePlayerType(PlayerType.ISAAC)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
local removedItemsMap, removedTrinketsMap = table.unpack(removeItemsAndTrinketsThatAffectItemPools(nil))
|
|
98
|
-
local itemPool = game:GetItemPool()
|
|
99
|
-
local collectibleSet = getCollectibleSet(nil)
|
|
100
|
-
for ____, collectibleTypeInSet in __TS__Iterator(collectibleSet:values()) do
|
|
101
|
-
if collectibleTypeInSet ~= collectibleType then
|
|
102
|
-
itemPool:AddRoomBlacklist(collectibleTypeInSet)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
local retrievedCollectibleType = itemPool:GetCollectible(itemPoolType, false, 1)
|
|
106
|
-
local collectibleUnlocked = retrievedCollectibleType == collectibleType
|
|
107
|
-
itemPool:ResetRoomBlacklist()
|
|
108
|
-
restoreItemsAndTrinketsThatAffectItemPools(nil, removedItemsMap, removedTrinketsMap)
|
|
109
|
-
if changedPlayerTypes then
|
|
110
|
-
for ____, player in ipairs(taintedLosts) do
|
|
111
|
-
player:ChangePlayerType(PlayerType.THE_LOST_B)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
return collectibleUnlocked
|
|
123
|
+
COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS = CollectibleType.KEY_PIECE_1
|
|
124
|
+
--- Helper function to get the remaining collectibles in a given item pool. This function is
|
|
125
|
+
-- expensive, so only use it in situations where the lag is acceptable.
|
|
126
|
+
function ____exports.getCollectiblesInItemPool(self, itemPoolType)
|
|
127
|
+
local collectibleArray = getCollectibleArray(nil)
|
|
128
|
+
return __TS__ArrayFilter(
|
|
129
|
+
collectibleArray,
|
|
130
|
+
function(____, collectibleType) return ____exports.isCollectibleInItemPool(nil, collectibleType, itemPoolType) end
|
|
131
|
+
)
|
|
115
132
|
end
|
|
116
133
|
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export declare function logArray<T>(this: void, array: T[] | readonly T[]): void
|
|
|
21
21
|
export declare function logColor(this: void, color: Color): void;
|
|
22
22
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
23
23
|
export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
24
|
-
export declare function logEffects(this: void, player: EntityPlayer): void;
|
|
25
24
|
/** Helper function for logging an array of specific entities. */
|
|
26
25
|
export declare function logEntities(this: void, entities: Entity[]): void;
|
|
27
26
|
/** Helper function to log information about a specific entity. */
|
|
@@ -52,6 +51,7 @@ export declare function logKColor(this: void, kColor: KColor): void;
|
|
|
52
51
|
*/
|
|
53
52
|
export declare function logLevelStateFlags(this: void): void;
|
|
54
53
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
54
|
+
export declare function logPlayerEffects(this: void, player: EntityPlayer): void;
|
|
55
55
|
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
56
56
|
/**
|
|
57
57
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,UAAU,EACV,UAAU,EAEV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IAAI,GAAG,IAAI,CAiB/C;AAED,wBAAgB,MAAM,CACpB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,SAAS,CAAC,GAC3C,IAAI,CAUN;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAQ1C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,OAAO,EACjB,YAAY,SAAI,GACf,IAAI,CA2CN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EACtC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,IAAI,CA0BN;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GACnC,IAAI,CAEN;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GACjC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAsB/D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAkC5C"}
|
package/dist/functions/log.lua
CHANGED
|
@@ -312,32 +312,6 @@ end
|
|
|
312
312
|
function ____exports.logDamageFlags(flags)
|
|
313
313
|
____exports.logFlags(flags, DamageFlag, "damage")
|
|
314
314
|
end
|
|
315
|
-
function ____exports.logEffects(player)
|
|
316
|
-
local effects = getEffectsList(nil, player)
|
|
317
|
-
____exports.log("Logging player effects:")
|
|
318
|
-
if #effects == 0 then
|
|
319
|
-
____exports.log(" n/a (no effects)")
|
|
320
|
-
return
|
|
321
|
-
end
|
|
322
|
-
__TS__ArrayForEach(
|
|
323
|
-
effects,
|
|
324
|
-
function(____, effect, i)
|
|
325
|
-
local effectDescription
|
|
326
|
-
if effect.Item:IsCollectible() then
|
|
327
|
-
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
328
|
-
effectDescription = "Collectible: " .. collectibleName
|
|
329
|
-
elseif effect.Item:IsTrinket() then
|
|
330
|
-
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
331
|
-
effectDescription = "Trinket: " .. trinketName
|
|
332
|
-
elseif effect.Item:IsNull() then
|
|
333
|
-
effectDescription = "Null item: " .. tostring(effect.Item.ID)
|
|
334
|
-
else
|
|
335
|
-
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
336
|
-
end
|
|
337
|
-
____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
338
|
-
end
|
|
339
|
-
)
|
|
340
|
-
end
|
|
341
315
|
--- Helper function for logging an array of specific entities.
|
|
342
316
|
function ____exports.logEntities(entities)
|
|
343
317
|
for ____, entity in ipairs(entities) do
|
|
@@ -417,6 +391,32 @@ function ____exports.logMap(map)
|
|
|
417
391
|
end
|
|
418
392
|
____exports.log(" The size of the map was: " .. tostring(map.size))
|
|
419
393
|
end
|
|
394
|
+
function ____exports.logPlayerEffects(player)
|
|
395
|
+
local effects = getEffectsList(nil, player)
|
|
396
|
+
____exports.log("Logging player effects:")
|
|
397
|
+
if #effects == 0 then
|
|
398
|
+
____exports.log(" n/a (no effects)")
|
|
399
|
+
return
|
|
400
|
+
end
|
|
401
|
+
__TS__ArrayForEach(
|
|
402
|
+
effects,
|
|
403
|
+
function(____, effect, i)
|
|
404
|
+
local effectDescription
|
|
405
|
+
if effect.Item:IsCollectible() then
|
|
406
|
+
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
407
|
+
effectDescription = "Collectible: " .. collectibleName
|
|
408
|
+
elseif effect.Item:IsTrinket() then
|
|
409
|
+
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
410
|
+
effectDescription = "Trinket: " .. trinketName
|
|
411
|
+
elseif effect.Item:IsNull() then
|
|
412
|
+
effectDescription = "Null item: " .. tostring(effect.Item.ID)
|
|
413
|
+
else
|
|
414
|
+
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
415
|
+
end
|
|
416
|
+
____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
417
|
+
end
|
|
418
|
+
)
|
|
419
|
+
end
|
|
420
420
|
function ____exports.logPlayerHealth(player)
|
|
421
421
|
local playerName = getPlayerName(nil, player)
|
|
422
422
|
local playerHealth = getPlayerHealth(nil, player)
|
|
@@ -613,7 +613,6 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
613
613
|
globals.logArray = ____exports.logArray
|
|
614
614
|
globals.logColor = ____exports.logColor
|
|
615
615
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
616
|
-
globals.logEffects = ____exports.logEffects
|
|
617
616
|
globals.logEntities = ____exports.logEntities
|
|
618
617
|
globals.logEntity = ____exports.logEntity
|
|
619
618
|
globals.logEntityID = ____exports.logEntityID
|
|
@@ -626,6 +625,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
626
625
|
globals.logKColor = ____exports.logKColor
|
|
627
626
|
globals.logLevelStateFlags = ____exports.logLevelStateFlags
|
|
628
627
|
globals.logMap = ____exports.logMap
|
|
628
|
+
globals.logPlayerEffects = ____exports.logPlayerEffects
|
|
629
629
|
globals.logPlayerHealth = ____exports.logPlayerHealth
|
|
630
630
|
globals.logProjectileFlags = ____exports.logProjectileFlags
|
|
631
631
|
globals.logRoom = ____exports.logRoom
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to see if the given collectible is unlocked on the current save file. This
|
|
4
|
-
* requires providing the corresponding item pool that the collectible is located in.
|
|
4
|
+
* requires providing the corresponding item pool that the collectible is normally located in.
|
|
5
5
|
*
|
|
6
6
|
* - If any player currently has the collectible, then it is assumed to be unlocked. (This is
|
|
7
7
|
* because in almost all cases, when a collectible is added to a player's inventory, it is
|
|
@@ -4,7 +4,7 @@ local isCollectibleInItemPool = ____itemPool.isCollectibleInItemPool
|
|
|
4
4
|
local ____players = require("functions.players")
|
|
5
5
|
local anyPlayerHasCollectible = ____players.anyPlayerHasCollectible
|
|
6
6
|
--- Helper function to see if the given collectible is unlocked on the current save file. This
|
|
7
|
-
-- requires providing the corresponding item pool that the collectible is located in.
|
|
7
|
+
-- requires providing the corresponding item pool that the collectible is normally located in.
|
|
8
8
|
--
|
|
9
9
|
-- - If any player currently has the collectible, then it is assumed to be unlocked. (This is
|
|
10
10
|
-- because in almost all cases, when a collectible is added to a player's inventory, it is
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export * from "./enums/SerializationType";
|
|
|
12
12
|
export { ConversionHeartSubType, registerCharacterHealthConversion, } from "./features/characterHealthConversion";
|
|
13
13
|
export { registerCharacterStats } from "./features/characterStats";
|
|
14
14
|
export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
|
|
15
|
-
export { removeCustomGrid, spawnCustomGridEntity as spawnCustomGrid, } from "./features/customGridEntity";
|
|
15
|
+
export { removeCustomGridEntity as removeCustomGrid, spawnCustomGridEntity as spawnCustomGrid, } from "./features/customGridEntity";
|
|
16
16
|
export * from "./features/customStage/exports";
|
|
17
17
|
export * from "./features/customTrapdoor/exports";
|
|
18
18
|
export * from "./features/debugDisplay/exports";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,sBAAsB,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ACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC"}
|
package/dist/index.lua
CHANGED
|
@@ -104,7 +104,7 @@ do
|
|
|
104
104
|
end
|
|
105
105
|
do
|
|
106
106
|
local ____customGridEntity = require("features.customGridEntity")
|
|
107
|
-
local removeCustomGrid = ____customGridEntity.
|
|
107
|
+
local removeCustomGrid = ____customGridEntity.removeCustomGridEntity
|
|
108
108
|
local spawnCustomGrid = ____customGridEntity.spawnCustomGridEntity
|
|
109
109
|
____exports.removeCustomGrid = removeCustomGrid
|
|
110
110
|
____exports.spawnCustomGrid = spawnCustomGrid
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridCollisionClass, GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
-
export interface
|
|
2
|
+
export interface GridEntityCustomData {
|
|
3
3
|
/**
|
|
4
4
|
* This is not a real `GridEntityType`; rather it is an arbitrary integer selected by end-user
|
|
5
5
|
* mods.
|
|
@@ -11,4 +11,4 @@ export interface CustomGridEntityData {
|
|
|
11
11
|
defaultAnimation?: string;
|
|
12
12
|
gridCollisionClass: GridCollisionClass;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=GridEntityCustomData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"GridEntityCustomData.d.ts","sourceRoot":"","sources":["../../src/interfaces/GridEntityCustomData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,oBAAoB,EAAE,cAAc,CAAC;IAErC,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;CACxC"}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -564,7 +564,7 @@ export enum ModCallbackCustom {
|
|
|
564
564
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
565
565
|
* only fire if it matches the `ItemType` provided.
|
|
566
566
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
567
|
-
* only fire if the `CollectibleType` or the `TrinketType` matches the
|
|
567
|
+
* only fire if the `CollectibleType` or the `TrinketType` matches the sub-type provided.
|
|
568
568
|
*
|
|
569
569
|
* ```ts
|
|
570
570
|
* function postItemPickup(
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ActiveSlot,
|
|
3
3
|
CollectibleType,
|
|
4
4
|
DamageFlag,
|
|
5
|
+
EntityFlag,
|
|
5
6
|
EntityType,
|
|
6
7
|
GridCollisionClass,
|
|
7
8
|
GridEntityType,
|
|
@@ -15,7 +16,7 @@ import { ModUpgraded } from "../classes/ModUpgraded";
|
|
|
15
16
|
import { DecorationVariant } from "../enums/DecorationVariant";
|
|
16
17
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
17
18
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
18
|
-
import {
|
|
19
|
+
import { spawn } from "../functions/entities";
|
|
19
20
|
import { hasFlag } from "../functions/flag";
|
|
20
21
|
import {
|
|
21
22
|
removeGridEntity,
|
|
@@ -23,22 +24,23 @@ import {
|
|
|
23
24
|
} from "../functions/gridEntities";
|
|
24
25
|
import { getRoomListIndex } from "../functions/roomData";
|
|
25
26
|
import { isVector } from "../functions/vector";
|
|
26
|
-
import {
|
|
27
|
+
import { GridEntityCustomData } from "../interfaces/GridEntityCustomData";
|
|
27
28
|
import { runNextGameFrame } from "./runInNFrames";
|
|
28
29
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
29
30
|
|
|
30
31
|
const FEATURE_NAME = "customGridEntity";
|
|
32
|
+
const GENERIC_PROP_SIZE_MULTIPLIER = 0.66;
|
|
31
33
|
|
|
32
34
|
const v = {
|
|
33
35
|
level: {
|
|
34
36
|
/** Indexed by room list index and grid index. */
|
|
35
|
-
customGridEntities: new DefaultMap<int, Map<int,
|
|
37
|
+
customGridEntities: new DefaultMap<int, Map<int, GridEntityCustomData>>(
|
|
36
38
|
() => new Map(),
|
|
37
39
|
),
|
|
38
40
|
},
|
|
39
41
|
|
|
40
42
|
room: {
|
|
41
|
-
|
|
43
|
+
genericPropPtrHashes: new Set<PtrHash>(),
|
|
42
44
|
manuallyUsingShovel: false,
|
|
43
45
|
},
|
|
44
46
|
};
|
|
@@ -49,8 +51,8 @@ export function customGridEntityInit(mod: ModUpgraded): void {
|
|
|
49
51
|
|
|
50
52
|
mod.AddCallback(
|
|
51
53
|
ModCallback.ENTITY_TAKE_DMG,
|
|
52
|
-
|
|
53
|
-
EntityType.
|
|
54
|
+
entityTakeDmgGenericProp,
|
|
55
|
+
EntityType.GENERIC_PROP,
|
|
54
56
|
); // 11
|
|
55
57
|
|
|
56
58
|
mod.AddCallback(
|
|
@@ -66,8 +68,8 @@ export function customGridEntityInit(mod: ModUpgraded): void {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
69
|
-
// EntityType.
|
|
70
|
-
function
|
|
71
|
+
// EntityType.GENERIC_PROP (960)
|
|
72
|
+
function entityTakeDmgGenericProp(
|
|
71
73
|
tookDamage: Entity,
|
|
72
74
|
_damageAmount: float,
|
|
73
75
|
damageFlags: BitFlags<DamageFlag>,
|
|
@@ -75,7 +77,7 @@ function entityTakeDmgDummy(
|
|
|
75
77
|
_damageCountdownFrames: int,
|
|
76
78
|
): boolean | undefined {
|
|
77
79
|
const ptrHash = GetPtrHash(tookDamage);
|
|
78
|
-
if (!v.room.
|
|
80
|
+
if (!v.room.genericPropPtrHashes.has(ptrHash)) {
|
|
79
81
|
return undefined;
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -105,8 +107,8 @@ function entityTakeDmgDummy(
|
|
|
105
107
|
|
|
106
108
|
postGridEntityCustomBrokenFire(gridEntity, data.gridEntityTypeCustom);
|
|
107
109
|
|
|
108
|
-
// Even though the custom grid entity is now
|
|
109
|
-
// could intend for it to persist with different graphics.
|
|
110
|
+
// Even though the custom grid entity is now broken, we do not want to remove it, as the end-user
|
|
111
|
+
// could intend for it to persist with different graphics (or take multiple hits to be destroyed).
|
|
110
112
|
return false;
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -261,6 +263,7 @@ export function spawnCustomGridEntity(
|
|
|
261
263
|
if (decoration === undefined) {
|
|
262
264
|
error("Failed to spawn a decoration for a custom grid entity.");
|
|
263
265
|
}
|
|
266
|
+
decoration.CollisionClass = gridCollisionClass;
|
|
264
267
|
|
|
265
268
|
const sprite = decoration.GetSprite();
|
|
266
269
|
sprite.Load(anm2Path, true);
|
|
@@ -270,7 +273,7 @@ export function spawnCustomGridEntity(
|
|
|
270
273
|
: defaultAnimation;
|
|
271
274
|
sprite.Play(animationToPlay, true);
|
|
272
275
|
|
|
273
|
-
const customGridEntityData:
|
|
276
|
+
const customGridEntityData: GridEntityCustomData = {
|
|
274
277
|
gridEntityTypeCustom,
|
|
275
278
|
roomListIndex,
|
|
276
279
|
gridIndex,
|
|
@@ -287,8 +290,18 @@ export function spawnCustomGridEntity(
|
|
|
287
290
|
// the monitoring for explosions in the `ENTITY_TAKE_DMG` callback.
|
|
288
291
|
if (breakable) {
|
|
289
292
|
const position = room.GetGridPosition(gridIndex);
|
|
290
|
-
const
|
|
291
|
-
|
|
293
|
+
const entity = spawn(EntityType.GENERIC_PROP, 0, 0, position);
|
|
294
|
+
entity.ClearEntityFlags(EntityFlag.APPEAR);
|
|
295
|
+
entity.Visible = false;
|
|
296
|
+
|
|
297
|
+
// By default, it is larger than a grid tile, so make it a bit smaller.
|
|
298
|
+
entity.SizeMulti = Vector(
|
|
299
|
+
GENERIC_PROP_SIZE_MULTIPLIER,
|
|
300
|
+
GENERIC_PROP_SIZE_MULTIPLIER,
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
const ptrHash = GetPtrHash(entity);
|
|
304
|
+
v.room.genericPropPtrHashes.add(ptrHash);
|
|
292
305
|
}
|
|
293
306
|
|
|
294
307
|
return decoration;
|
|
@@ -309,7 +322,7 @@ export function spawnCustomGridEntity(
|
|
|
309
322
|
* @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
|
|
310
323
|
* given location or if the given grid entity was not a custom grid entity.
|
|
311
324
|
*/
|
|
312
|
-
export function
|
|
325
|
+
export function removeCustomGridEntity(
|
|
313
326
|
gridIndexOrPositionOrGridEntity: int | Vector | GridEntity,
|
|
314
327
|
updateRoom = true,
|
|
315
328
|
): GridEntity | undefined {
|
|
@@ -356,7 +369,7 @@ export function removeCustomGrid(
|
|
|
356
369
|
* containing the raw decoration grid entity and the associated entity data.
|
|
357
370
|
*/
|
|
358
371
|
export function getCustomGridEntities(): Array<
|
|
359
|
-
[gridEntity: GridEntity, data:
|
|
372
|
+
[gridEntity: GridEntity, data: GridEntityCustomData]
|
|
360
373
|
> {
|
|
361
374
|
const roomListIndex = getRoomListIndex();
|
|
362
375
|
const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
|
|
@@ -365,7 +378,7 @@ export function getCustomGridEntities(): Array<
|
|
|
365
378
|
}
|
|
366
379
|
|
|
367
380
|
const room = game.GetRoom();
|
|
368
|
-
const customGridEntities: Array<[GridEntity,
|
|
381
|
+
const customGridEntities: Array<[GridEntity, GridEntityCustomData]> = [];
|
|
369
382
|
for (const [gridIndex, data] of roomCustomGridEntities.entries()) {
|
|
370
383
|
const gridEntity = room.GetGridEntity(gridIndex);
|
|
371
384
|
if (gridEntity !== undefined) {
|
|
@@ -64,7 +64,7 @@ import { getEnumValues } from "../../functions/enums";
|
|
|
64
64
|
import { addFlag } from "../../functions/flag";
|
|
65
65
|
import { spawnGridEntity } from "../../functions/gridEntities";
|
|
66
66
|
import {
|
|
67
|
-
|
|
67
|
+
logPlayerEffects,
|
|
68
68
|
logRoom,
|
|
69
69
|
logSeedEffects,
|
|
70
70
|
logSounds,
|
|
@@ -515,7 +515,7 @@ export function dungeon(): void {
|
|
|
515
515
|
/** Logs the player's current temporary effects to the "log.txt" file. */
|
|
516
516
|
export function effects(): void {
|
|
517
517
|
const player = Isaac.GetPlayer();
|
|
518
|
-
|
|
518
|
+
logPlayerEffects(player);
|
|
519
519
|
printConsole('Logged the player\'s effects to the "log.txt" file.');
|
|
520
520
|
}
|
|
521
521
|
|
|
@@ -170,10 +170,10 @@ function postNewRoomReordered() {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
if (pickupIndex === undefined) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
// At this point, if we do not already have an existing pickup index, we need to create a new
|
|
174
|
+
// one in order to cover the cases where mods spawn items in the `POST_NEW_ROOM` callback.
|
|
175
|
+
v.run.pickupCounter++;
|
|
176
|
+
pickupIndex = v.run.pickupCounter;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
const ptrHash = GetPtrHash(pickup);
|
|
@@ -5,7 +5,7 @@ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
|
5
5
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
6
6
|
import { arrayRemoveInPlace, copyArray } from "../functions/array";
|
|
7
7
|
import { isActiveCollectible } from "../functions/collectibles";
|
|
8
|
-
import {
|
|
8
|
+
import { getCollectibleArray } from "../functions/collectibleSet";
|
|
9
9
|
import {
|
|
10
10
|
defaultMapGetPlayer,
|
|
11
11
|
mapSetPlayer,
|
|
@@ -30,8 +30,7 @@ const v = {
|
|
|
30
30
|
function newPlayerInventory(player: EntityPlayer) {
|
|
31
31
|
const inventory: CollectibleType[] = [];
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
for (const collectibleType of collectibleSet.values()) {
|
|
33
|
+
for (const collectibleType of getCollectibleArray()) {
|
|
35
34
|
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
36
35
|
repeat(numCollectibles, () => {
|
|
37
36
|
inventory.push(collectibleType);
|
package/src/functions/eden.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollectibleType, ItemConfigTag } from "isaac-typescript-definitions";
|
|
2
2
|
import { isHiddenCollectible, isPassiveCollectible } from "./collectibles";
|
|
3
|
-
import {
|
|
3
|
+
import { getCollectibleArray } from "./collectibleSet";
|
|
4
4
|
import { collectibleHasTag } from "./collectibleTag";
|
|
5
5
|
import { getRandomSeed } from "./rng";
|
|
6
6
|
import { copySet, getRandomSetElement } from "./set";
|
|
@@ -8,9 +8,7 @@ import { copySet, getRandomSetElement } from "./set";
|
|
|
8
8
|
const EDEN_PASSIVE_COLLECTIBLES_SET = new Set<CollectibleType>();
|
|
9
9
|
|
|
10
10
|
function initCollectibleSet() {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
for (const collectibleType of collectibleSet.values()) {
|
|
11
|
+
for (const collectibleType of getCollectibleArray()) {
|
|
14
12
|
if (
|
|
15
13
|
isPassiveCollectible(collectibleType) &&
|
|
16
14
|
!isHiddenCollectible(collectibleType) &&
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "isaac-typescript-definitions";
|
|
8
8
|
import { game } from "../cachedClasses";
|
|
9
9
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
10
|
-
import {
|
|
10
|
+
import { getCollectibleArray } from "./collectibleSet";
|
|
11
11
|
import { collectibleHasTag } from "./collectibleTag";
|
|
12
12
|
import { mapGetPlayer, mapSetPlayer } from "./playerDataStructures";
|
|
13
13
|
import { getPlayers } from "./playerIndex";
|
|
@@ -24,17 +24,41 @@ const TRINKETS_THAT_AFFECT_ITEM_POOLS: readonly TrinketType[] = [
|
|
|
24
24
|
TrinketType.NO,
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
const COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS = CollectibleType.KEY_PIECE_1;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to get the remaining collectibles in a given item pool. This function is
|
|
31
|
+
* expensive, so only use it in situations where the lag is acceptable.
|
|
32
|
+
*/
|
|
33
|
+
export function getCollectiblesInItemPool(
|
|
34
|
+
itemPoolType: ItemPoolType,
|
|
35
|
+
): CollectibleType[] {
|
|
36
|
+
const collectibleArray = getCollectibleArray();
|
|
37
|
+
return collectibleArray.filter((collectibleType) =>
|
|
38
|
+
isCollectibleInItemPool(collectibleType, itemPoolType),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
/**
|
|
28
43
|
* Helper function to see if the given collectible is still present in the given item pool.
|
|
29
44
|
*
|
|
30
45
|
* If the collectible is non-offensive, any Tainted Losts will be temporarily changed to Isaac and
|
|
31
46
|
* then changed back. (This is because Tainted Lost is not able to retrieve non-offensive
|
|
32
47
|
* collectibles from item pools).
|
|
48
|
+
*
|
|
49
|
+
* Under the hood, this function works by using the `ItemPool.AddRoomBlacklist` method to blacklist
|
|
50
|
+
* every collectible except for the one provided.
|
|
33
51
|
*/
|
|
34
52
|
export function isCollectibleInItemPool(
|
|
35
53
|
collectibleType: CollectibleType,
|
|
36
54
|
itemPoolType: ItemPoolType,
|
|
37
55
|
): boolean {
|
|
56
|
+
// We use a specific collectible which is known to not be in any pools as a default value. Thus,
|
|
57
|
+
// we must explicitly handle this case.
|
|
58
|
+
if (collectibleType === COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
38
62
|
// On Tainted Lost, it is impossible to retrieve non-offensive collectibles from pools, so we
|
|
39
63
|
// temporarily change the character to Isaac.
|
|
40
64
|
const taintedLosts = getPlayersOfType(PlayerType.THE_LOST_B);
|
|
@@ -55,8 +79,8 @@ export function isCollectibleInItemPool(
|
|
|
55
79
|
|
|
56
80
|
// Blacklist every collectible in the game except for the provided collectible.
|
|
57
81
|
const itemPool = game.GetItemPool();
|
|
58
|
-
|
|
59
|
-
for (const collectibleTypeInSet of
|
|
82
|
+
itemPool.ResetRoomBlacklist();
|
|
83
|
+
for (const collectibleTypeInSet of getCollectibleArray()) {
|
|
60
84
|
if (collectibleTypeInSet !== collectibleType) {
|
|
61
85
|
itemPool.AddRoomBlacklist(collectibleTypeInSet);
|
|
62
86
|
}
|
|
@@ -64,12 +88,13 @@ export function isCollectibleInItemPool(
|
|
|
64
88
|
|
|
65
89
|
// Get a collectible from the pool and see if it is the intended collectible. (We can use any
|
|
66
90
|
// arbitrary value as the seed since it should not influence the result.)
|
|
91
|
+
const seed = 1 as Seed;
|
|
67
92
|
const retrievedCollectibleType = itemPool.GetCollectible(
|
|
68
93
|
itemPoolType,
|
|
69
94
|
false,
|
|
70
|
-
|
|
95
|
+
seed,
|
|
96
|
+
COLLECTIBLE_TYPE_THAT_IS_NOT_IN_ANY_POOLS,
|
|
71
97
|
);
|
|
72
|
-
|
|
73
98
|
const collectibleUnlocked = retrievedCollectibleType === collectibleType;
|
|
74
99
|
|
|
75
100
|
// Reset the blacklist
|
package/src/functions/log.ts
CHANGED
|
@@ -203,34 +203,6 @@ export function logDamageFlags(
|
|
|
203
203
|
logFlags(flags, DamageFlag, "damage");
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
export function logEffects(this: void, player: EntityPlayer): void {
|
|
207
|
-
const effects = getEffectsList(player);
|
|
208
|
-
|
|
209
|
-
log("Logging player effects:");
|
|
210
|
-
|
|
211
|
-
if (effects.length === 0) {
|
|
212
|
-
log(" n/a (no effects)");
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
effects.forEach((effect, i) => {
|
|
217
|
-
let effectDescription: string;
|
|
218
|
-
if (effect.Item.IsCollectible()) {
|
|
219
|
-
const collectibleName = getCollectibleName(effect.Item.ID);
|
|
220
|
-
effectDescription = `Collectible: ${collectibleName}`;
|
|
221
|
-
} else if (effect.Item.IsTrinket()) {
|
|
222
|
-
const trinketName = getTrinketName(effect.Item.ID);
|
|
223
|
-
effectDescription = `Trinket: ${trinketName}`;
|
|
224
|
-
} else if (effect.Item.IsNull()) {
|
|
225
|
-
effectDescription = `Null item: ${effect.Item.ID}`;
|
|
226
|
-
} else {
|
|
227
|
-
effectDescription = `Unknown type of effect: ${effect.Item.ID}`;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
log(` ${i + 1}) ${effectDescription} (x${effect.Count})`);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
206
|
/** Helper function for logging an array of specific entities. */
|
|
235
207
|
export function logEntities(this: void, entities: Entity[]): void {
|
|
236
208
|
for (const entity of entities) {
|
|
@@ -505,6 +477,34 @@ export function logMap(this: void, map: Map<AnyNotNil, unknown>): void {
|
|
|
505
477
|
log(` The size of the map was: ${map.size}`);
|
|
506
478
|
}
|
|
507
479
|
|
|
480
|
+
export function logPlayerEffects(this: void, player: EntityPlayer): void {
|
|
481
|
+
const effects = getEffectsList(player);
|
|
482
|
+
|
|
483
|
+
log("Logging player effects:");
|
|
484
|
+
|
|
485
|
+
if (effects.length === 0) {
|
|
486
|
+
log(" n/a (no effects)");
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
effects.forEach((effect, i) => {
|
|
491
|
+
let effectDescription: string;
|
|
492
|
+
if (effect.Item.IsCollectible()) {
|
|
493
|
+
const collectibleName = getCollectibleName(effect.Item.ID);
|
|
494
|
+
effectDescription = `Collectible: ${collectibleName}`;
|
|
495
|
+
} else if (effect.Item.IsTrinket()) {
|
|
496
|
+
const trinketName = getTrinketName(effect.Item.ID);
|
|
497
|
+
effectDescription = `Trinket: ${trinketName}`;
|
|
498
|
+
} else if (effect.Item.IsNull()) {
|
|
499
|
+
effectDescription = `Null item: ${effect.Item.ID}`;
|
|
500
|
+
} else {
|
|
501
|
+
effectDescription = `Unknown type of effect: ${effect.Item.ID}`;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
log(` ${i + 1}) ${effectDescription} (x${effect.Count})`);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
508
508
|
export function logPlayerHealth(this: void, player: EntityPlayer): void {
|
|
509
509
|
const playerName = getPlayerName(player);
|
|
510
510
|
const playerHealth = getPlayerHealth(player);
|
|
@@ -769,7 +769,6 @@ export function setLogFunctionsGlobal(): void {
|
|
|
769
769
|
globals["logArray"] = logArray;
|
|
770
770
|
globals["logColor"] = logColor;
|
|
771
771
|
globals["logDamageFlags"] = logDamageFlags;
|
|
772
|
-
globals["logEffects"] = logEffects;
|
|
773
772
|
globals["logEntities"] = logEntities;
|
|
774
773
|
globals["logEntity"] = logEntity;
|
|
775
774
|
globals["logEntityID"] = logEntityID;
|
|
@@ -782,6 +781,7 @@ export function setLogFunctionsGlobal(): void {
|
|
|
782
781
|
globals["logKColor"] = logKColor;
|
|
783
782
|
globals["logLevelStateFlags"] = logLevelStateFlags;
|
|
784
783
|
globals["logMap"] = logMap;
|
|
784
|
+
globals["logPlayerEffects"] = logPlayerEffects;
|
|
785
785
|
globals["logPlayerHealth"] = logPlayerHealth;
|
|
786
786
|
globals["logProjectileFlags"] = logProjectileFlags;
|
|
787
787
|
globals["logRoom"] = logRoom;
|
|
@@ -4,7 +4,7 @@ import { anyPlayerHasCollectible } from "./players";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to see if the given collectible is unlocked on the current save file. This
|
|
7
|
-
* requires providing the corresponding item pool that the collectible is located in.
|
|
7
|
+
* requires providing the corresponding item pool that the collectible is normally located in.
|
|
8
8
|
*
|
|
9
9
|
* - If any player currently has the collectible, then it is assumed to be unlocked. (This is
|
|
10
10
|
* because in almost all cases, when a collectible is added to a player's inventory, it is
|
package/src/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export {
|
|
|
23
23
|
export { registerCharacterStats } from "./features/characterStats";
|
|
24
24
|
export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
|
|
25
25
|
export {
|
|
26
|
-
removeCustomGrid,
|
|
26
|
+
removeCustomGridEntity as removeCustomGrid,
|
|
27
27
|
spawnCustomGridEntity as spawnCustomGrid,
|
|
28
28
|
} from "./features/customGridEntity";
|
|
29
29
|
export * from "./features/customStage/exports";
|